[icinga-checkins] icinga.org: icingaweb2-module-director/bugfix/loop-templateresolver-11803: config/diff: allow to flip shown configs, even...

git at icinga.org git at icinga.org
Mon Oct 31 13:31:46 CET 2016


Module: icingaweb2-module-director
Branch: bugfix/loop-templateresolver-11803
Commit: 6642d8cf745cf8b471abd29c212aeda06285958a
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=6642d8cf745cf8b471abd29c212aeda06285958a

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 27 20:40:57 2016 +0000

config/diff: allow to flip shown configs, even...

...undeployed ones

---

 application/controllers/ConfigController.php |    9 ++++++++-
 application/views/scripts/config/diff.phtml  |   13 +++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php
index 6ff9aa8..19a2d00 100644
--- a/application/controllers/ConfigController.php
+++ b/application/controllers/ConfigController.php
@@ -213,7 +213,14 @@ class ConfigController extends ActionController
         $rightSum = $this->view->rightSum = $this->params->get('right');
         $left  = IcingaConfig::load(Util::hex2binary($leftSum), $db);
 
-        $this->view->configs = $db->enumDeployedConfigs();
+        $configs = $db->enumDeployedConfigs();
+        foreach (array($leftSum, $rightSum) as $sum) {
+            if (! array_key_exists($sum, $configs)) {
+                $configs[$sum] = substr($sum, 0, 7);
+            }
+        }
+
+        $this->view->configs = $configs;
         if ($rightSum === null) {
             return;
         }
diff --git a/application/views/scripts/config/diff.phtml b/application/views/scripts/config/diff.phtml
index d8bf64c..cc8dbbe 100644
--- a/application/views/scripts/config/diff.phtml
+++ b/application/views/scripts/config/diff.phtml
@@ -8,14 +8,23 @@
 <?= $this->formSelect(
     'left',
     $this->leftSum,
-    array('class' => 'autosubmit'),
+    array('class' => 'autosubmit', 'style' => 'width: 37%'),
     array(null => $this->translate('- please choose -')) + $this->configs
 )
 ?>
+<?= $this->qlink(
+    '',
+    $this->url(),
+    array(
+        'left'  => $this->rightSum,
+        'right' => $this->leftSum
+    ),
+    array('class' => 'icon-flapping')
+) ?>
 <?= $this->formSelect(
     'right',
     $this->rightSum,
-    array('class' => 'autosubmit'),
+    array('class' => 'autosubmit', 'style' => 'width: 37%'),
     array(null => $this->translate('- please choose -')) + $this->configs
 )
 ?>



More information about the icinga-checkins mailing list