utils: task descriptions: allow to use functions

Useful if we need to split the ID, or do some more complex rendering
for a task type.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-25 18:27:18 +02:00
parent 4afd5b2f9d
commit 5e80efaeea

View File

@ -560,16 +560,18 @@ Ext.define('Proxmox.Utils', { utilities: {
}, },
format_task_description: function(type, id) { format_task_description: function(type, id) {
var farray = Proxmox.Utils.task_desc_table[type]; let farray = Proxmox.Utils.task_desc_table[type];
var text; let text;
if (!farray) { if (!farray) {
text = type; text = type;
if (id) { if (id) {
type += ' ' + id; type += ' ' + id;
} }
return text; return text;
} else if (Ext.isFunction(farray)) {
return farray(type, id);
} }
var prefix = farray[0]; let prefix = farray[0];
text = farray[1]; text = farray[1];
if (prefix) { if (prefix) {
return prefix + ' ' + id + ' - ' + text; return prefix + ' ' + id + ' - ' + text;