Merge branch 'multi-server' into storageareas

This commit is contained in:
Isaac Connor 2016-01-01 17:11:01 -05:00
commit 5c0e4aa172
3 changed files with 37 additions and 2 deletions

View File

@ -31,6 +31,13 @@ switch ( $_REQUEST['task'] )
if ( !canView( 'System' ) )
ajaxError( 'Insufficient permissions to view log entries' );
$servers = Server::find_all();
$servers_by_Id = array();
# There is probably a better way to do this.
foreach ( $servers as $server ) {
$servers_by_Id[$server->Id()] = $server;
}
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
$limit = isset($_POST['limit'])?$_POST['limit']:100;
@ -66,6 +73,7 @@ switch ( $_REQUEST['task'] )
$logs = array();
foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) {
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
$log['Server'] = $log['ServerId'] ? $servers_by_Id[$log['ServerId']]->Name() : '';
$logs[] = $log;
}
$options = array();
@ -96,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;
@ -244,6 +250,12 @@ function updateFilterSelectors()
function( values, key )
{
var selector = $('filter['+key+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
window.console.log("No selector found for " + key );
}
return;
}
selector.options.length = 1;
if ( key == 'Level' )
{
@ -254,6 +266,15 @@ function updateFilterSelectors()
}
);
}
else if ( key == 'ServerId' )
{
Object.each(values,
function( value, label )
{
selector.options[selector.options.length] = new Option( value, label );
}
);
}
else
{
values.each(

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>