menu/overview/global: re-ordered, less menu entries

This commit is contained in:
Thomas Gelf 2015-12-16 11:45:00 +01:00
parent c6557d6d6c
commit 2f55884aa9
3 changed files with 31 additions and 6 deletions

View File

@ -6,17 +6,39 @@ use Icinga\Module\Director\Web\Controller\ActionController;
class WelcomeController extends ActionController
{
protected $globalTypes = array(
'TimePeriod',
'Zone',
'Endpoint'
);
public function indexAction()
{
$this->getTabs()->add('welcome', array(
$this->getTabs()->add('overview', array(
'url' => $this->getRequest()->getUrl(),
'label' => $this->translate('Welcome')
))->activate('welcome');
if (! $this->Config()->get('db', 'resource')) {
'label' => $this->translate('Overview')
))->activate('overview');
if ($this->Config()->get('db', 'resource')) {
$this->addGlobalTypeTabs();
} else {
$this->view->errorMessage = sprintf(
$this->translate('No database resource has been configured yet. Please %s to complete your config'),
$this->view->qlink($this->translate('click here'), 'director/settings')
);
}
}
protected function addGlobalTypeTabs()
{
$tabs = $this->getTabs();
foreach ($this->globalTypes as $tabType) {
$ltabType = strtolower($tabType);
$tabs->add($ltabType, array(
'label' => $this->translate(ucfirst($ltabType) . 's'),
'url' => sprintf('director/%ss', $ltabType)
));
}
}
}

View File

@ -26,11 +26,10 @@ $section = $this->menuSection(
$this->translate('Icinga Director')
)->setIcon('cubes');
$section->add($this->translate('Welcome'))->setUrl('director/welcome')->setPriority(20);
$section->add($this->translate('Overview'))->setUrl('director/welcome')->setPriority(20);
$section->add($this->translate('Hosts'))->setUrl('director/hosts')->setPriority(30);
$section->add($this->translate('Services'))->setUrl('director/services')->setPriority(40);
$section->add($this->translate('Commands'))->setUrl('director/commands')->setPriority(50);
$section->add($this->translate('Global'))->setUrl('director/zones')->setPriority(60);
$section->add($this->translate('Users'))->setUrl('director/users')->setPriority(70);
$section->add($this->translate('Import / Sync'))
->setUrl('director/list/importsource')

View File

@ -21,6 +21,10 @@ abstract class ObjectsController extends ActionController
if (in_array(ucfirst($type), $this->globalTypes)) {
$ltype = strtolower($type);
$tabs->add('overview', array(
'url' => $this->getRequest()->getUrl(),
'label' => $this->translate('Overview')
));
foreach ($this->globalTypes as $tabType) {
$ltabType = strtolower($tabType);