config: add tabs, less menu items

This commit is contained in:
Thomas Gelf 2015-06-29 10:13:39 +02:00
parent 0af3ed4452
commit 854ba20451
5 changed files with 33 additions and 10 deletions

View File

@ -4,6 +4,7 @@ use Icinga\Module\Director\ActionController;
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
use Icinga\Module\Director\Util;
use Icinga\Web\Url;
class Director_ConfigController extends ActionController
{
@ -14,8 +15,10 @@ class Director_ConfigController extends ActionController
public function storeAction()
{
/** @var IcingaConfig $config */
$config = IcingaConfig::generate($this->db());
$this->view->id = $config->getHexChecksum();
$this->redirectNow(
Url::fromPath('director/config/show',
array('checksum' => $config->getHexChecksum()))
);
}
}

View File

@ -182,6 +182,7 @@ class Director_ListController extends ActionController
public function activitylogAction()
{
$this->setConfigTabs()->activate('activitylog');
$this->view->title = $this->translate('Activity Log');
$this->view->table = $this->loadTable('activityLog')->setConnection($this->db());
$this->render('table');
@ -189,6 +190,12 @@ class Director_ListController extends ActionController
public function generatedconfigAction()
{
$this->view->addLink = $this->view->qlink(
$this->translate('Generate'),
'director/config/store'
);
$this->setConfigTabs()->activate('generatedconfig');
$this->view->title = $this->translate('Generated Configs');
$this->view->table = $this->loadTable('generatedConfig')->setConnection($this->db());
$this->render('table');

View File

@ -1,6 +1,9 @@
<div class="controls" data-base-target="_next">
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<span data-base-target="_next">
<?= $this->addLink ?>
</span>
</div>
<div class="content" data-base-target="_next">

View File

@ -1,5 +1,8 @@
<?php
// Sample permission:
$this->providePermission('director/templates', 'Allow to modify templates');
$section = $this->menuSection($this->translate('Icinga Director'));
$section->setIcon('cubes');
@ -39,12 +42,7 @@ $section->add($this->translate('Endpoints'))
->setUrl('director/list/endpoints');
// INTERNAL
$section->add($this->translate('Activity Log'))
->setUrl('director/list/activitylog')
->setPriority(900);
$section->add($this->translate('Show configs'))
$section->add($this->translate('Config'))
->setUrl('director/list/generatedconfig')
->setPriority(902);
$section->add($this->translate('Store config'))
->setUrl('director/config/store')
->setPriority(902);

View File

@ -33,6 +33,18 @@ abstract class ActionController extends Controller
return TableLoader::load($name, $this->Module());
}
protected function setConfigTabs()
{
$this->view->tabs = Widget::create('tabs')->add('generatedconfig', array(
'label' => $this->translate('Configs'),
'url' => 'director/list/generatedconfig')
)->add('activitylog', array(
'label' => $this->translate('Activity Log'),
'url' => 'director/list/activitylog')
);
return $this->view->tabs;
}
protected function setIcingaTabs()
{
$this->view->tabs = Widget::create('tabs')->add('services', array(