generated from coulomb/repo-seed
fix(WP-0014): pre-flight compilation fixes, Tailwind pipeline, and admin seed
A2 — Compilation fixes: - Remove inline FK constraints from Schema.sql; IHP schema compiler cannot parse them. Add 1744329600-restore-fk-constraints.sql migration to restore referential integrity at the DB level. - Rename `#label` → `#label_` throughout to avoid clash with Haskell built-in. - Fix `hub.id == hid` UUID comparisons to use `toUUID hub.id`. - Replace non-existent `setStatus`/`respondJson` calls with `renderJsonWithStatusCode` throughout Api controllers. - Fix qualified package import for `cryptohash-sha256` in Auth.hs. - Add `CanSelect (Text, Text)` instance in Helper.View. - Refactor HSX inline lambdas to named helper functions in 100+ views (GHC cannot infer types for anonymous functions inside quasi-quoted HSX). - Fix missing imports (IHP.QueryBuilder, IHP.Fetch, Web.Routes, Only, etc.) across helpers and controllers. - Remove duplicate `diffUTCTime` definition in BottleneckDetector. - Change `createEventForHub` return type from `IO ResponseReceived` to `IO ()`. - Seed type-registry vocabulary via 1744502400-seed-type-registries.sql (moved from Schema.sql where IHP does not execute INSERT statements). A3 — Tailwind build pipeline: - Add `tailwindcss` to flake.nix native packages. - Uncomment `tailwind.exec` process in devenv shell config. - Add tailwind/tailwind.config.js (scans Web/View/**/*.hs). - Add tailwind/app.css with @tailwind directives. A4 — Admin user seed: - Add 1744416000-seed-admin-user.sql: inserts admin@inter-hub.local with bcrypt-hashed password admin1234! (cost 10). - Add .env.example documenting all required environment variables and default admin credentials. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.Routes ()
|
||||
|
||||
data AgentAuditDashboardView = AgentAuditDashboardView
|
||||
{ hub :: !Hub
|
||||
@@ -19,7 +20,7 @@ instance View AgentAuditDashboardView where
|
||||
<h1 class="text-2xl font-semibold">Agent Audit Dashboard</h1>
|
||||
<p class="text-sm text-gray-500">{hub.name}</p>
|
||||
</div>
|
||||
<a href={ShowHubAction { hubId = hub.id }}
|
||||
<a href={ShowHubAction (hub.id)}
|
||||
class="text-sm text-indigo-600 hover:underline">← Hub</a>
|
||||
</div>
|
||||
|
||||
@@ -35,14 +36,7 @@ instance View AgentAuditDashboardView where
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-5 mb-5">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-3">Proposals by Type</h2>
|
||||
<div class="flex gap-4 flex-wrap">
|
||||
{forEach allTypes (\t ->
|
||||
let cnt = length (filter (\p -> p.proposalType == t) proposals)
|
||||
in [hsx|
|
||||
<div class="flex items-center gap-2">
|
||||
<span class={typeBadge t <> " text-xs px-2 py-0.5 rounded font-medium"}>{t}</span>
|
||||
<span class="text-sm font-semibold text-gray-700">{show cnt}</span>
|
||||
</div>
|
||||
|])}
|
||||
{forEach allTypes (renderTypeCount proposals)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -51,15 +45,7 @@ instance View AgentAuditDashboardView where
|
||||
<div class="px-5 py-3 border-b border-gray-100 bg-yellow-50">
|
||||
<h2 class="text-sm font-semibold text-yellow-800">Unreviewed Queue ({show pendingCount})</h2>
|
||||
</div>
|
||||
{if null pending
|
||||
then [hsx|<p class="text-sm text-gray-400 px-5 py-4">No pending proposals.</p>|]
|
||||
else [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
{forEach (sortByCreatedAt pending) renderQueueRow}
|
||||
</tbody>
|
||||
</table>
|
||||
|]}
|
||||
{renderPendingQueue pending}
|
||||
</div>
|
||||
|
||||
<!-- Recent proposals (last 20) -->
|
||||
@@ -90,20 +76,11 @@ instance View AgentAuditDashboardView where
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left px-3 py-1 text-gray-500">Model</th>
|
||||
{forEach allTypes (\t -> [hsx|
|
||||
<th class="px-3 py-1 text-gray-500">{t}</th>
|
||||
|])}
|
||||
{forEach allTypes renderTypeHeader}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{forEach allModels (\m -> [hsx|
|
||||
<tr class="border-t border-gray-100">
|
||||
<td class="px-3 py-1 font-mono text-gray-600">{m}</td>
|
||||
{forEach allTypes (\t ->
|
||||
let cnt = length (filter (\p -> p.modelRef == m && p.proposalType == t) proposals)
|
||||
in [hsx|<td class="px-3 py-1 text-center text-gray-700">{if cnt == 0 then "—" else show cnt}</td>|])}
|
||||
</tr>
|
||||
|])}
|
||||
{forEach allModels (renderModelRow allTypes proposals)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -121,6 +98,23 @@ instance View AgentAuditDashboardView where
|
||||
allTypes = ["summary", "requirement_draft", "duplicate_flag", "policy_flag", "impl_proposal"]
|
||||
allModels = nub (map (.modelRef) proposals)
|
||||
|
||||
renderTypeHeader :: Text -> Html
|
||||
renderTypeHeader t = [hsx|<th class="px-3 py-1 text-gray-500">{t}</th>|]
|
||||
|
||||
renderModelRow :: [Text] -> [AgentProposal] -> Text -> Html
|
||||
renderModelRow types props m = [hsx|
|
||||
<tr class="border-t border-gray-100">
|
||||
<td class="px-3 py-1 font-mono text-gray-600">{m}</td>
|
||||
{forEach types (renderMatrixCell props m)}
|
||||
</tr>
|
||||
|]
|
||||
|
||||
renderMatrixCell :: [AgentProposal] -> Text -> Text -> Html
|
||||
renderMatrixCell props m t =
|
||||
let cnt = length (filter (\p -> p.modelRef == m && p.proposalType == t) props)
|
||||
display = if cnt == 0 then "—" else show cnt
|
||||
in [hsx|<td class="px-3 py-1 text-center text-gray-700">{display}</td>|]
|
||||
|
||||
kpiCard :: Text -> Text -> Text -> Html
|
||||
kpiCard label value colorClass = [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-4">
|
||||
@@ -139,7 +133,7 @@ renderQueueRow p = [hsx|
|
||||
</td>
|
||||
<td class="px-4 py-2 text-gray-400 text-xs">{show p.createdAt}</td>
|
||||
<td class="px-4 py-2">
|
||||
<a href={ShowAgentProposalAction { agentProposalId = p.id }}
|
||||
<a href={ShowAgentProposalAction (p.id)}
|
||||
class="text-xs text-indigo-600 hover:underline">Review →</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -149,7 +143,7 @@ renderRecentRow :: [Widget] -> AgentProposal -> Html
|
||||
renderRecentRow widgets p = [hsx|
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-4 py-2">
|
||||
<a href={ShowAgentProposalAction { agentProposalId = p.id }}
|
||||
<a href={ShowAgentProposalAction (p.id)}
|
||||
class={typeBadge p.proposalType <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
||||
{p.proposalType}
|
||||
</a>
|
||||
@@ -165,6 +159,26 @@ renderRecentRow widgets p = [hsx|
|
||||
</tr>
|
||||
|]
|
||||
|
||||
renderTypeCount :: [AgentProposal] -> Text -> Html
|
||||
renderTypeCount proposals t =
|
||||
let cnt = length (filter (\p -> p.proposalType == t) proposals)
|
||||
in [hsx|
|
||||
<div class="flex items-center gap-2">
|
||||
<span class={typeBadge t <> " text-xs px-2 py-0.5 rounded font-medium"}>{t}</span>
|
||||
<span class="text-sm font-semibold text-gray-700">{show cnt}</span>
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderPendingQueue :: [AgentProposal] -> Html
|
||||
renderPendingQueue [] = [hsx|<p class="text-sm text-gray-400 px-5 py-4">No pending proposals.</p>|]
|
||||
renderPendingQueue pending = [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
{forEach (sortByCreatedAt pending) renderQueueRow}
|
||||
</tbody>
|
||||
</table>
|
||||
|]
|
||||
|
||||
widgetName :: [Widget] -> Maybe (Id Widget) -> Text
|
||||
widgetName _ Nothing = "—"
|
||||
widgetName widgets (Just wid) = maybe "—" (.name) (find (\w -> w.id == wid) widgets)
|
||||
|
||||
Reference in New Issue
Block a user