mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
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->setTitle(sprintf($this->translate('Remove Navigation Item %s'), $itemName));
|
||||||
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($itemName, $navigationConfigForm) {
|
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($itemName, $navigationConfigForm) {
|
||||||
try {
|
try {
|
||||||
$navigationConfigForm->delete($itemName);
|
$itemConfig = $navigationConfigForm->delete($itemName);
|
||||||
} catch (NotFoundError $e) {
|
} catch (NotFoundError $e) {
|
||||||
Notification::success(sprintf(t('Navigation Item "%s" not found. No action required'), $itemName));
|
Notification::success(sprintf(t('Navigation Item "%s" not found. No action required'), $itemName));
|
||||||
return true;
|
return true;
|
||||||
@ -267,6 +267,10 @@ class NavigationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($navigationConfigForm->save()) {
|
if ($navigationConfigForm->save()) {
|
||||||
|
if ($itemConfig->type === 'menu-item') {
|
||||||
|
$form->getResponse()->setRerenderLayout();
|
||||||
|
}
|
||||||
|
|
||||||
Notification::success(sprintf(t('Navigation Item "%s" successfully removed'), $itemName));
|
Notification::success(sprintf(t('Navigation Item "%s" successfully removed'), $itemName));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ use Icinga\Application\Config;
|
|||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Authentication\Auth;
|
use Icinga\Authentication\Auth;
|
||||||
|
use Icinga\Data\ConfigObject;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
@ -449,7 +450,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @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 NotFoundError In case no navigation item with the given name is found
|
||||||
* @throws IcingaException In case the navigation item has still children
|
* @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);
|
$config->removeSection($name);
|
||||||
$this->setIniConfig($config);
|
$this->setIniConfig($config);
|
||||||
return $this;
|
return $section;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user