mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
Monitoring/Notifications: Wrap information in a two column view
This commit is contained in:
parent
ebc9f02cb4
commit
06158aa4ea
@ -218,20 +218,7 @@ class Monitoring_ListController extends MonitoringController
|
|||||||
*/
|
*/
|
||||||
public function notificationsAction()
|
public function notificationsAction()
|
||||||
{
|
{
|
||||||
$query = NotificationView::fromRequest(
|
$query = NotificationView::fromRequest($this->_request)->getQuery();
|
||||||
$this->_request,
|
|
||||||
array(
|
|
||||||
'host_name',
|
|
||||||
'service_description',
|
|
||||||
'notification_type',
|
|
||||||
'notification_reason',
|
|
||||||
'notification_start_time',
|
|
||||||
'notification_contact',
|
|
||||||
'notification_information',
|
|
||||||
'notification_command',
|
|
||||||
'notification_internal_id'
|
|
||||||
)
|
|
||||||
)->getQuery();
|
|
||||||
$this->view->notifications = $query->paginate();
|
$this->view->notifications = $query->paginate();
|
||||||
$this->setupSortControl(array(
|
$this->setupSortControl(array(
|
||||||
'notification_start_time' => 'Notification Start'
|
'notification_start_time' => 'Notification Start'
|
||||||
|
@ -1,71 +1,56 @@
|
|||||||
<?= $this->tabs->render($this); ?>
|
<h1>Notifications</h1>
|
||||||
|
|
||||||
<?php
|
<?php if (!empty($notifications)): ?>
|
||||||
$formatter = $this->getHelper('MonitoringProperties');
|
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
|
||||||
?>
|
|
||||||
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="multi">
|
|
||||||
<?= $this->sortControl->render($this); ?>
|
<?= $this->sortControl->render($this); ?>
|
||||||
|
|
||||||
<?= $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
<table class="table table-condensed" >
|
<table class="table table-condensed" >
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Host</th>
|
|
||||||
<th>Service</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Time</th>
|
|
||||||
<th>Contact</th>
|
|
||||||
<th>Notification Command</th>
|
|
||||||
<th>Information</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($notifications as $notification): ?>
|
<?php foreach ($notifications as $notification): ?>
|
||||||
<?php
|
<?php
|
||||||
if (empty($notification->service_description)) {
|
if (isset($notification->service)) {
|
||||||
$detailLink = $this->href('monitoring/show/host', array('host' => $notification->host_name));
|
$isService = true;
|
||||||
|
$href = $this->href('monitoring/show/service', array(
|
||||||
|
'host' => $notification->host,
|
||||||
|
'service' => $notification->service
|
||||||
|
));
|
||||||
|
$stateName = strtolower($this->util()->getServiceStateName($notification->notification_state));
|
||||||
} else {
|
} else {
|
||||||
$detailLink = $this->href('monitoring/show/host', array(
|
$isService = false;
|
||||||
'host' => $notification->host_name,
|
$href = $this->href('monitoring/show/host', array(
|
||||||
'service' => $notification->service_description,
|
'host' => $notification->host
|
||||||
'notification_id' => $notification->notification_internal_id
|
));
|
||||||
)
|
$stateName = strtolower($this->util()->getHostStateName($notification->notification_state));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr <?= ($this->activeRowHref === $detailLink) ? 'class="active"' : ''; ?>>
|
<tr>
|
||||||
<td>
|
<td class="border-status-<?= $stateName ?>"><?= date('d.m. H:i', $notification->notification_start_time); ?></td>
|
||||||
<a href="<?= $detailLink; ?>" style="visibility:hidden"></a>
|
|
||||||
<a href="<?= $this->href('monitoring/show/host', array('host' => $notification->host_name)); ?>">
|
|
||||||
<?= $notification->host_name ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="<?= $this->href('monitoring/show/host', array(
|
|
||||||
'host' => $notification->host_name,
|
|
||||||
'service' => $notification->service_description
|
|
||||||
)
|
|
||||||
); ?>">
|
|
||||||
<?= empty($notification->service_description) ? '' : $notification->service_description; ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?= $formatter->getNotificationType($notification); ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?= $notification->notification_start_time ?>
|
|
||||||
</td>
|
|
||||||
<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 ?>
|
<?= $notification->notification_contact ?>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
</small>
|
||||||
<?= $notification->notification_command ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?= $this->escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<?= $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
No notifications yet
|
||||||
|
<?php endif; ?>
|
||||||
|
@ -37,17 +37,13 @@ class NotificationQuery extends IdoQuery
|
|||||||
*/
|
*/
|
||||||
protected $columnMap = array(
|
protected $columnMap = array(
|
||||||
'notification' => array(
|
'notification' => array(
|
||||||
'notification_type' => 'n.notification_type',
|
'notification_output' => 'n.output',
|
||||||
'notification_reason' => 'n.notification_reason',
|
'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)',
|
||||||
'notification_start_time' => 'n.start_time',
|
'notification_state' => 'n.state'
|
||||||
'notification_information' => 'n.output',
|
|
||||||
'notification_internal_id' => 'n.notification_id'
|
|
||||||
),
|
),
|
||||||
'objects' => array(
|
'objects' => array(
|
||||||
'host_name' => 'o.name1',
|
'host' => 'o.name1',
|
||||||
'service_description' => 'o.name2',
|
'service' => 'o.name2'
|
||||||
'service' => 'o.name2',
|
|
||||||
'host_name' => 'o.name1'
|
|
||||||
),
|
),
|
||||||
'contact' => array(
|
'contact' => array(
|
||||||
'notification_contact' => 'c_o.name1'
|
'notification_contact' => 'c_o.name1'
|
||||||
|
@ -14,17 +14,13 @@ class Notification extends DataView
|
|||||||
public function getColumns()
|
public function getColumns()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'host_name',
|
'host',
|
||||||
'service_description',
|
'service',
|
||||||
'notification_type',
|
'notification_state',
|
||||||
'notification_reason',
|
|
||||||
'notification_start_time',
|
'notification_start_time',
|
||||||
'notification_contact',
|
'notification_contact',
|
||||||
'notification_information',
|
'notification_output',
|
||||||
'notification_command',
|
'notification_command'
|
||||||
'host',
|
|
||||||
'service'
|
|
||||||
'notification_internal_id'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user