text: /*
   * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
   * or more contributor license agreements. Licensed under the Elastic License;
   * you may not use this file except in compliance with the Elastic License.
   */
  
  import { ajaxErrorHandlersProvider } from 'plugins/monitoring/lib/ajax_error_handler';
  import { timefilter } from 'ui/timefilter';
  
  export function getPageData($injector) {
    const $http = $injector.get('$http');
    const globalState = $injector.get('globalState');
    const $route = $injector.get('$route');
    const url = `../api/monitoring/v1/clusters/${globalState.cluster_uuid}/elasticsearch/nodes/${$route.current.params.node}`;
    const features = $injector.get('features');
    const showSystemIndices = features.isEnabled('showSystemIndices', false);
    const timeBounds = timefilter.getBounds();
  
    return $http.post(url, {
      showSystemIndices,
      ccs: globalState.ccs,
      timeRange: {
        min: timeBounds.min.toISOString(),
        max: timeBounds.max.toISOString()
      },
      is_advanced: false,
    })
      .then(response => response.data)
      .catch((err) => {
        const Private = $injector.get('Private');
        const ajaxErrorHandlers = Private(ajaxErrorHandlersProvider);
        return ajaxErrorHandlers(err);
      });
  }
  