From 5ca77402851dbab63441bdae2995599d4f91b41f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 28 Jul 2017 23:07:48 +0200 Subject: [PATCH] Various: cosmetics, hints, more links --- .../Web/Controller/TemplateController.php | 9 ++++----- library/Director/Web/Table/ApplyRulesTable.php | 8 ++++++++ .../Director/Web/Table/ObjectsTableEndpoint.php | 1 + library/Director/Web/Table/TemplatesTable.php | 17 +++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/library/Director/Web/Controller/TemplateController.php b/library/Director/Web/Controller/TemplateController.php index 86bc4af2..98607792 100644 --- a/library/Director/Web/Controller/TemplateController.php +++ b/library/Director/Web/Controller/TemplateController.php @@ -135,11 +135,10 @@ abstract class TemplateController extends CompatController $list->addItem(new FormattedString( $this->translate('Create a new %s inheriting from this one'), [Link::create( - $this->translate('Template'), - "director/$type/add", - ['imports' => $templateName, 'type' => 'template'] - ) - ] + $this->translate('Template'), + "director/$type/add", + ['imports' => $templateName, 'type' => 'template'] + )] )); } if ($template->supportsApplyRules()) { diff --git a/library/Director/Web/Table/ApplyRulesTable.php b/library/Director/Web/Table/ApplyRulesTable.php index 1e99b47e..10255e31 100644 --- a/library/Director/Web/Table/ApplyRulesTable.php +++ b/library/Director/Web/Table/ApplyRulesTable.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Director\Web\Table; use Icinga\Authentication\Auth; use Icinga\Data\Filter\Filter; use Icinga\Exception\IcingaException; +use Icinga\Module\Director\Db; use Icinga\Module\Director\Db\IcingaObjectFilterHelper; use Icinga\Module\Director\IcingaConfig\AssignRenderer; use Icinga\Module\Director\Objects\IcingaObject; @@ -24,6 +25,13 @@ class ApplyRulesTable extends ZfQueryBasedTable private $type; + public static function create($type, Db $db) + { + $table = new static($db); + $table->setType($type); + return $table; + } + public function setType($type) { $this->type = $type; diff --git a/library/Director/Web/Table/ObjectsTableEndpoint.php b/library/Director/Web/Table/ObjectsTableEndpoint.php index cab43e82..15ea8573 100644 --- a/library/Director/Web/Table/ObjectsTableEndpoint.php +++ b/library/Director/Web/Table/ObjectsTableEndpoint.php @@ -68,6 +68,7 @@ class ObjectsTableEndpoint extends ObjectsTable public function prepareQuery() { if ($this->deploymentEndpoint === null) { + /** @var \Icinga\Module\Director\Db $c */ $c = $this->connection(); if ($c->hasDeploymentEndpoint()) { $this->deploymentEndpoint = $c->getDeploymentEndpointName(); diff --git a/library/Director/Web/Table/TemplatesTable.php b/library/Director/Web/Table/TemplatesTable.php index 090d56c9..fcd447ef 100644 --- a/library/Director/Web/Table/TemplatesTable.php +++ b/library/Director/Web/Table/TemplatesTable.php @@ -55,12 +55,17 @@ class TemplatesTable extends ZfQueryBasedTable 'name' => $name ]); - return $this::tr([ - $this::td(new Link($caption, $url)), - $this::td(new Link(new Icon('plus'), "director/$type/add", [ - 'type' => 'object', - 'imports' => $name - ])) + return $this::row([ + new Link($caption, $url), + [ + new Link(new Icon('plus'), "director/$type/add", [ + 'type' => 'object', + 'imports' => $name + ]), + new Link(new Icon('history'), "director/$type/history", [ + 'name' => $name + ]) + ] ]); }