diff --git a/html/includes/common/alerts.inc.php b/html/includes/common/alerts.inc.php index 3ae907ac3306..cd649c33cd02 100644 --- a/html/includes/common/alerts.inc.php +++ b/html/includes/common/alerts.inc.php @@ -44,6 +44,7 @@ $current_state = isset($widget_settings['state']) ? $widget_settings['state'] : ''; $current_group = isset($widget_settings['group']) ? $widget_settings['group'] : ''; $current_proc = isset($widget_settings['proc']) ? $widget_settings['proc'] : ''; + $current_sorting = isset($widget_settings['sort']) ? $widget_settings['sort'] : ''; $common_output[] = '
@@ -140,6 +141,21 @@ +
+
+ +
+
+ +
+
@@ -156,6 +172,7 @@ $min_severity = $widget_settings['min_severity']; $group = $widget_settings['group']; $proc = $widget_settings['proc']; + $sort = $widget_settings['sort']; $title = "Alerts"; @@ -194,6 +211,10 @@ } } + if (!empty($sort)) { + $title = "$title " . "sorted by severity (higher first)"; + } + $widget_settings['title'] = $title; $group = $widget_settings['group']; @@ -254,6 +275,10 @@ $common_output[] = "proc: '$proc',\n"; } + if (isset($sort) && sort != '') { + $common_output[] = "sort: '$sort',\n"; + } + $common_output[] = ' device_id: \'' . $device['device_id'] . '\' } diff --git a/html/includes/table/alerts.inc.php b/html/includes/table/alerts.inc.php index 164692ff3686..4efd937540c2 100644 --- a/html/includes/table/alerts.inc.php +++ b/html/includes/table/alerts.inc.php @@ -100,8 +100,10 @@ $total = 0; } -if (!isset($sort) || empty($sort)) { +if (!isset($vars['sort']) || empty($vars['sort'])) { $sort = 'timestamp DESC'; +} else { + $sort = '`alert_rules`.`severity` DESC'; } $sql .= " ORDER BY $sort";