mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 02:48:37 +00:00
webui: Eventlog table refresh (#7793)
* initial release * added copyright info * set username to System if empty * eventlog page cleanup * added copyright
This commit is contained in:
parent
34e07a1d66
commit
9e63d3200d
@ -1,4 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$common_output[] = '
|
||||
<div class="table-responsive">
|
||||
@ -6,9 +19,9 @@ $common_output[] = '
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="eventicon"></th>
|
||||
<th data-column-id="datetime" data-order="desc">Datetime</th>
|
||||
<th data-column-id="hostname">Hostname</th>
|
||||
<th data-column-id="datetime" data-order="desc">Timestamp</th>
|
||||
<th data-column-id="type">Type</th>
|
||||
<th data-column-id="hostname">Hostname</th>
|
||||
<th data-column-id="message">Message</th>
|
||||
<th data-column-id="username">User</th>
|
||||
</tr>
|
||||
|
@ -1441,17 +1441,17 @@ function eventlog_severity($eventlog_severity)
|
||||
{
|
||||
switch ($eventlog_severity) {
|
||||
case 1:
|
||||
return "severity-ok"; //OK
|
||||
return "label-success"; //OK
|
||||
case 2:
|
||||
return "severity-info"; //Informational
|
||||
return "label-info"; //Informational
|
||||
case 3:
|
||||
return "severity-notice"; //Notice
|
||||
return "label-primary"; //Notice
|
||||
case 4:
|
||||
return "severity-warning"; //Warning
|
||||
return "label-warning"; //Warning
|
||||
case 5:
|
||||
return "severity-critical"; //Critical
|
||||
return "label-danger"; //Critical
|
||||
default:
|
||||
return "severity-unknown"; //Unknown
|
||||
return "label-default"; //Unknown
|
||||
}
|
||||
} // end eventlog_severity
|
||||
|
||||
|
@ -1,4 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$where = '1';
|
||||
|
||||
@ -61,8 +74,12 @@ foreach (dbFetchRows($sql, $param) as $eventlog) {
|
||||
}
|
||||
$severity_colour = $eventlog['severity'];
|
||||
|
||||
if ($eventlog['username'] == '') {
|
||||
$eventlog['username'] = 'System';
|
||||
}
|
||||
|
||||
$response[] = array(
|
||||
'eventicon' => "<i class='fa fa-bookmark fa-lg ".eventlog_severity($severity_colour)."' aria-hidden='true'></i>",
|
||||
'eventicon' => "<span class='alert-status ".eventlog_severity($severity_colour)."'> </span>",
|
||||
'datetime' => $eventlog['humandate'],
|
||||
'hostname' => generate_device_link($dev, shorthost($dev['hostname'])),
|
||||
'type' => $type,
|
||||
|
@ -1,7 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$no_refresh = true;
|
||||
|
||||
$param = array();
|
||||
|
||||
if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
||||
@ -10,59 +22,62 @@ if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
||||
}
|
||||
|
||||
$pagetitle[] = 'Eventlog';
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" action="" class="form-inline" role="form" id="result_form">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<strong>Device</strong>
|
||||
</label>
|
||||
<select name="device" id="device" class="form-control input-sm">
|
||||
<option value="">All Devices</option>
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Eventlog</strong>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once 'includes/common/eventlog.inc.php';
|
||||
echo implode('', $common_output);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('.actionBar').append(
|
||||
'<div class="pull-left">' +
|
||||
'<form method="post" action="" class="form-inline" role="form" id="result_form">' +
|
||||
'<div class="form-group">' +
|
||||
'<label><strong>Device </strong></label>' +
|
||||
'<select name="device" id="device" class="form-control input-sm">' +
|
||||
'<option value="">All Devices</option>' +
|
||||
<?php
|
||||
foreach (get_all_devices() as $data) {
|
||||
if (device_permitted($data['device_id'])) {
|
||||
echo "<option value='".$data['device_id']."'";
|
||||
echo "'<option value=\"" . $data['device_id'] . "\"";
|
||||
if ($data['device_id'] == $_POST['device']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.format_hostname($data).'</option>';
|
||||
echo ">" . format_hostname($data) . "</option>' + ";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<strong>Type: </strong>
|
||||
</label>
|
||||
<select name="eventtype" id="eventtype" class="form-control input-sm">
|
||||
<option value="">All types</option>
|
||||
'</select>' +
|
||||
'</div> ' +
|
||||
'<div class="form-group"><label><strong>Type </strong></label>' +
|
||||
'<select name="eventtype" id="eventtype" class="form-control input-sm">' +
|
||||
'<option value="">All types</option>' +
|
||||
<?php
|
||||
|
||||
foreach (dbFetchColumn("SELECT `type` FROM `eventlog` GROUP BY `type`") as $type) {
|
||||
echo "<option value='$type'";
|
||||
echo "'<option value=\"" . $type . "\"";
|
||||
if ($type === $_POST['eventtype']) {
|
||||
echo ' selected';
|
||||
echo " selected";
|
||||
}
|
||||
echo ">$type</option>";
|
||||
echo ">" . $type . "</option>' + ";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default input-sm">Filter</button>
|
||||
</form>
|
||||
'</select>' +
|
||||
'</div> ' +
|
||||
'<button type="submit" class="btn btn-default input-sm">Filter</button>' +
|
||||
'</form>' +
|
||||
'</div>'
|
||||
);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print_optionbar_end();
|
||||
|
||||
require_once 'includes/common/eventlog.inc.php';
|
||||
echo implode('', $common_output);
|
||||
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user