index: re-organize menu and overview link

This commit is contained in:
Thomas Gelf 2016-02-27 02:02:43 +01:00
parent 0574217568
commit 84a788f36c
3 changed files with 1 additions and 27 deletions

View File

@ -6,13 +6,6 @@ use Icinga\Module\Director\Web\Controller\ActionController;
class IndexController extends ActionController class IndexController extends ActionController
{ {
protected $globalTypes = array(
'ApiUser',
'Zone',
'Endpoint',
'TimePeriod',
);
public function indexAction() public function indexAction()
{ {
$this->setAutorefreshInterval(10); $this->setAutorefreshInterval(10);
@ -29,24 +22,10 @@ class IndexController extends ActionController
return; return;
} }
$this->addGlobalTypeTabs();
$this->view->stats = $this->db()->getObjectSummary(); $this->view->stats = $this->db()->getObjectSummary();
$this->view->undeployedActivities = $this->db()->countActivitiesSinceLastDeployedConfig(); $this->view->undeployedActivities = $this->db()->countActivitiesSinceLastDeployedConfig();
if ((int) $this->view->stats['apiuser']->cnt_total === 0) { if ((int) $this->view->stats['apiuser']->cnt_total === 0) {
$this->view->form = $this->loadForm('kickstart')->setDb($this->db)->handleRequest(); $this->view->form = $this->loadForm('kickstart')->setDb($this->db)->handleRequest();
} }
} }
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

@ -23,14 +23,13 @@ $this->provideConfigTab('config', array(
$section = $this->menuSection( $section = $this->menuSection(
$this->translate('Icinga Director') $this->translate('Icinga Director')
)->setIcon( )->setUrl('director')->setPriority(60)->setIcon(
'cubes' 'cubes'
)->setRenderer(array( )->setRenderer(array(
'SummaryNavigationItemRenderer', 'SummaryNavigationItemRenderer',
'state' => 'critical' 'state' => 'critical'
)); ));
$section->add($this->translate('Overview'))->setUrl('director')->setPriority(20);
$section->add($this->translate('Hosts'))->setUrl('director/hosts')->setPriority(30); $section->add($this->translate('Hosts'))->setUrl('director/hosts')->setPriority(30);
$section->add($this->translate('Services'))->setUrl('director/services')->setPriority(40); $section->add($this->translate('Services'))->setUrl('director/services')->setPriority(40);
$section->add($this->translate('Commands'))->setUrl('director/commands')->setPriority(50); $section->add($this->translate('Commands'))->setUrl('director/commands')->setPriority(50);

View File

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