mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
IcingaDependencyForm: allow to store var names
This commit is contained in:
parent
adace00df4
commit
de0b3db8a2
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Data\Db\DbObject;
|
||||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
use Icinga\Module\Director\Objects\IcingaDependency;
|
use Icinga\Module\Director\Objects\IcingaDependency;
|
||||||
|
|
||||||
@ -287,4 +288,29 @@ class IcingaDependencyForm extends DirectorObjectForm
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function handleProperties(DbObject $object, & $values)
|
||||||
|
{
|
||||||
|
if ($this->hasBeenSent()) {
|
||||||
|
if (isset($values['parent_host'])
|
||||||
|
&& $this->isCustomVar($values['parent_host'])
|
||||||
|
) {
|
||||||
|
$values['parent_host_var'] = $values['parent_host'];
|
||||||
|
$values['parent_host'] = '';
|
||||||
|
}
|
||||||
|
if (isset($values['parent_service'])
|
||||||
|
&& $this->isCustomVar($values['parent_service'])
|
||||||
|
) {
|
||||||
|
$values['parent_service_var'] = $values['parent_service'];
|
||||||
|
$values['parent_service'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::handleProperties($object, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isCustomVar($string)
|
||||||
|
{
|
||||||
|
return \preg_match('/^(?:host|service)\.vars\./', $string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user