NavigationController: Rerender the layout when removing menu entries
refs #5600
This commit is contained in:
parent
2952eaefcd
commit
086579b254
|
@ -257,7 +257,7 @@ class NavigationController extends Controller
|
|||
$form->setTitle(sprintf($this->translate('Remove Navigation Item %s'), $itemName));
|
||||
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($itemName, $navigationConfigForm) {
|
||||
try {
|
||||
$navigationConfigForm->delete($itemName);
|
||||
$itemConfig = $navigationConfigForm->delete($itemName);
|
||||
} catch (NotFoundError $e) {
|
||||
Notification::success(sprintf(t('Navigation Item "%s" not found. No action required'), $itemName));
|
||||
return true;
|
||||
|
@ -267,6 +267,10 @@ class NavigationController extends Controller
|
|||
}
|
||||
|
||||
if ($navigationConfigForm->save()) {
|
||||
if ($itemConfig->type === 'menu-item') {
|
||||
$form->getResponse()->setRerenderLayout();
|
||||
}
|
||||
|
||||
Notification::success(sprintf(t('Navigation Item "%s" successfully removed'), $itemName));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Icinga\Application\Config;
|
|||
use Icinga\Application\Logger;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Authentication\Auth;
|
||||
use Icinga\Data\ConfigObject;
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Exception\NotFoundError;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
@ -449,7 +450,7 @@ class NavigationConfigForm extends ConfigForm
|
|||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
* @return ConfigObject The navigation item's config
|
||||
*
|
||||
* @throws NotFoundError In case no navigation item with the given name is found
|
||||
* @throws IcingaException In case the navigation item has still children
|
||||
|
@ -473,9 +474,10 @@ class NavigationConfigForm extends ConfigForm
|
|||
);
|
||||
}
|
||||
|
||||
$section = $config->getSection($name);
|
||||
$config->removeSection($name);
|
||||
$this->setIniConfig($config);
|
||||
return $this;
|
||||
return $section;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue