PanelData: Adds timeRange prop to PanelData (#19361)

* Refactor: Adds newTimeRange property to PanelData

* Refactor: Handles timeRange prop after requests

* Refactor: Makes timeRange mandatory

* Refactor: Adds DefaultTimeRange
This commit is contained in:
Hugo Häggmark
2019-09-25 02:19:17 -07:00
committed by Torkel Ödegaard
parent e35de167f9
commit 889f8e3131
16 changed files with 111 additions and 51 deletions

View File

@@ -1,17 +1,22 @@
// Libraries
import _ from 'lodash';
// Utils
import kbn from 'app/core/utils/kbn';
import coreModule from 'app/core/core_module';
import { dateMath } from '@grafana/data';
// Types
import { TimeRange, RawTimeRange, TimeZone } from '@grafana/data';
import {
dateMath,
DefaultTimeRange,
TimeRange,
RawTimeRange,
TimeZone,
toUtc,
dateTime,
isDateTime,
} from '@grafana/data';
import { ITimeoutService, ILocationService } from 'angular';
import { ContextSrv } from 'app/core/services/context_srv';
import { DashboardModel } from '../state/DashboardModel';
import { toUtc, dateTime, isDateTime } from '@grafana/data';
import { getZoomedTimeRange, getShiftedTimeRange } from 'app/core/utils/timePicker';
export class TimeSrv {
@@ -32,7 +37,7 @@ export class TimeSrv {
private contextSrv: ContextSrv
) {
// default time
this.time = { from: '6h', to: 'now' };
this.time = DefaultTimeRange.raw;
$rootScope.$on('zoom-out', this.zoomOut.bind(this));
$rootScope.$on('shift-time', this.shiftTime.bind(this));