[pbs-devel] [PATCH manager 4/6] ui: cluster task log: handle warnings like the node task log does

Fabian Ebner f.ebner at proxmox.com
Fri Mar 12 13:53:27 CET 2021


Copied the relevant code from widget-toolkit.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Dependency bump for widget-toolkit is needed.

 www/manager6/dc/Tasks.js | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js
index c5075dc3..ddf15642 100644
--- a/www/manager6/dc/Tasks.js
+++ b/www/manager6/dc/Tasks.js
@@ -61,9 +61,15 @@ Ext.define('PVE.dc.Tasks', {
 		getRowClass: function(record, index) {
 		    var 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 '';
 		},
 	    },
 	    sortableColumns: false,
@@ -122,11 +128,16 @@ Ext.define('PVE.dc.Tasks', {
 			    }
 			    return "";
 			}
-			if (value == 'OK') {
-			    return 'OK';
+
+			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;
 			}
-			// metaData.attr = 'style="color:red;"';
-			return Proxmox.Utils.errorText + ': ' + value;
 		    },
 		},
 	    ],
-- 
2.20.1






More information about the pbs-devel mailing list