The branch, master has been updated via 75f916fd3c13333b655a72427d8158ce17c3995e (commit) via 14f8664272af543a16bb78a3c72e5cd64fae64b9 (commit) via bc19b678305a6ef1d9677122f56e389ceed5cd38 (commit) via f771e68a73dfca6199030c1598b23e92de50f64c (commit) via ab5d9b278a2360fcce78dd8a5b0142a46a14fa18 (commit) via 6f4b0f88d2e4bc85980a8650b395ba3083b288b0 (commit) from 79f28d8dbbcfe0e42847d2bfa3bb5a9003f5f470 (commit)
- Log ----------------------------------------------------------------- commit 75f916fd3c13333b655a72427d8158ce17c3995e Merge: 79f28d8dbbcfe0e42847d2bfa3bb5a9003f5f470 14f8664272af543a16bb78a3c72e5cd64fae64b9 Author: Michal Čihař mcihar@suse.cz Date: Fri Jun 17 09:11:36 2011 +0200
Merge remote-tracking branch 'tyron/master'
Conflicts: server_status.php
commit 14f8664272af543a16bb78a3c72e5cd64fae64b9 Author: Tyron Madlener tyronx@gmail.com Date: Thu Jun 16 15:18:24 2011 +0200
some more code formatting
commit bc19b678305a6ef1d9677122f56e389ceed5cd38 Author: Tyron Madlener tyronx@gmail.com Date: Thu Jun 16 15:10:41 2011 +0200
forgot some css changes in original theme
commit f771e68a73dfca6199030c1598b23e92de50f64c Author: Tyron Madlener tyronx@gmail.com Date: Thu Jun 16 15:05:08 2011 +0200
- Fix for: If the moseout event on the row highlighting fails to get called (e.g. when having html code in the row), the toggle class will wrongly assign the hover class next time the element is being hovered over - Better formatted PMA_createChart()
commit ab5d9b278a2360fcce78dd8a5b0142a46a14fa18 Author: Tyron Madlener tyronx@gmail.com Date: Thu Jun 16 15:03:04 2011 +0200
Cleaned up code
commit 6f4b0f88d2e4bc85980a8650b395ba3083b288b0 Author: Tyron Madlener tyronx@gmail.com Date: Wed Jun 15 20:36:58 2011 +0200
- Server variables that represent bytes are convert to a byte format (e.g. 16 EiB instead of 18,446,744,073,709,551,616) - A javascript code snippet that cuts off long strings (such as the optimizer_switch variable) so the whole table stays in view without scrolling.
-----------------------------------------------------------------------
Summary of changes: js/functions.js | 63 ++++++----- js/messages.php | 13 ++ js/server_status.js | 191 ++++++++++++++++++------------- js/server_variables.js | 132 +++++++++++++++------- libraries/server_variables_doc.php | 63 +++++----- server_status.php | 152 ++++++++++--------------- server_variables.php | 6 +- themes/original/css/theme_right.css.php | 19 +++ themes/pmahomme/css/theme_right.css.php | 33 +++++- 9 files changed, 401 insertions(+), 271 deletions(-)
diff --git a/js/functions.js b/js/functions.js index 3418e51..e552b1a 100644 --- a/js/functions.js +++ b/js/functions.js @@ -30,7 +30,6 @@ var codemirror_editor = false; var chart_activeTimeouts = new Object();
- /** * Add a hidden field to the form to indicate that this will be an * Ajax request (only if this hidden field does not exist) @@ -658,10 +657,10 @@ $(document).ready(function() { * so that it works also for pages reached via AJAX) */ $(document).ready(function() { - $('tr.odd, tr.even').live('hover',function() { + $('tr.odd, tr.even').live('hover',function(event) { var $tr = $(this); - $tr.toggleClass('hover'); - $tr.children().toggleClass('hover'); + $tr.toggleClass('hover',event.type=='mouseover'); + $tr.children().toggleClass('hover',event.type=='mouseover'); }); })
@@ -1391,31 +1390,41 @@ function PMA_createChart(passedSettings) { events: { load: function() { var thisChart = this; - var lastValue=null, curValue=null; - var numLoadedPoints=0, otherSum=0; + var lastValue = null, curValue = null; + var numLoadedPoints = 0, otherSum = 0; var diff; // No realtime updates for graphs that are being exported, and disabled when no callback is set - if(thisChart.options.chart.forExport==true || !passedSettings.realtime || !passedSettings.realtime.callback) return; + if(thisChart.options.chart.forExport == true || + ! passedSettings.realtime || + ! passedSettings.realtime.callback) return;
thisChart.options.realtime.timeoutCallBack = function() { - $.get(passedSettings.realtime.url,{ajax_request:1, chart_data:1, type:passedSettings.realtime.type},function(data) { - curValue = jQuery.parseJSON(data); - //if(lastValue==null) lastValue = curValue; - - if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max; - else diff = parseInt(curValue.x - lastValue.x); - - thisChart.xAxis[0].setExtremes(thisChart.xAxis[0].getExtremes().min+diff, thisChart.xAxis[0].getExtremes().max+diff, false); - - passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints); - - lastValue = curValue; - numLoadedPoints++; - - // Timeout has been cleared => don't start a new timeout - if(chart_activeTimeouts[container]==null) return; - chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, thisChart.options.realtime.refreshRate); - + $.post(passedSettings.realtime.url, + { ajax_request: true, chart_data: 1, type: passedSettings.realtime.type }, + function(data) { + curValue = jQuery.parseJSON(data); + + if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max; + else diff = parseInt(curValue.x - lastValue.x); + + thisChart.xAxis[0].setExtremes( + thisChart.xAxis[0].getExtremes().min+diff, + thisChart.xAxis[0].getExtremes().max+diff, + false + ); + + passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints); + + lastValue = curValue; + numLoadedPoints++; + + // Timeout has been cleared => don't start a new timeout + if(chart_activeTimeouts[container]==null) return; + + chart_activeTimeouts[container] = setTimeout( + thisChart.options.realtime.timeoutCallBack, + thisChart.options.realtime.refreshRate + ); }); }
@@ -1449,8 +1458,8 @@ function PMA_createChart(passedSettings) { }, tooltip: { formatter: function() { - return '<b>'+ this.series.name +'</b><br/>'+ - Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+ + return '<b>' + this.series.name +'</b><br/>' + + Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' + Highcharts.numberFormat(this.y, 2); } }, diff --git a/js/messages.php b/js/messages.php index 01aede4..7ec366f 100644 --- a/js/messages.php +++ b/js/messages.php @@ -61,6 +61,8 @@ $js_messages['strRemovingSelectedUsers'] = __('Removing Selected Users'); $js_messages['strClose'] = __('Close');
/* for server_status.js */ +$js_messages['strEdit'] = __('Edit'); + $js_messages['strLiveTrafficChart'] = __('Live traffic chart'); $js_messages['strLiveConnChart'] = __('Live conn./process chart'); $js_messages['strLiveQueryChart'] = __('Live query chart'); @@ -75,6 +77,17 @@ $js_messages['strThousandsSeperator'] = __(','); /* l10n: Decimal separator */ $js_messages['strDecimalSeperator'] = __('.');
+$js_messages['strChartKBSent'] = __('kB sent since last refresh'); +$js_messages['strChartKBReceived'] = __('kB received since last refresh'); +$js_messages['strChartServerTraffic'] = __('Server traffic (in kB)'); +$js_messages['strChartConnections'] = __('Connections since last refresh'); +$js_messages['strChartProcesses'] = __('Processes'); +$js_messages['strChartConnectionsTitle'] = __('Connections / Processes'); +$js_messages['strChartIssuedQueries'] = __('Issued queries since last refresh'); +$js_messages['strChartIssuedQueriesTitle'] = __('Issued queries'); + +$js_messages['strChartQueryPie'] = __('Query statistics'); + /* For inline query editing */ $js_messages['strGo'] = __('Go'); $js_messages['strCancel'] = __('Cancel'); diff --git a/js/server_status.js b/js/server_status.js index 4413c80..08b2b43 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -21,9 +21,13 @@ $(function() { return /^[0-9]?[0-9,.]*\s?(k|M|G|T|%)?$/.test(s); }, format: function(s) { - var num = jQuery.tablesorter.formatFloat( s.replace(PMA_messages['strThousandsSeperator'],'').replace(PMA_messages['strDecimalSeperator'],'.') ); + var num = jQuery.tablesorter.formatFloat( + s.replace(PMA_messages['strThousandsSeperator'],'') + .replace(PMA_messages['strDecimalSeperator'],'.') + ); + var factor = 1; - switch (s.charAt(s.length-1)) { + switch (s.charAt(s.length - 1)) { case '%': factor = -2; break; // Todo: Complete this list (as well as in the regexp a few lines up) case 'k': factor = 3; break; @@ -31,7 +35,8 @@ $(function() { case 'G': factor = 9; break; case 'T': factor = 12; break; } - return num*Math.pow(10,factor); + + return num * Math.pow(10,factor); }, type: "numeric" }); @@ -45,12 +50,16 @@ $(function() { var odd_row=false; var text=''; // Holds filter text var queryPieChart = null; - /* Chart configuration */
+ /* Chart configuration */ // Defines what the tabs are currently displaying (realtime or data) var tabStatus = new Object(); // Holds the current chart instances for each tab var tabChart = new Object(); + + $.ajaxSetup({ + cache:false + });
// Add tabs $('#serverStatusTabs').tabs({ @@ -69,12 +78,23 @@ $(function() { tabStatus[$(this).attr('id')] = 'static'; });
+ // Handles refresh rate changing $('.statuslinks select').change(function() { var chart=tabChart[$(this).parents('div.ui-tabs-panel').attr('id')]; chart.options.realtime.refreshRate = 1000*parseInt(this.value); - chart.xAxis[0].setExtremes(new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate, chart.xAxis[0].getExtremes().max, true); + + chart.xAxis[0].setExtremes( + new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate, + chart.xAxis[0].getExtremes().max, + true + ); + + // Clear current timeout and set timeout with the new refresh rate clearTimeout(chart_activeTimeouts[chart.options.chart.renderTo]); - chart_activeTimeouts[chart.options.chart.renderTo] = setTimeout(chart.options.realtime.timeoutCallBack, chart.options.realtime.refreshRate); + chart_activeTimeouts[chart.options.chart.renderTo] = setTimeout( + chart.options.realtime.timeoutCallBack, + chart.options.realtime.refreshRate + ); });
// Ajax refresh of variables (always the first element in each tab) @@ -107,26 +127,32 @@ $(function() {
if(tabstat=='static' || tabstat=='liveconnections') { var settings = { - series: [{name:'kB sent since last refresh',data:[]},{name:'kB received since last refresh',data:[]}], - title: {text:'Server traffic (in kB)'}, - realtime:{ url:'server_status.php?'+url_query, + series: [ + { name: PMA_messages['strChartKBSent'], data: [] }, + { name: PMA_messages['strChartKBReceived'], data: [] } + ], + title: { text: PMA_messages['strChartServerTraffic'] }, + realtime: { url:'server_status.php?' + url_query, type: 'traffic', - callback: function(chartObj, curVal, lastVal,numLoadedPoints) { + callback: function(chartObj, curVal, lastVal, numLoadedPoints) { if(lastVal==null) return; chartObj.series[0].addPoint( - { x:curVal.x, y:(curVal.y_sent-lastVal.y_sent)/1024}, - false, numLoadedPoints >= chartObj.options.realtime.numMaxPoints + { x: curVal.x, y: (curVal.y_sent - lastVal.y_sent) / 1024 }, + false, + numLoadedPoints >= chartObj.options.realtime.numMaxPoints ); chartObj.series[1].addPoint( - { x:curVal.x, y:(curVal.y_received-lastVal.y_received)/1024}, - true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints + { x: curVal.x, y: (curVal.y_received - lastVal.y_received) / 1024 }, + true, + numLoadedPoints >= chartObj.options.realtime.numMaxPoints ); } - } + } }
setupLiveChart($tab,this,settings); - if(tabstat=='liveconnections') $tab.find('.statuslinks a.liveconnectionsLink').html(PMA_messages['strLiveConnChart']); + if(tabstat == 'liveconnections') + $tab.find('.statuslinks a.liveconnectionsLink').html(PMA_messages['strLiveConnChart']); tabStatus[$tab.attr('id')]='livetraffic'; } else { $(this).html(PMA_messages['strLiveTrafficChart']); @@ -141,28 +167,34 @@ $(function() { var $tab=$(this).parents('div.ui-tabs-panel'); var tabstat = tabStatus[$tab.attr('id')];
- if(tabstat=='static' || tabstat=='livetraffic') { + if(tabstat == 'static' || tabstat == 'livetraffic') { var settings = { - series: [{name:'Connections since last refresh', data:[]},{name:'Processes', data:[]}], - title: {text:'Connections / Processes'}, - realtime:{ url:'server_status.php?'+url_query, + series: [ + { name: PMA_messages['strChartConnections'], data: [] }, + { name: PMA_messages['strChartProcesses'], data: [] } + ], + title: { text: PMA_messages['strChartConnectionsTitle'] }, + realtime: { url:'server_status.php?'+url_query, type: 'proc', callback: function(chartObj, curVal, lastVal,numLoadedPoints) { if(lastVal==null) return; chartObj.series[0].addPoint( - { x:curVal.x, y:curVal.y_conn-lastVal.y_conn }, - false, numLoadedPoints >= chartObj.options.realtime.numMaxPoints + { x: curVal.x, y: curVal.y_conn - lastVal.y_conn }, + false, + numLoadedPoints >= chartObj.options.realtime.numMaxPoints ); chartObj.series[1].addPoint( - { x:curVal.x, y:curVal.y_proc }, - true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints + { x: curVal.x, y: curVal.y_proc }, + true, + numLoadedPoints >= chartObj.options.realtime.numMaxPoints ); } - } + } };
setupLiveChart($tab,this,settings); - if(tabstat=='livetraffic') $tab.find('.statuslinks a.livetrafficLink').html(PMA_messages['strLiveTrafficChart']); + if(tabstat == 'livetraffic') + $tab.find('.statuslinks a.livetrafficLink').html(PMA_messages['strLiveTrafficChart']); tabStatus[$tab.attr('id')]='liveconnections'; } else { $(this).html(PMA_messages['strLiveConnChart']); @@ -172,62 +204,63 @@ $(function() { return false; });
- // Live query charting + // Live query statistics $('.statuslinks a.livequeriesLink').click(function() { - var $tab=$(this).parents('div.ui-tabs-panel'); - var settings=null; + var $tab = $(this).parents('div.ui-tabs-panel'); + var settings = null;
- if(tabStatus[$tab.attr('id')]=='static') { + if(tabStatus[$tab.attr('id')] == 'static') { settings = { - series: [{name:'Issued queries since last refresh', data:[]}], - title: {text:'Issued queries'}, + series: [ { name: PMA_messages['strChartIssuedQueries'], data: [] } ], + title: { text: PMA_messages['strChartIssuedQueriesTitle'] }, tooltip: { formatter:function() { return this.point.name; } }, - realtime:{ url:'server_status.php?'+url_query, + realtime: { url:'server_status.php?'+url_query, type: 'queries', callback: function(chartObj, curVal, lastVal,numLoadedPoints) { - if(lastVal==null) return; + if(lastVal == null) return; chartObj.series[0].addPoint( - { x:curVal.x, y:curVal.y-lastVal.y, name:sortedQueriesPointInfo(curVal,lastVal) }, - true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints + { x: curVal.x, y: curVal.y - lastVal.y, name: sortedQueriesPointInfo(curVal,lastVal) }, + true, + numLoadedPoints >= chartObj.options.realtime.numMaxPoints ); } - } + } }; } else { $(this).html(PMA_messages['strLiveQueryChart']); }
setupLiveChart($tab,this,settings); - tabStatus[$tab.attr('id')]='livequeries'; + tabStatus[$tab.attr('id')] = 'livequeries'; return false; });
function setupLiveChart($tab,link,settings) { - if(settings!=null) { + if(settings != null) { // Loading a chart with existing chart => remove old chart first - if(tabStatus[$tab.attr('id')]!='static') { - clearTimeout(chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]); - chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]=null; + if(tabStatus[$tab.attr('id')] != 'static') { + clearTimeout(chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]); + chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"] = null; tabChart[$tab.attr('id')].destroy(); // Also reset the select list - $tab.find('.statuslinks select').get(0).selectedIndex=0; + $tab.find('.statuslinks select').get(0).selectedIndex = 0; }
- if(!settings.chart) settings.chart = {}; - settings.chart.renderTo=$tab.attr('id')+"_chart_cnt"; + if(! settings.chart) settings.chart = {}; + settings.chart.renderTo = $tab.attr('id') + "_chart_cnt";
$tab.find('.tabInnerContent') .hide() - .after('<div style="clear:both; min-width:500px; height:400px; padding-bottom:80px;" id="'+$tab.attr('id')+'_chart_cnt"></div>'); - tabChart[$tab.attr('id')]=PMA_createChart(settings); + .after('<div class="liveChart" id="' + $tab.attr('id') + '_chart_cnt"></div>'); + tabChart[$tab.attr('id')] = PMA_createChart(settings); $(link).html(PMA_messages['strStaticData']); $tab.find('.statuslinks a.tabRefresh').hide(); $tab.find('.statuslinks select').show(); } else { - clearTimeout(chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]); - chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]=null; + clearTimeout(chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]); + chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]=null; $tab.find('.tabInnerContent').show(); - $tab.find('div#'+$tab.attr('id')+'_chart_cnt').remove(); + $tab.find('div#'+$tab.attr('id') + '_chart_cnt').remove(); tabStatus[$tab.attr('id')]='static'; tabChart[$tab.attr('id')].destroy(); $tab.find('.statuslinks a.tabRefresh').show(); @@ -243,9 +276,10 @@ $(function() { });
$('#filterText').keyup(function(e) { - if($(this).val().length==0) textFilter=null; - else textFilter = new RegExp("(^|_)"+$(this).val(),'i'); - text=$(this).val(); + if($(this).val().length == 0) textFilter = null; + else textFilter = new RegExp("(^|_)" + $(this).val(),'i'); + + text = $(this).val(); filterVariables(); });
@@ -258,11 +292,11 @@ $(function() { function initTab(tab,data) { switch(tab.attr('id')) { case 'statustabs_traffic': - if(data!=null) tab.find('.tabInnerContent').html(data); + if(data != null) tab.find('.tabInnerContent').html(data); initTooltips(); break; case 'statustabs_queries': - if(data!=null) { + if(data != null) { queryPieChart.destroy(); tab.find('.tabInnerContent').html(data); } @@ -273,10 +307,9 @@ $(function() { cdata.push([key,parseInt(value)]); });
- queryPieChart=PMA_createChart({ + queryPieChart = PMA_createChart({ chart: { renderTo: 'serverstatusquerieschart' - }, title: { text:'', @@ -284,7 +317,7 @@ $(function() { }, series: [{ type:'pie', - name: 'Query statistics', + name: PMA_messages['strChartQueryPie'], data: cdata }], plotOptions: { @@ -293,20 +326,22 @@ $(function() { cursor: 'pointer', dataLabels: { enabled: true, - formatter: function() { - return '<b>'+ this.point.name +'</b><br> '+ Highcharts.numberFormat(this.percentage, 2) +' %'; + formatter: function() { + return '<b>'+ this.point.name +'</b><br/> ' + Highcharts.numberFormat(this.percentage, 2) + ' %'; } } } }, tooltip: { - formatter: function() { return '<b>'+ this.point.name +'</b><br/>'+Highcharts.numberFormat(this.y, 2)+'<br/>('+Highcharts.numberFormat(this.percentage, 2) +' %)'; } + formatter: function() { + return '<b>' + this.point.name + '</b><br/>' + Highcharts.numberFormat(this.y, 2) + '<br/>(' + Highcharts.numberFormat(this.percentage, 2) + ' %)'; + } } }); break;
case 'statustabs_allvars': - if(data!=null) { + if(data != null) { tab.find('.tabInnerContent').html(data); filterVariables(); } @@ -329,7 +364,7 @@ $(function() { });
$('#serverstatusqueriesdetails tr:first th') - .append('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">'); + .append('<img class="sortableIcon" src="' + pma_theme_image + 'cleardot.gif" alt="">');
break;
@@ -343,7 +378,7 @@ $(function() { });
$('#serverstatusvariables tr:first th') - .append('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">'); + .append('<img class="sortableIcon" src="' + pma_theme_image + 'cleardot.gif" alt="">');
break; } @@ -351,14 +386,14 @@ $(function() {
/* Filters the status variables by name/category/alert in the variables tab */ function filterVariables() { - var useful_links=0; + var useful_links = 0; var section = text;
- if(categoryFilter.length>0) section = categoryFilter; + if(categoryFilter.length > 0) section = categoryFilter;
- if(section.length>1) { + if(section.length > 1) { $('#linkSuggestions span').each(function() { - if($(this).attr('class').indexOf('status_'+section)!=-1) { + if($(this).attr('class').indexOf('status_'+section) != -1) { useful_links++; $(this).css('display',''); } else { @@ -369,16 +404,16 @@ $(function() { }); }
- if(useful_links>0) + if(useful_links > 0) $('#linkSuggestions').css('display',''); else $('#linkSuggestions').css('display','none');
odd_row=false; $('#serverstatusvariables th.name').each(function() { - if((textFilter==null || textFilter.exec($(this).text())) - && (!alertFilter || $(this).next().find('span.attention').length>0) - && (categoryFilter.length==0 || $(this).parent().hasClass('s_'+categoryFilter))) { - odd_row = !odd_row; + if((textFilter == null || textFilter.exec($(this).text())) + && (! alertFilter || $(this).next().find('span.attention').length>0) + && (categoryFilter.length == 0 || $(this).parent().hasClass('s_'+categoryFilter))) { + odd_row = ! odd_row; $(this).parent().css('display',''); if(odd_row) { $(this).parent().addClass('odd'); @@ -406,22 +441,22 @@ $(function() { if(value-lastQueries.pointInfo[key] > 0) { queryKeys.push(key); queryValues.push(value-lastQueries.pointInfo[key]); - sumTotal+=value-lastQueries.pointInfo[key]; + sumTotal += value-lastQueries.pointInfo[key]; } }); var numQueries = queryKeys.length; var pointInfo = '<b>' + PMA_messages['strTotal'] + ': ' + sumTotal + '</b><br>';
while(queryKeys.length > 0) { - max=0; - for(var i=0; i<queryKeys.length; i++) { + max = 0; + for(var i=0; i < queryKeys.length; i++) { if(queryValues[i] > max) { max = queryValues[i]; maxIdx = i; } } - if(numQueries > 8 && num>=6) - sumOther+=queryValues[maxIdx]; + if(numQueries > 8 && num >= 6) + sumOther += queryValues[maxIdx]; else pointInfo += queryKeys[maxIdx].substr(4).replace('_',' ') + ': ' + queryValues[maxIdx] + '<br>';
queryKeys.splice(maxIdx,1); diff --git a/js/server_variables.js b/js/server_variables.js index 1877ce7..11be3de 100644 --- a/js/server_variables.js +++ b/js/server_variables.js @@ -1,42 +1,92 @@ -$(function() {
- var textFilter=null;
- var odd_row=false;
-
- // Filter options are invisible for disabled js users
- $('fieldset#tableFilter').css('display','');
-
- $('#filterText').keyup(function(e) {
- if($(this).val().length==0) textFilter=null;
- else textFilter = new RegExp("(^| )"+$(this).val(),'i');
- filterVariables();
- });
-
- function filterVariables() {
- odd_row=false;
- var mark_next=false;
- var firstCell;
-
- $('table.filteredData tbody tr').each(function() {
- firstCell = $(this).children(':first');
-
- if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) {
- // If current row is 'marked', also display next row
- if($(this).hasClass('marked') && !mark_next)
- mark_next=true;
- else mark_next=false;
-
- odd_row = !odd_row;
- $(this).css('display','');
- if(odd_row) {
- $(this).addClass('odd');
- $(this).removeClass('even');
- } else {
- $(this).addClass('even');
- $(this).removeClass('odd');
- }
- } else {
- $(this).css('display','none');
- }
- });
- }
+$(function() { + var textFilter=null; + var odd_row=false; + var testString = 'abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ'; + var $tmpDiv; + var charWidth; + + /*** This code snippet takes care that the table stays readable. It cuts off long strings when the window is resized ***/ + $('table.data').after($tmpDiv=$('<span>'+testString+'</span>')); + charWidth = $tmpDiv.width() / testString.length; + $tmpDiv.remove(); + + $(window).resize(limitTableWidth); + limitTableWidth(); + + function limitTableWidth() { + var fulltext; + var charDiff; + var maxTableWidth; + var $tmpTable; + + $('table.data').after($tmpTable=$('<table id="testTable" style="width:100%;"><tr><td>'+testString+'</td></tr></table>')); + maxTableWidth = $('#testTable').width(); + $tmpTable.remove(); + charDiff = ($('table.data').width()-maxTableWidth) / charWidth; + + if($('body').innerWidth() < $('table.data').width()+10 || $('body').innerWidth() > $('table.data').width()+20) { + var maxChars=0; + + $('table.data tbody tr td:nth-child(2)').each(function() { + maxChars=Math.max($(this).text().length,maxChars); + }); + + // Do not resize smaller if there's only 50 chars displayed already + if(charDiff > 0 && maxChars < 50) return; + + $('table.data tbody tr td:nth-child(2)').each(function() { + if((charDiff>0 && $(this).text().length > maxChars-charDiff) || (charDiff<0 && $(this).find('abbr.cutoff').length>0)) { + if($(this).find('abbr.cutoff').length > 0) + fulltext = $(this).find('abbr.cutoff').attr('title'); + else { + fulltext = $(this).text(); + // Do not cut off elements with html in it and hope they are not too long + if(fulltext.length != $(this).html().length) return 0; + } + + if(fulltext.length < maxChars-charDiff) + $(this).html(fulltext); + else $(this).html('<abbr class="cutoff" title="'+fulltext+'">'+fulltext.substr(0,maxChars-charDiff-3)+'...</abbr>'); + } + }); + } + } + + // Filter options are invisible for disabled js users + $('fieldset#tableFilter').css('display',''); + + $('#filterText').keyup(function(e) { + if($(this).val().length==0) textFilter=null; + else textFilter = new RegExp("(^| )"+$(this).val(),'i'); + filterVariables(); + }); + + function filterVariables() { + odd_row=false; + var mark_next=false; + var firstCell; + + $('table.filteredData tbody tr').each(function() { + firstCell = $(this).children(':first'); + + if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) { + // If current row is 'marked', also display next row + if($(this).hasClass('marked') && !mark_next) + mark_next=true; + else mark_next=false; + + odd_row = !odd_row; + $(this).css('display',''); + if(odd_row) { + $(this).addClass('odd'); + $(this).removeClass('even'); + } else { + $(this).addClass('even'); + $(this).removeClass('odd'); + } + } else { + $(this).css('display','none'); + } + }); + } }); \ No newline at end of file diff --git a/libraries/server_variables_doc.php b/libraries/server_variables_doc.php index 3e8faa8..ce81e89 100644 --- a/libraries/server_variables_doc.php +++ b/libraries/server_variables_doc.php @@ -6,6 +6,7 @@ * string $anchor: anchor to the documentation page * string $chapter: chapter of "HTML, one page per chapter" documentation * string $type: type of system variable + * string $format: if set to 'byte' it will format the variable with PMA_formatByteDown() */ $VARIABLE_DOC_LINKS = array(); $VARIABLE_DOC_LINKS['auto_increment_increment'] = array('auto_increment_increment','replication-options-master','sysvar'); @@ -16,11 +17,11 @@ $VARIABLE_DOC_LINKS['back_log'] = array('back_log','server-system-variables','sy $VARIABLE_DOC_LINKS['basedir'] = array('basedir','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['big_tables'] = array('big-tables','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['bind_address'] = array('bind-address','server-options','option_mysqld'); -$VARIABLE_DOC_LINKS['binlog_cache_size'] = array('binlog_cache_size','replication-options-binary-log','sysvar'); +$VARIABLE_DOC_LINKS['binlog_cache_size'] = array('binlog_cache_size','replication-options-binary-log','sysvar','byte'); $VARIABLE_DOC_LINKS['binlog_direct_non_transactional_updates'] = array('binlog_direct_non_transactional_updates','replication-options-binary-log','sysvar'); $VARIABLE_DOC_LINKS['binlog_format'] = array('binlog-format','server-options','sysvar'); -$VARIABLE_DOC_LINKS['binlog_stmt_cache_size'] = array('binlog_stmt_cache_size','replication-options-binary-log','sysvar'); -$VARIABLE_DOC_LINKS['bulk_insert_buffer_size'] = array('bulk_insert_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['binlog_stmt_cache_size'] = array('binlog_stmt_cache_size','replication-options-binary-log','sysvar','byte'); +$VARIABLE_DOC_LINKS['bulk_insert_buffer_size'] = array('bulk_insert_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['character_set_client'] = array('character_set_client','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['character_set_connection'] = array('character_set_connection','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['character_set_database'] = array('character_set_database','server-system-variables','sysvar'); @@ -84,11 +85,11 @@ $VARIABLE_DOC_LINKS['init_file'] = array('init-file','server-options','option_my $VARIABLE_DOC_LINKS['init_slave'] = array('init_slave','replication-options-slave','sysvar'); $VARIABLE_DOC_LINKS['innodb_adaptive_flushing'] = array('innodb_adaptive_flushing','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_adaptive_hash_index'] = array('innodb_adaptive_hash_index','innodb-parameters','sysvar'); -$VARIABLE_DOC_LINKS['innodb_additional_mem_pool_size'] = array('innodb_additional_mem_pool_size','innodb-parameters','sysvar'); +$VARIABLE_DOC_LINKS['innodb_additional_mem_pool_size'] = array('innodb_additional_mem_pool_size','innodb-parameters','sysvar','byte'); $VARIABLE_DOC_LINKS['innodb_autoextend_increment'] = array('innodb_autoextend_increment','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_autoinc_lock_mode'] = array('innodb_autoinc_lock_mode','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_buffer_pool_instances'] = array('innodb_buffer_pool_instances','innodb-parameters','sysvar'); -$VARIABLE_DOC_LINKS['innodb_buffer_pool_size'] = array('innodb_buffer_pool_size','innodb-parameters','sysvar'); +$VARIABLE_DOC_LINKS['innodb_buffer_pool_size'] = array('innodb_buffer_pool_size','innodb-parameters','sysvar','byte'); $VARIABLE_DOC_LINKS['innodb_change_buffering'] = array('innodb_change_buffering','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_checksums'] = array('innodb_checksums','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_commit_concurrency'] = array('innodb_commit_concurrency','innodb-parameters','sysvar'); @@ -107,8 +108,8 @@ $VARIABLE_DOC_LINKS['innodb_force_recovery'] = array('innodb_force_recovery','in $VARIABLE_DOC_LINKS['innodb_io_capacity'] = array('innodb_io_capacity','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_lock_wait_timeout'] = array('innodb_lock_wait_timeout','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_locks_unsafe_for_binlog'] = array('innodb_locks_unsafe_for_binlog','innodb-parameters','sysvar'); -$VARIABLE_DOC_LINKS['innodb_log_buffer_size'] = array('innodb_log_buffer_size','innodb-parameters','sysvar'); -$VARIABLE_DOC_LINKS['innodb_log_file_size'] = array('innodb_log_file_size','innodb-parameters','sysvar'); +$VARIABLE_DOC_LINKS['innodb_log_buffer_size'] = array('innodb_log_buffer_size','innodb-parameters','sysvar','byte'); +$VARIABLE_DOC_LINKS['innodb_log_file_size'] = array('innodb_log_file_size','innodb-parameters','sysvar','byte'); $VARIABLE_DOC_LINKS['innodb_log_files_in_group'] = array('innodb_log_files_in_group','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_log_group_home_dir'] = array('innodb_log_group_home_dir','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['innodb_max_dirty_pages_pct'] = array('innodb_max_dirty_pages_pct','innodb-parameters','sysvar'); @@ -138,15 +139,15 @@ $VARIABLE_DOC_LINKS['innodb_version'] = array('innodb_version','innodb-parameter $VARIABLE_DOC_LINKS['innodb_write_io_threads'] = array('innodb_write_io_threads','innodb-parameters','sysvar'); $VARIABLE_DOC_LINKS['insert_id'] = array('insert_id','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['interactive_timeout'] = array('interactive_timeout','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['join_buffer_size'] = array('join_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['join_buffer_size'] = array('join_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['keep_files_on_create'] = array('keep_files_on_create','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['key_buffer_size'] = array('key_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['key_buffer_size'] = array('key_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['key_cache_age_threshold'] = array('key_cache_age_threshold','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['key_cache_block_size'] = array('key_cache_block_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['key_cache_block_size'] = array('key_cache_block_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['key_cache_division_limit'] = array('key_cache_division_limit','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['language'] = array('language','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['large_files_support'] = array('large_files_support','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['large_page_size'] = array('large_page_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['large_page_size'] = array('large_page_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['large_pages'] = array('large-pages','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['last_insert_id'] = array('last_insert_id','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['lc_messages'] = array('lc-messages','server-options','option_mysqld'); @@ -172,19 +173,19 @@ $VARIABLE_DOC_LINKS['lower_case_file_system'] = array('lower_case_file_system',' $VARIABLE_DOC_LINKS['lower_case_table_names'] = array('lower_case_table_names','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['master-bind'] = array('','replication-options',0); $VARIABLE_DOC_LINKS['max_allowed_packet'] = array('max_allowed_packet','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['max_binlog_cache_size'] = array('max_binlog_cache_size','replication-options-binary-log','sysvar'); -$VARIABLE_DOC_LINKS['max_binlog_size'] = array('max_binlog_size','replication-options-binary-log','sysvar'); -$VARIABLE_DOC_LINKS['max_binlog_stmt_cache_size'] = array('max_binlog_stmt_cache_size','replication-options-binary-log','sysvar'); +$VARIABLE_DOC_LINKS['max_binlog_cache_size'] = array('max_binlog_cache_size','replication-options-binary-log','sysvar','byte'); +$VARIABLE_DOC_LINKS['max_binlog_size'] = array('max_binlog_size','replication-options-binary-log','sysvar','byte'); +$VARIABLE_DOC_LINKS['max_binlog_stmt_cache_size'] = array('max_binlog_stmt_cache_size','replication-options-binary-log','sysvar','byte'); $VARIABLE_DOC_LINKS['max_connect_errors'] = array('max_connect_errors','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_connections'] = array('max_connections','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_delayed_threads'] = array('max_delayed_threads','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_error_count'] = array('max_error_count','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['max_heap_table_size'] = array('max_heap_table_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['max_heap_table_size'] = array('max_heap_table_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['max_insert_delayed_threads'] = array('max_insert_delayed_threads','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_join_size'] = array('max_join_size','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_length_for_sort_data'] = array('max_length_for_sort_data','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_prepared_stmt_count'] = array('max_prepared_stmt_count','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['max_relay_log_size'] = array('max_relay_log_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['max_relay_log_size'] = array('max_relay_log_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['max_seeks_for_key'] = array('max_seeks_for_key','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_sort_length'] = array('max_sort_length','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['max_sp_recursion_depth'] = array('max_sp_recursion_depth','server-system-variables','sysvar'); @@ -193,12 +194,12 @@ $VARIABLE_DOC_LINKS['max_user_connections'] = array('max_user_connections','serv $VARIABLE_DOC_LINKS['max_write_lock_count'] = array('max_write_lock_count','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['memlock'] = array('memlock','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['min_examined_row_limit'] = array('min-examined-row-limit','server-options','option_mysqld'); -$VARIABLE_DOC_LINKS['myisam_data_pointer_size'] = array('myisam_data_pointer_size','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['myisam_max_sort_file_size'] = array('myisam_max_sort_file_size','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['myisam_mmap_size'] = array('myisam_mmap_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['myisam_data_pointer_size'] = array('myisam_data_pointer_size','server-system-variables','sysvar','byte'); +$VARIABLE_DOC_LINKS['myisam_max_sort_file_size'] = array('myisam_max_sort_file_size','server-system-variables','sysvar','byte'); +$VARIABLE_DOC_LINKS['myisam_mmap_size'] = array('myisam_mmap_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['myisam_recover_options'] = array('myisam_recover_options','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['myisam_repair_threads'] = array('myisam_repair_threads','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['myisam_sort_buffer_size'] = array('myisam_sort_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['myisam_sort_buffer_size'] = array('myisam_sort_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['myisam_stats_method'] = array('myisam_stats_method','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['myisam_use_mmap'] = array('myisam_use_mmap','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['named_pipe'] = array('named_pipe','server-system-variables','sysvar'); @@ -234,25 +235,25 @@ $VARIABLE_DOC_LINKS['performance_schema_max_thread_instances'] = array('performa $VARIABLE_DOC_LINKS['pid_file'] = array('pid-file','server-options','option_mysqld'); $VARIABLE_DOC_LINKS['plugin_dir'] = array('plugin_dir','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['port'] = array('port','server-options','option_mysqld'); -$VARIABLE_DOC_LINKS['preload_buffer_size'] = array('preload_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['preload_buffer_size'] = array('preload_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['profiling'] = array('profiling','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['profiling_history_size'] = array('profiling_history_size','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['protocol_version'] = array('protocol_version','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['proxy_user'] = array('proxy_user','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['pseudo_thread_id'] = array('pseudo_thread_id','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['query_alloc_block_size'] = array('query_alloc_block_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['query_alloc_block_size'] = array('query_alloc_block_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['query_cache_limit'] = array('query_cache_limit','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['query_cache_min_res_unit'] = array('query_cache_min_res_unit','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['query_cache_size'] = array('query_cache_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['query_cache_size'] = array('query_cache_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['query_cache_type'] = array('query_cache_type','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['query_cache_wlock_invalidate'] = array('query_cache_wlock_invalidate','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['query_prealloc_size'] = array('query_prealloc_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['query_prealloc_size'] = array('query_prealloc_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['rand_seed1'] = array('rand_seed1','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['rand_seed2'] = array('rand_seed2','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['range_alloc_block_size'] = array('range_alloc_block_size','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['read_buffer_size'] = array('read_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['range_alloc_block_size'] = array('range_alloc_block_size','server-system-variables','sysvar','byte'); +$VARIABLE_DOC_LINKS['read_buffer_size'] = array('read_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['read_only'] = array('read_only','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['read_rnd_buffer_size'] = array('read_rnd_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['read_rnd_buffer_size'] = array('read_rnd_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['relay-log-index'] = array('relay-log-index','replication-options-slave','option_mysqld'); $VARIABLE_DOC_LINKS['relay_log_index'] = array('relay_log_index','replication-options-slave','sysvar'); $VARIABLE_DOC_LINKS['relay_log_info_file'] = array('relay_log_info_file','replication-options-slave','sysvar'); @@ -291,7 +292,7 @@ $VARIABLE_DOC_LINKS['slow_launch_time'] = array('slow_launch_time','server-syste $VARIABLE_DOC_LINKS['slow_query_log'] = array('slow-query-log','server-options','server-system-variables'); $VARIABLE_DOC_LINKS['slow_query_log_file'] = array('slow_query_log_file','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['socket'] = array('socket','server-options','option_mysqld'); -$VARIABLE_DOC_LINKS['sort_buffer_size'] = array('sort_buffer_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['sort_buffer_size'] = array('sort_buffer_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['sql_auto_is_null'] = array('sql_auto_is_null','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['sql_big_selects'] = array('sql_big_selects','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['sql_big_tables'] = array('big-tables','server-options','server-system-variables'); @@ -332,10 +333,10 @@ $VARIABLE_DOC_LINKS['time_format'] = array('time_format','server-system-variable $VARIABLE_DOC_LINKS['time_zone'] = array('time_zone','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['timed_mutexes'] = array('timed_mutexes','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['timestamp'] = array('timestamp','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['tmp_table_size'] = array('tmp_table_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['tmp_table_size'] = array('tmp_table_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['tmpdir'] = array('tmpdir','server-options','option_mysqld'); -$VARIABLE_DOC_LINKS['transaction_alloc_block_size'] = array('transaction_alloc_block_size','server-system-variables','sysvar'); -$VARIABLE_DOC_LINKS['transaction_prealloc_size'] = array('transaction_prealloc_size','server-system-variables','sysvar'); +$VARIABLE_DOC_LINKS['transaction_alloc_block_size'] = array('transaction_alloc_block_size','server-system-variables','sysvar','byte'); +$VARIABLE_DOC_LINKS['transaction_prealloc_size'] = array('transaction_prealloc_size','server-system-variables','sysvar','byte'); $VARIABLE_DOC_LINKS['tx_isolation'] = array('tx_isolation','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['unique_checks'] = array('unique_checks','server-system-variables','sysvar'); $VARIABLE_DOC_LINKS['updatable_views_with_limit'] = array('updatable_views_with_limit','server-system-variables','sysvar'); diff --git a/server_status.php b/server_status.php index 2c4739f..0811558 100644 --- a/server_status.php +++ b/server_status.php @@ -15,17 +15,17 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) { define('PMA_NO_VARIABLES_IMPORT', true); }
+if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) + $GLOBALS['is_header_sent'] = true; + require_once './libraries/common.inc.php';
/** * Ajax request */
-if (isset($_REQUEST['ajax_request'])) { - // Prevent ajax requests from being cached - header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 - header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past - // Send correct charset +if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { + // Send with correct charset header('Content-Type: text/html; charset=UTF-8');
// real-time charting data @@ -36,7 +36,12 @@ if (isset($_REQUEST['ajax_request'])) { $result = PMA_DBI_query('SHOW PROCESSLIST'); $num_procs = PMA_DBI_num_rows($result);
- $ret = Array('x'=>(microtime(true)*1000),'y_proc'=>$num_procs,'y_conn'=>$c['Connections']); + $ret = array( + 'x' => microtime(true)*1000, + 'y_proc' => $num_procs, + 'y_conn' => $c['Connections'] + ); + exit(json_encode($ret)); case 'queries': $queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" AND Value>0', 0, 1); @@ -45,12 +50,22 @@ if (isset($_REQUEST['ajax_request'])) { unset($queries['Com_admin_commands']);
$sum=array_sum($queries); - $ret = Array('x'=>(microtime(true)*1000),'y'=>$sum,'pointInfo'=>$queries); + $ret = array( + 'x' => microtime(true)*1000, + 'y' => $sum, + 'pointInfo' => $queries + ); + exit(json_encode($ret)); case 'traffic': $traffic = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name="Bytes_received" OR Variable_name="Bytes_sent"', 0, 1);
- $ret = Array('x'=>(microtime(true)*1000),'y_sent'=>$traffic['Bytes_sent'],'y_received'=>$traffic['Bytes_received']); + $ret = array( + 'x' => microtime(true)*1000, + 'y_sent' => $traffic['Bytes_sent'], + 'y_received' => $traffic['Bytes_received'] + ); + exit(json_encode($ret));
} @@ -294,17 +309,17 @@ $links['innodb']['doc'] = 'innodb';
// Variable to contain all com_ variables -$used_queries = Array(); +$used_queries = array();
// Variable to map variable names to their respective section name (used for js category filtering) -$allocationMap = Array(); +$allocationMap = array();
// sort vars into arrays foreach ($server_status as $name => $value) { foreach ($allocations as $filter => $section) { if (strpos($name, $filter) !== FALSE) { $allocationMap[$name] = $section; - if($section=='com' && $value>0) $used_queries[$name] = $value; + if($section == 'com' && $value > 0) $used_queries[$name] = $value; break; // Only exits inner loop } } @@ -453,7 +468,7 @@ echo __('Runtime Information'); <select id="filterCategory" name="filterCategory"> <option value=''><?php echo __('Filter by category...'); ?></option> <?php - foreach($sections as $section_id=>$section_name) { + foreach($sections as $section_id => $section_name) { ?> <option value='<?php echo $section_id; ?>'><?php echo $section_name; ?></option> <?php @@ -470,7 +485,7 @@ echo __('Runtime Information'); echo '<span class="status_'.$section_name.'"> '; $i=0; foreach ($section_links as $link_name => $link_url) { - if($i>0) echo ', '; + if($i > 0) echo ', '; if ('doc' == $link_name) { echo PMA_showMySQLDocu($link_url, $link_url); } else { @@ -496,30 +511,32 @@ echo __('Runtime Information'); function printQueryStatistics() { global $server_status, $used_queries, $url_query, $PMA_PHP_SELF;
- $hour_factor = 3600 / $server_status['Uptime']; + $hour_factor = 3600 / $server_status['Uptime'];
$total_queries = array_sum($used_queries);
?> - <h3 id="serverstatusqueries"><?php echo - //sprintf(__('<b>Query statistics</b>: Since its startup, %s queries have been sent to the server.'), - //PMA_formatNumber($server_status['Questions'], 0)); - sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0)); - //echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions'); + <h3 id="serverstatusqueries"> + <?php + echo sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0)); ?> - <br> - <span style="font-size:60%; display:inline;"> - ø <?php echo __('per hour'); ?>: - <?php echo PMA_formatNumber($total_queries * $hour_factor, 0); ?><br> - - ø <?php echo __('per minute'); ?>: - <?php echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0); ?><br> + <br> + <span> + <?php + echo 'ø'.__('per hour').':'; + echo PMA_formatNumber($total_queries * $hour_factor, 0); + echo '<br>';
- <?php if($total_queries / $server_status['Uptime'] >= 1) { - ?> - ø <?php echo __('per second'); ?>: - <?php echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0); ?><br> + echo 'ø'.__('per minute').':'; + echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0); + echo '<br>';
+ if($total_queries / $server_status['Uptime'] >= 1) { + echo 'ø'.__('per second').':'; + echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0); + ?> + </span><br> + </h3> <?php }
@@ -527,11 +544,11 @@ function printQueryStatistics() { arsort($used_queries);
$odd_row = true; - $count_displayed_rows = 0; - $perc_factor = 100 / $total_queries //(- $server_status['Connections']); + $count_displayed_rows = 0; + $perc_factor = 100 / $total_queries; //(- $server_status['Connections']);
?> - </h3> + <table id="serverstatusqueriesdetails" class="data sortable"> <col class="namecol" /> <col class="valuecol" span="3" /> @@ -548,7 +565,7 @@ function printQueryStatistics() { <tbody>
<?php - $chart_json = Array(); + $chart_json = array(); $query_sum = array_sum($used_queries); $other_sum = 0; foreach ($used_queries as $name => $value) { @@ -557,7 +574,7 @@ function printQueryStatistics() { // For the percentage column, use Questions - Connections, because // the number of connections is not an item of the Query types // but is included in Questions. Then the total of the percentages is 100. - $name = str_replace(Array('Com_','_'), Array('',' '), $name); + $name = str_replace(Array('Com_', '_'), Array('', ' '), $name);
if($value < $query_sum * 0.02) $other_sum += $value; @@ -577,21 +594,12 @@ function printQueryStatistics() { </tbody> </table>
- <div id="serverstatusquerieschart" style="width:500px; height:350px; "> + <div id="serverstatusquerieschart"> <?php - /*// Generate the graph if this is an ajax request - if(isset($_REQUEST['ajax_request'])) { - echo createQueryChart(); - } else { - echo '<a href="'.$PMA_PHP_SELF.'?'.$url_query.'&query_chart=1#serverstatusqueries"' - .'title="' . __('Show query chart') . '">['.__('Show query chart').']</a>'; - }*/ - - if($other_sum>0) + if($other_sum > 0) $chart_json[__('Other')] = $other_sum;
echo json_encode($chart_json); - ?> </div> <?php @@ -610,10 +618,11 @@ function printServerTraffic() { 'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
?> - <h3><?php /* echo __('<b>Server traffic</b>: These tables show the network traffic statistics of this MySQL server since its startup.');*/ - echo sprintf(__('Network traffic since startup: %s'), - implode(' ', PMA_formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)) - ); + <h3><?php + echo sprintf( + __('Network traffic since startup: %s'), + implode(' ', PMA_formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)) + ); ?> </h3>
@@ -790,7 +799,7 @@ function printServerTraffic() { <th><?php echo __('Status'); ?></th> <th><?php echo __('SQL query'); - if (!PMA_DRIZZLE) { ?> + if (! PMA_DRIZZLE) { ?> <a href="<?php echo $full_text_link; ?>" title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>"> <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png" @@ -841,7 +850,7 @@ function printVariablesTable() { /** * Messages are built using the message name */ - $strShowStatus = Array( + $strShowStatus = array( 'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'), 'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'), 'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'), @@ -1019,19 +1028,12 @@ function printVariablesTable() { <th><?php echo __('Description'); ?></th> </tr> </thead> - <!--<tfoot> - <tr class="tblFooters"> - <th colspan="3" class="tblFooters"> - </th> - </tr> - </tfoot>--> <tbody> <?php
$odd_row = false; foreach ($server_status as $name => $value) { $odd_row = !$odd_row; - // $allocations ?> <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>"> <th class="name"><?php echo htmlspecialchars($name) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?> @@ -1087,38 +1089,6 @@ function printVariablesTable() { <?php }
-function createQueryChart($com_vars=FALSE) { - /** - * Chart generation - */ - require_once './libraries/chart.lib.php'; - - if(!$com_vars) - $com_vars = PMA_DBI_fetch_result("SHOW GLOBAL STATUS LIKE 'Com_%'", 0, 1); - - // admin commands are not queries (e.g. they include COM_PING, which is excluded from $server_status['Questions']) - unset($com_vars['Com_admin_commands']); - - arsort($com_vars); - - $merge_minimum = array_sum($com_vars) * 0.005; - $merged_value = 0; - - // remove zero values from the end, as well as merge together every value that is below 0.5% - // variable empty for Drizzle - if ($com_vars) { - while (($last_element=end($com_vars)) <= $merge_minimum) { - array_pop($com_vars); - $merged_value += $last_element; - } - - $com_vars['Other'] = $merged_value; - return PMA_chart_status($com_vars); - } - - return ''; -} - /** * cleanup of some deprecated values */ diff --git a/server_variables.php b/server_variables.php index 00c8a85..e538c91 100644 --- a/server_variables.php +++ b/server_variables.php @@ -86,8 +86,10 @@ foreach ($serverVars as $name => $value) { <th nowrap="nowrap"> <?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th> <td class="value"><?php - if (strlen($value) < 16 && is_numeric($value)) { - echo PMA_formatNumber($value, 0); + if (is_numeric($value)) { + if(isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') + echo '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>'; + else echo PMA_formatNumber($value, 0); $is_numeric = true; } else { echo htmlspecialchars($value); diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 72dec00..8f03feb 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -258,6 +258,10 @@ td.null { text-align: <?php echo $right; ?>; }
+table .valueHeader { + text-align: <?php echo $right; ?>; + white-space: normal; +} table .value { text-align: <?php echo $right; ?>; white-space: normal; @@ -960,6 +964,11 @@ img.sortableIcon { background-repeat:no-repeat; }
+h3#serverstatusqueries span { + font-size:60%; + display:inline; +} + table#serverstatusqueriesdetails th img.sortableIcon, table#serverstatusvariables th img.sortableIcon { background-image:url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_sortable.png); } @@ -990,6 +999,8 @@ div#serverstatus table caption a.top {
div#serverstatusquerieschart { float:<?php echo $right; ?>; + width:500px; + height:350px; }
div#serverstatus table#serverstatusqueriesdetails { @@ -1035,6 +1046,14 @@ div#serverstatus table tbody td.descr a:after, div#serverstatus table .tblFooters a:after { content: ']'; } + +div.liveChart { + clear:both; + min-width:500px; + height:400px; + padding-bottom:80px; +} + /* end serverstatus */
/* querywindow */ diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php index 3c9d951..e55caad 100644 --- a/themes/pmahomme/css/theme_right.css.php +++ b/themes/pmahomme/css/theme_right.css.php @@ -432,6 +432,10 @@ td.null { text-align: <?php echo $right; ?>; }
+table .valueHeader { + text-align: <?php echo $right; ?>; + white-space: normal; +} table .value { text-align: <?php echo $right; ?>; white-space: normal; @@ -1166,6 +1170,11 @@ img.sortableIcon { background-repeat:no-repeat; }
+h3#serverstatusqueries span { + font-size:60%; + display:inline; +} + table#serverstatusqueriesdetails th.headerSortUp img.sortableIcon, table#serverstatusvariables th.headerSortUp img.sortableIcon { background-image:url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_asc.png); } @@ -1175,7 +1184,7 @@ table#serverstatusqueriesdetails th.headerSortDown img.sortableIcon, table#serve
.statuslinks { float: <?php echo $right; ?>; - white-space: nowrap; + white-space: nowrap; }
/* Also used for the variables page */ @@ -1193,6 +1202,8 @@ div#serverstatus table caption a.top {
div#serverstatusquerieschart { float:<?php echo $right; ?>; + width:500px; + height:350px; }
div#serverstatus table#serverstatusqueriesdetails { @@ -1225,8 +1236,28 @@ div#serverstatus table tbody td.descr a, div#serverstatus table .tblFooters a { white-space: nowrap; } + +div.liveChart { + clear:both; + min-width:500px; + height:400px; + padding-bottom:80px; +} /* end serverstatus */
+/* server variables */ + +a.editIcon { + float: <?php echo $left; ?>; + font-family:sans-serif; +} + +table#serverVariables td { + height:18px; +} + +/* end server variables */ + /* querywindow */ body#bodyquerywindow { margin: 0;
hooks/post-receive