mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-03 01:04:30 +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';
|
||||
},
|
||||
|
||||
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) {
|
||||
if (value === undefined) {
|
||||
return '-';
|
||||
|
@ -198,15 +198,7 @@ Ext.define('Proxmox.node.Tasks', {
|
||||
return '';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
return Proxmox.Utils.format_task_status(value);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user