Importsource/Syncrule: unify links

This commit is contained in:
Thomas Gelf 2018-11-07 11:02:56 +01:00
parent 7f0ffb1691
commit 62a16bd259
2 changed files with 28 additions and 28 deletions

View File

@ -58,7 +58,10 @@ class ImportsourceController extends ActionController
'type' => 'ImportSource',
'names' => $source->getUniqueIdentifier()
],
['class' => 'icon-tag']
[
'class' => 'icon-tag',
'data-base-target' => '_next'
]
));
}

View File

@ -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