module Web.View.Hubs.BottleneckDashboard where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Data.Time.Clock (diffUTCTime, getCurrentTime) data BottleneckDashboardView = BottleneckDashboardView { hub :: !Hub , widgets :: ![Widget] , bottlenecks :: ![BottleneckRecord] } instance View BottleneckDashboardView where html BottleneckDashboardView { .. } = [hsx|
{forEach stages renderStageSection} {if null bottlenecks then [hsx|No active bottlenecks detected.
|] else mempty} |] where stages = ["candidate", "requirement", "decision", "observation"] :: [Text] stageLabel s = case s of "candidate" -> "Stale Candidates (>30 days open)" "requirement" -> "Requirements Without Decision (>60 days)" "decision" -> "Decisions Without Deployment (>30 days)" "observation" -> "Deployments Without Outcome Signal (>14 days)" _ -> s active = filter (\b -> isNothing b.resolvedAt) bottlenecks renderStageSection :: Text -> Html renderStageSection stage = let stageBNs = filter (\b -> b.stage == stage) active in if null stageBNs then mempty else [hsx|| Subject | Stalled Since | Severity |
|---|