gui: refactor render_full_name

this also fixes a missing  htmlEncode in UserSelector

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-11-19 12:51:38 +01:00 committed by Thomas Lamprecht
parent c460f95dc1
commit 123273bb92
3 changed files with 8 additions and 16 deletions

View File

@ -806,6 +806,12 @@ Ext.define('PVE.Utils', { utilities: {
return value;
},
render_full_name: function(firstname, metaData, record) {
var first = firstname || '';
var last = record.data.lastname || '';
return Ext.htmlEncode(first + " " + last);
},
windowHostname: function() {
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
function(m, addr, offset, original) { return addr; });

View File

@ -92,13 +92,6 @@ Ext.define('PVE.dc.UserView', {
edit_btn, remove_btn, pwchange_btn
];
var render_full_name = function(firstname, metaData, record) {
var first = firstname || '';
var last = record.data.lastname || '';
return Ext.htmlEncode(first + " " + last);
};
var render_username = function(userid) {
return userid.match(/^(.+)(@[^@]+)$/)[1];
};
@ -147,7 +140,7 @@ Ext.define('PVE.dc.UserView', {
header: gettext('Name'),
width: 150,
sortable: true,
renderer: render_full_name,
renderer: PVE.Utils.render_full_name,
dataIndex: 'firstname'
},
{

View File

@ -21,13 +21,6 @@ Ext.define('PVE.form.UserSelector', {
}]
});
var render_full_name = function(firstname, metaData, record) {
var first = firstname || '';
var last = record.data.lastname || '';
return first + " " + last;
};
Ext.apply(me, {
store: store,
listConfig: {
@ -41,7 +34,7 @@ Ext.define('PVE.form.UserSelector', {
{
header: gettext('Name'),
sortable: true,
renderer: render_full_name,
renderer: PVE.Utils.render_full_name,
dataIndex: 'firstname',
flex: 1
},