generated from coulomb/repo-seed
Fix compilation errors across 6 controllers and 29 views: import cleanup, ResponseException pattern for API auth, type fixes, unused import removal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.5 KiB
Haskell
39 lines
1.5 KiB
Haskell
module Web.View.HubCapabilityManifests.New where
|
|
|
|
import Web.View.Prelude
|
|
import Web.Routes ()
|
|
|
|
data NewView = NewView
|
|
{ manifest :: !HubCapabilityManifest
|
|
, hubs :: ![Hub]
|
|
}
|
|
|
|
instance View NewView where
|
|
html NewView { .. } = [hsx|
|
|
<div class="mb-4">
|
|
<a href={HubCapabilityManifestsAction} class="text-sm text-gray-500 hover:text-gray-700">
|
|
← Capability Manifests
|
|
</a>
|
|
</div>
|
|
<h1 class="text-xl font-semibold mb-6">New Capability Manifest</h1>
|
|
<div class="bg-amber-50 border border-amber-200 rounded p-4 mb-6 text-sm text-amber-800">
|
|
A capability manifest lets a domain or shared hub declare the widget types, event types,
|
|
annotation categories, and policy scopes it owns. Create a draft, declare your types,
|
|
then activate to register them with the framework.
|
|
</div>
|
|
<div class="bg-white rounded-lg border border-gray-200 p-6 max-w-lg">
|
|
{renderManifestForm manifest hubs}
|
|
</div>
|
|
|]
|
|
|
|
renderManifestForm :: HubCapabilityManifest -> [Hub] -> Html
|
|
renderManifestForm manifest hubs = formFor manifest [hsx|
|
|
{selectField #hubId (hubOptions hubs)}
|
|
{(textareaField #capabilityDescription) { fieldLabel = "Capability Description" }}
|
|
{(textField #contact) { fieldLabel = "Contact (team or person)" }}
|
|
{submitButton { label = "Create Draft" }}
|
|
|]
|
|
|
|
hubOptions :: [Hub] -> [(Text, Id Hub)]
|
|
hubOptions hubs = map (\h -> (h.name <> " (" <> h.hubKind <> ")", h.id)) hubs
|