mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-06 19:58:41 +00:00
task status: create helper for formatting
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
df096ae3fc
commit
4294143f92
12
src/Utils.js
12
src/Utils.js
@ -738,6 +738,18 @@ utilities: {
|
|||||||
return 'error';
|
return 'error';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
format_task_status: function(value) {
|
||||||
|
let parsed = Proxmox.Utils.parse_task_status(value);
|
||||||
|
switch (parsed) {
|
||||||
|
case 'unknown': return Proxmox.Utils.unknownText;
|
||||||
|
case 'error': return Proxmox.Utils.errorText + ': ' + value;
|
||||||
|
case 'warning': return Proxmox.Utils.warningsText +
|
||||||
|
value.replace('WARNINGS', '');
|
||||||
|
case 'ok': // fall-through
|
||||||
|
default: return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
render_duration: function(value) {
|
render_duration: function(value) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return '-';
|
return '-';
|
||||||
|
@ -198,15 +198,7 @@ Ext.define('Proxmox.node.Tasks', {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
let parsed = Proxmox.Utils.parse_task_status(value);
|
return Proxmox.Utils.format_task_status(value);
|
||||||
switch (parsed) {
|
|
||||||
case 'unknown': return Proxmox.Utils.unknownText;
|
|
||||||
case 'error': return Proxmox.Utils.errorText + ': ' + value;
|
|
||||||
case 'warning': return Proxmox.Utils.warningsText +
|
|
||||||
value.replace('WARNINGS', '');
|
|
||||||
case 'ok': // fall-through
|
|
||||||
default: return value;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user