list/notifications: fix query, select columns, style

This commit is contained in:
Thomas Gelf 2014-06-20 19:12:10 +02:00
parent f9b18828c1
commit 127b728a4c
2 changed files with 29 additions and 25 deletions

View File

@ -213,7 +213,14 @@ class Monitoring_ListController extends Controller
{
$this->addTitleTab('notifications');
$this->setAutorefreshInterval(15);
$query = $this->backend->select()->from('notification');
$query = $this->backend->select()->from('notification', array(
'host',
'service',
'notification_output',
'notification_contact',
'notification_start_time',
'notification_state'
));
$this->applyFilters($query);
$this->view->notifications = $query->paginate();
$this->setupSortControl(array(

View File

@ -1,10 +1,11 @@
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em" class="dontprint">
<div class="dontprint">
<?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this) ?>
<?= $this->selectionToolbar('single') ?>
</div>
<?= $this->widget('limiter') ?>
<?php if ($notifications->count() >= 100): ?><br /><?php endif ?>
<?= $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve)) ?>
</div>
@ -37,29 +38,25 @@ foreach ($notifications as $notification):
));
$stateName = strtolower($this->util()->getHostStateName($notification->notification_state));
}
?>
?>
<tr class="state <?= $stateName ?>">
<td class="state"><?= $this->timeSince($notification->notification_start_time) ?></td>
<td>
<?php if ($isService): ?>
<a href="<?= $href ?>"><?= $notification->service ?></a>
<small>
on <?= $notification->host ?>
</small>
<?php $isService = true; ?>
<?php else: ?>
<a href="<?= $href ?>"><?= $notification->host ?></a>
<?php endif; ?>
<br />
<?= $this->escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?>
<br />
<small>
Sent to
<a href="<?= $this->href('monitoring/show/contact', array('contact' => $notification->notification_contact)); ?>">
<?= $notification->notification_contact ?>
</a>
</small>
</td>
<td class="state"><?= $this->timeSince($notification->notification_start_time) ?></td>
<td>
<?php if ($isService): ?>
<a href="<?= $href ?>"><?= $notification->service ?></a> on <?= $notification->host ?>
<?php else: ?>
<a href="<?= $href ?>"><?= $notification->host ?></a>
<?php endif; ?>
<br />
<?= $this->escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?>
<br />
<small>
Sent to <a href="<?= $this->href(
'monitoring/show/contact',
array('contact' => $notification->notification_contact)
) ?>"><?= $this->escape($notification->notification_contact) ?></a>
</small>
</td>
</tr>
<?php endforeach ?>
</tbody>