diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f17a9465c..e0413a32a 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -175,25 +175,7 @@ class Monitoring_ListController extends MonitoringController */ public function downtimesAction() { - $query = DowntimeView::fromRequest( - $this->_request, - array( - 'host_name', - 'object_type', - 'service_description', - 'downtime_entry_time', - 'downtime_internal_downtime_id', - 'downtime_author_name', - 'downtime_comment_data', - 'downtime_duration', - 'downtime_scheduled_start_time', - 'downtime_scheduled_end_time', - 'downtime_is_fixed', - 'downtime_is_in_effect', - 'downtime_triggered_by_id', - 'downtime_trigger_time' - ) - )->getQuery(); + $query = DowntimeView::fromRequest($this->_request)->getQuery(); $this->view->downtimes = $query->paginate(); $this->setupSortControl(array( diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 26b49e169..5c5128903 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -1,135 +1,63 @@ util()->showTime($d->getTimestamp()); -} - $commandHelper = $this->getHelper('CommandForm'); ?> -tabs->render($this); ?> - -
+
sortControl->render($this); ?>
- paginationControl( - $this->downtimes, - null, - array( - 'mixedPagination.phtml', - 'default' - ), - array('preserve' => $this->preserve) - ); - ?> + paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?> - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + service)): ?> + service ?> + on host ?> + + host ?> + +
+ downtime_author ?>: downtime_comment ?> +
+ Entry Time: downtime_entry_time ?> +
Is In EffectObjectHost NameService NameEntry TimeAuthorCommentStart TimeEnd TimeTypeTrigger TimeDowntime IDTrigger IDDuration 
- downtime_is_in_effect == 0 ? 'False' : 'True'); ?> + dateFormat()->formatDateTime((int) $downtime->downtime_start); ?> - + dateFormat()->formatDateTime((int) $downtime->downtime_end); ?> +
+ Duration: util()->showHourMin((int) $downtime->downtime_duration); ?> +
+ The downtime_is_flexible): ?>flexiblefixed downtime is downtime_is_in_effect): ?>not in effect
-
- object_type == 'service'): ?> - {{SERVICE_ICON}} - - - object_type == 'host'): ?> - {{HOST_ICON}} - -
-
- host_name ?> - - service_description ?> - - downtime_entry_time); ?> - - downtime_author_name ?> - - downtime_comment_data ?> - - downtime_scheduled_start_time); ?> - - downtime_scheduled_end_time); ?> - - downtime_is_fixed == 1 ? 'Fixed' : 'Not Fixed' ?> - - downtime_trigger_time); - echo $date != 'undef' ? $date : 'N/A'; - ?> - - downtime_internal_downtime_id ?> - - downtime_triggered_by_id == 0 ? - 'N/A' : $downtime->downtime_triggered_by_id ?> - - util()->showHourMin(intval($downtime->downtime_duration)); ?> - $downtime->downtime_internal_downtime_id, - 'host' => $downtime->host_name + 'downtimeid' => $downtime->downtime_internal_downtime_id, + 'host' => $downtime->host ); - - if ($downtime->object_type == 'service') { - $data['service'] = $downtime->service_description; + if (isset($downtime->service)) { + $data['service'] = $downtime->service; } - - echo $commandHelper->simpleForm( - 'removedowntime', + echo $commandHelper->iconSubmitForm( + 'icinga-icon-remove', 'Remove Downtime', + 'btn-small', + 'removedowntime', $data ); ?>
+ paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml index e38b10a14..af212f18f 100644 --- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -1,33 +1,3 @@ -downtimes)): ?> -downtimes as $downtime) { - $row = array(); - if ($downtime->downtime_is_in_effect === '1') { - $row[] = 'Running
since '. $this->timeSince($downtime->downtime_actual_start_time); - } else { - if ($downtime->downtime_is_fixed) { - $row[] = 'Scheduled
for '. $downtime->downtime_scheduled_start_time; - } else { - $row[] = 'Waiting'; - } - } - - $row[] = sprintf( - 'Triggered by %s: %s', - $downtime->downtime_author_name, - $downtime->downtime_comment_data - ); - - $row[] = ''; - - $list[] = ''. implode('', $row). ''; - } -?> -
@@ -61,30 +31,30 @@
-
- - - - - -
+ getHelper('CommandForm')->iconSubmitForm( + 'icinga-icon-remove', + 'Remove Downtime', + 'btn-small', + 'removedowntime', + array( + 'downtimeid' => $downtime->downtime_internal_downtime_id, + 'host' => $downtime->host, + 'service' => $downtime->service + ) + ); ?>
downtime_is_in_effect === '1'): ?> - Running since timeSince($downtime->downtime_actual_start_time); ?> + In scheduled downtime since timeSince($downtime->downtime_start); ?> downtime_is_fixed): ?> - Scheduled for downtime_scheduled_start_time; ?> + Downtime scheduled for downtime_start; ?> Waiting - Triggered by downtime_author_name; ?> -
- downtime_comment_data; ?> + downtime_author; ?>: downtime_comment; ?>
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php index 7ccc0c45a..0455113e9 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php @@ -36,27 +36,21 @@ class DowntimeQuery extends IdoQuery */ protected $columnMap = array( 'downtime' => array( - 'downtime_type' => 'sd.downtime_type', - 'downtime_author_name' => 'sd.author_name', - 'downtime_comment_data' => 'sd.comment_data', - 'downtime_entry_time' => 'sd.entry_time', - 'downtime_is_fixed' => 'sd.is_fixed', - 'downtime_duration' => 'sd.duration', - 'downtime_scheduled_start_time' => 'sd.scheduled_start_time', - 'downtime_scheduled_end_time' => 'sd.scheduled_end_time', - 'downtime_was_started' => 'sd.was_started', - 'downtime_actual_start_time' => 'sd.actual_start_time', - 'downtime_actual_start_time_usec' => 'sd.actual_start_time_usec', - 'downtime_is_in_effect' => 'sd.is_in_effect', - 'downtime_trigger_time' => 'sd.trigger_time', - 'downtime_triggered_by_id' => 'sd.triggered_by_id', - 'downtime_internal_downtime_id' => 'sd.internal_downtime_id' + 'downtime_author' => 'sd.author_name', + 'downtime_comment' => 'sd.comment_data', + 'downtime_entry_time' => 'sd.entry_time', + 'downtime_is_fixed' => 'sd.is_fixed', + 'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END', + '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', + 'downtime_is_in_effect' => 'sd.is_in_effect', + 'downtime_triggered_by_id' => 'sd.triggered_by_id', + 'downtime_internal_downtime_id' => 'sd.internal_downtime_id', ), 'objects' => array( - 'host_name' => 'o.name1 COLLATE latin1_general_ci', - 'service_host_name' => 'o.name1 COLLATE latin1_general_ci', - 'service_description' => 'o.name2 COLLATE latin1_general_ci', - 'object_type' => "CASE o.objecttype_id WHEN 1 THEN 'host' ELSE 'service' END", + 'host' => 'o.name1 COLLATE latin1_general_ci', + 'service' => 'o.name2 COLLATE latin1_general_ci' ) ); diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index 05a367b7e..7b7bab23a 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -14,23 +14,17 @@ class Downtime extends DataView public function getColumns() { return array( - 'host_name', - 'object_type', - 'service_host_name', - 'service_description', - 'downtime_type', - 'downtime_author_name', - 'downtime_comment_data', - 'downtime_is_fixed', - 'downtime_duration', + 'host', + 'service', + 'downtime_author', + 'downtime_comment', 'downtime_entry_time', - 'downtime_scheduled_start_time', - 'downtime_scheduled_end_time', - 'downtime_was_started', - 'downtime_actual_start_time', - 'downtime_actual_start_time_usec', + 'downtime_is_fixed', + 'downtime_is_flexible', + 'downtime_start', + 'downtime_end', + 'downtime_duration', 'downtime_is_in_effect', - 'downtime_trigger_time', 'downtime_triggered_by_id', 'downtime_internal_downtime_id' ); @@ -42,7 +36,7 @@ class Downtime extends DataView 'downtime_is_in_effect' => array( 'order' => self::SORT_DESC ), - 'downtime_actual_start_time' => array( + 'downtime_start' => array( 'order' => self::SORT_DESC ) ); diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index 0c3ff8927..cf6c70dab 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -68,23 +68,7 @@ abstract class AbstractObject public function fetchDowntimes() { - $this->downtimes = Downtime::fromRequest( - $this->request, - array( - 'downtime_type', - 'downtime_author_name', - 'downtime_comment_data', - 'downtime_is_fixed', - 'downtime_duration', - 'downtime_entry_time', - 'downtime_scheduled_start_time', - 'downtime_scheduled_end_time', - 'downtime_was_started', - 'downtime_actual_start_time', - 'downtime_is_in_effect', - 'downtime_triggered_by_id', - ) - )->getQuery()->fetchAll(); + $this->downtimes = Downtime::fromRequest($this->request)->getQuery()->fetchAll(); return $this; }