Skip to content

Commit ed6c72a

Browse files
authored
fix:delete run in pipeline detail (#679)
1 parent aacc566 commit ed6c72a

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

src/app/pipelines/[namespace]/RunsTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import { useAllPipelineRuns } from "@/data/pipeline-runs/all-pipeline-runs-query
66
import { SearchField } from "@/components/SearchField";
77
import Pagination from "@/components/Pagination";
88
import { getPipelineDetailColumns } from "./columns";
9+
import { useRunsSelectorContext } from "../RunsTab/RunsSelectorContext";
10+
import { RunsButtonGroup } from "../RunsTab/ButtonGroup";
911

1012
export function PipelineRunsTable() {
1113
const { namespace } = useParams() as { namespace: string };
1214
const params = usePipelineRunParams();
1315
const cols = getPipelineDetailColumns();
16+
const { selectedRuns } = useRunsSelectorContext();
1417

1518
const { data, refetch } = useAllPipelineRuns(
1619
{
@@ -26,7 +29,7 @@ export function PipelineRunsTable() {
2629
return (
2730
<div className="flex flex-col gap-5 p-5">
2831
<div className="flex items-center justify-between">
29-
<SearchField searchParams={params} />
32+
{selectedRuns.length ? <RunsButtonGroup /> : <SearchField searchParams={params} />}
3033
<Button intent="primary" emphasis="subtle" size="md" onClick={() => refetch()}>
3134
<Refresh className="h-5 w-5 fill-theme-text-brand" />
3235
Refresh

src/app/pipelines/[namespace]/columns.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,23 @@ import {
1717
TooltipTrigger
1818
} from "@zenml-io/react-component-library";
1919
import { Link } from "react-router-dom";
20+
import { RunDropdown } from "../RunsTab/RunDropdown";
21+
import { RunSelector } from "../RunsTab/RunSelector";
2022

2123
export function getPipelineDetailColumns(): ColumnDef<PipelineRun>[] {
2224
return [
25+
{
26+
id: "check",
27+
header: "",
28+
meta: {
29+
width: "1%"
30+
},
31+
accessorFn: (row) => ({ id: row.id }),
32+
cell: ({ getValue }) => {
33+
const { id } = getValue<{ id: string }>();
34+
return <RunSelector id={id} />;
35+
}
36+
},
2337
{
2438
id: "run",
2539
header: "Run",
@@ -129,6 +143,16 @@ export function getPipelineDetailColumns(): ColumnDef<PipelineRun>[] {
129143
const { author } = getValue<{ author: User }>();
130144
return <InlineAvatar username={author.name} />;
131145
}
146+
},
147+
{
148+
id: "admin_actions",
149+
header: "",
150+
meta: {
151+
width: "5%"
152+
},
153+
cell: ({ row }) => {
154+
return <RunDropdown id={row.original.id} />;
155+
}
132156
}
133157
];
134158
}

src/app/pipelines/[namespace]/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ import { Header } from "./Header";
33
import { PipelineRunsTable } from "./RunsTable";
44
import { useEffect } from "react";
55
import { useBreadcrumbsContext } from "@/layouts/AuthenticatedLayout/BreadcrumbsContext";
6+
import { RunsSelectorProvider } from "../RunsTab/RunsSelectorContext";
67

78
export default function PipelineNamespacePage() {
89
const { namespace } = useParams() as { namespace: string };
910
const { setCurrentBreadcrumbData } = useBreadcrumbsContext();
1011

1112
useEffect(() => {
1213
namespace &&
13-
setCurrentBreadcrumbData({ segment: "pipeline_detail", data: { name: namespace } });
14+
setCurrentBreadcrumbData({
15+
segment: "pipeline_detail",
16+
data: { name: namespace }
17+
});
1418
}, [namespace]);
1519

1620
return (
1721
<div>
18-
<Header namespace={namespace} />
19-
<PipelineRunsTable />
22+
<RunsSelectorProvider>
23+
<Header namespace={namespace} />
24+
<PipelineRunsTable />
25+
</RunsSelectorProvider>
2026
</div>
2127
);
2228
}

0 commit comments

Comments
 (0)