]> git.proxmox.com Git - pmg-gui.git/commitdiff
RegexTester: fix getting reference to regex field
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 12 Nov 2020 17:57:57 +0000 (18:57 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 13 Nov 2020 07:10:42 +0000 (08:10 +0100)
the regular expression field is not necessarily after the regex tester
(mostly it is before). In order to be more robust, use the child
method of the parent window instead of previousSibling of the button.

The child method gets any direct descendant matching the query, the
sibling one is always directional and there's no method for "any
sibling".

Tested with:
* mailproxy whitelist
* match field
* match filename
* who object

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
js/RegexTester.js

index 3b03f6de6cd16891fe2597b0fd566e0ebafe1ea4..486c1972538b86d8fc02efb247d1bda6e47ec65a 100644 (file)
@@ -26,7 +26,7 @@ Ext.define('PMG.RegexTester', {
            text: 'Test',
            handler: function(btn) {
                let view = this.up();
-               let regexField = btn.nextSibling(`field[reference=${view.regexFieldReference}]`);
+               let regexField = view.up().child(`field[reference=${view.regexFieldReference}]`);
 
                let regex = regexField.getValue();
                if (view.wholeMatch) {