]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
utils: task descriptions: allow to use functions
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 25 May 2020 16:27:18 +0000 (18:27 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 25 May 2020 16:28:21 +0000 (18:28 +0200)
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>
Utils.js

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