]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: firewall grid: fix rendering comment, only show tooltip when truncated
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Feb 2021 13:28:35 +0000 (14:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Feb 2021 13:28:38 +0000 (14:28 +0100)
avoid showing "undefined" if there's no comment, renderer must not
return null or undefined directly, it will converted to string as is,
so always fallback to '' empty string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/grid/FirewallRules.js

index f7f304b88f760fe1c32d33d244005ee37960b60f..cb9966ca08c208cad20fd0165e6312e3088ed4c9 100644 (file)
@@ -763,10 +763,12 @@ Ext.define('PVE.FirewallRules', {
                dataIndex: 'comment',
                flex: 6,
                renderer: function(value, metaData, record) {
-                   let comment = render_errors('comment', Ext.util.Format.htmlEncode(value), metaData, record);
-                   return `<span data-qtip="${comment}">${comment}</span>`;
-},
-
+                   let comment = render_errors('comment', Ext.util.Format.htmlEncode(value), metaData, record) || '';
+                   if (comment.length * 12 > metaData.column.cellWidth) {
+                       comment = `<span data-qtip="${comment}">${comment}</span>`;
+                   }
+                   return comment;
+               },
            },
        );