Reorganised eventhistory view script, still far from being perfect
This commit is contained in:
parent
635cdcbbc5
commit
5c5268651c
|
@ -1,133 +1,114 @@
|
||||||
<div class="row">
|
<div class="controls">
|
||||||
<div class="pull-left">
|
<?= $this->tabs->render($this); ?>
|
||||||
<h1>History</h1>
|
<?= $this->filterBox->render($this); ?>
|
||||||
</div>
|
<?= $this->sortControl->render($this); ?>
|
||||||
<div class="pull-right">
|
<?= $this->selectionToolbar('single'); ?>
|
||||||
<?= $this->tabs->render($this); ?>
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php if (!empty($history)): ?>
|
|
||||||
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
|
|
||||||
|
|
||||||
<div class="container pull-left">
|
<div class="content">
|
||||||
<div class="row">
|
<?php if (empty($history)): ?>
|
||||||
<div class="col-md-5">
|
No entries found
|
||||||
<?= $this->filterBox->render($this); ?>
|
</div>
|
||||||
</div>
|
<?php return; endif ?>
|
||||||
<div class="col-md-7">
|
|
||||||
<?= $this->sortControl->render($this); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<table class="action">
|
||||||
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
<tbody>
|
||||||
</div>
|
<?php foreach ($history as $event): ?>
|
||||||
<div class="row">
|
<?php
|
||||||
<?= $this->selectionToolbar('single'); ?>
|
$class = null;
|
||||||
</div>
|
$isService = false;
|
||||||
</div>
|
switch ($event->type) {
|
||||||
|
case 'notify':
|
||||||
|
$icon = 'notification';
|
||||||
|
$title = 'Notification';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'comment':
|
||||||
|
$icon = 'comment';
|
||||||
|
$title = 'Comment';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'ack':
|
||||||
|
$icon = 'acknowledgement';
|
||||||
|
$title = 'Acknowledgement';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'dt_comment':
|
||||||
|
$icon = 'in-downtime';
|
||||||
|
$title = 'In Downtime';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'flapping':
|
||||||
|
$icon = 'flapping';
|
||||||
|
$title = 'Flapping';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'hard_state':
|
||||||
|
$icon = '{{HARDSTATE_ICON}}';
|
||||||
|
$title = 'Hard State';
|
||||||
|
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Hard)</small>';
|
||||||
|
$class = 'border-status-' . (
|
||||||
|
$isService ?
|
||||||
|
strtolower($this->util()->getServiceStateName($event->state)) :
|
||||||
|
strtolower($this->util()->getHostStateName($event->state))
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'soft_state':
|
||||||
|
$icon = '{{SOFTSTATE_ICON}}';
|
||||||
|
$title = 'Soft State';
|
||||||
|
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Soft)</small>';
|
||||||
|
$class = 'border-status-' . (
|
||||||
|
$isService ?
|
||||||
|
strtolower($this->util()->getServiceStateName($event->state)) :
|
||||||
|
strtolower($this->util()->getHostStateName($event->state))
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'dt_start':
|
||||||
|
$icon = 'downtime-start';
|
||||||
|
$title = 'Downtime Start';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'dt_end':
|
||||||
|
$icon = 'downtime-end';
|
||||||
|
$title = 'Downtime End';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr class="state">
|
||||||
|
<td style="width: 6em;" <?= !empty($class) ? 'class="' . $class . '"' : '' ?>">
|
||||||
|
<?= date('d.m. H:i', $event->timestamp); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if (isset($event->service)): ?>
|
||||||
|
<a href="<?= $this->href('monitoring/show/service', array(
|
||||||
|
'host' => $event->host,
|
||||||
|
'service' => $event->service
|
||||||
|
)); ?>">
|
||||||
|
<?= $event->service ?>
|
||||||
|
</a>
|
||||||
|
<small>
|
||||||
|
on <?= $event->host ?>
|
||||||
|
</small>
|
||||||
|
<?php $isService = true; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?= $this->href('monitoring/show/host', array(
|
||||||
|
'host' => $event->host
|
||||||
|
)); ?>">
|
||||||
|
<?= $event->host ?>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<i title="<?= $title ?>" class="icinga-icon-<?= $icon ?>"></i>
|
||||||
|
<?php if (!empty($msg)) { echo $msg; } ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<? endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<table class="table table-condensed pull-left">
|
</div>
|
||||||
<tbody>
|
|
||||||
<?php foreach ($history as $event): ?>
|
|
||||||
<?php
|
|
||||||
$class = null;
|
|
||||||
$isService = false;
|
|
||||||
switch ($event->type) {
|
|
||||||
case 'notify':
|
|
||||||
$icon = 'notification';
|
|
||||||
$title = 'Notification';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'comment':
|
|
||||||
$icon = 'comment';
|
|
||||||
$title = 'Comment';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'ack':
|
|
||||||
$icon = 'acknowledgement';
|
|
||||||
$title = 'Acknowledgement';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'dt_comment':
|
|
||||||
$icon = 'in-downtime';
|
|
||||||
$title = 'In Downtime';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'flapping':
|
|
||||||
$icon = 'flapping';
|
|
||||||
$title = 'Flapping';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'hard_state':
|
|
||||||
$icon = '{{HARDSTATE_ICON}}';
|
|
||||||
$title = 'Hard State';
|
|
||||||
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Hard)</small>';
|
|
||||||
$class = 'border-status-' . (
|
|
||||||
$isService ?
|
|
||||||
strtolower($this->util()->getServiceStateName($event->state)) :
|
|
||||||
strtolower($this->util()->getHostStateName($event->state))
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'soft_state':
|
|
||||||
$icon = '{{SOFTSTATE_ICON}}';
|
|
||||||
$title = 'Soft State';
|
|
||||||
$msg = $event->output . '<br /><small>Attempt ' . $event->attempt . '/' . $event->max_attempts . ' (Soft)</small>';
|
|
||||||
$class = 'border-status-' . (
|
|
||||||
$isService ?
|
|
||||||
strtolower($this->util()->getServiceStateName($event->state)) :
|
|
||||||
strtolower($this->util()->getHostStateName($event->state))
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'dt_start':
|
|
||||||
$icon = 'downtime-start';
|
|
||||||
$title = 'Downtime Start';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
case 'dt_end':
|
|
||||||
$icon = 'downtime-end';
|
|
||||||
$title = 'Downtime End';
|
|
||||||
$msg = $event->output;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td <?= !empty($class) ? 'class="' . $class . '"' : '' ?>">
|
|
||||||
<?= date('d.m. H:i', $event->timestamp); ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if (isset($event->service)): ?>
|
|
||||||
<a href="<?= $this->href('monitoring/show/service', array(
|
|
||||||
'host' => $event->host,
|
|
||||||
'service' => $event->service
|
|
||||||
)); ?>">
|
|
||||||
<?= $event->service ?>
|
|
||||||
</a>
|
|
||||||
<small>
|
|
||||||
on <?= $event->host ?>
|
|
||||||
</small>
|
|
||||||
<?php $isService = true; ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<a href="<?= $this->href('monitoring/show/host', array(
|
|
||||||
'host' => $event->host
|
|
||||||
)); ?>">
|
|
||||||
<?= $event->host ?>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<i title="<?= $title ?>" class="icinga-icon-<?= $icon ?>"></i>
|
|
||||||
<?php if (!empty($msg)) { echo $msg; } ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<? endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="container pull-left">
|
|
||||||
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
Loading…
Reference in New Issue