Response: Add methods to override the client's window id

This commit is contained in:
Johannes Meyer 2020-01-14 10:13:02 +01:00
parent 7bb9c8e25f
commit d459e58aca

View File

@ -61,6 +61,13 @@ class Response extends Zend_Controller_Response_Http
*/
protected $rerenderLayout = false;
/**
* Whether to send the current window ID to the client
*
* @var bool
*/
protected $overrideWindowId = false;
/**
* Get the auto-refresh interval
*
@ -237,6 +244,29 @@ class Response extends Zend_Controller_Response_Http
return $this;
}
/**
* Get whether to send the current window ID to the client
*
* @return bool
*/
public function getOverrideWindowId()
{
return $this->overrideWindowId;
}
/**
* Set whether to send the current window ID to the client
*
* @param bool $overrideWindowId
*
* @return $this
*/
public function setOverrideWindowId($overrideWindowId = true)
{
$this->overrideWindowId = $overrideWindowId;
return $this;
}
/**
* Entry point for HTTP responses in JSON format
*
@ -262,6 +292,9 @@ class Response extends Zend_Controller_Response_Http
$this->setHeader('X-Icinga-Rerender-Layout', 'yes', true);
}
}
if ($this->getOverrideWindowId()) {
$this->setHeader('X-Icinga-WindowId', Window::getInstance()->getId(), true);
}
if ($this->getRerenderLayout()) {
$this->setHeader('X-Icinga-Container', 'layout', true);
}