From 06158aa4ea366f9378b7c5e727d8eee7cc06b0f1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Sat, 19 Oct 2013 13:13:56 +0200 Subject: [PATCH] Monitoring/Notifications: Wrap information in a two column view --- .../controllers/ListController.php | 15 +-- .../views/scripts/list/notifications.phtml | 125 ++++++++---------- .../Backend/Ido/Query/NotificationQuery.php | 18 +-- .../Monitoring/DataView/Notification.php | 14 +- 4 files changed, 68 insertions(+), 104 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 81b446adf..f17a9465c 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -218,20 +218,7 @@ class Monitoring_ListController extends MonitoringController */ public function notificationsAction() { - $query = NotificationView::fromRequest( - $this->_request, - array( - 'host_name', - 'service_description', - 'notification_type', - 'notification_reason', - 'notification_start_time', - 'notification_contact', - 'notification_information', - 'notification_command', - 'notification_internal_id' - ) - )->getQuery(); + $query = NotificationView::fromRequest($this->_request)->getQuery(); $this->view->notifications = $query->paginate(); $this->setupSortControl(array( 'notification_start_time' => 'Notification Start' diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 4395e813b..077ba44aa 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -1,71 +1,56 @@ -tabs->render($this); ?> +

Notifications

-getHelper('MonitoringProperties'); -?> -
- sortControl->render($this); ?> - - paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?> - - - - - - - - - - - - - - - service_description)) { - $detailLink = $this->href('monitoring/show/host', array('host' => $notification->host_name)); - } else { - $detailLink = $this->href('monitoring/show/host', array( - 'host' => $notification->host_name, - 'service' => $notification->service_description, - 'notification_id' => $notification->notification_internal_id - ) - ); - } - ?> - activeRowHref === $detailLink) ? 'class="active"' : ''; ?>> - - - - - - - - - - -
HostServiceTypeTimeContactNotification CommandInformation
- - - host_name ?> - - - - service_description) ? '' : $notification->service_description; ?> - - getNotificationType($notification); ?> - - notification_start_time ?> - - notification_contact ?> - - notification_command ?> - - escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?> -
- -
\ No newline at end of file + +
+ sortControl->render($this); ?> + paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?> + + + + service)) { + $isService = true; + $href = $this->href('monitoring/show/service', array( + 'host' => $notification->host, + 'service' => $notification->service + )); + $stateName = strtolower($this->util()->getServiceStateName($notification->notification_state)); + } else { + $isService = false; + $href = $this->href('monitoring/show/host', array( + 'host' => $notification->host + )); + $stateName = strtolower($this->util()->getHostStateName($notification->notification_state)); + } + ?> + + + + + + +
notification_start_time); ?> + + service ?> + + on host ?> + + + + host ?> + +
+ escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?> +
+ + Sent to + + notification_contact ?> + + +
+ paginationControl($notifications, null, null, array('preserve' => $this->preserve)); ?> +
+ +No notifications yet + diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php index a0d803e10..dcc1fc3f3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php @@ -37,23 +37,19 @@ class NotificationQuery extends IdoQuery */ protected $columnMap = array( 'notification' => array( - 'notification_type' => 'n.notification_type', - 'notification_reason' => 'n.notification_reason', - 'notification_start_time' => 'n.start_time', - 'notification_information' => 'n.output', - 'notification_internal_id' => 'n.notification_id' + 'notification_output' => 'n.output', + 'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)', + 'notification_state' => 'n.state' ), 'objects' => array( - 'host_name' => 'o.name1', - 'service_description' => 'o.name2', - 'service' => 'o.name2', - 'host_name' => 'o.name1' + 'host' => 'o.name1', + 'service' => 'o.name2' ), 'contact' => array( - 'notification_contact' => 'c_o.name1' + 'notification_contact' => 'c_o.name1' ), 'command' => array( - 'notification_command' => 'cmd_o.name1' + 'notification_command' => 'cmd_o.name1' ) ); diff --git a/modules/monitoring/library/Monitoring/DataView/Notification.php b/modules/monitoring/library/Monitoring/DataView/Notification.php index 817a93609..9efefdac2 100644 --- a/modules/monitoring/library/Monitoring/DataView/Notification.php +++ b/modules/monitoring/library/Monitoring/DataView/Notification.php @@ -14,17 +14,13 @@ class Notification extends DataView public function getColumns() { return array( - 'host_name', - 'service_description', - 'notification_type', - 'notification_reason', + 'host', + 'service', + 'notification_state', 'notification_start_time', 'notification_contact', - 'notification_information', - 'notification_command', - 'host', - 'service' - 'notification_internal_id' + 'notification_output', + 'notification_command' ); }