Skip to content

Commit 8a732e2

Browse files
committed
Cleanup RunDetails
1 parent 357c105 commit 8a732e2

File tree

2 files changed

+72
-119
lines changed

2 files changed

+72
-119
lines changed

src/components/Editor/Context/PipelineIO.tsx

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { InputValueEditor } from "../IOEditor/InputValueEditor";
1515
import { OutputNameEditor } from "../IOEditor/OutputNameEditor";
1616
import { getOutputConnectedDetails } from "../utils/getOutputConnectedDetails";
1717

18-
const PipelineIO = () => {
18+
const PipelineIO = ({ readOnly }: { readOnly?: boolean }) => {
1919
const { setContent } = useContextPanel();
2020
const { componentSpec, graphSpec } = useComponentSpec();
2121

@@ -37,6 +37,23 @@ const PipelineIO = () => {
3737
);
3838
};
3939

40+
const inputActions: IORowAction[] = [];
41+
const outputActions: IORowAction[] = [];
42+
43+
if (!readOnly) {
44+
inputActions.push({
45+
label: "Edit",
46+
icon: <Icon name="Pencil" size="sm" />,
47+
onClick: () => handleInputEdit,
48+
});
49+
50+
outputActions.push({
51+
label: "Edit",
52+
icon: <Icon name="Pencil" size="sm" />,
53+
onClick: () => handleOutputEdit,
54+
});
55+
}
56+
4057
return (
4158
<BlockStack gap="4">
4259
<ContentBlock title="Inputs">
@@ -48,13 +65,7 @@ const PipelineIO = () => {
4865
name={input.name}
4966
value={input.value || input.default || "No value"}
5067
type={typeSpecToString(input?.type)}
51-
actions={[
52-
{
53-
label: "Edit",
54-
icon: <Icon name="Pencil" size="sm" />,
55-
onClick: () => handleInputEdit(input),
56-
},
57-
]}
68+
actions={inputActions}
5869
/>
5970
))}
6071
</BlockStack>
@@ -79,12 +90,7 @@ const PipelineIO = () => {
7990
name={output.name}
8091
value={connectedOutput.outputName ?? "No value"}
8192
type={typeSpecToString(connectedOutput.outputType)}
82-
actions={[
83-
{
84-
label: "Edit",
85-
onClick: () => handleOutputEdit(output),
86-
},
87-
]}
93+
actions={outputActions}
8894
/>
8995
);
9096
})}
@@ -101,11 +107,17 @@ const PipelineIO = () => {
101107

102108
export default PipelineIO;
103109

110+
type IORowAction = {
111+
label: string;
112+
icon?: ReactNode;
113+
onClick: () => void;
114+
};
115+
104116
interface IORowProps {
105117
name: string;
106118
value: string;
107119
type: string;
108-
actions?: { label: string; icon?: ReactNode; onClick: () => void }[];
120+
actions?: IORowAction[];
109121
}
110122

111123
function IORow({ name, value, type, actions }: IORowProps) {
Lines changed: 45 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { Frown } from "lucide-react";
2-
3-
import { ArtifactsList } from "@/components/shared/ArtifactsList/ArtifactsList";
41
import { CopyText } from "@/components/shared/CopyText/CopyText";
52
import { BlockStack, InlineStack } from "@/components/ui/layout";
63
import { Spinner } from "@/components/ui/spinner";
7-
import { Text } from "@/components/ui/typography";
4+
import { Paragraph, Text } from "@/components/ui/typography";
85
import { useCheckComponentSpecFromPath } from "@/hooks/useCheckComponentSpecFromPath";
96
import { useUserDetails } from "@/hooks/useUserDetails";
107
import { useBackend } from "@/providers/BackendProvider";
@@ -17,6 +14,10 @@ import {
1714
isStatusInProgress,
1815
} from "@/services/executionService";
1916

17+
import PipelineIO from "../Editor/context/PipelineIO";
18+
import { ContentBlock } from "../shared/ContextPanel/Blocks/ContentBlock";
19+
import { ListBlock } from "../shared/ContextPanel/Blocks/ListBlock";
20+
import { TextBlock } from "../shared/ContextPanel/Blocks/TextBlock";
2021
import { InfoBox } from "../shared/InfoBox";
2122
import { StatusBar, StatusText } from "../shared/Status";
2223
import { TaskImplementation } from "../shared/TaskDetails";
@@ -52,29 +53,30 @@ export const RunDetails = () => {
5253

5354
if (error || !details || !state || !componentSpec) {
5455
return (
55-
<div className="flex flex-col gap-8 items-center justify-center h-full">
56-
<Frown className="w-12 h-12 text-secondary-foreground" />
57-
<div className="text-secondary-foreground">
58-
Error loading run details.
59-
</div>
60-
</div>
56+
<BlockStack align="center" inlineAlign="center" className="h-full">
57+
<InfoBox title="Error" variant="error">
58+
Pipeline Run could not be loaded.
59+
</InfoBox>
60+
</BlockStack>
6161
);
6262
}
6363

6464
if (isLoading) {
6565
return (
66-
<div className="flex items-center justify-center h-full">
66+
<InlineStack align="center" blockAlign="center" className="h-full">
6767
<Spinner className="mr-2" />
68-
<p className="text-secondary-foreground">Loading run details...</p>
69-
</div>
68+
<Paragraph tone="subdued">Loading run details...</Paragraph>
69+
</InlineStack>
7070
);
7171
}
7272

7373
if (!configured) {
7474
return (
75-
<InfoBox title="Backend not configured" variant="warning">
76-
Configure a backend to view execution artifacts.
77-
</InfoBox>
75+
<BlockStack align="center" inlineAlign="center" className="h-full">
76+
<InfoBox title="Backend not configured" variant="warning">
77+
Configure a backend to view execution artifacts.
78+
</InfoBox>
79+
</BlockStack>
7880
);
7981
}
8082

@@ -109,110 +111,49 @@ export const RunDetails = () => {
109111
</InlineStack>
110112

111113
{metadata && (
112-
<BlockStack>
113-
<Text as="h3" size="md" weight="semibold" className="mb-1">
114-
Run Info
115-
</Text>
116-
<dl className="flex flex-col gap-1 text-xs text-secondary-foreground">
117-
{metadata.id && (
118-
<InlineStack as="div" gap="1" blockAlign="center">
119-
<Text as="dt" weight="semibold" className="shrink-0">
120-
Run Id:
121-
</Text>
122-
<dd>
123-
<CopyText className="font-mono truncate max-w-[180px]">
124-
{metadata.id}
125-
</CopyText>
126-
</dd>
127-
</InlineStack>
128-
)}
129-
{metadata.root_execution_id && (
130-
<InlineStack as="div" gap="1" blockAlign="center">
131-
<Text as="dt" weight="semibold" className="shrink-0">
132-
Execution Id:
133-
</Text>
134-
<dd>
135-
<CopyText className="font-mono truncate max-w-[180px]">
136-
{metadata.root_execution_id}
137-
</CopyText>
138-
</dd>
139-
</InlineStack>
140-
)}
141-
{metadata.created_by && (
142-
<InlineStack as="div" gap="1" blockAlign="center">
143-
<Text as="dt" weight="semibold">
144-
Created by:
145-
</Text>
146-
<dd>{metadata.created_by}</dd>
147-
</InlineStack>
148-
)}
149-
{metadata.created_at && (
150-
<InlineStack as="div" gap="1" blockAlign="center">
151-
<Text as="dt" weight="semibold">
152-
Created at:
153-
</Text>
154-
<dd>{new Date(metadata.created_at).toLocaleString()}</dd>
155-
</InlineStack>
156-
)}
157-
</dl>
158-
</BlockStack>
114+
<ListBlock
115+
title="Run Info"
116+
items={[
117+
{ label: "Run Id", value: metadata.id },
118+
{ label: "Execution Id", value: metadata.root_execution_id },
119+
{ label: "Created by", value: metadata.created_by ?? undefined },
120+
{
121+
label: "Created at",
122+
value: metadata.created_at
123+
? new Date(metadata.created_at).toLocaleString()
124+
: undefined,
125+
},
126+
]}
127+
marker="none"
128+
/>
159129
)}
160130

161131
{componentSpec.description && (
162-
<BlockStack>
163-
<Text as="h3" size="md" weight="semibold" className="mb-1">
164-
Description
165-
</Text>
166-
<Text as="p" size="sm" className="whitespace-pre-line">
167-
{componentSpec.description}
168-
</Text>
169-
</BlockStack>
132+
<TextBlock title="Description" text={componentSpec.description} />
170133
)}
171134

172-
<BlockStack>
173-
<Text as="h3" size="md" weight="semibold" className="mb-1">
174-
Status
175-
</Text>
135+
<ContentBlock title="Status">
176136
<InlineStack gap="2" blockAlign="center" className="mb-1">
177137
<Text size="sm" weight="semibold">
178138
{runStatus}
179139
</Text>
180140
<StatusText statusCounts={statusCounts} />
181141
</InlineStack>
182142
<StatusBar statusCounts={statusCounts} />
183-
</BlockStack>
143+
</ContentBlock>
184144

185145
{Object.keys(annotations).length > 0 && (
186-
<BlockStack>
187-
<Text as="h3" size="md" weight="semibold" className="mb-1">
188-
Annotations
189-
</Text>
190-
<ul className="text-xs text-secondary-foreground">
191-
{Object.entries(annotations).map(([key, value]) => (
192-
<li key={key}>
193-
<Text as="span" weight="semibold">
194-
{key}:
195-
</Text>{" "}
196-
<Text as="span" className="break-all">
197-
{String(value)}
198-
</Text>
199-
</li>
200-
))}
201-
</ul>
202-
</BlockStack>
146+
<ListBlock
147+
title="Annotations"
148+
items={Object.entries(annotations).map(([key, value]) => ({
149+
label: key,
150+
value: String(value),
151+
}))}
152+
marker="none"
153+
/>
203154
)}
204155

205-
<ArtifactsList
206-
inputs={(componentSpec.inputs ?? []).map((input) => ({
207-
name: input.name,
208-
type: typeof input.type === "string" ? input.type : "object",
209-
value: input.value ?? input.default,
210-
}))}
211-
outputs={(componentSpec.outputs ?? []).map((output) => ({
212-
name: output.name,
213-
type: typeof output.type === "string" ? output.type : "object",
214-
}))}
215-
/>
156+
<PipelineIO readOnly />
216157
</BlockStack>
217158
);
218159
};

0 commit comments

Comments
 (0)