mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-06-27 13:45:28 +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;
|
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) {
|
render_duration: function(value) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return '-';
|
return '-';
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
background-color: #f3d6d7;
|
background-color: #f3d6d7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.proxmox-warning-row {
|
||||||
|
background-color: #f5e5d8;
|
||||||
|
}
|
||||||
|
|
||||||
/* some icons have to be color manually */
|
/* some icons have to be color manually */
|
||||||
.black {
|
.black {
|
||||||
color: #000;
|
color: #000;
|
||||||
|
@ -81,8 +81,13 @@ Ext.define('Proxmox.node.Tasks', {
|
|||||||
getRowClass: function(record, index) {
|
getRowClass: function(record, index) {
|
||||||
let status = record.get('status');
|
let status = record.get('status');
|
||||||
|
|
||||||
if (status && status !== 'OK') {
|
if (status) {
|
||||||
|
let parsed = Proxmox.Utils.parse_task_status(status);
|
||||||
|
if (parsed === 'error') {
|
||||||
return "proxmox-invalid-row";
|
return "proxmox-invalid-row";
|
||||||
|
} else if (parsed === 'warning') {
|
||||||
|
return "proxmox-warning-row";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
@ -162,14 +167,19 @@ Ext.define('Proxmox.node.Tasks', {
|
|||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
width: 200,
|
width: 200,
|
||||||
renderer: function(value, metaData, record) {
|
renderer: function(value, metaData, record) {
|
||||||
if (value === 'OK') {
|
|
||||||
return 'OK';
|
|
||||||
}
|
|
||||||
if (value === undefined && !record.data.endtime) {
|
if (value === undefined && !record.data.endtime) {
|
||||||
metaData.tdCls = "x-grid-row-loading";
|
metaData.tdCls = "x-grid-row-loading";
|
||||||
return '';
|
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