Merge branch 'master' of git.icinga.org:icingaweb2-module-director

This commit is contained in:
Alexander Fuhr 2015-06-29 10:21:14 +02:00
commit b8a35e068c
7 changed files with 37 additions and 12 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(

View File

@ -14,4 +14,5 @@ CREATE TABLE icinga_user_inheritance (
REFERENCES icinga_user (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -14,4 +14,5 @@ CREATE TABLE icinga_timeperiod_inheritance (
REFERENCES icinga_timeperiod (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;