ConfigController: switch over to new config tabs

Module configuration now takes place in module detail view and does no
longer pollute our config tabs. Modules are now able to provide a bunch
of own config tabs, we don't really care what they use them for.
This commit is contained in:
Thomas Gelf 2014-06-24 21:31:59 +02:00
parent ccdf1ca354
commit 2746b5ff9f
3 changed files with 22 additions and 81 deletions

View File

@ -59,52 +59,24 @@ class ConfigController extends BaseConfigController
*/
private $resourceTypes = array('livestatus', 'ido', 'statusdat', 'ldap');
/**
* Create tabs for this configuration controller
*
* @return array
*
* @see BaseConfigController::createProvidedTabs()
*/
public static function createProvidedTabs()
public function init()
{
return array(
'index' => new Tab(
array(
'name' => 'index',
'title' => 'Application',
'url' => Url::fromPath('/config')
)
),
'authentication' => new Tab(
array(
'name' => 'auth',
'title' => 'Authentication',
'url' => Url::fromPath('/config/authentication')
)
),
'resources' => new Tab(
array(
'name' => 'resource',
'title' => 'Resources',
'url' => Url::fromPath('/config/resource')
)
),
'logging' => new Tab(
array(
'name' => 'logging',
'title' => 'Logging',
'url' => Url::fromPath('/config/logging')
)
),
'modules' => new Tab(
array(
'name' => 'modules',
'title' => 'Modules',
'url' => Url::fromPath('/config/modules')
)
)
);
$this->view->tabs = Widget::create('tabs')->add('index', array(
'title' => 'Application',
'url' => 'config'
))->add('authentication', array(
'title' => 'Authentication',
'url' => 'config/authentication'
))->add('resources', array(
'title' => 'Resources',
'url' => 'config/resource'
))->add('logging', array(
'title' => 'Logging',
'url' => 'config/logging'
))->add('modules', array(
'title' => 'Modules',
'url' => 'config/modules'
));
}
/**
@ -175,10 +147,7 @@ class ConfigController extends BaseConfigController
} else {
$this->view->module = false;
}
$this->view->tabs = Widget::create('tabs')->add('info', array(
'url' => Url::fromRequest(),
'title' => 'Module info'
))->activate('info');
$this->view->tabs = $module->getConfigTabs()->activate('info');
}
/**

View File

@ -84,16 +84,5 @@ class BaseConfigController extends ActionController
{
return array();
}
/**
* Initialize the controller and collect all tabs for it from the application and it's modules
*
* @see ActionController::init
*/
public function init()
{
parent::init();
$this->view->tabs = ControllerTabCollector::collectControllerTabs('ConfigController');
}
}
// @codeCoverageIgnoreEnd

View File

@ -30,9 +30,8 @@
use \Exception;
use \Icinga\Config\PreservingIniWriter;
use \Icinga\Web\Controller\BaseConfigController;
use \Icinga\Web\Widget\Tab;
use Icinga\Config\PreservingIniWriter;
use Icinga\Web\Controller\ModuleActionController;
use Icinga\Web\Notification;
use Icinga\Web\Url;
@ -47,23 +46,8 @@ use Icinga\Exception\NotReadableError;
/**
* Configuration controller for editing monitoring resources
*/
class Monitoring_ConfigController extends BaseConfigController {
/**
* Create the tabs for being available via the applications 'Config' view
*
* @return array
*/
static public function createProvidedTabs()
{
return array(
'backends' => new Tab(array(
'name' => 'backends',
'title' => 'Monitoring Backends',
'url' => Url::fromPath('/monitoring/config')
))
);
}
class Monitoring_ConfigController extends ModuleActionController
{
/**
* Display a list of available backends and instances
@ -71,7 +55,6 @@ class Monitoring_ConfigController extends BaseConfigController {
public function indexAction()
{
$this->view->tabs = $this->Module()->getConfigTabs()->activate('backends');
$this->view->messageBox = new AlertMessageBox(true);
foreach (array('backends', 'instances') as $element) {
try {
$elementConfig = $this->Config($element);