mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 10:50:37 -06:00
suppress refresh when user is inactive (#7219)
This commit is contained in:
parent
f045fbf267
commit
4b567e35d5
@ -57,6 +57,10 @@ export class ContextSrv {
|
||||
store.set('grafana.sidemenu.pinned', val);
|
||||
}
|
||||
|
||||
isGrafanaVisible() {
|
||||
return !!(document.visibilityState === undefined || document.visibilityState === 'visible');
|
||||
}
|
||||
|
||||
toggleSideMenu() {
|
||||
this.sidemenu = !this.sidemenu;
|
||||
if (!this.sidemenu) {
|
||||
|
@ -10,7 +10,7 @@ define([
|
||||
|
||||
var module = angular.module('grafana.services');
|
||||
|
||||
module.service('timeSrv', function($rootScope, $timeout, $routeParams, timer) {
|
||||
module.service('timeSrv', function($rootScope, $timeout, $routeParams, timer, contextSrv) {
|
||||
var self = this;
|
||||
|
||||
// default time
|
||||
@ -95,7 +95,9 @@ define([
|
||||
self.cancel_scheduled_refresh();
|
||||
self.refresh_timer = timer.register($timeout(function () {
|
||||
self.start_scheduled_refresh(after_ms);
|
||||
if (contextSrv.isGrafanaVisible()) {
|
||||
self.refreshDashboard();
|
||||
}
|
||||
}, after_ms));
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user