From 9114a34223c227eb0440b64fe97d46ca2642c808 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 23 Apr 2015 11:31:53 +0200 Subject: [PATCH] Display host and service state in downtime detail area refs #8902 --- .../controllers/DowntimeController.php | 6 + .../views/scripts/downtime/show.phtml | 121 ++++++++++-------- 2 files changed, 76 insertions(+), 51 deletions(-) diff --git a/modules/monitoring/application/controllers/DowntimeController.php b/modules/monitoring/application/controllers/DowntimeController.php index af2888383a..32c183ba17 100644 --- a/modules/monitoring/application/controllers/DowntimeController.php +++ b/modules/monitoring/application/controllers/DowntimeController.php @@ -2,6 +2,8 @@ /* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ use Icinga\Module\Monitoring\Controller; +use Icinga\Module\Monitoring\Object\Service; +use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm; use Icinga\Web\Url; use Icinga\Web\Widget\Tabextension\DashboardAction; @@ -76,6 +78,10 @@ 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->delDowntimeForm = $this->createDelDowntimeForm(); $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes'); $this->view->showHostLink = Url::fromPath('monitoring/host/show') diff --git a/modules/monitoring/application/views/scripts/downtime/show.phtml b/modules/monitoring/application/views/scripts/downtime/show.phtml index c6084a29fd..34751cd7c8 100644 --- a/modules/monitoring/application/views/scripts/downtime/show.phtml +++ b/modules/monitoring/application/views/scripts/downtime/show.phtml @@ -2,6 +2,75 @@ compact): ?> tabs; ?> + + + + + + +
+ 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) + ); ?> + + + +
+

isService): ?>
- - 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) - ); ?> - - - -
-
- - +
translate('Author') ?>