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

View File

@ -84,16 +84,5 @@ class BaseConfigController extends ActionController
{ {
return array(); 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 // @codeCoverageIgnoreEnd

View File

@ -30,9 +30,8 @@
use \Exception; use \Exception;
use \Icinga\Config\PreservingIniWriter; use Icinga\Config\PreservingIniWriter;
use \Icinga\Web\Controller\BaseConfigController; use Icinga\Web\Controller\ModuleActionController;
use \Icinga\Web\Widget\Tab;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Url; use Icinga\Web\Url;
@ -47,23 +46,8 @@ use Icinga\Exception\NotReadableError;
/** /**
* Configuration controller for editing monitoring resources * Configuration controller for editing monitoring resources
*/ */
class Monitoring_ConfigController extends BaseConfigController { class Monitoring_ConfigController extends ModuleActionController
{
/**
* 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')
))
);
}
/** /**
* Display a list of available backends and instances * Display a list of available backends and instances
@ -71,7 +55,6 @@ class Monitoring_ConfigController extends BaseConfigController {
public function indexAction() public function indexAction()
{ {
$this->view->tabs = $this->Module()->getConfigTabs()->activate('backends'); $this->view->tabs = $this->Module()->getConfigTabs()->activate('backends');
$this->view->messageBox = new AlertMessageBox(true);
foreach (array('backends', 'instances') as $element) { foreach (array('backends', 'instances') as $element) {
try { try {
$elementConfig = $this->Config($element); $elementConfig = $this->Config($element);