From 62a16bd25999c60daeb7f8b48074b386b52aa7f3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 7 Nov 2018 11:02:56 +0100 Subject: [PATCH] Importsource/Syncrule: unify links --- .../controllers/ImportsourceController.php | 5 +- .../controllers/SyncruleController.php | 51 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/application/controllers/ImportsourceController.php b/application/controllers/ImportsourceController.php index 3e5d8903..d7e7a2cf 100644 --- a/application/controllers/ImportsourceController.php +++ b/application/controllers/ImportsourceController.php @@ -58,7 +58,10 @@ class ImportsourceController extends ActionController 'type' => 'ImportSource', 'names' => $source->getUniqueIdentifier() ], - ['class' => 'icon-tag'] + [ + 'class' => 'icon-tag', + 'data-base-target' => '_next' + ] )); } diff --git a/application/controllers/SyncruleController.php b/application/controllers/SyncruleController.php index 42ac4575..fd3fdf59 100644 --- a/application/controllers/SyncruleController.php +++ b/application/controllers/SyncruleController.php @@ -6,6 +6,7 @@ use Icinga\Module\Director\Forms\SyncCheckForm; use Icinga\Module\Director\Forms\SyncPropertyForm; use Icinga\Module\Director\Forms\SyncRuleForm; use Icinga\Module\Director\Forms\SyncRunForm; +use Icinga\Module\Director\Web\ActionBar\AutomationObjectActionBar; use Icinga\Module\Director\Web\Controller\ActionController; use Icinga\Module\Director\Objects\SyncRule; use Icinga\Module\Director\Objects\SyncRun; @@ -45,16 +46,7 @@ class SyncruleController extends ActionController $this->addPropertyHint($rule); return; } - $this->actions()->add(Link::create( - $this->translate('Add to Basket'), - 'director/basket/add', - [ - 'type' => 'SyncRule', - 'names' => $rule->getUniqueIdentifier() - ], - ['class' => 'icon-tag'] - )); - + $this->addMainActions(); if (! $run) { $this->warning($this->translate('This Sync Rule has never been run before.')); } @@ -160,23 +152,7 @@ class SyncruleController extends ActionController $this->translate('Sync rule: %s'), $rule->rule_name )); - $this->actions()->add( - Link::create( - $this->translate('Clone'), - 'director/syncrule/clone', - ['id' => $id], - ['class' => 'icon-paste'] - ) - ); - $this->actions()->add(Link::create( - $this->translate('Add to Basket'), - 'director/basket/add', - [ - 'type' => 'SyncRule', - 'names' => $rule->getUniqueIdentifier() - ], - ['class' => 'icon-tag'] - )); + $this->addMainActions(); if (! $rule->hasSyncProperties()) { $this->addPropertyHint($rule); @@ -308,6 +284,27 @@ class SyncruleController extends ActionController SyncRunTable::create($rule)->renderTo($this); } + protected function addMainActions() + { + $this->actions(new AutomationObjectActionBar( + $this->getRequest() + )); + $source = $this->requireSyncRule(); + + $this->actions()->add(Link::create( + $this->translate('Add to Basket'), + 'director/basket/add', + [ + 'type' => 'SyncRule', + 'names' => $source->getUniqueIdentifier() + ], + [ + 'class' => 'icon-tag', + 'data-base-target' => '_next', + ] + )); + } + /** * @param string $key * @return SyncRule