mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 07:44:05 +02:00
HostController: services on new branch host, hint
This commit is contained in:
parent
97b2f6c946
commit
83617b22e8
@ -107,6 +107,7 @@ class HostController extends ObjectController
|
|||||||
$this->addTitle($this->translate('Add Service to %s'), $host->getObjectName());
|
$this->addTitle($this->translate('Add Service to %s'), $host->getObjectName());
|
||||||
$this->content()->add(
|
$this->content()->add(
|
||||||
IcingaAddServiceForm::load()
|
IcingaAddServiceForm::load()
|
||||||
|
->setBranch($this->getBranch())
|
||||||
->setHost($host)
|
->setHost($host)
|
||||||
->setDb($this->db())
|
->setDb($this->db())
|
||||||
->handleRequest()
|
->handleRequest()
|
||||||
@ -199,12 +200,21 @@ class HostController extends ObjectController
|
|||||||
public function servicesAction()
|
public function servicesAction()
|
||||||
{
|
{
|
||||||
$this->addServicesHeader();
|
$this->addServicesHeader();
|
||||||
$db = $this->db();
|
|
||||||
$host = $this->getHostObject();
|
$host = $this->getHostObject();
|
||||||
$this->addTitle($this->translate('Services: %s'), $host->getObjectName());
|
$this->addTitle($this->translate('Services: %s'), $host->getObjectName());
|
||||||
|
$branch = $this->getBranch();
|
||||||
|
if ($branch->isBranch() && $host->get('id') === null) {
|
||||||
|
$this->content()->add(Hint::info(
|
||||||
|
$this->translate('Managing services on new Hosts is possible only after they have been merged.')
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
$content = $this->content();
|
$content = $this->content();
|
||||||
$table = IcingaHostServiceTable::load($host)
|
$table = IcingaHostServiceTable::load($host)
|
||||||
->setTitle($this->translate('Individual Service objects'));
|
->setTitle($this->translate('Individual Service objects'));
|
||||||
|
if ($branch->isBranch()) {
|
||||||
|
$table->setBranchUuid($branch->getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
if (count($table)) {
|
if (count($table)) {
|
||||||
$content->add($table);
|
$content->add($table);
|
||||||
@ -598,7 +608,7 @@ class HostController extends ObjectController
|
|||||||
*/
|
*/
|
||||||
protected function getHostObject()
|
protected function getHostObject()
|
||||||
{
|
{
|
||||||
/** @var IcingaHost $this->object */
|
assert($this->object instanceof IcingaHost);
|
||||||
return $this->object;
|
return $this->object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user