diff --git a/app.py b/app.py index 2f6cd07..fb90ddd 100644 --- a/app.py +++ b/app.py @@ -160,6 +160,16 @@ def index(): last_check = db.get_state('last_check', 'Never') snapshot = json.loads(snapshot_raw) if snapshot_raw else {} suppressions = db.get_active_suppressions() + for ev in events: + sup_type = ( + 'unifi_device' if ev.get('event_type') == 'unifi_device_offline' + else 'interface' if ev.get('event_type') == 'interface_down' + else 'host' + ) + ev['is_suppressed'] = db.check_suppressed( + suppressions, sup_type, + ev.get('target_name', ''), ev.get('target_detail', '') or '', + ) recent_resolved = db.get_recent_resolved(hours=24, limit=10) return render_template( 'index.html', @@ -214,6 +224,17 @@ def suppressions_page(): @require_auth def api_status(): active = db.get_active_events(limit=_PAGE_LIMIT) + suppressions = db.get_active_suppressions() + for ev in active: + sup_type = ( + 'unifi_device' if ev.get('event_type') == 'unifi_device_offline' + else 'interface' if ev.get('event_type') == 'interface_down' + else 'host' + ) + ev['is_suppressed'] = db.check_suppressed( + suppressions, sup_type, + ev.get('target_name', ''), ev.get('target_detail', '') or '', + ) last_check = db.get_state('last_check', 'Never') return jsonify({ 'summary': db.get_status_summary(), diff --git a/static/app.js b/static/app.js index c077aef..82c2010 100644 --- a/static/app.js +++ b/static/app.js @@ -222,9 +222,12 @@ function updateEventsTable(events, totalActive) { ? `#${e.ticket_id}` : '–'; + const supBadge = e.is_suppressed + ? `🔕 sup` + : ''; return ` - - ${e.severity} + + ${e.severity}${supBadge} ${lt.escHtml(e.event_type.replace(/_/g,' '))} ${lt.escHtml(e.target_name)} ${lt.escHtml(e.target_detail || '–')} diff --git a/static/style.css b/static/style.css index 35e3f18..b8097e9 100644 --- a/static/style.css +++ b/static/style.css @@ -203,6 +203,8 @@ .lt-table tr.row-warning td { background: rgba(255,107,0,.04); } .lt-table tr.row-warning td:first-child { border-left: 2px solid var(--orange); } .lt-table tr.row-resolved td { opacity: .65; } +.lt-table tr.row-suppressed td { opacity: .6; } +.lt-table tr.row-suppressed td:first-child{ border-left-color: var(--text-muted) !important; } /* ── Table size modifier ─────────────────────────────────────────── */ .lt-table-sm th, diff --git a/templates/index.html b/templates/index.html index 156b0b0..9842983 100644 --- a/templates/index.html +++ b/templates/index.html @@ -111,8 +111,11 @@ {% for e in events %} {% if e.severity != 'info' %} - - {{ e.severity }} + + + {{ e.severity }} + {% if e.is_suppressed %}🔕 sup{% endif %} + {{ e.event_type | replace('_', ' ') }} {{ e.target_name }} {{ e.target_detail or '–' }}