[pve-devel] [PATCH manager] fix #5879: ui: add tooltip to security group comments

Timothy Nicholson t.nicholson at proxmox.com
Mon Nov 18 12:44:03 CET 2024


This patch adds a tooltip in the security group selector for group
comments that are too long to fit within the column width.

Signed-off-by: Timothy Nicholson <t.nicholson at proxmox.com>
---
 www/manager6/form/SecurityGroupSelector.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/SecurityGroupSelector.js b/www/manager6/form/SecurityGroupSelector.js
index 64db7542..8b1b4b1e 100644
--- a/www/manager6/form/SecurityGroupSelector.js
+++ b/www/manager6/form/SecurityGroupSelector.js
@@ -34,7 +34,13 @@ Ext.define('PVE.form.SecurityGroupsSelector', {
 		    {
 			header: gettext('Comment'),
 			dataIndex: 'comment',
-			renderer: Ext.String.htmlEncode,
+			renderer: function(value, metaData) {
+			    let comment = Ext.String.htmlEncode(value) || '';
+			    if (comment.length * 12 > metaData.column.cellWidth) {
+				comment = `<span data-qtip="${comment}">${comment}</span>`;
+			    }
+			    return comment;
+			},
 			flex: 1,
 		    },
 		],
-- 
2.39.5




More information about the pve-devel mailing list