From 423aae4c9d02a9d0fe545937e3b728ac5e7c6c36 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 16 Sep 2012 17:49:48 -0400 Subject: [PATCH] Send time span selection to log analysis dialog --- js/server_status_monitor.js | 47 ++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index dff1a59362..f12046ea83 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -1203,10 +1203,12 @@ $(function() { $('#gridchart' + runtime.chartAI).bind('jqplotMouseUp', function(ev, gridpos, datapos, neighbor, plot) { selectionTimeDiff.push(datapos.xaxis); - //get date from timestamp - alert(new Date(Math.ceil(selectionTimeDiff[0])) + " \n to \n " + new Date(Math.ceil(selectionTimeDiff[1]))); - selectionTimeDiff = []; $('#selection_box').attr({ id: '' }); + //get date from timestamp + var min = new Date(Math.ceil(selectionTimeDiff[0])); + var max = new Date(Math.ceil(selectionTimeDiff[1])); + PMA_getLogAnalyseDialog(min, max); + selectionTimeDiff = []; }); $('#gridchart' + runtime.chartAI).bind('jqplotMouseMove', function(ev, gridpos, datapos, neighbor, plot) { @@ -1279,6 +1281,45 @@ $(function() { buttons: dlgBtns }); } + + function PMA_getLogAnalyseDialog(min, max) { + $('#logAnalyseDialog input[name="dateStart"]') + .attr('value', formatDate(min, 'yyyy-MM-dd HH:mm:ss')); + $('#logAnalyseDialog input[name="dateEnd"]') + .attr('value', formatDate(max, 'yyyy-MM-dd HH:mm:ss')); + + var dlgBtns = { }; + + dlgBtns[PMA_messages['strFromSlowLog']] = function() { + loadLog('slow', min, max); + $(this).dialog("close"); + }; + + dlgBtns[PMA_messages['strFromGeneralLog']] = function() { + loadLog('general', min, max); + $(this).dialog("close"); + }; + + $('#logAnalyseDialog').dialog({ + width: 'auto', + height: 'auto', + buttons: dlgBtns + }); + } + + function loadLog(type, min, max) { + var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').prop('value')) || min; + var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').prop('value')) || max; + + loadLogStatistics({ + src: type, + start: dateStart, + end: dateEnd, + removeVariables: $('input#removeVariables').prop('checked'), + limitTypes: $('input#limitTypes').prop('checked') + }); + } + /* Removes a chart from the grid */ function removeChart(chartObj) {