Fix populating the server filter and then fix filtering by server. Also introduce robustness and consolel ogging when a filter doesn't exist

This commit is contained in:
Isaac Connor
2016-01-01 17:10:37 -05:00
parent 468f997e4c
commit cf7e168872
3 changed files with 25 additions and 4 deletions

View File

@@ -104,6 +104,12 @@ switch ( $_REQUEST['task'] )
else
$options[$field][$value] = "DB".$value;
}
elseif ( $field == 'ServerId' )
{
foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value )
$options['ServerId'][$value] = $value ? $servers_by_Id[$value]->Name() : '';
}
else
{
foreach( dbFetchAll( $sql, $field, array_values( $fieldValues ) ) as $value )

View File

@@ -22,7 +22,7 @@ var logTimeout = maxSampleTime;
var firstLoad = true;
var initialDisplayLimit = 200;
var sortReversed = false;
var filterFields = [ 'Component', 'Server', 'Pid', 'Level', 'File', 'Line'];
var filterFields = [ 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
var options = {};
function buildFetchParms( parms )
@@ -163,6 +163,12 @@ function filterLog()
function( field )
{
var selector = $('filter['+field+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
window.console.log("No selector found for " + field );
}
return;
}
var value = selector.get('value');
if ( value )
filter[field] = value;
@@ -246,9 +252,9 @@ function updateFilterSelectors()
var selector = $('filter['+key+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
window.console.log("No selector foudn for " + key );
window.console.log("No selector found for " + key );
}
continue;
return;
}
selector.options.length = 1;
if ( key == 'Level' )
@@ -259,6 +265,15 @@ function updateFilterSelectors()
selector.options[selector.options.length] = new Option( value, label );
}
);
}
else if ( key == 'ServerId' )
{
Object.each(values,
function( value, label )
{
selector.options[selector.options.length] = new Option( value, label );
}
);
}
else
{

View File

@@ -54,7 +54,7 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<div id="content">
<div id="filters"><?php echo translate('FilterLog') ?> -
<?php echo translate('Component') ?> <select id="filter[Component]" onchange="filterLog(this)"><option value="">-----</option></select>
<?php echo translate('Server') ?> <select id="filter[Server]" onchange="filterLog(this)"><option value="">-----</option></select>
<?php echo translate('Server') ?> <select id="filter[ServerId]" onchange="filterLog(this)"><option value="">-----</option></select>
<?php echo translate('Pid') ?> <select id="filter[Pid]" onchange="filterLog(this)"><option value="">-----</option></select>
<?php echo translate('Level') ?> <select id="filter[Level]" onchange="filterLog(this)"><option value="">---</option></select>
<?php echo translate('File') ?> <select id="filter[File]" onchange="filterLog(this)"><option value="">------</option></select>