mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
ImportsourceController: align titles, cleanup
This commit is contained in:
parent
df4c3b925c
commit
4c9a40c688
@ -15,6 +15,9 @@ use dipl\Html\Link;
|
|||||||
|
|
||||||
class ImportsourceController extends ActionController
|
class ImportsourceController extends ActionController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\Http\HttpNotFoundException
|
||||||
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
@ -27,6 +30,11 @@ class ImportsourceController extends ActionController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
||||||
@ -42,6 +50,9 @@ class ImportsourceController extends ActionController
|
|||||||
$this->content()->add(new ImportSourceDetails($source));
|
$this->content()->add(new ImportSourceDetails($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
*/
|
||||||
public function addAction()
|
public function addAction()
|
||||||
{
|
{
|
||||||
$this->addTitle($this->translate('Add import source'))
|
$this->addTitle($this->translate('Add import source'))
|
||||||
@ -52,41 +63,69 @@ class ImportsourceController extends ActionController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
*/
|
||||||
public function editAction()
|
public function editAction()
|
||||||
{
|
{
|
||||||
$form = ImportSourceForm::load()->setDb($this->db())
|
$form = ImportSourceForm::load()->setDb($this->db())
|
||||||
->loadObject($this->params->getRequired('id'))
|
->loadObject($this->params->getRequired('id'))
|
||||||
->setListUrl('director/importsources')
|
->setListUrl('director/importsources')
|
||||||
->handleRequest();
|
->handleRequest();
|
||||||
|
$this->addTitle(
|
||||||
|
$this->translate('Import source: %s'),
|
||||||
|
$form->getObject()->get('source_name')
|
||||||
|
)->setAutorefreshInterval(10);
|
||||||
|
|
||||||
$this->content()->add($form);
|
$this->content()->add($form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function previewAction()
|
public function previewAction()
|
||||||
{
|
{
|
||||||
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
||||||
|
|
||||||
$this->addTitle(
|
$this->addTitle(
|
||||||
$this->translate('Import source preview: "%s"'),
|
$this->translate('Import source preview: %s'),
|
||||||
$source->get('source_name')
|
$source->get('source_name')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->actions()->add(Link::create('[..]', '#', null, [
|
||||||
|
'onclick' => 'javascript:$("table.raw-data-table").toggleClass("collapsed");'
|
||||||
|
]));
|
||||||
(new ImportsourceHookTable())->setImportSource($source)->renderTo($this);
|
(new ImportsourceHookTable())->setImportSource($source)->renderTo($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ImportSource
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
protected function requireImportSourceAndAddModifierTable()
|
protected function requireImportSourceAndAddModifierTable()
|
||||||
{
|
{
|
||||||
$source = ImportSource::load($this->params->getRequired('source_id'), $this->db());
|
$source = ImportSource::load($this->params->getRequired('source_id'), $this->db());
|
||||||
PropertymodifierTable::load($source, $this->url())
|
PropertymodifierTable::load($source, $this->url())
|
||||||
->handleSortPriorityActions($this->getRequest(), $this->getResponse())
|
->handleSortPriorityActions($this->getRequest(), $this->getResponse())
|
||||||
->renderTo($this);
|
->renderTo($this);
|
||||||
|
|
||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function modifierAction()
|
public function modifierAction()
|
||||||
{
|
{
|
||||||
$this->addTitle($this->translate('Property modifiers'));
|
|
||||||
$source = $this->requireImportSourceAndAddModifierTable();
|
$source = $this->requireImportSourceAndAddModifierTable();
|
||||||
|
$this->addTitle($this->translate('Property modifiers: %s'), $source->get('source_name'));
|
||||||
$this->addAddLink(
|
$this->addAddLink(
|
||||||
$this->translate('Add property modifier'),
|
$this->translate('Add property modifier'),
|
||||||
'director/importsource/addmodifier',
|
'director/importsource/addmodifier',
|
||||||
@ -95,16 +134,27 @@ class ImportsourceController extends ActionController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function historyAction()
|
public function historyAction()
|
||||||
{
|
{
|
||||||
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
|
||||||
$this->addTitle($this->translate('Import run history'));
|
$this->addTitle($this->translate('Import run history: %s'), $source->get('source_name'));
|
||||||
|
|
||||||
// TODO: temporarily disabled, find a better place for stats:
|
// TODO: temporarily disabled, find a better place for stats:
|
||||||
// $this->view->stats = $this->db()->fetchImportStatistics();
|
// $this->view->stats = $this->db()->fetchImportStatistics();
|
||||||
ImportrunTable::load($source)->renderTo($this);
|
ImportrunTable::load($source)->renderTo($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\Http\HttpNotFoundException
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function addmodifierAction()
|
public function addmodifierAction()
|
||||||
{
|
{
|
||||||
$source = $this->requireImportSourceAndAddModifierTable();
|
$source = $this->requireImportSourceAndAddModifierTable();
|
||||||
@ -124,6 +174,12 @@ class ImportsourceController extends ActionController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
* @throws \Icinga\Exception\Http\HttpNotFoundException
|
||||||
|
* @throws \Icinga\Exception\MissingParameterException
|
||||||
|
* @throws \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
public function editmodifierAction()
|
public function editmodifierAction()
|
||||||
{
|
{
|
||||||
// We need to load the table AFTER adding the title, otherwise search
|
// We need to load the table AFTER adding the title, otherwise search
|
||||||
@ -148,6 +204,10 @@ class ImportsourceController extends ActionController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportSource $source
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
protected function addBackToModifiersLink(ImportSource $source)
|
protected function addBackToModifiersLink(ImportSource $source)
|
||||||
{
|
{
|
||||||
$this->actions()->add(
|
$this->actions()->add(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user