]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: create ceph pool: fix false-positive trigger showing advanced fields
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 10 Mar 2023 14:08:08 +0000 (15:08 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 11 Mar 2023 16:38:38 +0000 (17:38 +0100)
Since the rule selector is not allowed to be empty, but the loading
of the rules is not instant, the validity change will trigger before
the load was finished. Since it is in the advanced section, it will
be opened every time instead of only when there is an invalid value.

This patch fixes that by temporarily setting 'allowBlank' to true
until the store is loaded, and then it revalidates the field.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
www/manager6/ceph/Pool.js

index a1f008d1a0253d00a881568fc97541ad7d50f19d..f7a4d9bae05c6f22c62cfd00806d294f9e044951 100644 (file)
@@ -484,6 +484,10 @@ Ext.define('PVE.form.CephRuleSelector', {
        if (!me.nodename) {
            throw "no nodename given";
        }
+
+       me.originalAllowBlank = me.allowBlank;
+       me.allowBlank = true;
+
        Ext.apply(me, {
            store: {
                fields: ['name'],
@@ -492,13 +496,17 @@ Ext.define('PVE.form.CephRuleSelector', {
                    type: 'proxmox',
                    url: `/api2/json/nodes/${me.nodename}/ceph/rules`,
                },
-               autoLoad: me.isCreate ? {
+               autoLoad: {
                    callback: (records, op, success) => {
-                       if (success && records.length > 0) {
+                       if (me.isCreate && success && records.length > 0) {
                            me.select(records[0]);
                        }
+
+                       me.allowBlank = me.originalAllowBlank;
+                       delete me.originalAllowBlank;
+                       me.validate();
                    },
-               } : true,
+               },
            },
        });