@grafana/data#DefaultTimeRange TypeScript Examples

The following examples show how to use @grafana/data#DefaultTimeRange. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: reducers.ts    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
initialState = (): PanelEditorStateNew => {
  return {
    getPanel: () => new PanelModel({}),
    getSourcePanel: () => new PanelModel({}),
    getData: () => ({
      state: LoadingState.NotStarted,
      series: [],
      timeRange: DefaultTimeRange,
    }),
    initDone: false,
    shouldDiscardChanges: false,
    isOpen: false,
    ui: {
      ...DEFAULT_PANEL_EDITOR_UI_STATE,
      ...store.getObject(PANEL_EDITOR_UI_STATE_STORAGE_KEY, DEFAULT_PANEL_EDITOR_UI_STATE),
    },
  };
}
Example #2
Source File: PanelChrome.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
constructor(props: Props) {
    super(props);

    this.state = {
      isFirstLoad: true,
      renderCounter: 0,
      refreshWhenInView: false,
      data: {
        state: LoadingState.NotStarted,
        series: [],
        timeRange: DefaultTimeRange,
      },
    };
  }
Example #3
Source File: PanelChromeAngular.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
constructor(props: Props) {
    super(props);
    this.state = {
      data: {
        state: LoadingState.NotStarted,
        series: [],
        timeRange: DefaultTimeRange,
      },
    };
  }
Example #4
Source File: QueriesTab.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
state: State = {
    isLoadingHelp: false,
    currentDS: this.findCurrentDataSource(),
    helpContent: null,
    isPickerOpen: false,
    isAddingMixed: false,
    scrollTop: 0,
    data: {
      state: LoadingState.NotStarted,
      series: [],
      timeRange: DefaultTimeRange,
    },
  };
Example #5
Source File: VisualizationTab.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
constructor(props: Props) {
    super(props);

    this.state = {
      isVizPickerOpen: this.props.urlOpenVizPicker,
      hasBeenFocused: false,
      searchQuery: '',
      scrollTop: 0,
      data: {
        state: LoadingState.NotStarted,
        series: [],
        timeRange: DefaultTimeRange,
      },
    };
  }
Example #6
Source File: TimeSrv.ts    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
/** @ngInject */
  constructor(
    $rootScope: GrafanaRootScope,
    private $timeout: ITimeoutService,
    private $location: ILocationService,
    private timer: any,
    private contextSrv: ContextSrv
  ) {
    // default time
    this.time = DefaultTimeRange.raw;

    appEvents.on(CoreEvents.zoomOut, this.zoomOut.bind(this));
    appEvents.on(CoreEvents.shiftTime, this.shiftTime.bind(this));
    $rootScope.$on('$routeUpdate', this.routeUpdated.bind(this));

    document.addEventListener('visibilitychange', () => {
      if (this.autoRefreshBlocked && document.visibilityState === 'visible') {
        this.autoRefreshBlocked = false;
        this.refreshDashboard();
      }
    });
  }
Example #7
Source File: reducers.ts    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
createEmptyQueryResponse = (): PanelData => ({
  state: LoadingState.NotStarted,
  request: {} as DataQueryRequest<DataQuery>,
  series: [],
  error: null,
  timeRange: DefaultTimeRange,
})
Example #8
Source File: runSharedRequest.ts    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
function getQueryError(msg: string): PanelData {
  return {
    state: LoadingState.Error,
    series: [],
    error: { message: msg },
    timeRange: DefaultTimeRange,
  };
}