[pve-devel] [PATCH manager 4/7] ui: VMSelector: correctly change invalid class on en/disable
Dominik Csapak
d.csapak at proxmox.com
Mon Mar 6 15:23:32 CET 2023
since we manually handle the invalid class, we have to manually trigger
that on setDisabled
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/form/VMSelector.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index fb54e4835..399c4e658 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -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;
--
2.30.2
More information about the pve-devel
mailing list