mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added alert indicator to navbar
This commit is contained in:
@@ -491,10 +491,19 @@ if ($bgp_alerts) {
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
$alerts = new ObjectCache('alerts');
|
||||
|
||||
if ($alerts['active_count'] > 0) {
|
||||
$alert_colour = "danger";
|
||||
} else {
|
||||
$alert_colour = "success";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-exclamation-circle fa-fw fa-lg fa-nav-icons hidden-md"> </i> Alerts</a>
|
||||
<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-exclamation-circle fa-col-<?php echo $alert_colour;?> fa-fw fa-lg fa-nav-icons hidden-md"> </i> Alerts</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><i class="fa fa-bell fa-fw fa-lg"></i> Notifications</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'alert-log'))); ?>"><i class="fa fa-th-list fa-fw fa-lg"></i> Historical Log</a></li>
|
||||
|
11
includes/caches/alerts.inc.php
Normal file
11
includes/caches/alerts.inc.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
if ($_SESSION['userlevel'] >= 5) {
|
||||
$data['active_count'] = array('query' => 'SELECT COUNT(`alerts`.`id`) FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`device_id` RIGHT JOIN `alert_rules` ON `alerts`.`rule_id`=`alert_rules`.`id` WHERE 1 AND `alerts`.`state` NOT IN (0,1)');
|
||||
} else {
|
||||
$data['active_count'] = array(
|
||||
'query' => 'SELECT COUNT(`alerts`.`id`) FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`device_id` LEFT JOIN `devices_perms` AS `DP` ON `devices`.`device_id` = `DP`.`device_id` RIGHT JOIN `alert_rules` ON `alerts`.`rule_id`=`alert_rules`.`id` WHERE 1 AND `alerts`.`state` NOT IN (0,1) AND `DP`.`user_id`=?',
|
||||
'params' => array($_SESSION['user_id']),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user