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>
if (!me.nodename) {
throw "no nodename given";
}
if (!me.nodename) {
throw "no nodename given";
}
+
+ me.originalAllowBlank = me.allowBlank;
+ me.allowBlank = true;
+
Ext.apply(me, {
store: {
fields: ['name'],
Ext.apply(me, {
store: {
fields: ['name'],
type: 'proxmox',
url: `/api2/json/nodes/${me.nodename}/ceph/rules`,
},
type: 'proxmox',
url: `/api2/json/nodes/${me.nodename}/ceph/rules`,
},
- autoLoad: me.isCreate ? {
callback: (records, op, success) => {
callback: (records, op, success) => {
- if (success && records.length > 0) {
+ if (me.isCreate && success && records.length > 0) {
+
+ me.allowBlank = me.originalAllowBlank;
+ delete me.originalAllowBlank;
+ me.validate();