ConfigController: notifications before redirection

That's how they reach the browser in a nice way
This commit is contained in:
Thomas Gelf 2014-06-24 21:11:48 +02:00
parent 9187cd11bb
commit f7d2bdbc78
1 changed files with 7 additions and 15 deletions

View File

@ -121,7 +121,7 @@ class ConfigController extends BaseConfigController
if (!$this->writeConfigFile($form->getConfig(), 'config')) { if (!$this->writeConfigFile($form->getConfig(), 'config')) {
return; return;
} }
$this->addSuccessMessage("Configuration Sucessfully Updated"); Notification::success("Configuration Sucessfully Updated");
$form->setConfiguration(IcingaConfig::app(), true); $form->setConfiguration(IcingaConfig::app(), true);
$this->redirectNow('config/index'); $this->redirectNow('config/index');
} }
@ -143,7 +143,7 @@ class ConfigController extends BaseConfigController
if (!$this->writeConfigFile($form->getConfig(), 'config')) { if (!$this->writeConfigFile($form->getConfig(), 'config')) {
return; return;
} }
$this->addSuccessMessage("Configuration Sucessfully Updated"); Notification::success("Configuration Sucessfully Updated");
$form->setConfiguration(IcingaConfig::app(), true); $form->setConfiguration(IcingaConfig::app(), true);
$this->redirectNow('config/logging'); $this->redirectNow('config/logging');
} }
@ -241,7 +241,7 @@ class ConfigController extends BaseConfigController
if ($form->isSubmittedAndValid()) { if ($form->isSubmittedAndValid()) {
if ($this->writeAuthenticationFile($form->getReorderedConfig($config))) { if ($this->writeAuthenticationFile($form->getReorderedConfig($config))) {
$this->addSuccessMessage('Authentication Order Updated'); Notification::success('Authentication Order Updated');
$this->redirectNow('config/authentication'); $this->redirectNow('config/authentication');
} }
@ -291,7 +291,7 @@ class ConfigController extends BaseConfigController
} }
if ($this->writeAuthenticationFile($backendCfg)) { if ($this->writeAuthenticationFile($backendCfg)) {
// redirect to overview with success message // redirect to overview with success message
$this->addSuccessMessage('Backend Modification Written.'); Notification::success('Backend Modification Written.');
$this->redirectNow("config/authentication"); $this->redirectNow("config/authentication");
} }
return; return;
@ -356,7 +356,7 @@ class ConfigController extends BaseConfigController
} }
if ($this->writeAuthenticationFile($backendCfg)) { if ($this->writeAuthenticationFile($backendCfg)) {
// redirect to overview with success message // redirect to overview with success message
$this->addSuccessMessage('Backend "' . $authBackend . '" created'); Notification::success('Backend "' . $authBackend . '" created');
$this->redirectNow("config/authentication"); $this->redirectNow("config/authentication");
} }
return; return;
@ -380,7 +380,7 @@ class ConfigController extends BaseConfigController
$configArray = IcingaConfig::app('authentication', true)->toArray(); $configArray = IcingaConfig::app('authentication', true)->toArray();
$authBackend = $this->getParam('auth_backend'); $authBackend = $this->getParam('auth_backend');
if (!isset($configArray[$authBackend])) { if (!isset($configArray[$authBackend])) {
$this->addSuccessMessage('Can\'t perform removal: Unknown Authentication Backend Provided'); Notification::error('Can\'t perform removal: Unknown Authentication Backend Provided');
$this->render('authentication/remove'); $this->render('authentication/remove');
return; return;
} }
@ -392,7 +392,7 @@ class ConfigController extends BaseConfigController
if ($form->isSubmittedAndValid()) { if ($form->isSubmittedAndValid()) {
unset($configArray[$authBackend]); unset($configArray[$authBackend]);
if ($this->writeAuthenticationFile($configArray)) { if ($this->writeAuthenticationFile($configArray)) {
$this->addSuccessMessage('Authentication Backend "' . $authBackend . '" Removed'); Notification::success('Authentication Backend "' . $authBackend . '" Removed');
$this->redirectNow("config/authentication"); $this->redirectNow("config/authentication");
} }
return; return;
@ -403,14 +403,6 @@ class ConfigController extends BaseConfigController
$this->render('authentication/remove'); $this->render('authentication/remove');
} }
/**
* Show developer tools
*/
public function devtoolsAction()
{
$this->view->tabs = null;
}
public function resourceAction($showOnly = false) public function resourceAction($showOnly = false)
{ {
$this->view->tabs->activate('resources'); $this->view->tabs->activate('resources');