HostController: move tab handling to ObjectTabs

Helps to unify tabs on usage/edit
This commit is contained in:
Thomas Gelf 2017-07-28 23:20:58 +02:00
parent 5ca7740285
commit 34c6134b21
2 changed files with 13 additions and 19 deletions

View File

@ -24,24 +24,6 @@ use ipl\Web\Widget\ActionBar;
class HostController extends ObjectController
{
public function init()
{
parent::init();
if ($this->object) {
$tabs = $this->tabs();
$name = $this->object->getObjectName();
$tabs->add('services', [
'url' => 'director/host/services',
'urlParams' => ['name' => $name],
'label' => 'Services'
])->add('agent', [
'url' => 'director/host/agent',
'urlParams' => ['name' => $name],
'label' => 'Agent'
]);
}
}
protected function checkDirectorPermissions()
{
$this->assertPermission('director/hosts');

View File

@ -105,7 +105,7 @@ class ObjectTabs extends Tabs
if ($object->supportsRanges()) {
$this->add('ranges', [
'url' => 'director/timeperiod/ranges',
'urlParams' => $object->getUrlParams(),
'urlParams' => $params,
'label' => $this->translate('Ranges')
]);
}
@ -117,6 +117,18 @@ class ObjectTabs extends Tabs
'label' => $this->translate('Inspect')
]);
}
if ($object->getShortTableName() === 'host') {
$this->add('services', [
'url' => 'director/host/services',
'urlParams' => $params,
'label' => $this->translate('Services')
])->add('agent', [
'url' => 'director/host/agent',
'urlParams' => $params,
'label' => $this->translate('Agent')
]);
}
}
protected function hasFields()