mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
parent
d8f02c8974
commit
348cb1aa63
@ -75,16 +75,28 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
|
|||||||
'description' => $this->translate(
|
'description' => $this->translate(
|
||||||
'Whether the set_if parameter is a string (allowing macros like $host$)'
|
'Whether the set_if parameter is a string (allowing macros like $host$)'
|
||||||
. ' or an Icinga DSL lambda function (will be enclosed with {{ ... }}'
|
. ' or an Icinga DSL lambda function (will be enclosed with {{ ... }}'
|
||||||
)
|
),
|
||||||
|
'class' => 'autosubmit',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'set_if', array(
|
if ($this->getSentOrObjectValue('set_if_format') === 'expression') {
|
||||||
'label' => $this->translate('Condition (set_if)'),
|
$this->addElement('textarea', 'set_if', array(
|
||||||
'description' => $this->translate(
|
'label' => $this->translate('Condition (set_if)'),
|
||||||
'Only set this parameter if the argument value resolves to a'
|
'description' => $this->translate(
|
||||||
. ' numeric value. String values are not supported'
|
'An Icinga DSL expression that returns a boolean value, e.g.: var cmd = bool(macro("$cmd$"));'
|
||||||
)
|
. ' return cmd ...'
|
||||||
));
|
),
|
||||||
|
'rows' => 3
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
$this->addElement('text', 'set_if', array(
|
||||||
|
'label' => $this->translate('Condition (set_if)'),
|
||||||
|
'description' => $this->translate(
|
||||||
|
'Only set this parameter if the argument value resolves to a'
|
||||||
|
. ' numeric value. String values are not supported'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$this->addBoolean('repeat_key', array(
|
$this->addBoolean('repeat_key', array(
|
||||||
'label' => $this->translate('Repeat key'),
|
'label' => $this->translate('Repeat key'),
|
||||||
|
@ -124,6 +124,7 @@ class IcingaCommandArgument extends IcingaObject
|
|||||||
$data['argument_name'] = $this->argument_name;
|
$data['argument_name'] = $this->argument_name;
|
||||||
$data['argument_value'] = $this->argument_value;
|
$data['argument_value'] = $this->argument_value;
|
||||||
$data['argument_format'] = $this->argument_format;
|
$data['argument_format'] = $this->argument_format;
|
||||||
|
$data['set_if_format'] = $this->set_if_format;
|
||||||
return (object) $data;
|
return (object) $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +162,14 @@ class IcingaCommandArgument extends IcingaObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->set_if) {
|
if ($this->set_if) {
|
||||||
$data['set_if'] = c::renderString($this->set_if);
|
switch ($this->set_if_format) {
|
||||||
|
case 'string':
|
||||||
|
$data['set_if'] = c::renderString($this->set_if);
|
||||||
|
break;
|
||||||
|
case 'expression':
|
||||||
|
$data['set_if'] = c::renderExpression($this->set_if);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->required) {
|
if ($this->required) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user