]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: group filter: cleanup and comment more
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 1 Dec 2021 13:29:08 +0000 (14:29 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 1 Dec 2021 13:30:45 +0000 (14:30 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/form/GroupFilter.js

index 7398d3316b00d77435b263b525508ae146a9cc39..d52858ca2c504072df2f6c80cb70e7282772f81d 100644 (file)
@@ -134,28 +134,26 @@ Ext.define('PBS.form.GroupFilter', {
            let regex = widget.down('textfield[type=regex]');
            let group = widget.down('pbsGroupSelector');
 
+           // cannot reuse the same store for all group selectors due to combo grid limitations,
+           // and just setting the data directly makes trouble due to Ext.util.Collection and its
+           // observers behavior, so, lets do a manual full-clone
            let recs = [];
-           view.dsStore.each((record) => {
-               recs.push(record.data);
-           });
+           view.dsStore.each(record => recs.push(record.data));
            group.getStore().setData(recs);
 
-           // add a widget reference to the record so we can acces them
-           // from the other column
+           // add a widget reference to the record so we can acces them from the other column
            rec.widgets = {
                type,
                regex,
                group,
            };
 
-           // add a record reference so we can access the record from
-           // the change handler
+           // add a record reference so we can access the record from the change handler
            type.record = rec;
            regex.record = rec;
            group.record = rec;
 
-           // CAUTION we just created a cyclic reference, we have to delete
-           // that on filter removal!
+           // CAUTION: we just created a cyclic reference, we have to delete that on filter removal!
 
            me.setInputValue(rec.widgets, rec);
        },
@@ -221,9 +219,8 @@ Ext.define('PBS.form.GroupFilter', {
                if (me.isDestroyed) {
                    return;
                }
-               me.query('pbsGroupSelector').forEach((selector) => {
-                   selector.getStore().setData(records || []);
-               });
+               let groups = records || [];
+               me.query('pbsGroupSelector').forEach(el => el.getStore().setData(groups));
            },
        });
     },