monitoring: Fix the notifications view script

This commit is contained in:
Eric Lippmann 2014-12-30 11:14:30 +01:00
parent a5122f540d
commit ac56cc02ac

View File

@ -16,27 +16,14 @@ use Icinga\Module\Monitoring\Object\Service;
</div> </div>
<?php endif ?> <?php endif ?>
<?php if (! $this->inline): ?>
<div class="content"> <div class="content">
<?php endif; ?> <?php if (count($notifications) === 0): ?>
<?= $this->translate('No notifications matching the filter') ?>
<?php <?php return; endif ?>
if (empty($this->notifications)) {
echo 'No notifications yet</div>';
return;
}
?>
<table data-base-target="_next" class="action"> <table data-base-target="_next" class="action">
<tbody> <tbody>
<?php <?php foreach ($notifications as $notification):
if (count($notifications) === 0) {
echo mt('monitoring', 'No notifications matching the filter');
}
foreach ($notifications as $notification):
if (isset($notification->service)) { if (isset($notification->service)) {
$isService = true; $isService = true;
$href = $this->href('monitoring/show/service', array( $href = $this->href('monitoring/show/service', array(
@ -58,24 +45,30 @@ foreach ($notifications as $notification):
$this->translate('on %s', 'datetime'), $this->translate('on %s', 'datetime'),
$this->translate('at %s', 'time'), $this->translate('at %s', 'time'),
$this->translate('%s ago', 'timespan') $this->translate('%s ago', 'timespan')
); ) ?>
?>
</td> </td>
<td style="font-size: 0.8em"> <td style="font-size: 0.8em">
<?php if ($isService): ?> <?php if ($isService): ?>
<?= sprintf($this->translate('%s on %s'), "<a href=\"$href\">$notification->service</a>", $notification->host); ?> <?= sprintf(
$this->translate('%s on %s'),
$this->qlink($notification->service, $href), $notification->host
) ?>
<?php else: ?> <?php else: ?>
<a href="<?= $href ?>"><?= $notification->host ?></a> <?= $this->qlink($notification->host, $href) ?>
<?php endif; ?> <?php endif ?>
<br /> <br>
<?= $this->escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?> <?= $this->escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?>
<br /> <br>
<?php if (! $this->contact): ?> <?php if (! $this->contact): ?>
<small> <small>
<?= sprintf($this->translate('Sent to %s'), "<a href=\"$this->href( <?= sprintf(
$this->translate('Sent to %s'),
$this->qlink(
$notification->notification_contact,
'monitoring/show/contact', 'monitoring/show/contact',
array('contact' => $notification->notification_contact) array('contact' => $notification->notification_contact)
)\">$this->escape($notification->notification_contact)</a>"); ?> )
) ?>
</small> </small>
<?php endif ?> <?php endif ?>
</td> </td>
@ -83,7 +76,4 @@ foreach ($notifications as $notification):
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?php if (!$this->inline): ?>
</div> </div>
<?php endif; ?>