From 568c0f095515d22202cbd1ccc828b7234fa3430c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 27 Aug 2015 23:17:57 +0200 Subject: [PATCH] monitoring: Fix mess in the downtimes-header view script --- .../partials/downtime/downtimes-header.phtml | 176 ++++++++++-------- 1 file changed, 96 insertions(+), 80 deletions(-) diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml index 16e0daee7..e80ec72e3 100644 --- a/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/downtime/downtimes-header.phtml @@ -1,95 +1,111 @@ - + +
- 5) { + downtimes as $i => $downtime): + if ($i > 5) { break; - } ?> - - - + + - +
- start <= time() && ! $downtime->is_in_effect): ?> - translate('Ends'); ?> -
- timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, $this->compact) ?> - - is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?> -
- timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?> - -
- isService): ?> - 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); ?> - + } + if ($downtime->objecttype === 'service') { + $isService = true; + $stateText = Service::getStateText($downtime->service_state); + } else { + $isService = false; + $stateText = Host::getStateText($downtime->host_state); + } + ?> +
+ start <= time() && ! $downtime->is_in_effect): ?> + translate('Ends') ?> +
+ timeUntil( + $downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, $this->compact + ) ?> + + + is_in_effect ? $this->translate('Expires') : $this->translate('Starts') ?> + +
+ timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?> + +
+ + 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) ?> +
- 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.'), - $this->formatDate($downtime->start), - $this->formatTime($downtime->start), - $this->formatDuration($downtime->duration), - $this->formatDate($downtime->end), - $this->formatTime($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.'), - $this->formatDateTime($downtime->scheduled_start), - $this->formatDateTime($downtime->scheduled_end), - $this->formatDuration($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.'), - $this->formatDate($downtime->start), - $this->formatTime($downtime->start), - $this->formatDate($downtime->end), - $this->formatTime($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.'), - $this->formatDate($downtime->scheduled_start), - $this->formatTime($downtime->scheduled_start), - $this->formatDate($downtime->scheduled_end), - $this->formatTime($downtime->scheduled_end) - ); ?> - - + is_flexible): ?> + is_in_effect): ?> + 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.'), + $this->formatDate($downtime->start), + $this->formatTime($downtime->start), + $this->formatDuration($downtime->duration), + $this->formatDate($downtime->end), + $this->formatTime($downtime->end) + ) ?> + + 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.'), + $this->formatDateTime($downtime->scheduled_start), + $this->formatDateTime($downtime->scheduled_end), + $this->formatDuration($downtime->duration) + ) ?> + + + is_in_effect): ?> + 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.'), + $this->formatDate($downtime->start), + $this->formatTime($downtime->start), + $this->formatDate($downtime->end), + $this->formatTime($downtime->end) + ) ?> + + 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.'), + $this->formatDate($downtime->scheduled_start), + $this->formatTime($downtime->scheduled_start), + $this->formatDate($downtime->scheduled_end), + $this->formatTime($downtime->scheduled_end) + ) ?> + +
- - 5): ?> +count() > 5): ?>

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