Explore: Add t * keybindings to change time range (#45020)

* Add keybindings to explore, allow override of dashboard model update for explore update

* Remove edits to Dashboard Model, add definition when url params should be updated

* Add tests

* Add and expose util function instead of bringing in unrelated library do not define explicit path to library file

* Use more generic model for TimeSrv

* Remove url utility functions, use javascript function instead

* Break out TimeModel into new type and bring it in

* condense object creation
This commit is contained in:
Kristina
2022-02-17 07:39:02 -06:00
committed by GitHub
parent af1691dbfb
commit 773da0e330
13 changed files with 140 additions and 79 deletions

View File

@@ -13,7 +13,7 @@ import { TimePickerWithHistory } from 'app/core/components/TimePicker/TimePicker
// Utils & Services
import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { appEvents } from 'app/core/core';
import { ShiftTimeEvent, ShiftTimeEventPayload, ZoomOutEvent } from '../../../../types/events';
import { ShiftTimeEvent, ShiftTimeEventDirection, ZoomOutEvent } from '../../../../types/events';
import { Unsubscribable } from 'rxjs';
export interface Props {
@@ -38,16 +38,16 @@ export class DashNavTimeControls extends Component<Props> {
};
onRefresh = () => {
getTimeSrv().refreshDashboard();
getTimeSrv().refreshTimeModel();
return Promise.resolve();
};
onMoveBack = () => {
appEvents.publish(new ShiftTimeEvent(ShiftTimeEventPayload.Left));
appEvents.publish(new ShiftTimeEvent({ direction: ShiftTimeEventDirection.Left }));
};
onMoveForward = () => {
appEvents.publish(new ShiftTimeEvent(ShiftTimeEventPayload.Right));
appEvents.publish(new ShiftTimeEvent({ direction: ShiftTimeEventDirection.Right }));
};
onChangeTimePicker = (timeRange: TimeRange) => {
@@ -77,7 +77,7 @@ export class DashNavTimeControls extends Component<Props> {
};
onZoom = () => {
appEvents.publish(new ZoomOutEvent(2));
appEvents.publish(new ZoomOutEvent({ scale: 2 }));
};
render() {