diff --git a/plugins/orchestrator/src/components/WorkflowDescriptionModal.tsx b/plugins/orchestrator/src/components/WorkflowDescriptionModal.tsx index 0a84d7aea0..913fb19ba0 100644 --- a/plugins/orchestrator/src/components/WorkflowDescriptionModal.tsx +++ b/plugins/orchestrator/src/components/WorkflowDescriptionModal.tsx @@ -18,6 +18,10 @@ import { WorkflowOverviewDTO } from '@janus-idp/backstage-plugin-orchestrator-co export type WorkflowDescriptionModalProps = { workflow: WorkflowOverviewDTO; + workflowError?: { + itemId: string; + error: any; + }; runWorkflowLink: string; open: boolean; onClose?: () => void; @@ -37,7 +41,13 @@ export const RefForwardingWorkflowDescriptionModal: ForwardRefRenderFunction< ParentComponentRef, WorkflowDescriptionModalProps > = (props, forwardedRef): JSX.Element | null => { - const { workflow, open = false, onClose, runWorkflowLink } = props; + const { + workflow, + open = false, + onClose, + runWorkflowLink, + workflowError, + } = props; const classes = useStyles(); const navigate = useNavigate(); @@ -47,6 +57,27 @@ export const RefForwardingWorkflowDescriptionModal: ForwardRefRenderFunction< } }; + let content; + if (workflowError) { + content = ( + +

+ Failed to load details for the workflow ID: + {workflowError.itemId} +

+ {workflowError.error.message &&

{workflowError.error.message}

} +
+ ); + } else if (workflow.description) { + content = {workflow.description}; + } else { + content = ( + +

Are you sure you want to run this workflow?

+
+ ); + } + return ( onClose} @@ -67,17 +98,15 @@ export const RefForwardingWorkflowDescriptionModal: ForwardRefRenderFunction< - - {workflow.description ? ( - {workflow.description} - ) : ( - -

Are you sure you want to run this workflow?

-
- )} -
+ + {content} -