fix: alert panel always visible, version display normalization

- Remove x-show condition hiding alert panel when no alerts exist
- Add empty state message explaining alerts appear on rule triggers
- Normalize appVersion in loadVersion() to strip leading 'v' (prevents vv1.7.0 in footer)
This commit is contained in:
2026-04-22 14:21:34 +02:00
parent 0a16cf6870
commit 94983c43e9
2 changed files with 15 additions and 3 deletions

View File

@@ -70,7 +70,7 @@
</div>
</section>
<section class="panel" x-show="alertSummary.total_open > 0 || alerts.length > 0">
<section class="panel">
<div class="panel-header">
<h3>Alerts</h3>
<span x-text="`${alertSummary.total_open} open`" class="alert-open-count"></span>
@@ -90,7 +90,7 @@
<option value="low">Low</option>
</select>
</div>
<div class="alerts-list">
<div class="alerts-list" x-show="alerts.length > 0">
<template x-for="alert in alerts" :key="alert._id || alert.event_id">
<div class="alert-card" :class="'alert-card--' + alert.severity">
<div class="alert-card__meta">
@@ -109,6 +109,9 @@
</div>
</template>
</div>
<div class="alerts-empty" x-show="alerts.length === 0">
<p>No alerts match the current filters. Alerts appear here when rules trigger during event ingestion.</p>
</div>
<div class="pagination" x-show="alertsTotal > 20">
<button type="button" :disabled="alertsPage === 1" @click="alertsPage--; loadAlerts()">Prev</button>
<span x-text="`Page ${alertsPage}`"></span>
@@ -415,7 +418,7 @@
const res = await fetch('/api/version');
if (res.ok) {
const body = await res.json();
this.appVersion = body.version || '';
this.appVersion = (body.version || '').replace(/^v/, '');
}
} catch {}
},

View File

@@ -809,6 +809,15 @@ input {
flex-wrap: wrap;
}
.alerts-empty {
padding: 20px;
text-align: center;
color: var(--muted);
font-size: 14px;
border: 1px dashed var(--border);
border-radius: 10px;
}
@media (max-width: 640px) {
.topbar {
flex-direction: column;