From eedb6edff00a72cb0f7946c5744d0fedf8a8eedc Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 8 Oct 2018 13:02:56 +0200 Subject: [PATCH] ControlsAndContent, js: trigger immediate refresh ...on missing WindowId. This fixes an issue for instances with multiple DB resources --- .../Controller/Extension/ControlsAndContentHelper.php | 10 ++++++++++ public/js/module.js | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/library/vendor/ipl/Web/Controller/Extension/ControlsAndContentHelper.php b/library/vendor/ipl/Web/Controller/Extension/ControlsAndContentHelper.php index 761f0094..5c26bd32 100644 --- a/library/vendor/ipl/Web/Controller/Extension/ControlsAndContentHelper.php +++ b/library/vendor/ipl/Web/Controller/Extension/ControlsAndContentHelper.php @@ -7,6 +7,7 @@ use dipl\Web\Widget\Content; use dipl\Web\Widget\Controls; use dipl\Web\Widget\Tabs; use dipl\Web\Url; +use Icinga\Web\Window; trait ControlsAndContentHelper { @@ -33,7 +34,16 @@ trait ControlsAndContentHelper public function controls() { if ($this->controls === null) { + /** @var Window $window */ + $window = $this->Window(); + $id = $window->getId(); + if ($id === null || $id === Window::UNDEFINED) { + $id = '_UNDEFINED_'; + } $this->view->controls = $this->controls = new Controls(); + $this->controls->addAttributes([ + 'data-director-window-id' => $id, + ]); } return $this->controls; diff --git a/public/js/module.js b/public/js/module.js index b0a93aef..5599058a 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -671,7 +671,18 @@ rendered: function(ev) { var iid; + var icinga = this.module.icinga; var $container = $(ev.currentTarget); + if ($container.children('div.controls').first().data('directorWindowId') === '_UNDEFINED_') { + var $url = $container.data('icingaUrl'); + if (typeof $url !== 'undefined') { + icinga.loader.loadUrl($url, $container).autorefresh = true; + } + + $container.children('div.controls').children().hide(); + $container.children('div.content').hide(); + return; + } this.restoreContainerFieldsets($container); this.backupAllExtensibleSetDefaultValues($container); this.highlightFormErrors($container);