module Web.View.Hubs.HubHealthHistory where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Application.Helper.HubHealth (healthScoreBadge) data HubHealthHistoryView = HubHealthHistoryView { hub :: !Hub , snapshots :: ![HubHealthSnapshot] } instance View HubHealthHistoryView where html HubHealthHistoryView { .. } = [hsx|

Hub Health History

{hub.name}

Take Snapshot ← Hub
{case snapshots of [] -> [hsx|

No snapshots yet. Take the first one.

|] (latest : _) -> [hsx|

Current Health Score

healthScoreBadge latest.healthScore}> {show latest.healthScore}
Open candidates: {show latest.openCandidates}
Regressed widgets: {show latest.regressedWidgets}
Stale decisions: {show latest.staleDecisions}
Active bottlenecks: {show latest.activeBottlenecks}
|]} {if null snapshots then mempty else [hsx|
{forEach snapshots renderRow}
Score Open Cand. Regressed Stale Dec. Bottlenecks Taken At
|]} |] renderRow :: HubHealthSnapshot -> Html renderRow s = [hsx| healthScoreBadge s.healthScore}> {show s.healthScore} {show s.openCandidates} {show s.regressedWidgets} {show s.staleDecisions} {show s.activeBottlenecks} {show s.computedAt} |]