From 6642d8cf745cf8b471abd29c212aeda06285958a Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 27 Oct 2016 20:40:57 +0000 Subject: [PATCH] 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 6ff9aa85..19a2d006 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 d8bf64c5..cc8dbbe7 100644 --- a/application/views/scripts/config/diff.phtml +++ b/application/views/scripts/config/diff.phtml @@ -8,14 +8,23 @@ formSelect( 'left', $this->leftSum, - array('class' => 'autosubmit'), + array('class' => 'autosubmit', 'style' => 'width: 37%'), array(null => $this->translate('- please choose -')) + $this->configs ) ?> +qlink( + '', + $this->url(), + array( + 'left' => $this->rightSum, + 'right' => $this->leftSum + ), + array('class' => 'icon-flapping') +) ?> formSelect( 'right', $this->rightSum, - array('class' => 'autosubmit'), + array('class' => 'autosubmit', 'style' => 'width: 37%'), array(null => $this->translate('- please choose -')) + $this->configs ) ?>