Commit version 24.12.13800
This commit is contained in:
@ -4,9 +4,9 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -14,42 +14,54 @@ $alert_rules = cache_alert_rules();
|
||||
$alert_assoc = cache_alert_assoc();
|
||||
$alert_table = cache_device_alert_table($device['device_id']);
|
||||
|
||||
if (!isset($vars['status'])) { $vars['status'] = 'failed'; }
|
||||
if (!$vars['entity_type']) { $vars['entity_type'] = 'all'; }
|
||||
if (!isset($vars['status'])) {
|
||||
$vars['status'] = 'failed';
|
||||
}
|
||||
if (!$vars['entity_type']) {
|
||||
$vars['entity_type'] = 'all';
|
||||
}
|
||||
|
||||
// Build Navbar
|
||||
|
||||
$navbar['class'] = "navbar-narrow";
|
||||
$navbar['brand'] = "Alert Types";
|
||||
|
||||
if ($vars['entity_type'] === 'all') { $navbar['options']['all']['class'] = "active"; }
|
||||
$navbar['options']['all']['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => 'all'));
|
||||
if ($vars['entity_type'] === 'all') {
|
||||
$navbar['options']['all']['class'] = "active";
|
||||
}
|
||||
$navbar['options']['all']['url'] = generate_url(['page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => 'all']);
|
||||
$navbar['options']['all']['text'] = "All";
|
||||
|
||||
foreach ($alert_table as $entity_type => $thing)
|
||||
{
|
||||
foreach ($alert_table as $entity_type => $thing) {
|
||||
|
||||
if (!$vars['entity_type']) { $vars['entity_type'] = $entity_type; }
|
||||
if ($vars['entity_type'] == $entity_type) { $navbar['options'][$entity_type]['class'] = "active"; }
|
||||
if (!$vars['entity_type']) {
|
||||
$vars['entity_type'] = $entity_type;
|
||||
}
|
||||
if ($vars['entity_type'] == $entity_type) {
|
||||
$navbar['options'][$entity_type]['class'] = "active";
|
||||
}
|
||||
|
||||
$navbar['options'][$entity_type]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => $entity_type));
|
||||
$navbar['options'][$entity_type]['icon'] = $config['entities'][$entity_type]['icon'];
|
||||
$navbar['options'][$entity_type]['text'] = escape_html(nicecase($entity_type));
|
||||
$navbar['options'][$entity_type]['url'] = generate_url(['page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => $entity_type]);
|
||||
$navbar['options'][$entity_type]['icon'] = $config['entities'][$entity_type]['icon'];
|
||||
$navbar['options'][$entity_type]['text'] = escape_html(nicecase($entity_type));
|
||||
}
|
||||
|
||||
if (isset($config['enable_syslog']) && $config['enable_syslog'] && OBSERVIUM_EDITION != 'community')
|
||||
{
|
||||
$entity_type = "syslog";
|
||||
if (isset($config['enable_syslog']) && $config['enable_syslog'] && OBSERVIUM_EDITION != 'community') {
|
||||
$entity_type = "syslog";
|
||||
|
||||
if (!$vars['entity_type']) { $vars['entity_type'] = 'syslog'; }
|
||||
if ($vars['entity_type'] === 'syslog') { $navbar['options'][$entity_type]['class'] = "active"; }
|
||||
if (!$vars['entity_type']) {
|
||||
$vars['entity_type'] = 'syslog';
|
||||
}
|
||||
if ($vars['entity_type'] === 'syslog') {
|
||||
$navbar['options'][$entity_type]['class'] = "active";
|
||||
}
|
||||
|
||||
$navbar['options'][$entity_type]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => $entity_type));
|
||||
$navbar['options'][$entity_type]['icon'] = $config['icon']['syslog-alerts'];
|
||||
$navbar['options'][$entity_type]['text'] = 'Syslog';
|
||||
$navbar['options'][$entity_type]['url'] = generate_url(['page' => 'device', 'device' => $device['device_id'],
|
||||
'tab' => 'alerts', 'entity_type' => $entity_type]);
|
||||
$navbar['options'][$entity_type]['icon'] = $config['icon']['syslog-alerts'];
|
||||
$navbar['options'][$entity_type]['text'] = 'Syslog';
|
||||
}
|
||||
|
||||
/* Not required anymore
|
||||
@ -64,46 +76,44 @@ $navbar['options_right']['filters']['text'] = 'Filter';
|
||||
$navbar['options_right']['filters']['icon'] = $config['icon']['filter'];
|
||||
$navbar['options_right']['filters']['link_opts'] = 'data-hover="dropdown" data-toggle="dropdown"';
|
||||
|
||||
$filters = array('all' => array('url' => generate_url($vars, array('status' => 'all')),
|
||||
'url_o' => generate_url($vars, array('status' => 'all')),
|
||||
'icon' => $config['icon']['info'],
|
||||
'text' => 'All'),
|
||||
$filters = ['all' => ['url' => generate_url($vars, ['status' => 'all']),
|
||||
'url_o' => generate_url($vars, ['status' => 'all']),
|
||||
'icon' => $config['icon']['info'],
|
||||
'text' => 'All'],
|
||||
|
||||
'failed_delayed' => array('url' => generate_url($vars, array('status' => 'failed_delayed')),
|
||||
'url_o' => generate_url($vars, array('page' => 'alerts', 'status' => 'all')),
|
||||
'icon' => $config['icon']['important'],
|
||||
'text' => 'Failed & Delayed'),
|
||||
'failed_delayed' => ['url' => generate_url($vars, ['status' => 'failed_delayed']),
|
||||
'url_o' => generate_url($vars, ['page' => 'alerts', 'status' => 'all']),
|
||||
'icon' => $config['icon']['important'],
|
||||
'text' => 'Failed & Delayed'],
|
||||
|
||||
'failed' => array('url' => generate_url($vars, array('status' => 'failed')),
|
||||
'url_o' => generate_url($vars, array('status' => 'all')),
|
||||
'icon' => $config['icon']['cancel'],
|
||||
'text' => 'Failed'),
|
||||
'failed' => ['url' => generate_url($vars, ['status' => 'failed']),
|
||||
'url_o' => generate_url($vars, ['status' => 'all']),
|
||||
'icon' => $config['icon']['cancel'],
|
||||
'text' => 'Failed'],
|
||||
|
||||
'suppressed' => array('url' => generate_url($vars, array('status' => 'suppressed')),
|
||||
'url_o' => generate_url($vars, array('status' => 'all')),
|
||||
'icon' => $config['icon']['shutdown'],
|
||||
'text' => 'Suppressed')
|
||||
);
|
||||
'suppressed' => ['url' => generate_url($vars, ['status' => 'suppressed']),
|
||||
'url_o' => generate_url($vars, ['status' => 'all']),
|
||||
'icon' => $config['icon']['shutdown'],
|
||||
'text' => 'Suppressed']
|
||||
];
|
||||
|
||||
foreach ($filters as $option => $option_array)
|
||||
{
|
||||
foreach ($filters as $option => $option_array) {
|
||||
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['text'] = $option_array['text'];
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['icon'] = $option_array['icon'];
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['text'] = $option_array['text'];
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['icon'] = $option_array['icon'];
|
||||
|
||||
if ($vars['status'] == $option)
|
||||
{
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['class'] = "active";
|
||||
if ($vars['status'] != "all") {
|
||||
$navbar['options_right']['filters']['class'] = "active";
|
||||
if ($vars['status'] == $option) {
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['class'] = "active";
|
||||
if ($vars['status'] != "all") {
|
||||
$navbar['options_right']['filters']['class'] = "active";
|
||||
}
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['url'] = $option_array['url_o'];
|
||||
$navbar['options_right']['filters']['text'] .= " (" . $option_array['text'] . ")";
|
||||
$navbar['options_right']['filters']['icon'] = $option_array['icon'];
|
||||
|
||||
} else {
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['url'] = $option_array['url'];
|
||||
}
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['url'] = $option_array['url_o'];
|
||||
$navbar['options_right']['filters']['text'] .= " (".$option_array['text'].")";
|
||||
$navbar['options_right']['filters']['icon'] = $option_array['icon'];
|
||||
|
||||
} else {
|
||||
$navbar['options_right']['filters']['suboptions'][$option]['url'] = $option_array['url'];
|
||||
}
|
||||
}
|
||||
|
||||
print_navbar($navbar);
|
||||
@ -123,9 +133,9 @@ $vars['pagination'] = TRUE;
|
||||
|
||||
if ($vars['entity_type'] === "syslog") {
|
||||
|
||||
print_logalert_log($vars);
|
||||
print_logalert_log($vars);
|
||||
|
||||
} else {
|
||||
print_alert_table($vars);
|
||||
print_alert_table($vars);
|
||||
}
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user