mirror of
https://github.com/grafana/grafana.git
synced 2025-01-10 08:03:58 -06:00
Explore: Do not update URL when time range changes to absolute (#72436)
Allow passing updateURL flag to absolute time range event
This commit is contained in:
parent
2ae226de89
commit
89618e0c0f
@ -45,7 +45,6 @@ export class KeybindingSrv {
|
||||
this.bind('g e', this.goToExplore);
|
||||
this.bind('g a', this.openAlerting);
|
||||
this.bind('g p', this.goToProfile);
|
||||
this.bind('t a', this.makeAbsoluteTime);
|
||||
this.bind('esc', this.exit);
|
||||
this.bindGlobalEsc();
|
||||
}
|
||||
@ -108,10 +107,6 @@ export class KeybindingSrv {
|
||||
this.locationService.push('/explore');
|
||||
}
|
||||
|
||||
private makeAbsoluteTime() {
|
||||
appEvents.publish(new AbsoluteTimeEvent());
|
||||
}
|
||||
|
||||
private showHelpModal() {
|
||||
appEvents.publish(new ShowModalReactEvent({ component: HelpModal }));
|
||||
}
|
||||
@ -190,6 +185,10 @@ export class KeybindingSrv {
|
||||
}
|
||||
|
||||
setupTimeRangeBindings(updateUrl = true) {
|
||||
this.bind('t a', () => {
|
||||
appEvents.publish(new AbsoluteTimeEvent({ updateUrl }));
|
||||
});
|
||||
|
||||
this.bind('t z', () => {
|
||||
appEvents.publish(new ZoomOutEvent({ scale: 2, updateUrl }));
|
||||
});
|
||||
|
@ -46,8 +46,8 @@ export class TimeSrv {
|
||||
this.shiftTime(e.payload.direction, e.payload.updateUrl);
|
||||
});
|
||||
|
||||
appEvents.subscribe(AbsoluteTimeEvent, () => {
|
||||
this.makeAbsoluteTime();
|
||||
appEvents.subscribe(AbsoluteTimeEvent, (e) => {
|
||||
this.makeAbsoluteTime(e.payload.updateUrl);
|
||||
});
|
||||
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
@ -364,14 +364,9 @@ export class TimeSrv {
|
||||
);
|
||||
}
|
||||
|
||||
makeAbsoluteTime() {
|
||||
const params = locationService.getSearch();
|
||||
if (params.get('left')) {
|
||||
return; // explore handles this;
|
||||
}
|
||||
|
||||
makeAbsoluteTime(updateUrl: boolean) {
|
||||
const { from, to } = this.timeRange();
|
||||
this.setTime({ from, to }, true);
|
||||
this.setTime({ from, to }, updateUrl);
|
||||
}
|
||||
|
||||
// isRefreshOutsideThreshold function calculates the difference between last refresh and now
|
||||
|
@ -160,7 +160,11 @@ export class ShiftTimeEvent extends BusEventWithPayload<ShiftTimeEventPayload> {
|
||||
static type = 'shift-time';
|
||||
}
|
||||
|
||||
export class AbsoluteTimeEvent extends BusEventBase {
|
||||
interface AbsoluteTimeEventPayload {
|
||||
updateUrl: boolean;
|
||||
}
|
||||
|
||||
export class AbsoluteTimeEvent extends BusEventWithPayload<AbsoluteTimeEventPayload> {
|
||||
static type = 'absolute-time';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user