summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/event/index.phtml
blob: 83dcf01f5c377babeccecfbc5ca7237e02671686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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>