From bf66271e49dd5ab49f5175a2fc766091d1a8b666 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 9 Mar 2014 22:32:40 +0100 Subject: [PATCH] Still downtimes --- .../controllers/ListController.php | 43 +++++++++---------- .../forms/Command/ScheduleDowntimeForm.php | 6 +-- .../Backend/Ido/Query/DowntimeQuery.php | 2 +- .../library/Monitoring/DataView/Downtime.php | 10 ++++- .../Monitoring/Object/AbstractObject.php | 2 + 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index ba3347e15..09dbfa759 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -198,34 +198,33 @@ class Monitoring_ListController extends Controller $query = DowntimeView::fromRequest( $this->_request, array( - 'id' => 'downtime_internal_id', - 'objecttype' => 'downtime_objecttype', - 'comment' => 'downtime_comment', - 'author' => 'downtime_author', - 'start' => 'downtime_start', - 'end' => 'downtime_end', - 'duration' => 'downtime_duration', - 'is_flexible' => 'downtime_is_flexible', - 'is_in_effect' => 'downtime_is_in_effect', - 'entry_time' => 'downtime_entry_time', - 'host' => 'downtime_host', - 'service' => 'downtime_service' + 'id' => 'downtime_internal_id', + 'objecttype' => 'downtime_objecttype', + 'comment' => 'downtime_comment', + 'author' => 'downtime_author', + 'start' => 'downtime_start', + 'scheduled_start' => 'downtime_scheduled_start', + 'end' => 'downtime_end', + 'duration' => 'downtime_duration', + 'is_flexible' => 'downtime_is_flexible', + 'is_fixed' => 'downtime_is_fixed', + 'is_in_effect' => 'downtime_is_in_effect', + 'entry_time' => 'downtime_entry_time', + 'host' => 'downtime_host', + 'service' => 'downtime_service' ) - )->getQuery()->order('downtime_is_in_effect', 'DESC')->order('downtime_scheduled_start_time', 'DESC'); + )->getQuery()->order('downtime_is_in_effect', 'DESC')->order('downtime_scheduled_start', 'DESC'); $this->view->downtimes = $query->paginate(); $this->setupSortControl(array( 'downtime_is_in_effect' => 'Is In Effect', - 'object_type' => 'Service/Host', - 'host_name' => 'Host Name', - 'service_description' => 'Service Name', + 'downtime_host' => 'Host / Service', 'downtime_entry_time' => 'Entry Time', - 'downtime_author_name' => 'Author', - 'downtime_comment_data' => 'Comment', - 'downtime_scheduled_start_time' => 'Start', - 'downtime_scheduled_end_time' => 'End', - 'downtime_trigger_time' => 'Trigger Time', - 'downtime_internal_downtime_id' => 'Downtime ID', + 'downtime_author' => 'Author', + 'downtime_start' => 'Start Time', + 'downtime_start' => 'End Time', + 'downtime_scheduled_start_time' => 'Scheduled Start', + 'downtime_scheduled_end_time' => 'Scheduled End', 'downtime_duration' => 'Duration', )); $this->handleFormatRequest($query); diff --git a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php index 020ff7ed6..ac27fc457 100644 --- a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php +++ b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php @@ -115,12 +115,12 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm foreach ($downtimes as $downtime) { $label = sprintf( 'ID %s: %s%s Starting @ %s', - $downtime->downtime_internal_downtime_id, + $downtime->id, $object->host_name, $object instanceof Service ? ' (' . $object->service_description . ')' : '', - $dateFormat->formatDateTime($downtime->downtime_scheduled_start_time) + $dateFormat->formatDateTime($downtime->scheduled_start) ); - $options[$downtime->downtime_internal_downtime_id] = $label; + $options[$downtime->id] = $label; } return $options; } diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php index 89686cee7..77b08656d 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php @@ -46,7 +46,7 @@ class DowntimeQuery extends IdoQuery 'downtime_is_fixed' => 'sd.is_fixed', 'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END', 'downtime_triggered_by_id' => 'sd.triggered_by_id', - 'downtime_scheduled_start_time' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)', + 'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)', 'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)", 'downtime_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)', 'downtime_duration' => 'sd.duration', diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index a982822f2..4bf9e41cc 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -46,6 +46,7 @@ class Downtime extends DataView 'downtime_is_fixed', 'downtime_is_flexible', 'downtime_start', + 'downtime_scheduled_start', 'downtime_end', 'downtime_duration', 'downtime_is_in_effect', @@ -64,7 +65,14 @@ class Downtime extends DataView ), 'downtime_start' => array( 'order' => self::SORT_DESC - ) + ), + 'downtime_host' => array( + 'columns' => array( + 'downtime_host', + 'downtime_service' + ), + 'order' => self::SORT_ASC + ), ); } } diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index eb70f752f..9ef768c33 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -71,9 +71,11 @@ abstract class AbstractObject 'comment' => 'downtime_comment', 'author' => 'downtime_author', 'start' => 'downtime_start', + 'scheduled_start' => 'downtime_scheduled_start', 'end' => 'downtime_end', 'duration' => 'downtime_duration', 'is_flexible' => 'downtime_is_flexible', + 'is_fixed' => 'downtime_is_fixed', 'is_in_effect' => 'downtime_is_in_effect', 'entry_time' => 'downtime_entry_time', 'host' => 'downtime_host',