From 9375219feffbc5902d9bc1a4d9c4a78b635672ac Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Thu, 27 Feb 2025 00:38:13 -0500 Subject: [PATCH] Improve and unify graphs --- pvc-vue/src/App.vue | 30 +- pvc-vue/src/components/ClusterOverview.vue | 320 +++++++++++++++------ 2 files changed, 239 insertions(+), 111 deletions(-) diff --git a/pvc-vue/src/App.vue b/pvc-vue/src/App.vue index 7fef5ba..9886628 100644 --- a/pvc-vue/src/App.vue +++ b/pvc-vue/src/App.vue @@ -25,14 +25,11 @@ {{ connectionStatusMessage }}
-
- - -
- + +
@@ -246,23 +243,6 @@ onUnmounted(() => { gap: 0.5rem; } -.overview-row { - display: grid; - gap: 0.5rem; - grid-template-columns: 2fr 3fr; -} - -.overview-row > * { - height: 100%; - min-height: 400px; -} - -@media (max-width: 1200px) { - .overview-row { - grid-template-columns: 1fr; - } -} - .metric-card { /* Remove transition and hover effect */ } diff --git a/pvc-vue/src/components/ClusterOverview.vue b/pvc-vue/src/components/ClusterOverview.vue index fd70f40..24858fd 100644 --- a/pvc-vue/src/components/ClusterOverview.vue +++ b/pvc-vue/src/components/ClusterOverview.vue @@ -5,50 +5,96 @@
-
-
-
Cluster Health
-
-
-
-

- {{ clusterData.cluster_health?.health || 0 }}% -

+
+
+
+
Cluster Health
+
+
+
+
+
+

+ {{ clusterData.cluster_health?.health || 0 }}% +

+
+
- -
-
-
- -
- - No issues detected
+ +
+
+
+ CPU Utilization + + {{ metricsData.cpu.data[metricsData.cpu.data.length - 1] || 0 }}% + +
+
+
+ +
+
+ +
+
+
+ Memory Utilization + + {{ metricsData.memory.data[metricsData.memory.data.length - 1] || 0 }}% + +
+
+
+ +
+
+ +
+
+
+ Storage Utilization + + {{ metricsData.storage?.data[metricsData.storage?.data.length - 1] || 0 }}% + +
+
+
+ +
+
@@ -145,10 +191,10 @@ const props = defineProps({ required: true, default: () => ({}) }, - metricsHistory: { + metricsData: { type: Object, required: true, - default: () => ({ labels: [], data: [] }) + default: () => ({}) } }); @@ -173,9 +219,9 @@ const getDeltaClass = (delta) => { const healthChartData = computed(() => { return { - labels: props.metricsHistory.labels, + labels: props.metricsData.health.labels, datasets: [{ - data: props.metricsHistory.data, + data: props.metricsData.health.data, fill: true, segment: { borderColor: (ctx) => { @@ -263,6 +309,83 @@ const healthChartOptions = { intersect: false } }; + +const cpuChartData = computed(() => ({ + labels: props.metricsData.cpu.labels, + datasets: [{ + label: 'CPU', + data: props.metricsData.cpu.data, + borderColor: 'rgb(75, 192, 192)', + fill: false + }] +})); + +const memoryChartData = computed(() => ({ + labels: props.metricsData.memory.labels, + datasets: [{ + label: 'Memory', + data: props.metricsData.memory.data, + borderColor: 'rgb(153, 102, 255)', + fill: false + }] +})); + +const storageChartData = computed(() => ({ + labels: props.metricsData.storage?.labels || [], + datasets: [{ + label: 'Storage', + data: props.metricsData.storage?.data || [], + borderColor: 'rgb(255, 159, 64)', + fill: false + }] +})); + +const chartOptions = { + responsive: true, + maintainAspectRatio: false, + clip: false, + plugins: { + legend: { + display: false + }, + tooltip: { + callbacks: { + label: (context) => `${context.parsed.y}%` + } + } + }, + scales: { + x: { + display: false, + grid: { + display: false + } + }, + y: { + display: true, + grid: { + display: true + }, + min: 0, + max: 100, + ticks: { + stepSize: 20 + } + } + }, + elements: { + point: { + radius: 0, + hoverRadius: 4 + } + }, + animation: false, + interaction: { + enabled: true, + mode: 'nearest', + intersect: false + } +};