diff --git a/js/server_status.js b/js/server_status.js new file mode 100644 index 0000000000..10c29bd9e1 --- /dev/null +++ b/js/server_status.js @@ -0,0 +1,36 @@ +$(function() { + var textFilter=null; + var alertFilter = false; + + // Filter options are invisible for disabled js users + $('#serverstatusvars fieldset').css('display',''); + + $('#serverstatusquerieschart a').first().click(function() { + $.get('server_status.php',window.parent.common_query+'&query_chart_ajax=1', function(data) { + $('#serverstatusquerieschart').html(data); + }); + return false; + }); + $('#serverstatusquerieschart div.notice').css('display','none'); + + $('#filterAlert').change(function() { + alertFilter = this.checked; + filterVariables(); + }); + + $('#filterText').keyup(function(e) { + if($(this).val().length==0) textFilter=null; + else textFilter = new RegExp("(^|_)"+$(this).val(),'i'); + filterVariables(); + }); + + function filterVariables() { + $('#serverstatusvariables th.name').each(function() { + if((textFilter==null || textFilter.exec($(this).text())) + && (!alertFilter || $(this).next().find('span.attention').length>0)) + $(this).parent().css('display',''); + else + $(this).parent().css('display','none'); + }); + } +}); \ No newline at end of file diff --git a/server_status.php b/server_status.php index 3b44a4adec..5437385c80 100644 --- a/server_status.php +++ b/server_status.php @@ -16,7 +16,32 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) { } require_once './libraries/common.inc.php'; +/** + * Chart generation + */ +require_once './libraries/chart.lib.php'; + +/** + * Ajax request + */ +if (isset($_REQUEST["query_chart_ajax"])) { + $com_vars = PMA_DBI_fetch_result("SHOW GLOBAL STATUS LIKE 'Com_%'", 0, 1); + // remove all zero values from the end + // variable empty for Drizzle + if ($com_vars) { + while (end($com_vars) == 0) { + array_pop($com_vars); + } + exit(PMA_chart_status($com_vars)); + } +} + +/** + * JS Includes + */ + $GLOBALS['js_include'][] = 'pMap.js'; +$GLOBALS['js_include'][] = 'server_status.js'; /** * Does the common work @@ -35,11 +60,6 @@ require './libraries/server_links.inc.php'; require './libraries/replication.inc.php'; require_once './libraries/replication_gui.lib.php'; -/** - * Chart generation - */ -require_once './libraries/chart.lib.php'; - /** * Messages are built using the message name */ @@ -325,7 +345,7 @@ $allocations = array( // variable name => section 'Com_' => 'com', - 'Innodb_' => 'innodb', + /* 'Innodb_' => 'innodb', 'Ndb_' => 'ndb', 'Handler_' => 'handler', 'Qcache_' => 'qcache', @@ -337,7 +357,7 @@ $allocations = array( 'Key_' => 'key', 'Delayed_' => 'delayed', - 'Not_flushed_delayed_rows' => 'delayed', + 'Not_flushed_delayed_rows' => 'delayed',*/ 'Flush_commands' => 'query', 'Last_query_cost' => 'query', @@ -345,7 +365,7 @@ $allocations = array( 'Queries' => 'query', 'Prepared_stmt_count' => 'query', - 'Select_' => 'select', + /* 'Select_' => 'select', 'Sort_' => 'sort', 'Open_tables' => 'table', @@ -363,13 +383,13 @@ $allocations = array( 'Open_files' => 'files', 'Open_streams' => 'files', - 'Opened_files' => 'files', + 'Opened_files' => 'files',*/ ); $sections = array( // section => section name (description) 'com' => array('title' => ''), - 'query' => array('title' => __('SQL query')), + /*'query' => array('title' => __('SQL query')), 'innodb' => array('title' => 'InnoDB'), 'ndb' => array('title' => 'NDB'), 'handler' => array('title' => __('Handler')), @@ -385,7 +405,7 @@ $sections = array( 'table' => array('title' => __('Tables')), 'tc' => array('title' => __('Transaction coordinator')), 'files' => array('title' => __('Files')), - 'ssl' => array('title' => 'SSL'), + 'ssl' => array('title' => 'SSL'),*/ ); /** @@ -435,7 +455,7 @@ $links['innodb'][__('InnoDB Status')] $links['innodb']['doc'] = 'innodb'; -// sort status vars into arrays +// sort com_ and query_ vars into arrays foreach ($server_status as $name => $value) { if (isset($allocations[$name])) { $sections[$allocations[$name]]['vars'][$name] = $value; @@ -450,6 +470,7 @@ foreach ($server_status as $name => $value) { } } } + unset($name, $value, $filter, $section, $allocations); // rest @@ -461,7 +482,7 @@ $hour_factor = 3600 / $server_status['Uptime']; * start output */ ?> -