From 5b074cb511bb135f141cd5e1ea8535e561f3811f Mon Sep 17 00:00:00 2001 From: Eldon Koyle Date: Thu, 21 Jan 2016 17:01:45 -0700 Subject: [PATCH] Add information to widget title * Add info to widget title to make it clear what is being filtered * Remove some debug --- html/includes/common/alerts.inc.php | 39 +++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/html/includes/common/alerts.inc.php b/html/includes/common/alerts.inc.php index 67fe7427c..44495f347 100644 --- a/html/includes/common/alerts.inc.php +++ b/html/includes/common/alerts.inc.php @@ -110,9 +110,44 @@ else { $min_severity = $widget_settings['min_severity']; $group = $widget_settings['group']; - $common_output[] = ""; - $common_output[] = ""; + $title = "Alerts"; + // state can be 0 or '', be sure they are treated differently + if (is_numeric($state)) { + $state_name = array_search($state, $alert_states); + $title = "$title ($state_name)"; + } + elseif ($state) { + $title = "$title ($state)"; + } + + if (is_numeric($acknowledged)) { + if ($acknowledged == '0') { + $title = "Unacknowledged $title"; + } + elseif ($acknowledged == '1') { + $title = "Acknowledged $title"; + } + } + + if (is_numeric($group)) { + $group_row = dbFetchRow("SELECT * FROM device_groups WHERE id = ?", array($group)); + if ($group_row) { + $title = "$title for ".$group_row['name']; + } + } + + if ($min_severity) { + $sev_name = $min_severity; + if (is_numeric($min_severity)) { + $sev_name = array_search($min_severity, $alert_severities); + $title = "$title >=$sev_name"; + } + } + + $widget_settings['title'] = $title; + + $group = $widget_settings['group']; $common_output[] = '