56 lines
2.3 KiB
Haskell
56 lines
2.3 KiB
Haskell
|
|
module Web.View.ModelRoutingPolicies.New where
|
||
|
|
|
||
|
|
import Web.View.Prelude
|
||
|
|
|
||
|
|
data NewView = NewView
|
||
|
|
{ policy :: !ModelRoutingPolicy
|
||
|
|
, hubs :: ![Hub]
|
||
|
|
, agents :: ![AgentRegistration]
|
||
|
|
}
|
||
|
|
|
||
|
|
taskTypeOptions :: [Text]
|
||
|
|
taskTypeOptions =
|
||
|
|
[ "requirement_draft"
|
||
|
|
, "triage"
|
||
|
|
, "synthesis"
|
||
|
|
, "policy_check"
|
||
|
|
, "implementation"
|
||
|
|
]
|
||
|
|
|
||
|
|
instance View NewView where
|
||
|
|
html NewView { .. } = [hsx|
|
||
|
|
<div class="p-6 max-w-xl">
|
||
|
|
<h1 class="text-2xl font-bold text-gray-900 mb-6">Add Routing Policy</h1>
|
||
|
|
{formFor policy [hsx|
|
||
|
|
<div class="space-y-4">
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Hub</label>
|
||
|
|
<select name="hubId" class="block w-full border-gray-300 rounded-md shadow-sm text-sm">
|
||
|
|
{forEach hubs \h -> [hsx|<option value={show h.id}>{h.name}</option>|]}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Task Type</label>
|
||
|
|
<select name="taskType" class="block w-full border-gray-300 rounded-md shadow-sm text-sm">
|
||
|
|
{forEach taskTypeOptions \t -> [hsx|<option value={t}>{t}</option>|]}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Agent</label>
|
||
|
|
<select name="agentRegistrationId" class="block w-full border-gray-300 rounded-md shadow-sm text-sm">
|
||
|
|
{forEach agents \a -> [hsx|
|
||
|
|
<option value={show a.id}>{a.name} ({a.provider} / {a.modelName})</option>
|
||
|
|
|]}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div>{(numberField #priority) { label = "Priority (higher wins)", placeholder = "0" }}</div>
|
||
|
|
<div class="flex gap-3 pt-2">
|
||
|
|
{submitButton { label = "Create Policy" }}
|
||
|
|
<a href={ModelRoutingPoliciesAction}
|
||
|
|
class="px-4 py-2 bg-gray-100 hover:bg-gray-200 rounded-md text-sm">Cancel</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|]}
|
||
|
|
</div>
|
||
|
|
|]
|