Skip to content

Commit c699437

Browse files
committed
feat: add perma path for task runs
1 parent e825339 commit c699437

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useParams } from 'react-router-dom';
2+
import StepRunDetail, {
3+
TabOption,
4+
} from '../../workflow-runs-v2/$run/v2components/step-run-detail/step-run-detail';
5+
import invariant from 'tiny-invariant';
6+
7+
export default function TaskRun() {
8+
const params = useParams();
9+
invariant(params.run);
10+
11+
return (
12+
<div className="px-8">
13+
<StepRunDetail taskRunId={params.run} defaultOpenTab={TabOption.Output} />
14+
</div>
15+
);
16+
}

frontend/app/src/pages/main/workflow-runs-v2/$run/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export default function ExpandedWorkflowRun() {
159159
<StepRunDetail
160160
taskRunId={selectedTaskRunId}
161161
defaultOpenTab={TabOption.Output}
162+
showViewTaskRunButton
162163
/>
163164
)}
164165
</SheetContent>

frontend/app/src/pages/main/workflow-runs-v2/$run/v2components/step-run-detail/step-run-detail.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ import { useQuery } from '@tanstack/react-query';
1010
import invariant from 'tiny-invariant';
1111
import { Button } from '@/components/ui/button';
1212
import { Loading } from '@/components/ui/loading';
13-
import { ArrowPathIcon, XCircleIcon } from '@heroicons/react/24/outline';
13+
import {
14+
ArrowPathIcon,
15+
LinkIcon,
16+
XCircleIcon,
17+
} from '@heroicons/react/24/outline';
1418
import { Separator } from '@/components/ui/separator';
1519
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
1620
import { StepRunEvents } from '../step-run-events-for-workflow-run';
17-
import { useOutletContext } from 'react-router-dom';
21+
import { Link, useOutletContext } from 'react-router-dom';
1822
import { TenantContextType } from '@/lib/outlet';
1923
import { TaskRunsTable as WorkflowRunsTable } from '../../../components/workflow-runs-table';
2024
import { useTenant } from '@/lib/atoms';
@@ -34,6 +38,7 @@ export enum TabOption {
3438
interface StepRunDetailProps {
3539
taskRunId: string;
3640
defaultOpenTab?: TabOption;
41+
showViewTaskRunButton?: boolean;
3742
}
3843

3944
export const STEP_RUN_TERMINAL_STATUSES = [
@@ -46,6 +51,7 @@ export const STEP_RUN_TERMINAL_STATUSES = [
4651
const StepRunDetail: React.FC<StepRunDetailProps> = ({
4752
taskRunId,
4853
defaultOpenTab = TabOption.Output,
54+
showViewTaskRunButton,
4955
}) => {
5056
const { tenant } = useTenant();
5157

@@ -134,6 +140,14 @@ const StepRunDetail: React.FC<StepRunDetailProps> = ({
134140
<XCircleIcon className="w-4 h-4" />
135141
Cancel
136142
</Button>
143+
{showViewTaskRunButton && (
144+
<Link to={`/task-runs/${taskRunId}`}>
145+
<Button size={'sm'} className="px-2 py-2 gap-2" variant={'outline'}>
146+
<LinkIcon className="w-4 h-4" />
147+
View Task Run
148+
</Button>
149+
</Link>
150+
)}
137151
</div>
138152
{errors && errors.length > 0 && (
139153
<div className="mt-4">

frontend/app/src/pages/main/workflow-runs-v2/components/workflow-runs-table.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ export function TaskRunsTable({
698698
<StepRunDetail
699699
taskRunId={stepDetailSheetState.taskRunId}
700700
defaultOpenTab={TabOption.Output}
701+
showViewTaskRunButton
701702
/>
702703
</SheetContent>
703704
</Sheet>

frontend/app/src/router.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ const routes: RouteObject[] = [
188188
};
189189
}),
190190
},
191+
{
192+
path: '/task-runs/:run',
193+
lazy: async () =>
194+
import('./pages/main/task-runs-v2/$run').then((res) => {
195+
return {
196+
Component: res.default,
197+
};
198+
}),
199+
},
191200
{
192201
path: '/workers',
193202
lazy: async () => {

0 commit comments

Comments
 (0)