Skip to content

Commit 52e50de

Browse files
fix: Misc Bugs (#692)
1 parent f6ed63f commit 52e50de

File tree

9 files changed

+46
-47
lines changed

9 files changed

+46
-47
lines changed

src/app/page.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import CloudSquares from "@/assets/illustrations/cloud-squares.svg";
22
import { Badge, Box, Button } from "@zenml-io/react-component-library";
33
import { Codesnippet } from "../components/CodeSnippet";
44
import External from "@/assets/icons/link-external.svg?react";
5-
import Codespaces from "@/assets/images/codespaces.gif";
65
import { OverviewHeader } from "./Header";
76
import { Link } from "react-router-dom";
87
import { routes } from "@/router/routes";
@@ -59,30 +58,25 @@ function OverviewContent() {
5958

6059
function VsCodeBox() {
6160
return (
62-
<Box className="flex flex-col-reverse items-center overflow-hidden md:max-h-[200px] md:flex-row">
63-
<div className="w-full space-y-3 px-7 py-5 xl:w-4/5">
61+
<Box className="flex flex-col items-center justify-between gap-3 overflow-hidden px-7 py-5 md:flex-row md:flex-wrap">
62+
<div className="space-y-1">
6463
<div className="flex items-center space-x-1">
6564
<Badge className="text-text-xs font-semibold" color="green">
6665
NEW
6766
</Badge>
6867
<h2 className="text-text-xl font-semibold">VS Code Quickstart with ZenML</h2>
6968
</div>
7069
<p className="text-theme-text-secondary">
71-
Get started quickly with ZenML using GitHub Codespaces!
72-
<br />
73-
You can run our quickstart guide in a pre-configured environment.
70+
Get started quickly with ZenML using GitHub Codespaces! You can run our quickstart guide
71+
in a pre-configured environment.
7472
</p>
75-
<Button size="sm" className="w-fit" emphasis="subtle" asChild>
76-
<a target="_blank" rel="noopener noreferrer" href="https://github.com/zenml-io/zenml">
77-
Visit our GitHub repo <External className="h-5 w-5" />
78-
</a>
79-
</Button>
8073
</div>
81-
<img
82-
className="object-contain"
83-
src={Codespaces}
84-
alt="Gif explaining how to setup codespaces"
85-
/>
74+
75+
<Button size="sm" className="w-fit" emphasis="subtle" asChild>
76+
<a target="_blank" rel="noopener noreferrer" href="https://github.com/zenml-io/zenml">
77+
Visit our GitHub repo <External className="h-5 w-5 shrink-0" />
78+
</a>
79+
</Button>
8680
</Box>
8781
);
8882
}

src/app/runs/[id]/_Tabs/Stack/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ function StackTabContent({ stackId, run }: StackTabContentProps) {
4545
return <p>Failed to fetch Stack</p>;
4646
}
4747

48-
return <StackInfo stack={data} run={run} />;
48+
const config = (run.metadata?.config.settings as { [key: string]: any } | undefined) || {};
49+
50+
return <StackInfo stack={data} objectConfig={config} />;
4951
}

src/assets/images/codespaces.gif

-349 KB
Binary file not shown.

src/components/artifacts/artifact-node-sheet/DetailCards.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ export function CodeCard({ artifactVersionId }: Props) {
254254
function returnConfigSchema(id: string) {
255255
return `from zenml.client import Client
256256
257-
artifact = Client().get_artifact_version('${id}')
258-
loaded_artifact = artifact.load()`;
257+
step = Client().get_run_step(${id})
258+
config = step.config`;
259259
}
260260

261261
return (

src/components/stacks/info/ComponentCollapsible.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { snakeCaseToTitleCase } from "@/lib/strings";
22
import { sanitizeUrl } from "@/lib/url";
33
import { routes } from "@/router/routes";
4-
import { PipelineRun } from "@/types//pipeline-runs";
54
import { StackComponent } from "@/types/components";
65
import { Box, Button } from "@zenml-io/react-component-library/components/server";
76
import { Link } from "react-router-dom";
@@ -10,12 +9,11 @@ import { ComponentBadge } from "../../stack-components/ComponentBadge";
109

1110
type Props = {
1211
component: StackComponent;
13-
run: PipelineRun;
12+
objectConfig: Record<string, any>;
1413
};
15-
export function ComponentCollapsible({ component, run }: Props) {
14+
export function ComponentCollapsible({ component, objectConfig }: Props) {
1615
const keyName = `${component.body?.type}.${component.body?.flavor}`;
17-
const settings =
18-
(run.metadata?.config.settings as { [key: string]: any } | undefined)?.[keyName] ?? undefined;
16+
const settings = objectConfig?.[keyName] ?? undefined;
1917

2018
if (!settings || Object.keys(settings).length === 0) {
2119
return (

src/components/stacks/info/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { Stack, StackComponentsList } from "@/types/stack";
2-
import { StackHeader } from "./StackHeader";
3-
import { ComponentCollapsible } from "./ComponentCollapsible";
4-
import { PipelineRun } from "@/types/pipeline-runs";
52
import { InfoBox } from "../../Infobox";
3+
import { ComponentCollapsible } from "./ComponentCollapsible";
4+
import { StackHeader } from "./StackHeader";
65

76
type Props = {
87
stack: Stack;
9-
run: PipelineRun;
8+
objectConfig: Record<string, any>;
109
};
11-
export function StackInfo({ stack, run }: Props) {
10+
export function StackInfo({ stack, objectConfig }: Props) {
1211
return (
1312
<div className="space-y-5">
1413
<StackInfobox />
@@ -17,7 +16,7 @@ export function StackInfo({ stack, run }: Props) {
1716
{Object.values((stack.metadata?.components as StackComponentsList) || {}).map(
1817
(component) => (
1918
<li key={component[0].id} className="w-full">
20-
<ComponentCollapsible component={component[0]} run={run} />
19+
<ComponentCollapsible component={component[0]} objectConfig={objectConfig} />
2120
</li>
2221
)
2322
)}

src/components/steps/step-sheet/ConfigurationTab.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { usePipelineBuild } from "@/data/pipeline-builds/all-pipeline-builds-que
66
import { usePipelineRun } from "@/data/pipeline-runs/pipeline-run-detail-query";
77
import { useStepDetail } from "@/data/steps/step-detail-query";
88
import { renderAnyToString } from "@/lib/strings";
9-
import { AnyDict, MetadataMap } from "@/types/common";
9+
import { AnyDict } from "@/types/common";
1010
import { BuildItemMap } from "@/types/pipeline-builds";
1111
import { Skeleton } from "@zenml-io/react-component-library";
1212
import {
@@ -17,15 +17,14 @@ import {
1717
} from "@zenml-io/react-component-library/components/client";
1818
import { useParams } from "react-router-dom";
1919
import { ErrorFallback } from "../../Error";
20-
import { UncategorizedCard } from "../../MetadataCards";
20+
import { NestedCollapsible } from "../../NestedCollapsible";
2121

2222
type Props = {
2323
stepId: string;
2424
};
2525

2626
export function StepConfigTab({ stepId }: Props) {
2727
const { data, isPending, isError, error } = useStepDetail({ stepId });
28-
const extraData = Object.values(data?.metadata?.config?.extra || {});
2928

3029
const { runId } = useParams() as { runId: string };
3130

@@ -79,13 +78,15 @@ export function StepConfigTab({ stepId }: Props) {
7978

8079
return (
8180
<div className="space-y-5">
82-
{data.metadata?.run_metadata && (
83-
<UncategorizedCard title="Metadata" metadata={data.metadata?.run_metadata as MetadataMap} />
84-
)}
8581
<KeyValueCard data={data.metadata?.config?.parameters as AnyDict} title="Parameters" />
8682
{dataImage ? <DockerImageCollapsible data={dataImage} /> : null}
8783
<CodeSnippetCard id={data.id} />
88-
{extraData.length > 0 ? <KeyValueCard data={extraData as AnyDict} title="Extra" /> : null}
84+
<NestedCollapsible
85+
isInitialOpen
86+
title="Resources"
87+
data={(data.metadata?.config.settings as { [key: string]: any })?.resources || {}}
88+
/>
89+
<NestedCollapsible isInitialOpen title="Extra" data={data.metadata?.config.extra} />
8990
</div>
9091
);
9192
}

src/components/steps/step-sheet/SheetContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function StepSheetContent({ stepId }: Props) {
113113
<OrchestratorCard />
114114
</TabsContent>
115115
<TabsContent className="m-0 mt-5 border-0 bg-transparent p-0" value="stack">
116-
<StackTab />
116+
<StackTab stepId={stepId} />
117117
</TabsContent>
118118
<TabsContent className="m-0 mt-5 border-0 bg-transparent p-0" value="code">
119119
<StepCodeTab stepId={stepId} />

src/components/steps/step-sheet/StacksTab.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@ import AlertCircle from "@/assets/icons/alert-circle.svg?react";
22
import { StackInfo } from "@/components/stacks/info";
33
import { usePipelineRun } from "@/data/pipeline-runs/pipeline-run-detail-query";
44
import { useStack } from "@/data/stacks/stack-detail-query";
5-
import { PipelineRun } from "@/types/pipeline-runs";
5+
import { useStepDetail } from "@/data/steps/step-detail-query";
66
import { Skeleton } from "@zenml-io/react-component-library";
77
import { useParams } from "react-router-dom";
88
import { EmptyState } from "../../EmptyState";
99

10-
export function StackTab() {
10+
type Props = {
11+
stepId: string;
12+
};
13+
export function StackTab({ stepId }: Props) {
1114
const { runId } = useParams() as { runId: string };
1215

13-
const run = usePipelineRun({ runId: runId }, { throwOnError: true });
16+
const run = usePipelineRun({ runId: runId });
17+
const step = useStepDetail({ stepId: stepId });
1418

15-
if (run.isPending) return <Skeleton className="h-[250px] w-full" />;
16-
if (run.isError) return <p>Something went wrong fetching the run</p>;
19+
if (run.isPending || step.isPending) return <Skeleton className="h-[250px] w-full" />;
20+
if (run.isError || step.isError) return <p>Something went wrong fetching the run</p>;
1721

1822
const stackId = run.data?.body?.stack?.id;
23+
const config = (step.data.metadata?.config.settings as { [key: string]: any } | undefined) || {};
1924

2025
if (!stackId)
2126
return (
@@ -29,14 +34,14 @@ export function StackTab() {
2934
</EmptyState>
3035
);
3136

32-
return <StackTabContent run={run.data} stackId={stackId} />;
37+
return <StackTabContent objectConfig={config} stackId={stackId} />;
3338
}
3439

3540
type StackTabContentProps = {
3641
stackId: string;
37-
run: PipelineRun;
42+
objectConfig: Record<string, any>;
3843
};
39-
function StackTabContent({ stackId, run }: StackTabContentProps) {
44+
function StackTabContent({ stackId, objectConfig }: StackTabContentProps) {
4045
const { data, isError, isPending } = useStack({ stackId: stackId });
4146

4247
if (isPending) return <Skeleton className="h-[250px] w-full" />;
@@ -45,5 +50,5 @@ function StackTabContent({ stackId, run }: StackTabContentProps) {
4550
return <p>Failed to fetch Stack</p>;
4651
}
4752

48-
return <StackInfo stack={data} run={run} />;
53+
return <StackInfo stack={data} objectConfig={objectConfig} />;
4954
}

0 commit comments

Comments
 (0)