Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions frontend/relay-workflows-lib/lib/components/BaseWorkflowRelay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,24 @@ export const BaseWorkflowRelayFragment = graphql`
}
status {
__typename

... on WorkflowRunningStatus {
startTime
}

... on WorkflowSucceededStatus {
startTime
}

... on WorkflowFailedStatus {
startTime
}

... on WorkflowErroredStatus {
startTime
}
}

...WorkflowTasksFragment
}
`;
Expand All @@ -45,6 +62,14 @@ export default function BaseWorkflowRelay({
}: BaseWorkflowRelayProps) {
const data = useFragment(BaseWorkflowRelayFragment, fragmentRef);
const statusText = data.status?.__typename ?? "Unknown";
const submittedTime =
data.status?.__typename === "WorkflowRunningStatus" ||
data.status?.__typename === "WorkflowSucceededStatus" ||
data.status?.__typename === "WorkflowFailedStatus" ||
data.status?.__typename === "WorkflowErroredStatus"
? data.status.startTime
: undefined;

const [selectedTaskIds, setSelectedTaskIds] = useSelectedTaskIds();

const onNavigate = React.useCallback(
Expand Down Expand Up @@ -87,6 +112,7 @@ export default function BaseWorkflowRelay({
instrumentSession: data.visit,
status: statusText as WorkflowStatus,
creator: data.creator.creatorId,
submittedTime,
}}
workflowLink={workflowLink}
expanded={expanded}
Expand Down
5 changes: 4 additions & 1 deletion frontend/relay-workflows-lib/relay.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"language": "typescript",
"schema": "./supergraph.graphql",
"exclude": ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"],
"eagerEsModules": true
"eagerEsModules": true,
"customScalarTypes": {
"DateTime": "string"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ const WorkflowAccordion: React.FC<WorkflowProps> = ({
<Typography color="#757575">
Creator: {workflow.creator || "Unknown"}
</Typography>

{workflow.submittedTime && (
<Typography color="#757575">
Submitted: {new Date(workflow.submittedTime).toLocaleString()}
</Typography>
)}
</Box>
</AccordionSummary>
<AccordionDetails>{children}</AccordionDetails>
Expand Down
1 change: 1 addition & 0 deletions frontend/workflows-lib/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface Workflow {
instrumentSession: Visit;
status: WorkflowStatus;
creator: string;
submittedTime?: string;
}

export interface Visit {
Comment thread
hazdl marked this conversation as resolved.
Expand Down
Loading