module Web.View.ArchiveRecords.LineageInspector where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude data LineageInspectorView = LineageInspectorView { widget :: !Widget , events :: ![InteractionEvent] , annotations :: ![Annotation] , candidates :: ![RequirementCandidate] , requirements :: ![Requirement] , decisions :: ![DecisionRecord] , deployments :: ![DeploymentRecord] , signals :: ![OutcomeSignal] , mArchive :: !(Maybe ArchiveRecord) } instance View LineageInspectorView where html LineageInspectorView { .. } = [hsx|
{widget.name} /

Lineage Inspector

{if widget.isArchived then [hsx|Archived|] else mempty}

Full traceability chain for this widget.

{renderChainStep "1" "Widget" 1 (Just $ ShowWidgetAction { widgetId = widget.id })} {renderChainStep "2" "Interaction Events" (length events) Nothing} {renderChainStep "3" "Annotations" (length annotations) Nothing} {renderChainStep "4" "Requirement Candidates" (length candidates) Nothing} {renderChainStep "5" "Requirements" (length requirements) Nothing} {renderChainStep "6" "Decision Records" (length decisions) Nothing} {renderChainStep "7" "Deployments" (length deployments) Nothing} {renderChainStep "8" "Outcome Signals" (length signals) Nothing}
{whenJust mArchive \archive -> [hsx|

Archive Record

Archived At
{show archive.archivedAt}
Archived By
{archive.archivedBy}
Reason
{archive.reason}
|]}

Recent Interaction Events

{if null events then [hsx|

No events recorded.

|] else [hsx|
{forEach events renderEventRow}
Event Type Occurred At
|]}
|] where renderChainStep :: Text -> Text -> Int -> Maybe a -> Html renderChainStep stepNum label count mLink = [hsx|
{stepNum}
{label} {show count}
|] renderEventRow :: InteractionEvent -> Html renderEventRow e = [hsx| {e.eventType} {show e.occurredAt} |]