[pve-devel] [PATCH manager 4/6] ui: Utils: delete_if_default: add values by correct type

Dominik Csapak d.csapak at proxmox.com
Thu Apr 9 16:10:47 CEST 2020


if 'delete' is an Array, we want to push into it, not append a string
this could be an issue when we use an edit window with multiple inputpanels
and deleteEmpty set on some fields

we then could have an aray like this:

values: {
    delete: [
	'foo',
	'bar',
	'baz, qux',
    ],
},

which the edit window does not handle correctly anymore
(it only does string splitting if 'delete' itself is a string)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 5cf51d95..27e81c1e 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1241,7 +1241,11 @@ Ext.define('PVE.Utils', { utilities: {
 	if (values[fieldname] === '' || values[fieldname] === default_val) {
 	    if (!create) {
 		if (values['delete']) {
-		    values['delete'] += ',' + fieldname;
+		    if (Ext.isArray(values['delete'])) {
+			values['delete'].push(fieldname);
+		    } else {
+			values['delete'] += ',' + fieldname;
+		    }
 		} else {
 		    values['delete'] = fieldname;
 		}
-- 
2.20.1





More information about the pve-devel mailing list