add render_upid to Proxmox.Utils

This commit is contained in:
Dietmar Maurer 2017-01-31 12:18:29 +01:00
parent de2e10b511
commit 53ac9bca54
3 changed files with 18 additions and 11 deletions

View File

@ -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;
},

View File

@ -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"),

View File

@ -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',