ControlsAndContent, js: trigger immediate refresh

...on missing WindowId. This fixes an issue for instances with multiple DB
resources
This commit is contained in:
Thomas Gelf 2018-10-08 13:02:56 +02:00
parent 3632eea164
commit eedb6edff0
2 changed files with 21 additions and 0 deletions

View File

@ -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;

View File

@ -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);