feat(CORE-001D3B): surface alert history degraded state

This commit is contained in:
Bu5hm4nn
2026-03-26 15:12:04 +01:00
parent 09e03f96a8
commit ff76e326b1
8 changed files with 138 additions and 15 deletions

View File

@@ -170,6 +170,8 @@ async def overview_page(workspace_id: str) -> None:
f"Warning at {alert_status.warning_threshold:.0%} · Critical at {alert_status.critical_threshold:.0%} · "
f"Email alerts {'enabled' if alert_status.email_alerts_enabled else 'disabled'}"
).classes("text-sm text-slate-500 dark:text-slate-400")
if alert_status.history_notice:
ui.label(alert_status.history_notice).classes("text-sm text-amber-700 dark:text-amber-300")
if alert_status.history:
latest = alert_status.history[0]
ui.label(
@@ -211,9 +213,7 @@ async def overview_page(workspace_id: str) -> None:
ui.label(value).classes("text-2xl font-bold text-slate-900 dark:text-slate-50")
ui.label(caption).classes("text-sm text-slate-500 dark:text-slate-400")
with ui.card().classes(
f"w-full rounded-2xl border shadow-sm {recommendation_style('info')}"
):
with ui.card().classes(f"w-full rounded-2xl border shadow-sm {recommendation_style('info')}"):
ui.label("Quick Strategy Recommendations").classes(
"text-lg font-semibold text-slate-900 dark:text-slate-100"
)
@@ -265,6 +265,8 @@ async def overview_page(workspace_id: str) -> None:
f"Logged {_format_timestamp(event.updated_at)} · Spot ${event.spot_price:,.2f} · LTV {event.ltv_ratio:.1%}"
).classes("text-xs text-slate-500 dark:text-slate-400")
ui.label(event.severity.upper()).classes(_alert_badge_classes(event.severity))
elif alert_status.history_notice:
ui.label(alert_status.history_notice).classes("text-sm text-amber-700 dark:text-amber-300")
else:
ui.label(
"No alert history yet. Alerts will be logged once the warning threshold is crossed."

View File

@@ -352,7 +352,10 @@ def settings_page(workspace_id: str) -> None:
alert_message.set_text(alert_status.message)
status.set_text(_save_card_status_text(last_saved_config, preview_config=preview_config))
alert_history_column.clear()
if alert_status.history:
if alert_status.history_notice:
with alert_history_column:
ui.label(alert_status.history_notice).classes("text-sm text-amber-700 dark:text-amber-300")
elif alert_status.history:
for event in alert_status.history[:5]:
with alert_history_column:
with ui.row().classes(