mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
Refactored notifications for object detail view
This commit is contained in:
parent
a03f24b7ed
commit
a87925bbf6
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// We are not interested in notifications for OK or pending objects
|
||||||
|
if (in_array((int) $object->state, array(0, 99))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<th>Notifications</th>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ($object->current_notification_number > 0) {
|
||||||
|
if ((int) $object->current_notification_number === 1) {
|
||||||
|
$msg = sprintf(
|
||||||
|
$this->translate('A notication has been sent for this issue %s ago'),
|
||||||
|
$this->timeSince($object->last_notification)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$msg = sprintf(
|
||||||
|
$this->translate('%s notications have been sent for this issue'),
|
||||||
|
$object->current_notification_number
|
||||||
|
) . '<br />' . sprintf(
|
||||||
|
'The last one occured %s ago',
|
||||||
|
$this->timeSince($object->last_notification)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
echo $msg;
|
||||||
|
} else {
|
||||||
|
echo $this->translate('No notification has been sent for this issue');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
@ -47,43 +47,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($objectState > 0): ?>
|
|
||||||
<?php
|
|
||||||
if ($object->service_description) {
|
|
||||||
$notificationsHref = $this->href(
|
|
||||||
'monitoring/list/notifications',
|
|
||||||
array(
|
|
||||||
'host' => $object->host_name,
|
|
||||||
'service' => $object->service_description
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$notificationsHref = $this->href(
|
|
||||||
'monitoring/list/notifications',
|
|
||||||
array(
|
|
||||||
'host' => $object->host_name
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div class="panel-row">
|
|
||||||
<div class="panel-label">
|
|
||||||
Last Notification
|
|
||||||
</div>
|
|
||||||
<div class="panel-content">
|
|
||||||
<a href="<?= $notificationsHref ?>">
|
|
||||||
<?php if ($object->last_notification === '0000-00-00 00:00:00'): ?>
|
|
||||||
N/A
|
|
||||||
<?php else: ?>
|
|
||||||
<?= $object->last_notification ?>
|
|
||||||
<?php if ($object->current_notification_number > 0): ?>
|
|
||||||
<br />
|
|
||||||
<?= $object->current_notification_number ?> notifications sent during current problem state
|
|
||||||
<?php endif ;?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<table class="avp">
|
<table class="avp">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?= $this->render('show/components/comments.phtml') ?>
|
<?= $this->render('show/components/comments.phtml') ?>
|
||||||
|
<?= $this->render('show/components/notifications.phtml') ?>
|
||||||
<?= $this->render('show/components/downtime.phtml') ?>
|
<?= $this->render('show/components/downtime.phtml') ?>
|
||||||
<?= $this->render('show/components/flapping.phtml') ?>
|
<?= $this->render('show/components/flapping.phtml') ?>
|
||||||
<?= $this->render('show/components/perfdata.phtml') ?>
|
<?= $this->render('show/components/perfdata.phtml') ?>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<table class="avp">
|
<table class="avp">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?= $this->render('show/components/comments.phtml') ?>
|
<?= $this->render('show/components/comments.phtml') ?>
|
||||||
|
<?= $this->render('show/components/notifications.phtml') ?>
|
||||||
<?= $this->render('show/components/downtime.phtml') ?>
|
<?= $this->render('show/components/downtime.phtml') ?>
|
||||||
<?= $this->render('show/components/flapping.phtml') ?>
|
<?= $this->render('show/components/flapping.phtml') ?>
|
||||||
<?= $this->render('show/components/perfdata.phtml') ?>
|
<?= $this->render('show/components/perfdata.phtml') ?>
|
||||||
|
@ -79,8 +79,8 @@ class StatusQuery extends IdoQuery
|
|||||||
'host_attempt' => 'hs.current_check_attempt || \'/\' || hs.max_check_attempts',
|
'host_attempt' => 'hs.current_check_attempt || \'/\' || hs.max_check_attempts',
|
||||||
'host_check_type' => 'hs.check_type',
|
'host_check_type' => 'hs.check_type',
|
||||||
'host_state_type' => 'hs.state_type',
|
'host_state_type' => 'hs.state_type',
|
||||||
'host_last_notification' => 'hs.last_notification',
|
'host_last_notification' => 'UNIX_TIMESTAMP(hs.last_notification)',
|
||||||
'host_next_notification' => 'hs.next_notification',
|
'host_next_notification' => 'UNIX_TIMESTAMP(hs.next_notification)',
|
||||||
'host_no_more_notifications' => 'hs.no_more_notifications',
|
'host_no_more_notifications' => 'hs.no_more_notifications',
|
||||||
'host_problem_has_been_acknowledged' => 'hs.problem_has_been_acknowledged',
|
'host_problem_has_been_acknowledged' => 'hs.problem_has_been_acknowledged',
|
||||||
'host_acknowledgement_type' => 'hs.acknowledgement_type',
|
'host_acknowledgement_type' => 'hs.acknowledgement_type',
|
||||||
|
@ -71,6 +71,7 @@ class ServiceStatus extends DataView
|
|||||||
'service_attempt',
|
'service_attempt',
|
||||||
'service_last_notification',
|
'service_last_notification',
|
||||||
'service_check_command',
|
'service_check_command',
|
||||||
|
'service_current_notification_number',
|
||||||
'host_icon_image',
|
'host_icon_image',
|
||||||
'host_acknowledged',
|
'host_acknowledged',
|
||||||
'host_output',
|
'host_output',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user