diff --git a/client/app/pages/dashboards/dashboard.js b/client/app/pages/dashboards/dashboard.js index 15554741..2fec02ea 100644 --- a/client/app/pages/dashboards/dashboard.js +++ b/client/app/pages/dashboards/dashboard.js @@ -96,29 +96,22 @@ function DashboardCtrl( this.isGridDisabled = false; this.showPermissionsControl = clientConfig.showPermissionsControl; this.globalParameters = []; - this.refreshRates = [ - { name: '10 seconds', rate: 10 }, - { name: '30 seconds', rate: 30 }, - { name: '1 minute', rate: 60 }, - { name: '5 minutes', rate: 60 * 5 }, - { name: '10 minutes', rate: 60 * 10 }, - { name: '30 minutes', rate: 60 * 30 }, - { name: '1 hour', rate: 60 * 60 }, - { name: '12 hour', rate: 12 * 60 * 60 }, - { name: '24 hour', rate: 24 * 60 * 60 }, - ]; - this.refreshRates = - clientConfig.dashboardRefreshIntervals.map(interval => ({ name: durationHumanize(interval), rate: interval })); + this.refreshRates = clientConfig.dashboardRefreshIntervals.map(interval => ({ + name: durationHumanize(interval), + rate: interval, + })); $rootScope.$on('gridster-mobile-changed', ($event, gridster) => { this.isGridDisabled = gridster.isMobile; }); - this.setRefreshRate = (rate) => { + this.setRefreshRate = (rate, load = true) => { this.refreshRate = rate; if (rate !== null) { + if (load) { this.loadDashboard(true); + } this.autoRefresh(); } }; @@ -210,6 +203,17 @@ function DashboardCtrl( this.editLayout(true); } + if ($location.search().refresh !== undefined) { + if (this.refreshRate === null) { + const refreshRate = Math.max(30, parseFloat($location.search().refresh)); + + this.setRefreshRate({ + name: durationHumanize(refreshRate), + rate: refreshRate, + }, false); + } + } + savedWidgetPositions = collectWidgetPositions(dashboard.widgets); }, (rejection) => {