From a113974c5cf692599cac3eb8f347c29911b7f495 Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sat, 4 Aug 2012 16:38:20 +0530 Subject: [PATCH] Make refresh rate select work --- js/server_status.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/server_status.js b/js/server_status.js index 1e0977ff19..37607a0725 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -113,6 +113,8 @@ $(function() { var text = ''; // Holds filter text var queryPieChart = null; var monitorLoaded = false; + var query_stats_jqplot_timer = null; + var refresh_rate = 5000; /* Chart configuration */ // Defines what the tabs are currently displaying (realtime or data) @@ -189,6 +191,10 @@ $(function() { // Handles refresh rate changing $('.buttonlinks select').change(function() { + if(query_stats_jqplot_timer != null) { + refresh_rate = 1000*parseInt(this.value); + } + var chart = tabChart[$(this).parents('div.ui-tabs-panel').attr('id')]; // Clear current timeout and set timeout with the new refresh rate @@ -368,7 +374,7 @@ $(function() { labelRenderer: $.jqplot.CanvasAxisLabelRenderer, renderer: $.jqplot.DateAxisRenderer, tickOptions: { - formatString: '%H:%M' + formatString: '%H:%M:%S' } }, yaxis: { min:0 @@ -387,12 +393,10 @@ $(function() { return false; }); - var t; - function recursiveTimer($tab, settings) { replotQueryStatsChart($tab, settings); - t = setTimeout(function() { - recursiveTimer($tab, settings) }, 2000); + query_stats_jqplot_timer = setTimeout(function() { + recursiveTimer($tab, settings) }, refresh_rate); } function getCurrentQueryStats() {