Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: back button on execution detail page #190

Merged
merged 1 commit into from
Aug 26, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion src/components/Executions/Tables/WorkflowExecutionLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ 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<{
className?: string;
id: WorkflowExecutionIdentifier;
}> = ({ className, id }) => {
const commonStyles = useCommonStyles();
const {
location: { pathname }
} = history;
const fromExecutionNav = pathname.split('/').pop() === 'executions';

return (
<RouterLink
className={classnames(commonStyles.primaryLink, className)}
to={Routes.ExecutionDetails.makeUrl(id)}
to={`${Routes.ExecutionDetails.makeUrl(id)}${
fromExecutionNav ? '?fromExecutionNav=true' : ''
}`}
>
{id.name}
</RouterLink>
Expand Down