[icinga-checkins] icinga.org: icingaweb2/master: Display downtime end even if it hasn' t been started yet

git at icinga.org git at icinga.org
Fri Dec 9 13:49:41 CET 2016


Module: icingaweb2
Branch: master
Commit: 2292010a15ebe98eeb2ebc24cccc69e006c8dae3
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=2292010a15ebe98eeb2ebc24cccc69e006c8dae3

Author: Eric Lippmann <eric.lippmann at icinga.com>
Date:   Fri Dec  9 13:47:21 2016 +0100

Display downtime end even if it hasn't been started yet

resolves #12764

---

 .../partials/downtime/downtime-header.phtml        |    3 +++
 .../views/scripts/show/components/downtime.phtml   |   22 +++++++++++++-------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
index bfe88a7..d9b5a92 100644
--- a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml
@@ -42,6 +42,9 @@
         <?= $this->translate('by') ?>
         <?= $this->escape($downtime->author_name) ?>
     </span>
+  <?php if (! $downtime->is_in_effect && $downtime->start >= time()): ?>
+    <span><?= sprintf($this->translate('expires %s'), $this->timeUntil($downtime->end)) ?></span>
+  <?php endif ?>
     <span class="comment-icons">
       <?php if ($downtime->is_flexible): ?>
           <?= $this->icon('magic', $this->translate('This downtime is flexible')); ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml
index ded3b92..7e7fcdd 100644
--- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml
+++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml
@@ -60,15 +60,21 @@ if (empty($object->comments) && ! $addLink) {
                         $this->translate('ends %s', 'Last format parameter represents the end time'),
                         $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end)
                     );
-                } elseif ((bool) $downtime->is_fixed) {
-                    $state = sprintf(
-                        $this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
-                        $this->timeUntil($downtime->start)
-                    );
                 } else {
-                    $state = sprintf(
-                        $this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
-                        $this->timeUntil($downtime->start)
+                    if ((bool) $downtime->is_fixed) {
+                        $state = sprintf(
+                            $this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
+                            $this->timeUntil($downtime->start)
+                        );
+                    } else {
+                        $state = sprintf(
+                            $this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
+                            $this->timeUntil($downtime->start)
+                        );
+                    }
+                    $state .= ' ' . sprintf(
+                        $this->translate('expires %s', 'Last format parameter represents the downtime expire time'),
+                        $this->timeUntil($downtime->end)
                     );
                 }
             }



More information about the icinga-checkins mailing list