Show new notfication types in the history views

This commit is contained in:
Eric Lippmann 2019-07-15 16:37:26 +02:00 committed by Johannes Meyer
parent 54f9c68887
commit 213e7a3c13
1 changed files with 32 additions and 4 deletions

View File

@ -53,16 +53,44 @@ $rowAction = Url::fromPath('monitoring/event/show');
'id' => $event->id 'id' => $event->id
)); ));
switch ($event->type) { switch ($event->type) {
case 'notify': case substr($event->type, 0, 13) === 'notification_':
$icon = 'bell'; $icon = 'bell';
$iconTitle = $this->translate('Notification', 'tooltip'); switch (substr($event->type, 13)) {
case 'state':
$iconTitle = $this->translate('State notification', 'tooltip');
$label = $this->translate('NOTIFICATION'); $label = $this->translate('NOTIFICATION');
$stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
break;
case 'ack':
$iconTitle = $this->translate('Ack Notification', 'tooltip');
$label = $this->translate('ACK NOTIFICATION');
break;
case 'dt_start':
$iconTitle = $this->translate('Downtime start notification', 'tooltip');
$label = $this->translate('DOWNTIME START NOTIFICATION');
break;
case 'dt_end':
$iconTitle = $this->translate('Downtime end notification', 'tooltip');
$label = $this->translate('DOWNTIME END NOTIFICATION');
break;
case 'flapping':
$iconTitle = $this->translate('Flapping notification', 'tooltip');
$label = $this->translate('FLAPPING NOTIFICATION');
break;
case 'flapping_end':
$iconTitle = $this->translate('Flapping end notification', 'tooltip');
$label = $this->translate('FLAPPING END NOTIFICATION');
break;
case 'custom':
$iconTitle = $this->translate('Custom notification', 'tooltip');
$label = $this->translate('CUSTOM NOTIFICATION');
break;
}
$msg = $msg ? preg_replace_callback( $msg = $msg ? preg_replace_callback(
'/^\[([^\]]+)\]/', '/^\[([^\]]+)\]/',
function($match) use ($self) { return contactsLink($match, $self); }, function($match) use ($self) { return contactsLink($match, $self); },
$msg $msg
) : $this->translate('This notification was not sent out to any contact.'); ) : $this->translate('This notification was not sent out to any contact.');
$stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state);
break; break;
case 'comment': case 'comment':
$icon = 'comment-empty'; $icon = 'comment-empty';