mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
parent
334bd9f58d
commit
164b5bd93d
@ -109,11 +109,47 @@ class DirectorDatafield extends DbObjectWithSettings
|
|||||||
|
|
||||||
$varname = $this->get('varname');
|
$varname = $this->get('varname');
|
||||||
|
|
||||||
|
$inherited = $object->getInheritedVar($varname);
|
||||||
|
|
||||||
|
if (null !== $inherited) {
|
||||||
$form->setInheritedValue(
|
$form->setInheritedValue(
|
||||||
$el,
|
$el,
|
||||||
$object->getInheritedVar($varname),
|
$inherited,
|
||||||
$object->getOriginForVar($varname)
|
$object->getOriginForVar($varname)
|
||||||
);
|
);
|
||||||
|
} elseif ($object->hasRelation('check_command')) {
|
||||||
|
// TODO: Move all of this elsewhere and test it
|
||||||
|
try {
|
||||||
|
/** @var IcingaCommand $command */
|
||||||
|
$command = $object->getResolvedRelated('check_command');
|
||||||
|
$inherited = $command->vars()->get($varname);
|
||||||
|
$inheritedFrom = null;
|
||||||
|
|
||||||
|
if ($inherited !== null) {
|
||||||
|
$inherited = $inherited->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inherited === null) {
|
||||||
|
$inherited = $command->getResolvedVar($varname);
|
||||||
|
if ($inherited === null) {
|
||||||
|
$inheritedFrom = $command->getOriginForVar($varname);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$inheritedFrom = $command->getObjectName();
|
||||||
|
}
|
||||||
|
$inherited = $command->getResolvedVar($varname);
|
||||||
|
if (null !== $inherited) {
|
||||||
|
$form->setInheritedValue(
|
||||||
|
$el,
|
||||||
|
$inherited,
|
||||||
|
$inheritedFrom
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Ignore failures
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use Exception;
|
|||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Data\Filter\FilterExpression;
|
use Icinga\Data\Filter\FilterExpression;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Objects\DirectorDatafield;
|
use Icinga\Module\Director\Objects\DirectorDatafield;
|
||||||
@ -376,6 +377,7 @@ class IcingaObjectFieldLoader
|
|||||||
$fields = $this->loadResolvedFieldsForObject($object);
|
$fields = $this->loadResolvedFieldsForObject($object);
|
||||||
if ($object->hasRelation('check_command')) {
|
if ($object->hasRelation('check_command')) {
|
||||||
try {
|
try {
|
||||||
|
/** @var IcingaCommand $command */
|
||||||
$command = $object->getResolvedRelated('check_command');
|
$command = $object->getResolvedRelated('check_command');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Ignore failures
|
// Ignore failures
|
||||||
@ -383,7 +385,8 @@ class IcingaObjectFieldLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($command) {
|
if ($command) {
|
||||||
$cmdFields = $this->loadResolvedFieldsForObject($command);
|
$cmdLoader = new static($command);
|
||||||
|
$cmdFields = $cmdLoader->getFields($command);
|
||||||
foreach ($cmdFields as $varname => $field) {
|
foreach ($cmdFields as $varname => $field) {
|
||||||
if (! array_key_exists($varname, $fields)) {
|
if (! array_key_exists($varname, $fields)) {
|
||||||
$fields[$varname] = $field;
|
$fields[$varname] = $field;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user