From f2652380fcee7724a1cbf526faee1b4b7eca3d7f Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Thu, 27 Feb 2025 01:22:10 -0500 Subject: [PATCH] Add maintenance colourization to health graph --- pvc-vue/src/App.vue | 11 +-- pvc-vue/src/components/ClusterOverview.vue | 78 ++++++++++++++++++++-- 2 files changed, 79 insertions(+), 10 deletions(-) diff --git a/pvc-vue/src/App.vue b/pvc-vue/src/App.vue index 9886628..3a3061f 100644 --- a/pvc-vue/src/App.vue +++ b/pvc-vue/src/App.vue @@ -57,7 +57,8 @@ const metricsHistory = ref({ cpu: { labels: [], data: [] }, memory: { labels: [], data: [] }, health: { labels: [], data: [] }, - storage: { labels: [], data: [] } + storage: { labels: [], data: [] }, + maintenance: { labels: [], data: [] } }); const showConnectionStatus = ref(false); @@ -83,17 +84,19 @@ const saveConfig = async (newConfig) => { }; const updateMetricsHistory = (timestamp, status) => { - // Create new arrays instead of mutating const metrics = { cpu: status.resources?.cpu?.utilization || 0, memory: status.resources?.memory?.utilization || 0, health: status.cluster_health?.health || 0, - storage: status.resources?.disk?.utilization || 0 + storage: status.resources?.disk?.utilization || 0, + maintenance: status.maintenance === "true" ? true : false }; Object.keys(metrics).forEach(metric => { const labels = [...metricsHistory.value[metric].labels, timestamp]; - const data = [...metricsHistory.value[metric].data, Math.round(metrics[metric])]; + const data = [...metricsHistory.value[metric].data, + typeof metrics[metric] === 'boolean' ? metrics[metric] : Math.round(metrics[metric]) + ]; // Keep only last 180 points if (labels.length > 180) { diff --git a/pvc-vue/src/components/ClusterOverview.vue b/pvc-vue/src/components/ClusterOverview.vue index 10b4c15..e26d74d 100644 --- a/pvc-vue/src/components/ClusterOverview.vue +++ b/pvc-vue/src/components/ClusterOverview.vue @@ -123,9 +123,9 @@
-