mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Uses new TimePicker from Grafana/UI (#17793)
* Wip: Intiail commit * Refactor: Replaces TimePicker in Explore * Refactor: Removes Angular TimePicker folder * Refactor: Adds tests for getShiftedTimeRange * Fix: Fixes invalid import to removed TimePicker * Fix: Fixes dateTime tests * Refactor: Reuses getShiftedTimeRange for both Explore and Dashboards * Refactor: Shares getZoomedTimeRange between Explore and Dashboard
This commit is contained in:
@@ -12,6 +12,7 @@ import { ITimeoutService, ILocationService } from 'angular';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
import { DashboardModel } from '../state/DashboardModel';
|
||||
import { toUtc, dateTime, isDateTime } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { getZoomedTimeRange } from 'app/core/utils/timePicker';
|
||||
|
||||
export class TimeSrv {
|
||||
time: any;
|
||||
@@ -238,12 +239,7 @@ export class TimeSrv {
|
||||
|
||||
zoomOut(e: any, factor: number) {
|
||||
const range = this.timeRange();
|
||||
|
||||
const timespan = range.to.valueOf() - range.from.valueOf();
|
||||
const center = range.to.valueOf() - timespan / 2;
|
||||
|
||||
const to = center + (timespan * factor) / 2;
|
||||
const from = center - (timespan * factor) / 2;
|
||||
const { from, to } = getZoomedTimeRange(range, factor);
|
||||
|
||||
this.setTime({ from: toUtc(from), to: toUtc(to) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user