diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:47 +0000 |
commit | 5419d4428c86c488a43124f85e5407d7cbae6541 (patch) | |
tree | 772c4221a20fd7d1b3e7e67c6e21755a50e80fd7 /application/forms/ImportRowModifierForm.php | |
parent | Adding upstream version 1.10.2. (diff) | |
download | icingaweb2-module-director-5419d4428c86c488a43124f85e5407d7cbae6541.tar.xz icingaweb2-module-director-5419d4428c86c488a43124f85e5407d7cbae6541.zip |
Adding upstream version 1.11.1.upstream/1.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | application/forms/ImportRowModifierForm.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/application/forms/ImportRowModifierForm.php b/application/forms/ImportRowModifierForm.php index 9e53bd9..7033f4c 100644 --- a/application/forms/ImportRowModifierForm.php +++ b/application/forms/ImportRowModifierForm.php @@ -64,6 +64,41 @@ class ImportRowModifierForm extends DirectorObjectForm $error = $e->getMessage(); $mods = $this->optionalEnum([]); } + $this->addElement('YesNo', 'use_filter', [ + 'label' => $this->translate('Set based on filter'), + 'ignore' => true, + 'class' => 'autosubmit', + 'required' => true, + ]); + + if ($this->hasBeenSent()) { + $useFilter = $this->getSentValue('use_filter'); + if ($useFilter === null) { + $this->setElementValue('use_filter', $useFilter = 'n'); + } + } elseif ($object = $this->getObject()) { + $expression = $object->get('filter_expression'); + $useFilter = ($expression === null || strlen($expression) === 0) ? 'n' : 'y'; + $this->setElementValue('use_filter', $useFilter); + } else { + $this->setElementValue('use_filter', $useFilter = 'n'); + } + + if ($useFilter === 'y') { + $this->addElement('text', 'filter_expression', [ + 'label' => $this->translate('Filter Expression'), + 'description' => $this->translate( + 'This allows to filter for specific parts within the given source expression.' + . ' You are allowed to refer all imported columns. Examples: host=www* would' + . ' set this property only for rows imported with a host property starting' + . ' with "www". Complex example: host=www*&!(address=127.*|address6=::1).' + . ' Please note, that CIDR notation based matches are also supported: ' + . ' address=192.0.2.128/25| address=2001:db8::/32| address=::ffff:192.0.2.0/96' + ), + 'required' => true, + // TODO: validate filter + ]); + } $this->addElement('select', 'provider_class', [ 'label' => $this->translate('Modifier'), |