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 ()
|
||||
import Web.View.DecisionRecords.New (renderForm)
|
||||
|
||||
data EditView = EditView
|
||||
@@ -18,7 +19,7 @@ instance View EditView where
|
||||
<div class="mb-6 flex items-center gap-2 text-sm text-gray-500">
|
||||
<a href={DecisionRecordsAction} class="hover:text-gray-700">Decisions</a>
|
||||
<span>/</span>
|
||||
<a href={ShowDecisionRecordAction { decisionRecordId = record.id }}
|
||||
<a href={ShowDecisionRecordAction (record.id)}
|
||||
class="hover:text-gray-700">{record.title}</a>
|
||||
<span>/</span>
|
||||
<span>Edit</span>
|
||||
|
||||
@@ -4,6 +4,7 @@ import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.Routes ()
|
||||
|
||||
data IndexView = IndexView
|
||||
{ records :: ![DecisionRecord]
|
||||
@@ -29,17 +30,21 @@ instance View IndexView where
|
||||
<div class="flex gap-2 mb-5 text-sm flex-wrap">
|
||||
<a href={DecisionRecordsAction}
|
||||
class={filterTabClass Nothing mOutcomeFilter}>All</a>
|
||||
{forEach allOutcomes (\o -> [hsx|
|
||||
<a href={decisionFilterUrl o}
|
||||
class={filterTabClass (Just o) mOutcomeFilter}>{o}</a>
|
||||
|])}
|
||||
{forEach allOutcomes (renderOutcomeTab mOutcomeFilter)}
|
||||
</div>
|
||||
|
||||
{if null records
|
||||
then [hsx|<p class="text-sm text-gray-400">No decision records found.</p>|]
|
||||
else renderTable records requirements users}
|
||||
{if null records then noDecisionsMsg else renderTable records requirements users}
|
||||
|]
|
||||
|
||||
noDecisionsMsg :: Html
|
||||
noDecisionsMsg = [hsx|<p class="text-sm text-gray-400">No decision records found.</p>|]
|
||||
|
||||
renderOutcomeTab :: Maybe Text -> Text -> Html
|
||||
renderOutcomeTab mOutcomeFilter o = [hsx|
|
||||
<a href={decisionFilterUrl o}
|
||||
class={filterTabClass (Just o) mOutcomeFilter}>{o}</a>
|
||||
|]
|
||||
|
||||
decisionFilterUrl :: Text -> Text
|
||||
decisionFilterUrl o = "/DecisionRecords?outcome=" <> o
|
||||
|
||||
@@ -67,7 +72,7 @@ renderRow :: [Requirement] -> [User] -> DecisionRecord -> Html
|
||||
renderRow reqs users dr = [hsx|
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-4 py-3">
|
||||
<a href={ShowDecisionRecordAction { decisionRecordId = dr.id }}
|
||||
<a href={ShowDecisionRecordAction (dr.id)}
|
||||
class="text-indigo-600 hover:text-indigo-800 font-medium">{dr.title}</a>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
@@ -89,9 +94,9 @@ linkedReqTitle :: [Requirement] -> Maybe (Id Requirement) -> Text
|
||||
linkedReqTitle _ Nothing = "—"
|
||||
linkedReqTitle reqs (Just rid) = maybe "(unknown)" (.title) (find (\r -> r.id == rid) reqs)
|
||||
|
||||
userName :: [User] -> Maybe (Id User) -> Text
|
||||
userName :: [User] -> Maybe UUID -> Text
|
||||
userName _ Nothing = "—"
|
||||
userName users (Just uid) = maybe "(unknown)" (.name) (find (\u -> u.id == uid) users)
|
||||
userName users (Just uid) = maybe "(unknown)" (.name) (find (\u -> toUUID u.id == uid) users)
|
||||
|
||||
outcomeClass :: Text -> Text
|
||||
outcomeClass "accepted" = "bg-green-100 text-green-800"
|
||||
|
||||
@@ -4,6 +4,7 @@ import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.Routes ()
|
||||
|
||||
data NewView = NewView
|
||||
{ record :: !DecisionRecord
|
||||
@@ -29,8 +30,6 @@ instance View NewView where
|
||||
renderForm :: DecisionRecord -> [Requirement] -> [RequirementCandidate] -> [User] -> action -> Html
|
||||
renderForm record requirements candidates users submitAction = [hsx|
|
||||
<form method="POST" action={submitAction} class="bg-white rounded-lg border border-gray-200 px-6 py-5 space-y-4">
|
||||
{hiddenField "authenticity_token"}
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
||||
<input type="text" name="title" value={record.title}
|
||||
@@ -64,7 +63,7 @@ renderForm record requirements candidates users submitAction = [hsx|
|
||||
<select name="requirementId"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
||||
<option value="">— None —</option>
|
||||
{forEach requirements (\r -> [hsx|<option value={show r.id}>{r.title}</option>|])}
|
||||
{forEach requirements renderRequirementOption}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +72,7 @@ renderForm record requirements candidates users submitAction = [hsx|
|
||||
<select name="candidateId"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
||||
<option value="">— None —</option>
|
||||
{forEach candidates (\c -> [hsx|<option value={show c.id}>{c.title}</option>|])}
|
||||
{forEach candidates renderCandidateOption}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -82,7 +81,7 @@ renderForm record requirements candidates users submitAction = [hsx|
|
||||
<textarea name="notes" rows="2"
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"
|
||||
placeholder="For split/merged: list related candidate IDs or context"
|
||||
>{maybe "" id record.notes}</textarea>
|
||||
>{fromMaybe "" record.notes}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3 pt-2">
|
||||
@@ -95,3 +94,9 @@ renderForm record requirements candidates users submitAction = [hsx|
|
||||
</div>
|
||||
</form>
|
||||
|]
|
||||
|
||||
renderRequirementOption :: Requirement -> Html
|
||||
renderRequirementOption r = [hsx|<option value={show r.id}>{r.title}</option>|]
|
||||
|
||||
renderCandidateOption :: RequirementCandidate -> Html
|
||||
renderCandidateOption c = [hsx|<option value={show c.id}>{c.title}</option>|]
|
||||
|
||||
@@ -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