mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
HostController: cosmetics
This commit is contained in:
parent
00e0f9574d
commit
32cd0d6b83
@ -154,7 +154,7 @@ class HostController extends ObjectController
|
|||||||
array('hs' => 'icinga_service_set'),
|
array('hs' => 'icinga_service_set'),
|
||||||
'hs.id = hsi.service_set_id',
|
'hs.id = hsi.service_set_id',
|
||||||
array()
|
array()
|
||||||
)->where('hs.host_id = ?', $host->id);
|
)->where('hs.host_id = ?', $host->get('id'));
|
||||||
|
|
||||||
$sets = IcingaServiceSet::loadAll($db, $query, 'object_name');
|
$sets = IcingaServiceSet::loadAll($db, $query, 'object_name');
|
||||||
/** @var IcingaServiceSet $set*/
|
/** @var IcingaServiceSet $set*/
|
||||||
@ -181,7 +181,7 @@ class HostController extends ObjectController
|
|||||||
'imports' => $parent,
|
'imports' => $parent,
|
||||||
'object_type' => 'apply',
|
'object_type' => 'apply',
|
||||||
'object_name' => $serviceName,
|
'object_name' => $serviceName,
|
||||||
'host_id' => $host->id,
|
'host_id' => $host->get('id'),
|
||||||
'vars' => $host->getOverriddenServiceVars($serviceName),
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
||||||
], $db);
|
], $db);
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ class HostController extends ObjectController
|
|||||||
|
|
||||||
$parent = IcingaService::load([
|
$parent = IcingaService::load([
|
||||||
'object_name' => $serviceName,
|
'object_name' => $serviceName,
|
||||||
'host_id' => $from->id
|
'host_id' => $from->get('id')
|
||||||
], $this->db());
|
], $this->db());
|
||||||
|
|
||||||
// TODO: we want to eventually show the host template name, doesn't work
|
// TODO: we want to eventually show the host template name, doesn't work
|
||||||
@ -221,7 +221,7 @@ class HostController extends ObjectController
|
|||||||
$service = IcingaService::create([
|
$service = IcingaService::create([
|
||||||
'object_type' => 'apply',
|
'object_type' => 'apply',
|
||||||
'object_name' => $serviceName,
|
'object_name' => $serviceName,
|
||||||
'host_id' => $host->id,
|
'host_id' => $host->get('id'),
|
||||||
'imports' => [$parent],
|
'imports' => [$parent],
|
||||||
'vars' => $host->getOverriddenServiceVars($serviceName),
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
||||||
], $db);
|
], $db);
|
||||||
@ -231,7 +231,7 @@ class HostController extends ObjectController
|
|||||||
$form = IcingaServiceForm::load()
|
$form = IcingaServiceForm::load()
|
||||||
->setDb($db)
|
->setDb($db)
|
||||||
->setHost($host)
|
->setHost($host)
|
||||||
->setInheritedFrom($from->object_name)
|
->setInheritedFrom($from->getObjectName())
|
||||||
->setObject($service)
|
->setObject($service)
|
||||||
->handleRequest();
|
->handleRequest();
|
||||||
$this->content()->add($form);
|
$this->content()->add($form);
|
||||||
@ -252,7 +252,7 @@ class HostController extends ObjectController
|
|||||||
)->where(
|
)->where(
|
||||||
'si.parent_service_set_id = ?',
|
'si.parent_service_set_id = ?',
|
||||||
$this->params->get('setId')
|
$this->params->get('setId')
|
||||||
)->where('ss.host_id = ?', $this->object->id);
|
)->where('ss.host_id = ?', $this->object->get('id'));
|
||||||
|
|
||||||
IcingaServiceSet::loadWithAutoIncId($db->fetchOne($query), $this->db())->delete();
|
IcingaServiceSet::loadWithAutoIncId($db->fetchOne($query), $this->db())->delete();
|
||||||
$this->redirectNow(
|
$this->redirectNow(
|
||||||
@ -276,7 +276,7 @@ class HostController extends ObjectController
|
|||||||
$service = IcingaService::create([
|
$service = IcingaService::create([
|
||||||
'object_type' => 'apply',
|
'object_type' => 'apply',
|
||||||
'object_name' => $serviceName,
|
'object_name' => $serviceName,
|
||||||
'host_id' => $host->id,
|
'host_id' => $host->get('id'),
|
||||||
'imports' => [$service],
|
'imports' => [$service],
|
||||||
'vars' => $host->getOverriddenServiceVars($serviceName),
|
'vars' => $host->getOverriddenServiceVars($serviceName),
|
||||||
], $db);
|
], $db);
|
||||||
@ -334,7 +334,10 @@ class HostController extends ObjectController
|
|||||||
$host = $this->object;
|
$host = $this->object;
|
||||||
try {
|
try {
|
||||||
$mon = $this->monitoring();
|
$mon = $this->monitoring();
|
||||||
if ($host->isObject() && $mon->isAvailable() && $mon->hasHost($host->object_name)) {
|
if ($host->isObject()
|
||||||
|
&& $mon->isAvailable()
|
||||||
|
&& $mon->hasHost($host->getObjectName())
|
||||||
|
) {
|
||||||
$this->actions()->add(Link::create(
|
$this->actions()->add(Link::create(
|
||||||
$this->translate('Show'),
|
$this->translate('Show'),
|
||||||
'monitoring/host/show',
|
'monitoring/host/show',
|
||||||
@ -355,6 +358,7 @@ class HostController extends ObjectController
|
|||||||
*/
|
*/
|
||||||
protected function getHostObject()
|
protected function getHostObject()
|
||||||
{
|
{
|
||||||
|
/** @var IcingaHost $this->object */
|
||||||
return $this->object;
|
return $this->object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user