diff options
Diffstat (limited to 'application/views/scripts/event')
-rw-r--r-- | application/views/scripts/event/index-plain.phtml | 62 | ||||
-rw-r--r-- | application/views/scripts/event/index.phtml | 174 |
2 files changed, 236 insertions, 0 deletions
diff --git a/application/views/scripts/event/index-plain.phtml b/application/views/scripts/event/index-plain.phtml new file mode 100644 index 0000000..5b6ea8d --- /dev/null +++ b/application/views/scripts/event/index-plain.phtml @@ -0,0 +1,62 @@ +<?php +/** @var \Icinga\Module\Eventdb\Event $event */ +/** @var array $additionalColumns */ +/** @var \Icinga\Repository\RepositoryQuery $comments */ +/** @var \Icinga\Repository\RepositoryQuery $groupedEvents */ + +$commentTypes = array( + $this->translate('Comment'), + $this->translate('Acknowledgement'), + $this->translate('Revocation'), +); + +$displayColumns = array_merge(array('program', 'message', 'facility'), $additionalColumns); +?> +<?= $this->translate('Timestamp') ?>: <?= $event->created ?> + +<?= $this->translate('Priority') ?>: <?= strtoupper($event->getPriority()) ?> +<?= $event->ack ? sprintf(' (%s)', $this->translate('Acknowledged')) : '' ?> + +<?= $this->translate('Type') ?>: <?= $event->getType() ?> + +<?php foreach ($displayColumns as $col): ?> +<?= $this->columnHeader($col, null, true) ?>: <?= htmlspecialchars($event->offsetGet($col)) ?> + +<?php endforeach ?> + +<?php if ($comments->hasResult()): ?> +[ <?= $this->translate('Comments') ?> ] + +<?php foreach ($comments as $comment): ?> +<?= $commentTypes[$comment->type] ?>: <?= $comment->created ?> + +<?= $this->translate('User') ?>: <?= $comment->user ?> + +<?= $this->translate('Message') ?>: <?= $comment->message ?> + + +<?php endforeach ?> + +<?php endif; ?> +<?php if ($groupedEvents !== null && $groupedEvents->hasResult()): ?> +[ <?= $this->translate('Grouped Events') ?> ] + +<?php foreach ($groupedEvents as $groupedEventData): + /** @var \Icinga\Module\Eventdb\Event $groupedEvent */ + $groupedEvent = $this->event($groupedEventData); +?> +<?= $this->translate('Timestamp') ?>: <?= $event->created ?> + +<?= $this->translate('Priority') ?>: <?= strtoupper($event->getPriority()) ?> +<?= $event->ack ? sprintf(' (%s)', $this->translate('Acknowledged')) : '' ?> + +<?= $this->translate('Type') ?>: <?= $event->getType() ?> + +<?php foreach (array('host_name', 'program', 'message') as $col): ?> +<?= $this->columnHeader($col, null, true) ?>: <?= htmlspecialchars($event->offsetGet($col)) ?> + +<?php endforeach ?> + +<?php endforeach ?> +<?php endif; ?> + diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml new file mode 100644 index 0000000..83dcf01 --- /dev/null +++ b/application/views/scripts/event/index.phtml @@ -0,0 +1,174 @@ +<?php +/** @var \Icinga\Module\Eventdb\Event $event */ +/** @var array $additionalColumns */ +/** @var \Icinga\Repository\RepositoryQuery $comments */ +/** @var \Icinga\Repository\RepositoryQuery $groupedEvents */ + +$commentIcons = array( + $this->icon('comment', $this->translate('Comment')), + $this->icon('ok', $this->translate('Acknowledgement')), + $this->icon('cancel', $this->translate('Revocation')) +); + +if (! $this->compact): ?> +<div class="controls"> + <?= $this->tabs ?> +</div> +<?php endif ?> +<div class="content"> + <table class="event-summary-table"> + <tr> + <td rowspan="2" class="priority-col <?= $event->getPriority() ?> <?= $event->ack ? 'ack' : '' ?>"> + <div class="priority-label"><?= strtoupper($event->getPriority()) ?></div> + <div class="event-meta"><span class="timeago" title="<?= $event->created ?>"><?= $this->timeAgo(strtotime($event->created)) ?></span></div> + </td> + <td rowspan="2" class="icon-col"> + <?= $this->icon($event->getTypeIcon(), $event->getType()) ?> + <?php if ($event->ack) { echo $this->icon('ok', $this->translate('Acknowledged')); } ?> + <?php if ($event->group_autoclear) { echo $this->icon('reschedule', $this->translate('Auto-Clear')); } ?> + </td> + <?= $this->column('host_name', $event, array('selectable')) ?> + </tr> + <tr> + <?= $this->column('host_address', $event, array('selectable')) ?> + </tr> + </table> + <h2><?= $this->translate('Details') ?></h2> + <table class="name-value-table"> + <?php + $displayColumns = array_merge(array('program', 'message', 'facility'), $additionalColumns); + foreach ($displayColumns as $column): + if ($column === 'message') continue; + ?> + <tr> + <?= $this->columnHeader($column) ?> + <?= $this->column($column, $event) ?> + </tr> + <?php endforeach ?> + </table> + <?php if ($event->message): ?> + <h2><?= $this->translate('Message') ?></h2> + <div class="event-message detail preformatted"><?= $this->eventMessage($event->message) ?></div> + <?php endif; ?> + + <?php + foreach ($extensionsHtml as $extensionHtml) { + echo $extensionHtml; + } + ?> + + <h2><?= $this->translate('Actions') ?></h2> + <table class="name-value-table" data-base-target="_next"> + <tr> + <th><?= $this->translate('Other events for') ?></th> + <td><?= $this->qlink( + $this->translate('Host'), + 'eventdb/events', + array('host_name' => $event->host_name), + array( + 'icon' => 'search', + 'class' => 'action-link' + ) + ) ?> + <?php if ($event->program): ?> + <?= $this->qlink( + $this->translate('Program'), + 'eventdb/events', + array( + 'program' => $event->program, + ), + array( + 'icon' => 'search', + 'class' => 'action-link' + ) + ) ?> + <?= $this->qlink( + $this->translate('Program and Host'), + 'eventdb/events', + array( + 'host_name' => $event->host_name, + 'program' => $event->program, + ), + array( + 'icon' => 'search', + 'class' => 'action-link' + ) + ) ?> + <?php endif; ?> + </td> + </tr> + <tr> + <tr> + <th><?= $this->translate('Monitoring') ?></th> + <td> + <?= $this->qlink( + $this->translate('Host service status'), + 'eventdb/event/host', + array('host' => $event->host_name), + array( + 'icon' => 'search', + 'class' => 'action-link' + ) + ) ?> + </td> + </tr> + </table> + + <?php if (isset($commentForm)): ?> + <h2><?= $this->translate('Add comment / acknowledge') ?></h2> + <?php if ($event->group_autoclear): ?> + <div class="warning"> + <?= $this->translate('This event is set to auto-clear.') ?> + <?= $this->translate('Please only acknowledge manually, if you know what that means.') ?> + </div> + <?php endif; ?> + <div class="comment-form"><?= $commentForm ?></div> + <?php endif ?> + + <h2><?= $this->translate('Comments') ?></h2> + <?php if (! $comments->hasResult()): ?> + <p><?= $this->translate('No comments recorded for this event yet.') ?></p> + <?php else: ?> + <table class="common-table comments-table"> + <tbody> + <?php foreach ($comments as $comment): ?> + <tr> + <td class="comment-created timeago" title="<?= $comment->created ?>"><?= $this->timeAgo(strtotime($comment->created)) ?></td> + <td class="comment-type"><?= $commentIcons[$comment->type] ?></td> + <td class="comment-user"><?= $this->escape($comment->user) ?></td> + <td class="comment-message"><?= $this->escape($comment->message) ?></td> + </tr> + <?php endforeach ?> + </tbody> + </table> + <?php endif; ?> + + <?php if ($groupedEvents !== null && $groupedEvents->hasResult()): ?> + <h2><?= $this->translate('Grouped Events') ?></h2> + <table class="common-table events-table" data-base-target="_next"> + <tbody> + <?php foreach ($groupedEvents as $groupedEventData): + /** @var \Icinga\Module\Eventdb\Event $groupedEvent */ + $groupedEvent = $this->event($groupedEventData); + ?> + <tr> + <td class="priority-col <?= $groupedEvent->getPriority() ?> <?= $groupedEvent->ack ? 'ack' : '' ?>"> + <div class="priority-label"><?= strtoupper($groupedEvent->getPriority()) ?></div> + <div class="event-meta"><span class="timeago" title="<?= $groupedEvent->created ?>"><?= $this->timeAgo(strtotime($groupedEvent->created)) ?></span></div> + </td> + <td class="icon-col"> + <?= $this->icon($groupedEvent->getTypeIcon(), $groupedEvent->getType()) ?> + <?php if ($groupedEvent->ack) { echo $this->icon('ok', $this->translate('Acknowledged')); } ?> + <?php if ($groupedEvent->group_autoclear) { $autoClear = true; echo $this->icon('reschedule', $this->translate('Auto-Clear')); } ?> + </td> + <?= $this->column('host_name', $groupedEvent) ?> + <?= $this->column('program', $groupedEvent) ?> + <?= $this->column('message', $groupedEvent) ?> + </tr> + <?php endforeach ?> + </tbody> + </table> + <?php endif; ?> + +</div> + |