Window: workaround for bug in web >= 2.6.3

fixes #2063
This commit is contained in:
Thomas Gelf 2020-01-17 11:58:28 +01:00
parent 0d75ad69d6
commit 54ec11aec2
4 changed files with 32 additions and 2 deletions

View File

@ -10,6 +10,7 @@ use Icinga\Module\Director\Monitoring;
use Icinga\Module\Director\Web\Controller\Extension\CoreApi;
use Icinga\Module\Director\Web\Controller\Extension\DirectorDb;
use Icinga\Module\Director\Web\Controller\Extension\RestApi;
use Icinga\Module\Director\Web\Window;
use Icinga\Security\SecurityException;
use Icinga\Web\Controller;
use Icinga\Web\UrlParams;
@ -67,6 +68,21 @@ abstract class ActionController extends Controller implements ControlsAndContent
return $this->Auth();
}
/**
* @codingStandardsIgnoreStart
* @return Window
*/
public function Window()
{
// @codingStandardsIgnoreEnd
if ($this->window === null) {
$this->window = new Window(
$this->_request->getHeader('X-Icinga-WindowId', Window::UNDEFINED)
);
}
return $this->window;
}
/**
* @throws SecurityException
*/

View File

@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Web\Controller\Extension;
use Icinga\Module\Director\Db;
use Icinga\Module\Director\Web\Controller\ActionController;
use Icinga\Module\Director\Web\Window;
use RuntimeException;
trait DirectorDb
@ -125,7 +126,7 @@ trait DirectorDb
protected function getWindowSessionValue($value, $default = null)
{
/** @var \Icinga\Web\Window $window */
/** @var Window $window */
$window = $this->Window();
/** @var \Icinga\Web\Session\SessionNamespace $session */
$session = $window->getSessionNamespace('director');

View File

@ -12,7 +12,7 @@ use Icinga\Module\Director\Db\Migrations;
use Icinga\Module\Director\KickstartHelper;
use Icinga\Module\Director\Web\Controller\Extension\DirectorDb;
use Icinga\Web\Navigation\Renderer\BadgeNavigationItemRenderer;
use Icinga\Web\Window;
use Icinga\Module\Director\Web\Window;
class ConfigHealthItemRenderer extends BadgeNavigationItemRenderer
{

View File

@ -0,0 +1,13 @@
<?php
namespace Icinga\Module\Director\Web;
use Icinga\Web\Window as WebWindow;
class Window extends WebWindow
{
public function __construct($id)
{
parent::__construct(\preg_replace('/_.+$/', '', $id));
}
}