module Web.View.AiGovernancePolicies.Index where import Web.View.Prelude data IndexView = IndexView { policies :: ![AiGovernancePolicy] , hubs :: ![Hub] , agents :: ![AgentRegistration] } instance View IndexView where html IndexView { .. } = [hsx|

AI Governance Policies

Add Policy
{forEach policies renderRow}
Hub Agent Artifact Type Allowed Actions Active
|] where hubName hid = maybe "Unknown" (.name) (find (\h -> h.id == hid) hubs) agentName aid = maybe "Unknown" (.name) (find (\a -> a.id == aid) agents) renderRow p = [hsx| {hubName p.hubId} {agentName p.agentRegistrationId} {p.artifactType} {show p.allowedActions} {renderActiveStatus p.isActive} {if p.isActive then "Deactivate" :: Text else "Activate"} |] renderActiveStatus :: Bool -> Html renderActiveStatus True = [hsx|Active|] renderActiveStatus False = [hsx|Inactive|]