[pve-devel] [PATCH v2 manager] fix #2810: reset state properly when editing mount features of containers

Oguz Bektas o.bektas at proxmox.com
Mon Jun 22 15:55:53 CEST 2020


initializing 'mounts' array in the panel scope causes edits on subsequent
containers to get the values (mount=nfs) from the previous container. fix this by
initializing the 'mounts' array in 'onGetValues' and 'setValues'
separately.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 www/manager6/lxc/FeaturesEdit.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/www/manager6/lxc/FeaturesEdit.js b/www/manager6/lxc/FeaturesEdit.js
index 1275a2e0..dffd77fd 100644
--- a/www/manager6/lxc/FeaturesEdit.js
+++ b/www/manager6/lxc/FeaturesEdit.js
@@ -2,9 +2,6 @@ Ext.define('PVE.lxc.FeaturesInputPanel', {
     extend: 'Proxmox.panel.InputPanel',
     xtype: 'pveLxcFeaturesInputPanel',
 
-    // used to save the mounts fstypes until sending
-    mounts: [],
-
     fstypes: ['nfs', 'cifs'],
 
     viewModel: {
@@ -70,7 +67,7 @@ Ext.define('PVE.lxc.FeaturesInputPanel', {
 
     onGetValues: function(values) {
 	var me = this;
-	var mounts = me.mounts;
+	var mounts = [];
 	me.fstypes.forEach(function(fs) {
 	    if (values[fs]) {
 		mounts.push(fs);
@@ -83,6 +80,7 @@ Ext.define('PVE.lxc.FeaturesInputPanel', {
 	}
 
 	var featuresstring = PVE.Parser.printPropertyString(values, undefined);
+
 	if (featuresstring == '') {
 	    return { 'delete': 'features' };
 	}
@@ -94,13 +92,13 @@ Ext.define('PVE.lxc.FeaturesInputPanel', {
 
 	me.viewModel.set('unprivileged', values.unprivileged);
 
+	var mounts = [];
 	if (values.features) {
 	    var res = PVE.Parser.parsePropertyString(values.features);
-	    me.mounts = [];
 	    if (res.mount) {
 		res.mount.split(/[; ]/).forEach(function(item) {
 		    if (me.fstypes.indexOf(item) === -1) {
-			me.mounts.push(item);
+			mounts.push(item);
 		    } else {
 			res[item] = 1;
 		    }
-- 
2.20.1




More information about the pve-devel mailing list