From bc1ca6d8ab17adc010112197b7c975abf634ad76 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Wed, 26 Feb 2025 23:49:46 -0500 Subject: [PATCH] More tweaks to health output --- pvc-vue/src/components/ClusterOverview.vue | 79 ++++++++++++++++++---- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/pvc-vue/src/components/ClusterOverview.vue b/pvc-vue/src/components/ClusterOverview.vue index 7ce7047..8a79aa7 100644 --- a/pvc-vue/src/components/ClusterOverview.vue +++ b/pvc-vue/src/components/ClusterOverview.vue @@ -26,11 +26,19 @@
- {{ msg.id || 'Unknown Issue' }} + + {{ msg.id || 'Unknown Issue' }} + + ({{ msg.health_delta }}%) + +
@@ -156,21 +164,44 @@ const getHealthColors = (health) => { return { bg: 'rgba(220, 53, 69, 0.1)', border: 'rgba(220, 53, 69, 0.2)' }; // Red }; +const getDeltaClass = (delta) => { + const value = Math.abs(delta); + if (value <= 5) return 'delta-low'; + if (value <= 10) return 'delta-medium'; + return 'delta-high'; +}; + const healthChartData = computed(() => { const health = props.clusterData.cluster_health?.health || 0; - const colors = getHealthColors(health); return { labels: props.metricsHistory.labels, datasets: [{ data: props.metricsHistory.data, fill: true, - backgroundColor: colors.bg, - borderColor: colors.border, + segment: { + borderColor: (ctx) => { + const value = ctx.p1.parsed.y; + if (value > 90) return 'rgba(40, 167, 69, 0.2)'; // Green + if (value > 50) return 'rgba(255, 193, 7, 0.2)'; // Yellow + return 'rgba(220, 53, 69, 0.2)'; // Red + }, + backgroundColor: (ctx) => { + const value = ctx.p1.parsed.y; + if (value > 90) return 'rgba(40, 167, 69, 0.1)'; // Green + if (value > 50) return 'rgba(255, 193, 7, 0.1)'; // Yellow + return 'rgba(220, 53, 69, 0.1)'; // Red + } + }, borderWidth: 1.5, tension: 0.4, pointRadius: 2, - pointBackgroundColor: colors.border + pointBackgroundColor: (ctx) => { + const value = ctx.parsed.y; + if (value > 90) return 'rgba(40, 167, 69, 0.2)'; // Green + if (value > 50) return 'rgba(255, 193, 7, 0.2)'; // Yellow + return 'rgba(220, 53, 69, 0.2)'; // Red + } }] }; }); @@ -305,8 +336,6 @@ const healthChartOptions = { text-align: left; padding: 0.25rem 0.5rem; border-radius: 0.25rem; - background: rgba(220, 53, 69, 0.1); - color: #dc3545; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -320,11 +349,15 @@ const healthChartOptions = { } .health-message:hover { - background: rgba(0, 0, 0, 0.05); -} - -.health-message.healthy:hover { - background: rgba(40, 167, 69, 0.15); + &.delta-low { + background: rgba(40, 167, 69, 0.15); + } + &.delta-medium { + background: rgba(255, 193, 7, 0.15); + } + &.delta-high { + background: rgba(220, 53, 69, 0.15); + } } .health-message:hover::after { @@ -415,4 +448,24 @@ const healthChartOptions = { .metric-card .card-body { padding: 0.5rem; } + +.health-delta { + margin-left: 0.5rem; + font-size: 0.8em; +} + +.delta-low { + background: rgba(40, 167, 69, 0.1); + color: #0d5524; /* Darker green */ +} + +.delta-medium { + background: rgba(255, 193, 7, 0.1); + color: #856404; /* Darker yellow */ +} + +.delta-high { + background: rgba(220, 53, 69, 0.1); + color: #721c24; /* Darker red */ +}