HostController: pass branch to forms

This commit is contained in:
Thomas Gelf 2022-09-20 12:07:24 +02:00
parent 39f53b6cee
commit f301be425c

View File

@ -125,6 +125,7 @@ class HostController extends ObjectController
$this->content()->add(
IcingaServiceSetForm::load()
->setBranch($this->getBranch())
->setHost($host)
->setDb($this->db())
->handleRequest()
@ -209,11 +210,11 @@ class HostController extends ObjectController
$branch = $this->getBranch();
$hostHasBeenCreatedInBranch = $branch->isBranch() && $host->get('id');
$content = $this->content();
$table = (new ObjectsTableService($this->db()))->setAuth($this->Auth())->setHost($host)
$table = (new ObjectsTableService($this->db()))
->setAuth($this->Auth())
->setHost($host)
->setBranch($branch)
->setTitle($this->translate('Individual Service objects'));
if ($branch->isBranch()) {
$table->setBranchUuid($branch->getUuid());
}
if (count($table)) {
$content->add($table);
@ -225,6 +226,7 @@ class HostController extends ObjectController
foreach ($parents as $parent) {
$table = (new ObjectsTableService($this->db()))
->setAuth($this->Auth())
->setBranch($branch)
->setHost($parent)
->setInheritedBy($host);
if (count($table)) {
@ -251,6 +253,7 @@ class HostController extends ObjectController
$content->add(
IcingaServiceSetServiceTable::load($set)
// ->setHost($host)
->setBranch($branch)
->setAffectedHost($host)
->setTitle($title)
);
@ -279,6 +282,7 @@ class HostController extends ObjectController
$host = $this->getHostObject();
$service = $this->params->getRequired('service');
$db = $this->db();
$branch = $this->getBranch();
$this->controls()->setTabs(new Tabs());
$this->addSingleTab($this->translate('Configuration (read-only)'));
$this->addTitle($this->translate('Services on %s'), $host->getObjectName());
@ -287,6 +291,7 @@ class HostController extends ObjectController
$table = (new ObjectsTableService($db))
->setAuth($this->Auth())
->setHost($host)
->setBranch($branch)
->setReadonly()
->highlightService($service)
->setTitle($this->translate('Individual Service objects'));
@ -301,6 +306,7 @@ class HostController extends ObjectController
foreach ($parents as $parent) {
$table = (new ObjectsTableService($db))
->setReadonly()
->setBranch($branch)
->setHost($parent)
->highlightService($service)
->setInheritedBy($host);
@ -326,6 +332,7 @@ class HostController extends ObjectController
$content->add(
IcingaServiceSetServiceTable::load($set)
// ->setHost($host)
->setBranch($branch)
->setAffectedHost($host)
->setReadonly()
->highlightService($service)
@ -377,6 +384,7 @@ class HostController extends ObjectController
$title = sprintf($this->translate('%s (Service set)'), $name);
$table = IcingaServiceSetServiceTable::load($set)
->setHost($host)
->setBranch($this->getBranch())
->setAffectedHost($affectedHost)
->setTitle($title);
if ($roService) {
@ -413,6 +421,7 @@ class HostController extends ObjectController
$this->content()->add(
IcingaServiceForm::load()
->setDb($db)
->setBranch($this->getBranch())
->setHost($host)
->setApplyGenerated($parent)
->setObject($service)
@ -453,6 +462,7 @@ class HostController extends ObjectController
$form = IcingaServiceForm::load()
->setDb($db)
->setBranch($this->getBranch())
->setHost($host)
->setInheritedFrom($from->getObjectName())
->setObject($service)
@ -530,6 +540,7 @@ class HostController extends ObjectController
$form = IcingaServiceForm::load()
->setDb($db)
->setBranch($this->getBranch())
->setHost($host)
->setServiceSet($set)
->setObject($service)