ui: guest selector: correctly change invalid class on en/disable

since the invalid class is manually handled, validity needs to be
checked explicitly too on setDisabled

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak
2023-03-06 15:23:32 +01:00
committed by Thomas Lamprecht
parent 11fc6d7fb5
commit fc8138ec20

View File

@ -140,6 +140,8 @@ Ext.define('PVE.form.VMSelector', {
} else {
sm.deselectAll();
}
// to correctly trigger invalid class
me.getErrors();
},
setValue: function(value) {
@ -163,7 +165,7 @@ Ext.define('PVE.form.VMSelector', {
getErrors: function(value) {
let me = this;
if (me.allowBlank === false &&
if (!me.isDisabled() && me.allowBlank === false &&
me.getSelectionModel().getCount() === 0) {
me.addBodyCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']);
return [gettext('No VM selected')];
@ -173,6 +175,13 @@ Ext.define('PVE.form.VMSelector', {
return [];
},
setDisabled: function(disabled) {
let me = this;
let res = me.callParent([disabled]);
me.getErrors();
return res;
},
initComponent: function() {
let me = this;