[pve-devel] [PATCH widget-toolkit 1/2] Utils: add get_health_icon from PVE

Dominik Csapak d.csapak at proxmox.com
Fri Jul 2 12:48:58 CEST 2021


we'll need it here too

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/Utils.js | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/Utils.js b/src/Utils.js
index bc602de..866cd83 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -1106,6 +1106,42 @@ utilities: {
 	container.updateLayout();
 	container.updateLayout();
     },
+
+    get_health_icon: function(state, circle) {
+	if (circle === undefined) {
+	    circle = false;
+	}
+
+	if (state === undefined) {
+	    state = 'uknown';
+	}
+
+	var icon = 'faded fa-question';
+	switch (state) {
+	    case 'good':
+		icon = 'good fa-check';
+		break;
+	    case 'upgrade':
+		icon = 'warning fa-upload';
+		break;
+	    case 'old':
+		icon = 'warning fa-refresh';
+		break;
+	    case 'warning':
+		icon = 'warning fa-exclamation';
+		break;
+	    case 'critical':
+		icon = 'critical fa-times';
+		break;
+	    default: break;
+	}
+
+	if (circle) {
+	    icon += '-circle';
+	}
+
+	return icon;
+    },
 },
 
     singleton: true,
-- 
2.30.2






More information about the pve-devel mailing list