From 779dbe1632692fa7cdd2a5ad728511047cb3bc7d Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 2 Mar 2025 17:31:08 -0500 Subject: [PATCH] Add health messages for nodes --- .../components/pages/nodes/NodeOverview.vue | 227 +++++++++++++++++- 1 file changed, 226 insertions(+), 1 deletion(-) diff --git a/pvc-vue/src/components/pages/nodes/NodeOverview.vue b/pvc-vue/src/components/pages/nodes/NodeOverview.vue index 9cbf3ed..4e17e03 100644 --- a/pvc-vue/src/components/pages/nodes/NodeOverview.vue +++ b/pvc-vue/src/components/pages/nodes/NodeOverview.vue @@ -153,6 +153,52 @@ /> + + + +
+ +
+
+
Health Messages
+
+
+
+ +
+
+ + Node healthy +
+
+ Node is at full health with no faults +
+
+
+
+
+
+
@@ -204,7 +250,8 @@ const sections = ref({ graphs: true, cpu: true, resources: true, - vms: true + vms: true, + health: true }); // State for selected node and tab scrolling @@ -451,6 +498,50 @@ const handleNodeSelect = (node) => { selectedNode.value = node; // Any other node selection handling logic }; + +// Process node health messages +const nodeHealthMessages = computed(() => { + if (!selectedNodeData.value || !selectedNodeData.value.health_details) { + return []; + } + + const healthDetails = selectedNodeData.value.health_details; + // Make sure we're getting an array of health details + if (Array.isArray(healthDetails)) { + return healthDetails; + } else if (typeof healthDetails === 'object') { + // If it's an object, convert to array + return Object.values(healthDetails); + } + return []; +}); + +// Helper function to determine message class based on health status +const getHealthMessageClass = (msg) => { + if (msg.health_delta >= 25) { + return 'delta-high'; // Red for critical issues (>=25%) + } + if (msg.health_delta > 0) { + return 'delta-medium'; + } + return 'delta-low'; // Green for healthy items +}; + +// Helper function to get appropriate icon for health message +const getMessageIcon = (msg) => { + if (msg.health_delta >= 25) { + return 'fa-circle-exclamation me-1'; // Warning icon for significant issues + } + if (msg.health_delta > 0) { + return 'fa-info-circle me-1'; // Info icon for minor issues + } + return 'fa-circle-check me-1'; // Checkmark for healthy items +}; + +// Helper function to format message content +const getMessageContent = (msg) => { + return msg.message || 'No details available'; +}; \ No newline at end of file