[icinga-checkins] icinga.org: icingaweb2-module-director/master: ServiceController: show host if any

git at icinga.org git at icinga.org
Tue Aug 23 16:31:37 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 9ccab4c9cf5f6645b46a57ce1917ad61697542dd
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=9ccab4c9cf5f6645b46a57ce1917ad61697542dd

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Aug 23 13:48:44 2016 +0000

ServiceController: show host if any

---

 application/controllers/ServiceController.php |    8 ++++++++
 application/views/scripts/object/form.phtml   |    6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php
index 441bb5c..e7f02e7 100644
--- a/application/controllers/ServiceController.php
+++ b/application/controllers/ServiceController.php
@@ -80,6 +80,14 @@ class ServiceController extends ObjectController
     public function editAction()
     {
         parent::editAction();
+
+        if ($this->host) {
+            $this->view->subtitle = sprintf(
+                $this->translate('(on %s)'),
+                $this->host->object_name
+            );
+        }
+
         $object = $this->object;
         if ($object->isTemplate()
             && $object->getResolvedProperty('check_command_id')
diff --git a/application/views/scripts/object/form.phtml b/application/views/scripts/object/form.phtml
index 004f2da..81e5ed4 100644
--- a/application/views/scripts/object/form.phtml
+++ b/application/views/scripts/object/form.phtml
@@ -1,6 +1,10 @@
 <div class="controls">
 <?= $this->tabs ?>
-<h1><?= $this->escape($this->title) ?></h1>
+<h1><?= $this->escape($this->title) ?><?php
+if ($this->subtitle) {
+    echo ' <small>' . $this->escape($this->subtitle) . '</small>';
+}
+?></h1>
 <span class="action-links">
 <?= $this->actionLinks ?>
 <?= $this->render('object/deploymentLink.phtml') ?>



More information about the icinga-checkins mailing list