mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Mark acknowledged Alerts in Alert Rule List (#12320)
* Mark acknowledged Alerts in Alert Rule List * style fix
This commit is contained in:
@@ -27,6 +27,7 @@ if (! Auth::user()->hasGlobalAdmin()) {
|
||||
}
|
||||
|
||||
use LibreNMS\Alerting\QueryBuilderParser;
|
||||
use LibreNMS\Enum\AlertState;
|
||||
|
||||
$no_refresh = true;
|
||||
|
||||
@@ -90,9 +91,9 @@ if (isset($_POST['results_amount']) && $_POST['results_amount'] > 0) {
|
||||
|
||||
echo '<div class="table-responsive">';
|
||||
echo '<div class="col pull-left">';
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="' . $device['device_id'] . '"><i class="fa fa-plus"></i> Create new alert rule</button>';
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="' . $device['device_id'] . '">Create new alert rule</button>';
|
||||
echo '<i> - OR - </i>';
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#search_rule_modal" data-device_id="' . $device['device_id'] . '"><i class="fa fa-plus"></i> Create rule from collection</button>';
|
||||
echo '<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#search_rule_modal" data-device_id="' . $device['device_id'] . '">Create rule from collection</button>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="col pull-right">';
|
||||
@@ -193,12 +194,12 @@ foreach ($rule_list as $rule) {
|
||||
$status_msg = '';
|
||||
if (sizeof($sub) == 1) {
|
||||
$sub = $sub[0];
|
||||
if ((int) $sub['state'] === 0) {
|
||||
if ((int) $sub['state'] === AlertState::CLEAR) {
|
||||
$ico = 'check';
|
||||
$col = 'success';
|
||||
$status_msg = 'All devices matching ' . $rule['name'] . ' are OK';
|
||||
}
|
||||
if ((int) $sub['state'] === 1 || (int) $sub['state'] === 2) {
|
||||
if ((int) $sub['state'] === AlertState::ACTIVE || (int) $sub['state'] === AlertState::ACKNOWLEDGED) {
|
||||
$alert_style = alert_layout($severity);
|
||||
$ico = $alert_style['icon'];
|
||||
$col = $alert_style['icon_color'];
|
||||
@@ -385,9 +386,12 @@ foreach ($rule_list as $rule) {
|
||||
|
||||
echo "<td><span data-toggle='popover' data-placement='$status_popover' data-content='$status_msg' id='alert-rule-" . $rule['id'] . "' class='fa fa-fw fa-2x fa-" . $ico . ' text-' . $col . "'></span> ";
|
||||
if ($rule_extra['mute'] === true) {
|
||||
echo "<div data-toggle='popover' data-content='Alerts for " . $rule['name'] . " are muted' class='fa fa-fw fa-2x fa-volume-off text-primary' aria-hidden='true'></div></td>";
|
||||
echo "<div data-toggle='popover' data-content='Alerts for " . $rule['name'] . " are muted' class='fa fa-fw fa-2x fa-volume-off text-primary' aria-hidden='true'></div>";
|
||||
}
|
||||
|
||||
if ($sub['state'] == AlertState::ACKNOWLEDGED) {
|
||||
echo "<div data-toggle='popover' data-content='Some Alerts for " . $rule['name'] . " are acknowledged' class='fa fa-fw fa-2x fa-sticky-note text-info' aria-hidden='true'></div>";
|
||||
}
|
||||
echo '</td>';
|
||||
// Enabled
|
||||
|
||||
$enabled_popover = 'top';
|
||||
|
Reference in New Issue
Block a user