]>
git.proxmox.com Git - pve-manager.git/blob - www/mobile/TaskViewer.js
1 Ext
.define('PVE.TaskViewer', {
3 alias
: 'widget.pveTaskViewer',
6 pathMatch: function(loc
) {
7 return loc
.match(/^nodes\/([^\s\/]+)\/tasks\/([^\s\/]+)$/);
14 taskStatus
: 'running', // assume running
24 styleHtmlContent
: true,
25 style
: 'background-color:white;',
28 '<table style="margin-bottom:0px;">',
30 '<tr><td>{key}</td><td>{value}</td></tr>',
46 styleHtmlContent
: true,
47 style
: 'background-color:white;white-space: pre;font-family: Monospace;',
54 reloadLog: function() {
57 var logCmp
= me
.down('#taskLog');
59 PVE
.Utils
.API2Request({
60 url
: "/nodes/" + me
.nodename
+ "/tasks/" + me
.upid
+ "/log",
62 success: function(response
) {
63 var d
= response
.result
.data
;
66 Ext
.Array
.each(d
, function(el
) {
67 text
+= Ext
.htmlEncode(el
.t
) + "\n";
69 logCmp
.setData({ text
: text
});
71 failure: function(response
) {
72 logCmp
.setData({ text
: response
.htmlStatus
} );
80 var statusCmp
= me
.down('#taskStatus');
81 var logCmp
= me
.down('#taskLog');
83 PVE
.Utils
.API2Request({
84 url
: "/nodes/" + me
.nodename
+ "/tasks/" + me
.upid
+ "/status",
86 success: function(response
) {
89 var d
= response
.result
.data
;
92 kv
.push({ key
: gettext('Taskstatus'), value
: d
.status
});
93 kv
.push({ key
: gettext('Node'), value
: d
.node
});
94 kv
.push({ key
: gettext('User'), value
: d
.user
});
95 kv
.push({ key
: gettext('Starttime'), value
: Proxmox
.Utils
.render_timestamp(d
.starttime
) });
98 statusCmp
.setData(kv
);
99 if (d
.status
!== 'stopped') {
100 Ext
.defer(me
.reload
, 2000, me
);
103 failure: function(response
) {
104 me
.setMasked({ xtype
: 'loadmask', message
: response
.htmlStatus
} );
109 initialize: function() {
112 var match
= me
.self
.pathMatch(me
.getAppUrl());
114 throw "pathMatch failed";
117 me
.nodename
= match
[1];
120 me
.taskInfo
= Proxmox
.Utils
.parse_task_upid(me
.upid
);
122 me
.down('titlebar').setTitle(me
.taskInfo
.desc
);