From 53ac9bca54bc89fa1bc31bf8b3d3d9a19e0b5cb7 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 31 Jan 2017 12:18:29 +0100 Subject: [PATCH] add render_upid to Proxmox.Utils --- Utils.js | 14 ++++++++++++++ node/Tasks.js | 7 +------ window/TaskViewer.js | 8 +++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Utils.js b/Utils.js index fa27fe0..86a5de8 100644 --- a/Utils.js +++ b/Utils.js @@ -214,6 +214,18 @@ Ext.define('Proxmox.Utils', { utilities: { } }, + // you can override this to provide nicer task descriptions + format_task_description: function(type, id) { + return type + ' ' + id; + }, + + render_upid: function(value, metaData, record) { + var type = record.data.type; + var id = record.data.id; + + return Proxmox.Utils.format_task_description(type, id); + }, + parse_task_upid: function(upid) { var task = {}; @@ -229,6 +241,8 @@ Ext.define('Proxmox.Utils', { utilities: { task.id = res[6]; task.user = res[7]; + task.desc = Proxmox.Utils.format_task_description(task.type, task.id); + return task; }, diff --git a/node/Tasks.js b/node/Tasks.js index 55d9939..57d82eb 100644 --- a/node/Tasks.js +++ b/node/Tasks.js @@ -8,11 +8,6 @@ Ext.define('Proxmox.node.Tasks', { sortableColumns: false, vmidFilter: 0, - render_upid: function(upid) { - var task = Proxmox.Utils.parse_task_upid(upid); - return task.type + ' ' + task.id; - }, - initComponent : function() { var me = this; @@ -147,7 +142,7 @@ Ext.define('Proxmox.node.Tasks', { header: gettext("Description"), dataIndex: 'upid', flex: 1, - renderer: me.render_upid + renderer: Proxmox.Utils.render_upid }, { header: gettext("Status"), diff --git a/window/TaskViewer.js b/window/TaskViewer.js index 597404f..7a2ada4 100644 --- a/window/TaskViewer.js +++ b/window/TaskViewer.js @@ -47,11 +47,10 @@ Ext.define('Proxmox.window.TaskProgress', { } }); - // fixme: ?? - //var descr = Proxmox.Utils.format_task_description(task.type, task.id); + var descr = Proxmox.Utils.format_task_description(task.type, task.id); Ext.apply(me, { - title: "Task: " + me.upid, + title: gettetx('Task') + ': ' + descr, width: 300, layout: 'auto', modal: true, @@ -203,8 +202,7 @@ Ext.define('Proxmox.window.TaskViewer', { statstore.startUpdate(); Ext.apply(me, { - // fixme: better title - title: "Task viewer: " + me.upid, + title: "Task viewer: " + task.desc, width: 800, height: 400, layout: 'fit',