diff --git a/src/components/Executions/ExecutionDetails/ExecutionDetailsAppBarContent.tsx b/src/components/Executions/ExecutionDetails/ExecutionDetailsAppBarContent.tsx index b7049059c..a4b168b95 100644 --- a/src/components/Executions/ExecutionDetails/ExecutionDetailsAppBarContent.tsx +++ b/src/components/Executions/ExecutionDetails/ExecutionDetailsAppBarContent.tsx @@ -11,6 +11,8 @@ import { interactiveTextDisabledColor } from 'components/Theme/constants'; import { Execution } from 'models/Execution/types'; import * as React from 'react'; import { Link as RouterLink } from 'react-router-dom'; +import { history } from 'routes/history'; +import { Routes } from 'routes/routes'; import { ExecutionInputsOutputsModal } from '../ExecutionInputsOutputsModal'; import { ExecutionStatusBadge } from '../ExecutionStatusBadge'; import { TerminateExecutionButton } from '../TerminateExecution/TerminateExecutionButton'; @@ -79,12 +81,20 @@ export const ExecutionDetailsAppBarContent: React.FC<{ const { domain, name, project } = execution.id; const { phase } = execution.closure; const sourceId = getExecutionSourceId(execution); - const { backLink = getExecutionBackLink(execution) } = useLocationState(); + const { + backLink: originalBackLink = getExecutionBackLink(execution) + } = useLocationState(); const isRunning = executionIsRunning(execution); const isTerminal = executionIsTerminal(execution); const onClickShowInputsOutputs = () => setShowInputsOutputs(true); const onClickRelaunch = () => setShowRelaunchForm(true); const onCloseRelaunch = () => setShowRelaunchForm(false); + const fromExecutionNav = new URLSearchParams(history.location.search).get( + 'fromExecutionNav' + ); + const backLink = fromExecutionNav + ? Routes.ProjectDetails.sections.executions.makeUrl(project, domain) + : originalBackLink; let modalContent: JSX.Element | null = null; if (showInputsOutputs) { diff --git a/src/components/Executions/Tables/WorkflowExecutionLink.tsx b/src/components/Executions/Tables/WorkflowExecutionLink.tsx index 8e7371d4d..35400566e 100644 --- a/src/components/Executions/Tables/WorkflowExecutionLink.tsx +++ b/src/components/Executions/Tables/WorkflowExecutionLink.tsx @@ -4,6 +4,7 @@ import { WorkflowExecutionIdentifier } from 'models/Execution/types'; import * as React from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { Routes } from 'routes/routes'; +import { history } from 'routes/history'; /** A simple component to render a link to a specific WorkflowExecution */ export const WorkflowExecutionLink: React.FC<{ @@ -11,10 +12,17 @@ export const WorkflowExecutionLink: React.FC<{ id: WorkflowExecutionIdentifier; }> = ({ className, id }) => { const commonStyles = useCommonStyles(); + const { + location: { pathname } + } = history; + const fromExecutionNav = pathname.split('/').pop() === 'executions'; + return ( {id.name}