[pve-devel] [PATCH v2 manager] fix #2810: reset state properly when editing mount features of containers
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Jun 23 14:36:10 CEST 2020
On June 22, 2020 3:55 pm, Oguz Bektas wrote:
> 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);
it works now with regards to the reported issue, but AFAICT the whole
mounts variable is useless now (previously, it served to preserve any
mount values not handled by the GUI, which might be a nice thing to
have, but now those unknown values get stored in this variable but
never used..).
we try to not touch things we don't understand in the GUI, so it would
be nice to get this behaviour back without the bug of polluting state
across containers.
> } else {
> res[item] = 1;
> }
> --
> 2.20.1
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list