diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:48 +0000 |
commit | e6d4dfc040bbe3cb80a2ce65b82493b557f751fc (patch) | |
tree | 40bd6366b01b06f4d96fc8638f23a772263cb5e9 /application/forms/ImportRowModifierForm.php | |
parent | Releasing progress-linux version 1.10.2-2~progress7.99u1. (diff) | |
download | icingaweb2-module-director-e6d4dfc040bbe3cb80a2ce65b82493b557f751fc.tar.xz icingaweb2-module-director-e6d4dfc040bbe3cb80a2ce65b82493b557f751fc.zip |
Merging upstream version 1.11.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/forms/ImportRowModifierForm.php')
-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'), |