Improve health card

This commit is contained in:
Joshua Boniface 2025-02-26 23:14:39 -05:00
parent f97e3f2203
commit 5d0f390dec
2 changed files with 52 additions and 61 deletions

View File

@ -240,11 +240,11 @@ onUnmounted(() => {
display: grid;
gap: 1rem;
grid-template-columns: 2fr 3fr;
min-height: 500px;
}
.overview-row > * {
height: 100%;
min-height: 400px;
}
@media (max-width: 1200px) {

View File

@ -10,32 +10,32 @@
<h6 class="card-subtitle mb-2 text-muted">Cluster Health</h6>
<div class="health-content">
<div class="health-graph">
<div class="health-percentage">
<h4 :class="['health-title', getHealthClass(clusterData.cluster_health?.health)]">
{{ clusterData.cluster_health?.health || 0 }}%
</h4>
</div>
<Line
:data="healthChartData"
:options="healthChartOptions"
/>
</div>
<div class="health-overlay">
<div class="health-status">
<h4 :class="['health-title', getHealthClass(clusterData.cluster_health?.health)]">
{{ clusterData.cluster_health?.health || 0 }}%
</h4>
<div class="health-messages">
<template v-if="clusterData.cluster_health?.messages?.length">
<div
v-for="(msg, idx) in clusterData.cluster_health.messages"
:key="idx"
class="health-message"
:title="msg.text || 'No details available'"
>
<i class="fas fa-circle-exclamation me-1"></i>
<span class="message-text">{{ msg.id || 'Unknown Issue' }}</span>
</div>
</template>
<div v-else class="health-message healthy">
<i class="fas fa-check-circle me-1"></i>
<span>No issues detected</span>
<div class="health-messages">
<div class="messages-grid">
<template v-if="clusterData.cluster_health?.messages?.length">
<div
v-for="(msg, idx) in clusterData.cluster_health.messages"
:key="idx"
class="health-message"
:title="msg.text || 'No details available'"
>
<i class="fas fa-circle-exclamation me-1"></i>
<span class="message-text">{{ msg.id || 'Unknown Issue' }}</span>
</div>
</template>
<div v-else class="health-message healthy">
<i class="fas fa-check-circle me-1"></i>
<span>No issues detected</span>
</div>
</div>
</div>
@ -171,7 +171,8 @@ const healthChartData = computed(() => {
borderColor: colors.border,
borderWidth: 1.5,
tension: 0.4,
pointRadius: 0
pointRadius: 2,
pointBackgroundColor: colors.border
}]
};
});
@ -188,22 +189,23 @@ const healthChartOptions = {
x: {
display: false,
grid: {
display: false
}
display: false,
},
},
y: {
display: false,
grid: {
display: false
display: false,
},
min: 0,
max: 100,
beginAtZero: true
}
},
animation: false,
interaction: {
enabled: false
enabled: true,
mode: 'nearest',
intersect: false
}
};
</script>
@ -224,43 +226,29 @@ const healthChartOptions = {
}
.health-content {
position: relative;
height: 250px;
display: flex;
flex-direction: column;
gap: 1rem;
min-height: 300px;
height: auto;
width: 100%;
}
.health-graph {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
position: relative;
height: 200px;
}
.health-overlay {
.health-percentage {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
}
.health-status {
text-align: center;
padding: 1rem;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.9);
padding: 1rem;
border-radius: 0.5rem;
display: flex;
flex-direction: column;
gap: 1rem;
min-width: 300px;
max-width: 400px;
box-shadow: 0 0 10px rgba(0,0,0,0.05);
z-index: 2;
}
.health-title {
@ -270,14 +258,16 @@ const healthChartOptions = {
}
.health-messages {
display: flex;
flex-direction: column;
gap: 0.5rem;
max-height: 100px;
overflow-y: auto;
background: rgba(255, 255, 255, 0.95);
padding: 1rem;
background: rgba(0, 0, 0, 0.02);
border-radius: 0.25rem;
padding: 0.5rem;
flex-grow: 1;
}
.messages-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 0.5rem;
}
.health-message {
@ -291,6 +281,7 @@ const healthChartOptions = {
overflow: hidden;
text-overflow: ellipsis;
position: relative;
height: fit-content;
}
.health-message.healthy {