diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php index 55d3433a2..4782103d0 100644 --- a/library/Icinga/Web/Response.php +++ b/library/Icinga/Web/Response.php @@ -47,6 +47,13 @@ class Response extends Zend_Controller_Response_Http */ protected $request; + /** + * Whether to instruct the client to reload the window + * + * @var bool + */ + protected $reloadWindow; + /** * Whether to instruct client side script code to reload CSS * @@ -198,6 +205,30 @@ class Response extends Zend_Controller_Response_Http return $this->request; } + /** + * Get whether to instruct the client to reload the window + * + * @return bool + */ + public function isWindowReloaded() + { + return $this->reloadWindow; + } + + /** + * Set whether to instruct the client to reload the window + * + * @param bool $reloadWindow + * + * @return $this + */ + public function setReloadWindow($reloadWindow) + { + $this->reloadWindow = $reloadWindow; + + return $this; + } + /** * Get whether to instruct client side script code to reload CSS * @@ -302,6 +333,9 @@ class Response extends Zend_Controller_Response_Http if ($this->getRerenderLayout()) { $this->setHeader('X-Icinga-Container', 'layout', true); } + if ($this->isWindowReloaded()) { + $this->setHeader('X-Icinga-Reload-Window', 'yes', true); + } if ($this->isReloadCss()) { $this->setHeader('X-Icinga-Reload-Css', 'now', true); } diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 4fc7b78dc..79ebcf00f 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -930,6 +930,11 @@ } } + if (req.getResponseHeader('X-Icinga-Reload-Window') === 'yes') { + window.location.reload(); + return; + } + if (! req.autorefresh && ! req.autosubmit) { // TODO: Hook for response/url? var url = req.url;