webui: New eventlog severity classification (#5830)

* New event log severity model

* Revert "New event log severity model"

This reverts commit 0783527af8.

* New event log severity model

* Fixed spaces vs tabs

* Learning the format requirements

* Learning the format requirements

* Moved the colours in to the stylesheet

* change SQL file to stop conflicting

* refactor log_event so severity isn't last, but reference is.

* keep having to move the file due to new PR conflicts

* Revert "keep having to move the file due to new PR conflicts"

This reverts commit f3030e7218.

* extended support to dashboard and eventlog page

* formatting
This commit is contained in:
Richard Mayhew
2017-02-13 00:41:05 +02:00
committed by Neil Lathwood
parent a75ec7ab31
commit 5bfd23e7eb
31 changed files with 116 additions and 112 deletions

View File

@@ -299,9 +299,9 @@ function renamehost($id, $new, $source = 'console')
$host = dbFetchCell("SELECT `hostname` FROM `devices` WHERE `device_id` = ?", array($id));
if (!is_dir($config['rrd_dir']."/$new") && rename($config['rrd_dir']."/$host", $config['rrd_dir']."/$new") === true) {
dbUpdate(array('hostname' => $new), 'devices', 'device_id=?', array($id));
log_event("Hostname changed -> $new ($source)", $id, 'system');
log_event("Hostname changed -> $new ($source)", $id, 'system', 3);
} else {
log_event("Renaming of $host failed", $id, 'system');
log_event("Renaming of $host failed", $id, 'system', 5);
if (__FILE__ === $_SERVER['SCRIPT_FILE_NAME']) {
echo "Renaming of $host failed\n";
} else {
@@ -355,7 +355,7 @@ function delete_device($id)
}
$ret .= "Removed device $host\n";
log_event("Device $host has been removed", 0, 'system');
log_event("Device $host has been removed", 0, 'system', 3);
return $ret;
}
@@ -789,7 +789,7 @@ function get_astext($asn)
}
# Use this function to write to the eventlog table
function log_event($text, $device = null, $type = null, $reference = null)
function log_event($text, $device = null, $type = null, $severity = 2, $reference = null)
{
if (!is_array($device)) {
$device = device_by_id_cache($device);
@@ -800,6 +800,7 @@ function log_event($text, $device = null, $type = null, $reference = null)
'reference' => ($reference ? $reference : "NULL"),
'type' => ($type ? $type : "NULL"),
'datetime' => array("NOW()"),
'severity' => $severity,
'message' => $text);
dbInsert($insert, 'eventlog');