mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-02 15:09:25 +00:00
show Task warnings differently
tasks can now show also 'WARNINGS: <count>' filter it out and provide a 'parse_task_status' function for easy reuse Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
66be1b8ac1
commit
b1d446d0b2
17
src/Utils.js
17
src/Utils.js
@ -711,6 +711,23 @@ utilities: {
|
||||
return task;
|
||||
},
|
||||
|
||||
parse_task_status: function(status) {
|
||||
if (status === 'OK') {
|
||||
return 'ok';
|
||||
}
|
||||
|
||||
if (status === 'unknown') {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
let match = status.match(/^WARNINGS: (.*)$/);
|
||||
if (match) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
return 'error';
|
||||
},
|
||||
|
||||
render_duration: function(value) {
|
||||
if (value === undefined) {
|
||||
return '-';
|
||||
|
@ -14,6 +14,10 @@
|
||||
background-color: #f3d6d7;
|
||||
}
|
||||
|
||||
.proxmox-warning-row {
|
||||
background-color: #f5e5d8;
|
||||
}
|
||||
|
||||
/* some icons have to be color manually */
|
||||
.black {
|
||||
color: #000;
|
||||
|
@ -81,8 +81,13 @@ Ext.define('Proxmox.node.Tasks', {
|
||||
getRowClass: function(record, index) {
|
||||
let status = record.get('status');
|
||||
|
||||
if (status && status !== 'OK') {
|
||||
return "proxmox-invalid-row";
|
||||
if (status) {
|
||||
let parsed = Proxmox.Utils.parse_task_status(status);
|
||||
if (parsed === 'error') {
|
||||
return "proxmox-invalid-row";
|
||||
} else if (parsed === 'warning') {
|
||||
return "proxmox-warning-row";
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
@ -162,14 +167,19 @@ Ext.define('Proxmox.node.Tasks', {
|
||||
dataIndex: 'status',
|
||||
width: 200,
|
||||
renderer: function(value, metaData, record) {
|
||||
if (value === 'OK') {
|
||||
return 'OK';
|
||||
}
|
||||
if (value === undefined && !record.data.endtime) {
|
||||
metaData.tdCls = "x-grid-row-loading";
|
||||
return '';
|
||||
}
|
||||
return "ERROR: " + 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 'ok': // fall-through
|
||||
case 'warning': // fall-through
|
||||
default: return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user