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,8 @@ import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.Routes ()
|
||||
import Data.Int (Int16)
|
||||
|
||||
data ShowView = ShowView
|
||||
{ record :: !DecisionRecord
|
||||
@@ -33,7 +35,7 @@ instance View ShowView where
|
||||
<span class={outcomeClass record.outcome <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
||||
{record.outcome}
|
||||
</span>
|
||||
<a href={EditDecisionRecordAction { decisionRecordId = record.id }}
|
||||
<a href={EditDecisionRecordAction (record.id)}
|
||||
class="text-sm border border-gray-300 px-3 py-1.5 rounded hover:bg-gray-50">
|
||||
Edit
|
||||
</a>
|
||||
@@ -52,12 +54,7 @@ instance View ShowView where
|
||||
<!-- Linked requirement -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-2">Linked Requirement</h2>
|
||||
{case mRequirement of
|
||||
Nothing -> [hsx|<p class="text-sm text-gray-400">No requirement linked.</p>|]
|
||||
Just req -> [hsx|
|
||||
<a href={ShowRequirementAction { requirementId = req.id }}
|
||||
class="text-sm text-indigo-600 hover:text-indigo-800">{req.title}</a>
|
||||
|]}
|
||||
{renderLinkedRequirement mRequirement}
|
||||
</div>
|
||||
|
||||
<!-- Source candidate -->
|
||||
@@ -67,7 +64,7 @@ instance View ShowView where
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-3">Policy References</h2>
|
||||
{forEach policyRefs renderPolicyRef}
|
||||
<form method="POST" action={AddPolicyReferenceAction { decisionRecordId = record.id }}
|
||||
<form method="POST" action={AddPolicyReferenceAction (record.id)}
|
||||
class="mt-3 flex items-end gap-2">
|
||||
{hiddenField "authenticity_token"}
|
||||
<div>
|
||||
@@ -98,32 +95,23 @@ instance View ShowView where
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="text-sm font-semibold text-gray-700">Deployments</h2>
|
||||
{if null implRefs
|
||||
then mempty
|
||||
else [hsx|
|
||||
<a href={(pathTo NewDeploymentRecordAction) <> "?decisionId=" <> show record.id}
|
||||
class="text-xs border border-indigo-300 text-indigo-600 px-3 py-1 rounded hover:bg-indigo-50">
|
||||
New Deployment
|
||||
</a>
|
||||
|]}
|
||||
{if null implRefs then mempty else renderNewDeploymentLink record.id}
|
||||
</div>
|
||||
{if null deploymentRecords
|
||||
then [hsx|<p class="text-sm text-gray-400">No deployments recorded yet.</p>|]
|
||||
else [hsx|{forEach deploymentRecords (renderDeploymentRow evaluations)}|]}
|
||||
{if null deploymentRecords then noDeploymentsMsg else forEach deploymentRecords (renderDeploymentRow evaluations)}
|
||||
</div>
|
||||
|
||||
<!-- Implementation references -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="text-sm font-semibold text-gray-700">Implementation References</h2>
|
||||
<form method="POST" action={ProposeImplementationAction { decisionRecordId = record.id }} class="inline">
|
||||
<form method="POST" action={ProposeImplementationAction (record.id)} class="inline">
|
||||
<button type="submit" class="text-xs border border-green-300 text-green-700 px-2 py-1 rounded hover:bg-green-50">
|
||||
Propose Implementation
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{forEach implRefs renderImplRef}
|
||||
<form method="POST" action={AddImplementationRefAction { decisionRecordId = record.id }}
|
||||
<form method="POST" action={AddImplementationRefAction (record.id)}
|
||||
class="mt-3 flex items-end gap-2">
|
||||
{hiddenField "authenticity_token"}
|
||||
<div>
|
||||
@@ -163,7 +151,7 @@ renderCandidateSection :: RequirementCandidate -> Html
|
||||
renderCandidateSection c = [hsx|
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-2">Source Candidate</h2>
|
||||
<a href={ShowRequirementCandidateAction { requirementCandidateId = c.id }}
|
||||
<a href={ShowRequirementCandidateAction (c.id)}
|
||||
class="text-sm text-indigo-600 hover:text-indigo-800">{c.title}</a>
|
||||
</div>
|
||||
|]
|
||||
@@ -175,11 +163,11 @@ renderPolicyRef ref = [hsx|
|
||||
<span class={policyScopeClass ref.policyScope <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
||||
{ref.policyScope}
|
||||
</span>
|
||||
{maybe mempty (\n -> [hsx|<span class="text-gray-600">{n}</span>|]) ref.constraintNote}
|
||||
{maybe mempty renderConstraintNote ref.constraintNote}
|
||||
<span class="text-xs text-gray-400">{show ref.createdAt}</span>
|
||||
</div>
|
||||
<form method="POST"
|
||||
action={DeletePolicyReferenceAction { policyReferenceId = ref.id }}>
|
||||
action={DeletePolicyReferenceAction (ref.id)}>
|
||||
{hiddenField "authenticity_token"}
|
||||
<button type="submit"
|
||||
class="text-xs text-red-500 hover:text-red-700 ml-2">Remove</button>
|
||||
@@ -198,7 +186,7 @@ renderImplRef ref = [hsx|
|
||||
<span class="text-xs text-gray-400">{show ref.linkedAt}</span>
|
||||
</div>
|
||||
<form method="POST"
|
||||
action={DeleteImplementationRefAction { implementationChangeReferenceId = ref.id }}>
|
||||
action={DeleteImplementationRefAction (ref.id)}>
|
||||
{hiddenField "authenticity_token"}
|
||||
<button type="submit"
|
||||
class="text-xs text-red-500 hover:text-red-700 ml-2">Remove</button>
|
||||
@@ -228,11 +216,32 @@ systemBadgeClass "linear" = "bg-violet-100 text-violet-800"
|
||||
systemBadgeClass "jira" = "bg-blue-100 text-blue-800"
|
||||
systemBadgeClass _ = "bg-gray-100 text-gray-600"
|
||||
|
||||
renderLinkedRequirement :: Maybe Requirement -> Html
|
||||
renderLinkedRequirement Nothing = [hsx|<p class="text-sm text-gray-400">No requirement linked.</p>|]
|
||||
renderLinkedRequirement (Just req) = [hsx|
|
||||
<a href={ShowRequirementAction (req.id)}
|
||||
class="text-sm text-indigo-600 hover:text-indigo-800">{req.title}</a>
|
||||
|]
|
||||
|
||||
renderNewDeploymentLink :: Id DecisionRecord -> Html
|
||||
renderNewDeploymentLink recordId = [hsx|
|
||||
<a href={(pathTo NewDeploymentRecordAction) <> "?decisionId=" <> show recordId}
|
||||
class="text-xs border border-indigo-300 text-indigo-600 px-3 py-1 rounded hover:bg-indigo-50">
|
||||
New Deployment
|
||||
</a>
|
||||
|]
|
||||
|
||||
noDeploymentsMsg :: Html
|
||||
noDeploymentsMsg = [hsx|<p class="text-sm text-gray-400">No deployments recorded yet.</p>|]
|
||||
|
||||
renderConstraintNote :: Text -> Html
|
||||
renderConstraintNote n = [hsx|<span class="text-gray-600">{n}</span>|]
|
||||
|
||||
renderDeploymentRow :: [ChangeEvaluation] -> DeploymentRecord -> Html
|
||||
renderDeploymentRow evals dr = [hsx|
|
||||
<div class="flex items-center justify-between py-2 border-b border-gray-100 last:border-0">
|
||||
<div class="flex items-center gap-2 text-sm">
|
||||
<a href={ShowDeploymentRecordAction { deploymentRecordId = dr.id }}
|
||||
<a href={ShowDeploymentRecordAction (dr.id)}
|
||||
class="font-mono text-indigo-600 hover:text-indigo-800">{dr.versionRef}</a>
|
||||
<span class="text-xs text-gray-400">{show dr.deployedAt}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user