From 3b1fc1869285d9557afa5bdc9b4ef9275319063f Mon Sep 17 00:00:00 2001 From: Guilherme Caulada Date: Mon, 19 Sep 2022 15:16:27 -0300 Subject: [PATCH] PublicDashboards: Ignore time range input and changes on public dashboard (#55412) * Ignore time range input and changes on public dashboard * Use config instead of getConfig to access boot config --- public/app/features/dashboard/services/TimeSrv.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/app/features/dashboard/services/TimeSrv.ts b/public/app/features/dashboard/services/TimeSrv.ts index 4e8e18c6eb3..ff3f1b6c2b3 100644 --- a/public/app/features/dashboard/services/TimeSrv.ts +++ b/public/app/features/dashboard/services/TimeSrv.ts @@ -148,6 +148,11 @@ export class TimeSrv { } private initTimeFromUrl() { + // If we are in a public dashboard ignore the time range in the url + if (config.isPublicDashboardView) { + return; + } + const params = locationService.getSearch(); if (params.get('time') && params.get('time.window')) { @@ -275,6 +280,11 @@ export class TimeSrv { } setTime(time: RawTimeRange, updateUrl = true) { + // If we are in a public dashboard ignore time range changes + if (config.isPublicDashboardView) { + return; + } + extend(this.time, time); // disable refresh if zoom in or zoom out