ui: firewall grid: fix rendering comment, only show tooltip when truncated

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>
This commit is contained in:
Thomas Lamprecht 2021-02-22 14:28:35 +01:00
parent 1290a65d90
commit 2d1ed7d3cc

View 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;
},
},
);