mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-06-09 00:33:03 -04:00
IcingaDependencyForm: allow to store var names
This commit is contained in:
parent
adace00df4
commit
de0b3db8a2
1 changed files with 26 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Director\Forms;
|
||||
|
||||
use Icinga\Module\Director\Data\Db\DbObject;
|
||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||
use Icinga\Module\Director\Objects\IcingaDependency;
|
||||
|
||||
|
|
@ -287,4 +288,29 @@ class IcingaDependencyForm extends DirectorObjectForm
|
|||
|
||||
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…
Reference in a new issue