[pve-devel] [PATCH manager v2 2/8] gui: DiskStorageSelector: implement disabling

Dominik Csapak d.csapak at proxmox.com
Thu Mar 28 16:25:05 CET 2019


this patch implements disabling for the DiskStorageSelector, which
resets the storage and triggers a validity change

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v2
 www/manager6/form/DiskStorageSelector.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
index d5aaa0f8..8099696b 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -85,6 +85,21 @@ Ext.define('PVE.form.DiskStorageSelector', {
 	hdfilesel.setNodename(nodename);
     },
 
+    setDisabled: function(value) {
+	var me = this;
+	var hdstorage = me.getComponent('hdstorage');
+
+	// reset on disable
+	if (value) {
+	    hdstorage.setValue();
+	}
+	hdstorage.setDisabled(value);
+
+	// disabling does not always fire this event and we do not need
+	// the value of the validity
+	hdstorage.fireEvent('validitychange');
+    },
+
     initComponent: function() {
 	var me = this;
 
@@ -97,6 +112,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
 		fieldLabel: me.storageLabel,
 		nodename: me.nodename,
 		storageContent: me.storageContent,
+		disabled: me.disabled,
 		autoSelect: me.autoSelect,
 		allowBlank: me.allowBlank,
 		emptyText: me.emptyText,
@@ -145,6 +161,9 @@ Ext.define('PVE.form.DiskStorageSelector', {
 	    }
 	];
 
+	// use it to disable the children but not ourself
+	me.disabled = false;
+
 	me.callParent();
     }
 });
-- 
2.11.0





More information about the pve-devel mailing list