Include maintenance mode in node health graphs

This commit is contained in:
Joshua Boniface 2025-03-01 23:02:16 -05:00
parent 77adaea793
commit f29f18eb26
2 changed files with 19 additions and 5 deletions

View File

@ -169,7 +169,7 @@ const updateMetricsHistory = (timestamp, status) => {
if (!metricsHistory.value.nodes[nodeName]) {
metricsHistory.value.nodes[nodeName] = {
health: { labels: [], data: [] },
health: { labels: [], data: [], maintenance: [] },
cpu: { labels: [], data: [] },
memory: { labels: [], data: [] },
allocated: { labels: [], data: [] }
@ -197,8 +197,14 @@ const updateMetricsHistory = (timestamp, status) => {
metricsHistory.value.nodes[nodeName][metric] = {
labels: nodeLabels,
data: nodeData
data: nodeData,
...(metric === 'health' ? { maintenance: [...(metricsHistory.value.nodes[nodeName][metric].maintenance || []), isInMaintenance] } : {})
};
// Trim maintenance array if needed
if (metric === 'health' && metricsHistory.value.nodes[nodeName][metric].maintenance.length > 180) {
metricsHistory.value.nodes[nodeName][metric].maintenance.shift();
}
});
});
};

View File

@ -115,6 +115,7 @@
title="Node Health"
:value="selectedNodeData.health || 0"
:chart-data="nodeHealthChartData"
:maintenance="isMaintenanceMode"
/>
<!-- CPU Utilization Chart -->
@ -452,7 +453,12 @@ const formatMemory = (memoryMB) => {
return Math.round(memoryMB / 1024) + ' GB';
};
// Prepare chart data for the node
// Check if the cluster is in maintenance mode
const isMaintenanceMode = computed(() => {
return props.clusterData.maintenance === "true";
});
// Update the nodeHealthChartData computed property to include maintenance data
const nodeHealthChartData = computed(() => {
// Get node metrics history if available
const nodeMetrics = props.metricsData.nodes?.[selectedNodeData.value?.name];
@ -460,14 +466,16 @@ const nodeHealthChartData = computed(() => {
if (nodeMetrics && nodeMetrics.health && nodeMetrics.health.data.length > 0) {
return {
labels: nodeMetrics.health.labels,
data: nodeMetrics.health.data
data: nodeMetrics.health.data,
maintenance: nodeMetrics.health.maintenance || []
};
}
// Fallback to current value only
return {
labels: ['Health'],
data: [selectedNodeData.value?.health || 0]
data: [selectedNodeData.value?.health || 0],
maintenance: [isMaintenanceMode.value]
};
});