diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 6f74be5..915aa6b 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -263,7 +263,14 @@ class ProcessController extends Controller ->setSimulation(Simulation::fromSession($this->session())) ->handleRequest(); } elseif ($action === 'move') { + $successUrl = $this->url()->without(['action', 'movenode']); + if ($this->params->get('mode') === 'tree') { + // If the user moves a node from a subtree, the `node` param exists + $successUrl->getParams()->remove('node'); + } + $form = $this->loadForm('MoveNode') + ->setSuccessUrl($successUrl) ->setProcess($bp) ->setParentNode($node) ->setSession($this->session()) diff --git a/application/forms/MoveNodeForm.php b/application/forms/MoveNodeForm.php index 8e77f87..7396277 100644 --- a/application/forms/MoveNodeForm.php +++ b/application/forms/MoveNodeForm.php @@ -171,7 +171,11 @@ class MoveNodeForm extends QuickForm $this->notifySuccess($this->getSuccessMessage($this->translate('Node order updated'))); $response = $this->getRequest()->getResponse() - ->setHeader('X-Icinga-Container', 'ignore'); + ->setHeader('X-Icinga-Container', 'ignore') + ->setHeader('X-Icinga-Extra-Updates', implode(';', [ + $this->getRequest()->getHeader('X-Icinga-Container'), + $this->getSuccessUrl()->getAbsoluteUrl() + ])); Session::getSession()->write(); $response->sendResponse(); diff --git a/public/js/module.js b/public/js/module.js index 8bc6223..4855c9c 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -122,11 +122,7 @@ ].join('&'); var $container = $source.closest('.container'); - var req = icinga.loader.loadUrl(actionUrl, $container, data, 'POST'); - req.always(function() { - icinga.loader.loadUrl( - $container.data('icingaUrl'), $container, undefined, undefined, undefined, true); - }); + icinga.loader.loadUrl(actionUrl, $container, data, 'POST'); } }, @@ -159,11 +155,7 @@ ].join('&'); var $container = $target.closest('.container'); - var req = icinga.loader.loadUrl(actionUrl, $container, data, 'POST'); - req.always(function() { - icinga.loader.loadUrl( - $container.data('icingaUrl'), $container, undefined, undefined, undefined, true); - }); + icinga.loader.loadUrl(actionUrl, $container, data, 'POST'); event.stopPropagation(); } },