generated from coulomb/repo-seed
- Schema.sql: add FK constraints for phases 6–12 so IHP generates Id X instead of UUID for FK columns (widget_adapter_specs, friction_scores, hub_routing_rules, agent_proposals, hub_capability_manifests, etc.) - HubHealth, ModelRouter, ApiInteractionEvents: remove toUUID() wrappers now that FK columns carry proper Id types - FederatedGovernance/Dashboard, HubRoutingRules/Index: same Id comparison fix - AgentProposals/Index, DecisionRecords/Index, ApiConsumers/Edit: Id type fixes - BottleneckDetector: add Data.Coerce import; CrossHubPropagation: add guard - ApiKeys: qualify cryptohash-sha256 import to resolve package ambiguity - WebhookDeliveryJob: use LBS.fromStrict; remove duplicate diffUTCTime - Sessions/New: use renderFlashMessages (IHP built-in) - ArchiveRecords/LineageInspector: simplify renderChainStep signature - static/app.css: Tailwind CSS output (2011 lines) — A3 confirmed - workplans/IHUB-WP-0015-local-deployment-intro-ui.md: add workplan Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
3.0 KiB
Haskell
61 lines
3.0 KiB
Haskell
module Web.View.ApiConsumers.Edit where
|
|
|
|
import Web.Types
|
|
import Generated.Types
|
|
import IHP.Prelude
|
|
import IHP.ViewPrelude
|
|
import Web.Routes ()
|
|
|
|
data EditView = EditView
|
|
{ consumer :: !ApiConsumer
|
|
, manifests :: ![HubCapabilityManifest]
|
|
}
|
|
|
|
instance View EditView where
|
|
html EditView { .. } = [hsx|
|
|
<div class="max-w-lg">
|
|
<h1 class="text-2xl font-semibold mb-6">Edit API Consumer</h1>
|
|
<form method="POST" action={UpdateApiConsumerAction consumer.id} class="space-y-4">
|
|
<input type="hidden" name="id" value={show consumer.id} />
|
|
<input type="hidden" name="_method" value="PATCH"/>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Name *</label>
|
|
<input type="text" name="name" value={consumer.name} class="border rounded px-3 py-2 text-sm w-full" />
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
|
<textarea name="description" class="border rounded px-3 py-2 text-sm w-full" rows="3">{maybe "" id consumer.description}</textarea>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Linked Hub Manifest (optional)</label>
|
|
<select name="hubCapabilityManifestId" class="border rounded px-3 py-2 text-sm w-full">
|
|
<option value="">— none —</option>
|
|
{forEach manifests (manifestOption consumer.hubCapabilityManifestId)}
|
|
</select>
|
|
</div>
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Rate Limit (req/min)</label>
|
|
<input type="number" name="rateLimitPerMinute" value={show consumer.rateLimitPerMinute} class="border rounded px-3 py-2 text-sm w-full" />
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Quota (req/day)</label>
|
|
<input type="number" name="quotaPerDay" value={show consumer.quotaPerDay} class="border rounded px-3 py-2 text-sm w-full" />
|
|
</div>
|
|
</div>
|
|
<div class="pt-2 flex gap-3">
|
|
<button type="submit" class="bg-indigo-600 text-white text-sm font-medium px-4 py-2 rounded hover:bg-indigo-700">
|
|
Save Changes
|
|
</button>
|
|
<a href={ShowApiConsumerAction consumer.id} class="text-sm text-gray-500 px-4 py-2 hover:text-gray-700">Cancel</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|]
|
|
where
|
|
manifestOption selectedId m = [hsx|
|
|
<option value={show m.id} selected={selectedId == Just m.id}>
|
|
Manifest {show m.id} ({m.status})
|
|
</option>
|
|
|]
|