diff --git a/modules/monitoring/application/controllers/DowntimeController.php b/modules/monitoring/application/controllers/DowntimeController.php new file mode 100644 index 000000000..7a769b4d6 --- /dev/null +++ b/modules/monitoring/application/controllers/DowntimeController.php @@ -0,0 +1,117 @@ +params->get('downtime_id'); + + $this->downtime = $this->backend->select()->from('downtime', array( + 'id' => 'downtime_internal_id', + 'objecttype' => 'downtime_objecttype', + 'comment' => 'downtime_comment', + 'author_name' => 'downtime_author_name', + 'start' => 'downtime_start', + 'scheduled_start' => 'downtime_scheduled_start', + 'scheduled_end' => 'downtime_scheduled_end', + '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_state' => 'downtime_host_state', + 'service_state' => 'downtime_service_state', + 'host_name', + 'host', + 'service', + 'service_description', + 'host_display_name', + 'service_display_name' + ))->where('downtime_internal_id', $downtimeId)->getQuery()->fetchRow(); + + if (false === $this->downtime) { + throw new Zend_Controller_Action_Exception($this->translate('Downtime not found')); + } + + if (isset($this->downtime->service_description)) { + $this->isService = true; + } else { + $this->isService = false; + } + + $this->getTabs() + ->add( + 'downtime', + array( + 'title' => $this->translate( + 'Display detailed information about a downtime.' + ), + 'icon' => 'plug', + 'label' => $this->translate('Downtime'), + 'url' =>'monitoring/downtimes/show' + ) + )->activate('downtime')->extend(new DashboardAction()); + } + + public function showAction() + { + $this->view->downtime = $this->downtime; + $this->view->isService = $this->isService; + $this->view->stateName = isset($this->downtime->service_description) ? + Service::getStateText($this->downtime->service_state) : + Host::getStateText($this->downtime->host_state); + $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes'); + $this->view->showHostLink = Url::fromPath('monitoring/host/show') + ->setParam('host', $this->downtime->host); + $this->view->showServiceLink = Url::fromPath('monitoring/service/show') + ->setParam('host', $this->downtime->host) + ->setParam('service', $this->downtime->service_description); + if ($this->hasPermission('monitoring/command/downtime/delete')) { + $this->view->delDowntimeForm = $this->createDelDowntimeForm(); + } + } + + private function createDelDowntimeForm() + { + $this->assertPermission('monitoring/command/downtime/delete'); + + $delDowntimeForm = new DeleteDowntimeCommandForm(); + $delDowntimeForm->setAction( + Url::fromPath('monitoring/downtime/show') + ->setParam('downtime_id', $this->downtime->id) + ); + $delDowntimeForm->populate( + array( + 'redirect' => Url::fromPath('monitoring/list/downtimes'), + 'downtime_id' => $this->downtime->id + ) + ); + $delDowntimeForm->handleRequest(); + return $delDowntimeForm; + } +} diff --git a/modules/monitoring/application/controllers/DowntimesController.php b/modules/monitoring/application/controllers/DowntimesController.php new file mode 100644 index 000000000..28ba76cb4 --- /dev/null +++ b/modules/monitoring/application/controllers/DowntimesController.php @@ -0,0 +1,121 @@ +filter = Filter::fromQueryString(str_replace( + 'downtime_id', + 'downtime_internal_id', + (string)$this->params + )); + $this->downtimes = $this->backend->select()->from('downtime', array( + 'id' => 'downtime_internal_id', + 'objecttype' => 'downtime_objecttype', + 'comment' => 'downtime_comment', + 'author_name' => 'downtime_author_name', + 'start' => 'downtime_start', + 'scheduled_start' => 'downtime_scheduled_start', + 'scheduled_end' => 'downtime_scheduled_end', + '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_state' => 'downtime_host_state', + 'service_state' => 'downtime_service_state', + 'host_name', + 'host', + 'service', + 'service_description', + 'host_display_name', + 'service_display_name' + ))->addFilter($this->filter)->getQuery()->fetchAll(); + if (false === $this->downtimes) { + throw new Zend_Controller_Action_Exception( + $this->translate('Downtime not found') + ); + } + + $this->getTabs() + ->add( + 'downtimes', + array( + 'title' => $this->translate( + 'Display detailed information about multiple downtimes.' + ), + 'icon' => 'plug', + 'label' => $this->translate('Downtimes'), + 'url' =>'monitoring/downtimes/show' + ) + )->activate('downtimes')->extend(new DashboardAction()); + + foreach ($this->downtimes as $downtime) { + if (isset($downtime->service_description)) { + $downtime->isService = true; + } else { + $downtime->isService = false; + } + + if ($downtime->isService) { + $downtime->stateText = Service::getStateText($downtime->service_state); + } else { + $downtime->stateText = Host::getStateText($downtime->host_state); + } + } + } + + public function showAction() + { + $this->view->downtimes = $this->downtimes; + $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes') + ->setQueryString($this->filter->toQueryString()); + $this->view->removeAllLink = Url::fromPath('monitoring/downtimes/remove-all') + ->setParams($this->params); + } + + public function removeAllAction() + { + $this->assertPermission('monitoring/command/downtime/delete'); + $this->view->downtimes = $this->downtimes; + $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes') + ->setQueryString($this->filter->toQueryString()); + $delDowntimeForm = new DeleteDowntimesCommandForm(); + $delDowntimeForm->setTitle($this->view->translate('Remove all Downtimes')); + $delDowntimeForm->addDescription(sprintf( + $this->translate('Confirm removal of %d downtimes.'), + count($this->downtimes) + )); + $delDowntimeForm->setDowntimes($this->downtimes) + ->setRedirectUrl(Url::fromPath('monitoring/list/downtimes')) + ->handleRequest(); + $this->view->delDowntimeForm = $delDowntimeForm; + } +} \ No newline at end of file diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index d240251cf..8862c2b53 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -4,12 +4,13 @@ namespace Icinga\Module\Monitoring\Forms\Command\Object; use Icinga\Module\Monitoring\Command\Object\DeleteDowntimeCommand; +use \Icinga\Module\Monitoring\Forms\Command\CommandForm; use Icinga\Web\Notification; /** * Form for deleting host or service downtimes */ -class DeleteDowntimeCommandForm extends ObjectsCommandForm +class DeleteDowntimeCommandForm extends CommandForm { /** * (non-PHPDoc) @@ -19,33 +20,34 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm { $this->setAttrib('class', 'inline'); } - - /** + + /** * (non-PHPDoc) * @see \Icinga\Web\Form::createElements() For the method documentation. */ public function createElements(array $formData = array()) { - $this->addElements(array( + $this->addElements( array( - 'hidden', - 'downtime_id', array( - 'required' => true, - 'decorators' => array('ViewHelper') - ) - ), - array( - 'hidden', - 'redirect', + 'hidden', + 'downtime_id', + array( + 'decorators' => array('ViewHelper') + ) + ), array( - 'decorators' => array('ViewHelper') + 'hidden', + 'redirect', + array( + 'decorators' => array('ViewHelper') + ) ) ) - )); + ); return $this; } - + /** * (non-PHPDoc) * @see \Icinga\Web\Form::addSubmitButton() For the method documentation. @@ -67,26 +69,32 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm ); return $this; } - + /** * (non-PHPDoc) - * @see \Icinga\Web\Form::onSuccess() For the method documentation. + * @see \Icinga\Web\Form::onSuccess() For the method documentation. */ public function onSuccess() { - foreach ($this->objects as $object) { - /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ - $delDowntime = new DeleteDowntimeCommand(); - $delDowntime - ->setObject($object) - ->setDowntimeId($this->getElement('downtime_id')->getValue()); - $this->getTransport($this->request)->send($delDowntime); - } + $id = $this->getElement('downtime_id')->getValue(); + + // Presence of downtime id, only delete this specific downtime + $firstDowntime = $this->downtimes[0]; + + $delDowntime = new DeleteDowntimeCommand(); + $delDowntime->setDowntimeId($id); + $delDowntime->setDowntimeType( + isset($firstDowntime->service_description) ? + DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE : + DeleteDowntimeCommand::DOWNTIME_TYPE_HOST + ); + $this->getTransport($this->request)->send($delDowntime); + $redirect = $this->getElement('redirect')->getValue(); if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success($this->translate('Deleting downtime..')); + Notification::success($this->translate('Deleting downtime.')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimesCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimesCommandForm.php new file mode 100644 index 000000000..f460f3601 --- /dev/null +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimesCommandForm.php @@ -0,0 +1,89 @@ +setAttrib('class', 'inline'); + } + + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::createElements() For the method documentation. + */ + public function createElements(array $formData = array()) + { + $this->addElements(array( + array( + 'hidden', + 'redirect', + array( + 'decorators' => array('ViewHelper') + ) + ) + )); + return $this; + } + + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. + */ + public function getSubmitLabel() + { + return $this->translatePlural('Remove', 'Remove All', count($this->downtimes)); + } + + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::onSuccess() For the method documentation. + */ + public function onSuccess() + { + foreach ($this->downtimes as $downtime) { + $delDowntime = new DeleteDowntimeCommand(); + $delDowntime->setDowntimeId($downtime->id); + $delDowntime->setDowntimeType( + isset($downtime->service_description) ? + DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE : + DeleteDowntimeCommand::DOWNTIME_TYPE_HOST + ); + $this->getTransport($this->request)->send($delDowntime); + } + $redirect = $this->getElement('redirect')->getValue(); + if (! empty($redirect)) { + $this->setRedirectUrl($redirect); + } + Notification::success($this->translate('Deleting downtime.')); + return true; + } + + /** + * Set the downtimes to be deleted upon success + * + * @param type $downtimes + * + * @return $this + */ + public function setDowntimes($downtimes) + { + $this->downtimes = $downtimes; + return $this; + } +} diff --git a/modules/monitoring/application/views/scripts/downtime/remove.phtml b/modules/monitoring/application/views/scripts/downtime/remove.phtml new file mode 100644 index 000000000..57fe36655 --- /dev/null +++ b/modules/monitoring/application/views/scripts/downtime/remove.phtml @@ -0,0 +1,11 @@ +
+ + compact): ?> + tabs; ?> + + + render('partials/downtime/downtime-header.phtml'); ?> +
+
+ +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/downtime/show.phtml b/modules/monitoring/application/views/scripts/downtime/show.phtml new file mode 100644 index 000000000..aed35b9ac --- /dev/null +++ b/modules/monitoring/application/views/scripts/downtime/show.phtml @@ -0,0 +1,121 @@ +
+ compact): ?> + tabs; ?> + + + render('partials/downtime/downtime-header.phtml'); ?> +
+
+

translate('Downtime detail information') ?>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + downtime->is_flexible): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ isService ? $this->translate('Service') : $this->translate('Host') ?> + + isService): ?> + link()->service( + $downtime->service_description, + $downtime->service_display_name, + $downtime->host_name, + $downtime->host_display_name + ); + $icon = $this->icon('service', $this->translate('Service')); + ?> + + icon('host', $this->translate('Host')); + $link = $this->link()->host($downtime->host_name, $downtime->host_display_name) + ?> + + + +
translate('Author') ?>icon('user', $this->translate('User')) ?> escape($this->downtime->author_name) ?>
translate('Comment') ?>icon('comment', $this->translate('Comment')) ?> escape($this->downtime->comment) ?>
translate('Entry Time') ?> escape($this->downtime->entry_time)) ?>
escape( + $this->downtime->is_flexible ? + $this->translate('Flexible') : $this->translate('Fixed') + ); ?> + escape( + $this->downtime->is_flexible ? + $this->translate('Flexible downtimes have a hard start and end time,' + . ' but also an additional restriction on the duration in which ' + . ' the host or service may actually be down.') : + $this->translate('Fixed downtimes have a static start and end time.') + ); ?> +
translate('Scheduled start') ?>downtime->scheduled_start) ?>
translate('Scheduled end') ?>downtime->scheduled_end) ?>
translate('Duration') ?>format()->duration($this->escape($this->downtime->duration)); ?>
translate('Actual start time') ?>start); ?>
translate('Actual end time') ?>end); ?>
translate('In effect') ?> + escape( + $this->downtime->is_in_effect ? + $this->translate('Yes') : $this->translate('No') + ); + ?> +
translate('Commands') ?> + +
+ +
+ diff --git a/modules/monitoring/application/views/scripts/downtimes/remove-all.phtml b/modules/monitoring/application/views/scripts/downtimes/remove-all.phtml new file mode 100644 index 000000000..fed0e12f7 --- /dev/null +++ b/modules/monitoring/application/views/scripts/downtimes/remove-all.phtml @@ -0,0 +1,12 @@ +
+ + compact): ?> + tabs; ?> + + + render('partials/downtime/downtimes-header.phtml'); ?> +
+ +
+ +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/downtimes/show.phtml b/modules/monitoring/application/views/scripts/downtimes/show.phtml new file mode 100644 index 000000000..98999f012 --- /dev/null +++ b/modules/monitoring/application/views/scripts/downtimes/show.phtml @@ -0,0 +1,33 @@ +
+ + compact): ?> + tabs; ?> + + + render('partials/downtime/downtimes-header.phtml'); ?> +

+
+
+

icon('reschedule') ?> translate('Commands') ?>

+

+ translate('Issue commands to all %s selected downtimes.'), + '' . count($downtimes) . '' + ) + ?> +

+ qlink( + sprintf( + $this->translate('Remove all %d scheduled downtimes'), + count($downtimes) + ), + $removeAllLink, + null, + array( + 'icon' => 'trash', + 'title' => $this->translate('Remove all selected downtimes.') + ) + ) ?> +
+

+
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 3f882a733..b21e3c3fb 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -15,12 +15,15 @@ if (! $this->compact): ?> translate('No downtimes found matching the filter') . ''; + echo $this->translate('No downtimes found matching the filter,' + . ' maybe the downtime already expired.') . ''; return; } ?> - - +
diff --git a/modules/monitoring/library/Monitoring/Command/Object/DeleteDowntimeCommand.php b/modules/monitoring/library/Monitoring/Command/Object/DeleteDowntimeCommand.php index 52ad99e1b..96dc8f755 100644 --- a/modules/monitoring/library/Monitoring/Command/Object/DeleteDowntimeCommand.php +++ b/modules/monitoring/library/Monitoring/Command/Object/DeleteDowntimeCommand.php @@ -3,19 +3,22 @@ namespace Icinga\Module\Monitoring\Command\Object; +use Icinga\Module\Monitoring\Command\IcingaCommand; + /** * Delete a host or service downtime */ -class DeleteDowntimeCommand extends ObjectCommand +class DeleteDowntimeCommand extends IcingaCommand { /** - * (non-PHPDoc) - * @see \Icinga\Module\Monitoring\Command\Object\ObjectCommand::$allowedObjects For the property documentation. + * Downtime for a host */ - protected $allowedObjects = array( - self::TYPE_HOST, - self::TYPE_SERVICE - ); + const DOWNTIME_TYPE_HOST = 'host'; + + /** + * Downtime for a service + */ + const DOWNTIME_TYPE_SERVICE = 'service'; /** * ID of the downtime that is to be deleted @@ -23,6 +26,31 @@ class DeleteDowntimeCommand extends ObjectCommand * @var int */ protected $downtimeId; + + /** + * + * @var type + */ + protected $downtimeType = self::DOWNTIME_TYPE_HOST; + + /** + * Set the downtime type, either host or service + * + * @param string $type the downtime type + */ + public function setDowntimeType($type) + { + $this->downtimeType = $type; + } + + /** + * + * @return type + */ + public function getDowntimeType() + { + return $this->downtimeType; + } /** * Set the ID of the downtime that is to be deleted diff --git a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php index cf88d7d2e..83fbd4364 100644 --- a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php +++ b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php @@ -337,7 +337,7 @@ class IcingaCommandFileCommandRenderer implements IcingaCommandRendererInterface public function renderDeleteDowntime(DeleteDowntimeCommand $command) { - if ($command->getObject()->getType() === $command::TYPE_HOST) { + if ($command->getDowntimeType() === 'host') { $commandString = 'DEL_HOST_DOWNTIME'; } else { $commandString = 'DEL_SVC_DOWNTIME'; diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php index 04102e9d2..94d9f6399 100644 --- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php +++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php @@ -89,9 +89,7 @@ abstract class MonitoredObjectController extends Controller } if (! empty($this->object->downtimes) && $auth->hasPermission('monitoring/command/downtime/delete')) { $delDowntimeForm = new DeleteDowntimeCommandForm(); - $delDowntimeForm - ->setObjects($this->object) - ->handleRequest(); + $delDowntimeForm->handleRequest(); $this->view->delDowntimeForm = $delDowntimeForm; } $this->view->object = $this->object; @@ -147,16 +145,6 @@ abstract class MonitoredObjectController extends Controller $this->handleCommandForm(new DeleteCommentCommandForm()); } - /** - * Delete a downtime - */ - public function deleteDowntimeAction() - { - $this->assertHttpMethod('POST'); - $this->assertPermission('monitoring/command/downtime/delete'); - $this->handleCommandForm(new DeleteDowntimeCommandForm()); - } - /** * Create tabs */
- - icon('service', $this->translate('Service')); ?> - link()->service( - $downtime->service_description, $downtime->service_display_name, $downtime->host_name, $downtime->host_display_name - ) ?> - - icon('host', $this->translate('Host')); ?> - link()->host($downtime->host_name, $downtime->host_display_name) ?> - + icon('service'); + } else { + echo $this->icon('host'); + } + ?> + qlink( + sprintf($this->translate('%s on %s', 'Service running on host'), $downtime->service_display_name, $downtime->host_display_name), + 'monitoring/downtime/show', + array('downtime_id' => $downtime->id), + array('title' => sprintf( + $this->translate('Show detailed information for downtime on %s for %s'), + $downtime->service_display_name, + $downtime->host_display_name + ))) ?>
icon('comment', $this->translate('Comment')); ?> [escape($downtime->author_name) ?>] escape($downtime->comment) ?>
diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml new file mode 100644 index 000000000..92759a12a --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml @@ -0,0 +1,67 @@ + + + + + +
+ is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?> +
+ dateTimeRenderer( + ($downtime->is_in_effect ? $downtime->end : $downtime->start), + true + )->render( + $this->translate('on %s', 'datetime'), + $this->translate('at %s', 'time'), + $this->translate('in %s', 'timespan') + ); + ?> +
+ + is_flexible): ?> + is_in_effect): ?> + isService + ? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.') + : $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'), + date('d.m.y', $downtime->start), + date('H:i', $downtime->start), + $this->format()->duration($downtime->duration), + date('d.m.y', $downtime->end), + date('H:i', $downtime->end) + ); ?> + + isService + ? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.') + : $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'), + date('d.m.y H:i', $downtime->scheduled_start), + date('d.m.y H:i', $downtime->scheduled_end), + $this->format()->duration($downtime->duration) + ); ?> + + + is_in_effect): ?> + isService + ? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.') + : $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'), + date('d.m.y', $downtime->start), + date('H:i', $downtime->start), + date('d.m.y', $downtime->end), + date('H:i', $downtime->end) + ); ?> + + isService + ? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.') + : $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'), + date('d.m.y', $downtime->scheduled_start), + date('H:i', $downtime->scheduled_start), + date('d.m.y', $downtime->scheduled_end), + date('H:i', $downtime->scheduled_end) + ); ?> + + + +
diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml new file mode 100644 index 000000000..54cd0210c --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml @@ -0,0 +1,92 @@ + + + 5) { + continue; + } ?> + + + + + + +
+ is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?> +
+ dateTimeRenderer( + ($downtime->is_in_effect ? $downtime->end : $downtime->start), + true + )->render( + $this->translate('on %s', 'datetime'), + $this->translate('at %s', 'time'), + $this->translate('in %s', 'timespan') + ); + ?> +
+ isService): ?> + icon('service', $this->translate('Service')) ?> + service ?> on host_name ?>. + + icon('host', $this->translate('Host')) ?> + host_name ?>. + + + is_flexible): ?> + is_in_effect): ?> + isService + ? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.') + : $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'), + date('d.m.y', $downtime->start), + date('H:i', $downtime->start), + $this->format()->duration($downtime->duration), + date('d.m.y', $downtime->end), + date('H:i', $downtime->end) + ); ?> + + isService + ? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.') + : $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'), + date('d.m.y H:i', $downtime->scheduled_start), + date('d.m.y H:i', $downtime->scheduled_end), + $this->format()->duration($downtime->duration) + ); ?> + + + is_in_effect): ?> + isService + ? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.') + : $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'), + date('d.m.y', $downtime->start), + date('H:i', $downtime->start), + date('d.m.y', $downtime->end), + date('H:i', $downtime->end) + ); ?> + + isService + ? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.') + : $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'), + date('d.m.y', $downtime->scheduled_start), + date('H:i', $downtime->scheduled_start), + date('d.m.y', $downtime->scheduled_end), + date('H:i', $downtime->scheduled_end) + ); ?> + + +
+ +

+ qlink( + sprintf($this->translate('List all %d downtimes …'), count($downtimes)), + $listAllLink, + null, + array( + 'title' => $this->translate('List all'), + 'data-base-target' => "_next" + ) + ) ?> +

\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml index b338f8a71..bfb9bbf45 100644 --- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -47,12 +47,15 @@ foreach ($object->downtimes as $downtime) { ) : $this->escape($downtime->comment); if ((bool) $downtime->is_in_effect) { - $state = 'in downtime since ' . $this->timeSince($downtime->start); + $state = 'in downtime since '; + $time = $this->timeSince($downtime->start); } else { if ((bool) $downtime->is_fixed) { - $state = 'scheduled ' . $this->timeUntil($downtime->start); + $state = 'scheduled '; + $time = $this->timeUntil($downtime->start); } else { - $state = 'scheduled flexible ' . $this->timeUntil($downtime->start); + $state = 'scheduled flexible '; + $time = $this->timeUntil($downtime->start); } } @@ -65,7 +68,14 @@ foreach ($object->downtimes as $downtime) { $delDowntimeForm->populate(array('downtime_id' => $downtime->id)); echo $delDowntimeForm; } ?> - translate('Downtime'); ?> - ', $commentText); ?> + translate('Downtime'); ?> + qlink( + $state, + 'monitoring/downtime/show', + array('downtime_id' => $downtime->id), + array('data-base-target' => '_next') + ) . $time ; ?> - ', $commentText); ?>