[pve-devel] [PATCH widget-toolkit] form/RoleSelector: fix for pve

Dominik Csapak d.csapak at proxmox.com
Fri Jul 22 09:35:24 CEST 2022


in pbs we get an array here, so the renderer is fine, but in pve it's
just a long string, so add a space after commas to achieve the same
effect.

without this, the second column is not visible in pve because of an error
in the renderer (no 'join' function on a string)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/form/RoleSelector.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/form/RoleSelector.js b/src/form/RoleSelector.js
index d82c980..7d897f9 100644
--- a/src/form/RoleSelector.js
+++ b/src/form/RoleSelector.js
@@ -30,8 +30,15 @@ Ext.define('Proxmox.form.RoleSelector', {
 		header: gettext('Privileges'),
 		dataIndex: 'privs',
 		cellWrap: true,
-		// join manually here, as ExtJS joins without whitespace which breaks cellWrap
-		renderer: v => v.join(', '),
+		renderer: (v) => {
+		    if (Ext.isArray(v)) {
+			// join manually here, as ExtJS joins without whitespace which breaks cellWrap
+			return v.join(', ');
+		    }
+
+		    // add space after comma for cellWrap
+		    return v.replaceAll(',', ', ');
+		},
 		flex: 5,
 	    },
 	],
-- 
2.30.2





More information about the pve-devel mailing list