Skip to content

Commit d0dc623

Browse files
Merge pull request #654 from zenml-io/staging
2 parents fb9a6c8 + c0582f2 commit d0dc623

File tree

109 files changed

+2752
-1260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2752
-1260
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@zenml-io/react-component-library": "^0.18.0",
3434
"awesome-debounce-promise": "^2.1.0",
3535
"class-variance-authority": "^0.7.0",
36+
"clsx": "^2.1.1",
3637
"immer": "^10.1.1",
3738
"lodash.debounce": "^4.0.8",
3839
"papaparse": "^5.4.1",

pnpm-lock.yaml

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/activate-user/AwarenessStep.tsx renamed to src/app/activate-user/InfrastructureStep.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import AlertCircle from "@/assets/icons/alert-circle.svg?react";
2-
import { AwarenessForm } from "@/components/survey/AwarenessChannel";
3-
import { AwarenessFormType } from "@/components/survey/form-schemas";
2+
import { InfrastructureForm } from "@/components/survey/Infrastructure";
3+
import { InfrastructureFormType } from "@/components/survey/form-schemas";
44
import { useActivateUser } from "@/data/users/activate-user-mutation";
55
import { useToast } from "@zenml-io/react-component-library";
66
import { useActivationContext } from "./ActivationContext";
@@ -15,7 +15,7 @@ type Props = {
1515
setUsername: Dispatch<SetStateAction<string>>;
1616
};
1717

18-
export function AwarenessStep({ userId, setUsername }: Props) {
18+
export function InfraStep({ userId, setUsername }: Props) {
1919
const { newUser } = useActivationContext();
2020
const { setAuthState } = useAuthContext();
2121
const { setSurveyStep } = useSurveyContext();
@@ -44,14 +44,17 @@ export function AwarenessStep({ userId, setUsername }: Props) {
4444
}
4545
});
4646

47-
function handleAwarenessFormSubmit({ other, channels, otherVal }: AwarenessFormType) {
48-
const channelArr = other ? [...channels, otherVal] : channels;
49-
const updateMetadata: UserMetadata = { awareness_channels: channelArr as string[] };
47+
function handleInfraFormSubmit({ other, providers, otherVal }: InfrastructureFormType) {
48+
const providerArr = other ? [...providers, otherVal] : providers;
49+
const updateMetadata: UserMetadata = {
50+
infra_providers: providerArr as string[],
51+
finished_onboarding_survey: true
52+
};
5053
mutate({
5154
userId,
5255
body: { ...newUser, user_metadata: { ...newUser.user_metadata, ...updateMetadata } }
5356
});
5457
}
5558

56-
return <AwarenessForm submitHandler={handleAwarenessFormSubmit} />;
59+
return <InfrastructureForm submitHandler={handleInfraFormSubmit} />;
5760
}

src/app/activate-user/PrimaryUseStep.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ export function PrimaryUseStep() {
88
const { setSurveyStep } = useSurveyContext();
99
const { setNewUser } = useActivationContext();
1010

11-
function handlePrimaryUseSubmit({ amountProductionModels, primaryUse }: PrimaryUseFormType) {
11+
function handlePrimaryUseSubmit({ primaryUse }: PrimaryUseFormType) {
1212
const newMetadata: UserMetadata = {
13-
primary_use: primaryUse,
14-
models_production: amountProductionModels
13+
primary_use: primaryUse
1514
};
1615
setNewUser((prev) => ({
1716
...prev,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { useSurveyContext } from "@/components/survey/SurveyContext";
2+
import { UsageReasonForm } from "@/components/survey/UsageReason";
3+
import { UsageReasonFormType } from "@/components/survey/form-schemas";
4+
import { UserMetadata } from "@/types/user";
5+
import { useActivationContext } from "./ActivationContext";
6+
7+
export function UsageReasonStep() {
8+
const { setSurveyStep } = useSurveyContext();
9+
const { setNewUser } = useActivationContext();
10+
11+
function handleUsageReasonSubmit({
12+
usageReason,
13+
comparison_tools,
14+
otherTool,
15+
otherToolVal
16+
}: UsageReasonFormType) {
17+
const metadata: UserMetadata = {
18+
usage_reason: usageReason,
19+
...(!!comparison_tools && {
20+
comparing_tools:
21+
!!otherTool && !!otherToolVal ? [...comparison_tools, otherToolVal] : comparison_tools
22+
})
23+
};
24+
setNewUser((prev) => ({
25+
...prev,
26+
user_metadata: { ...prev.user_metadata, ...metadata }
27+
}));
28+
setSurveyStep((prev) => prev + 1);
29+
}
30+
31+
return <UsageReasonForm submitHandler={handleUsageReasonSubmit} />;
32+
}

src/app/activate-user/Wizard.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import { EmptyState } from "@/components/EmptyState";
2+
import { SlackStep } from "@/components/survey/SlackStep";
13
import StepDisplay from "@/components/survey/StepDisplay";
4+
import { SuccessStep } from "@/components/survey/SuccessStep";
25
import { useSurveyContext } from "@/components/survey/SurveyContext";
6+
import { useState } from "react";
7+
import { useSearchParams } from "react-router-dom";
38
import { AccountDetailsStep } from "./AccountDetailsStep";
9+
import { ActivationProvider } from "./ActivationContext";
10+
import { InfraStep } from "./InfrastructureStep";
411
import { SetPasswordStep } from "./PasswordStep";
512
import { PrimaryUseStep } from "./PrimaryUseStep";
6-
import { AwarenessStep } from "./AwarenessStep";
7-
import { ActivationProvider } from "./ActivationContext";
8-
import { useSearchParams } from "react-router-dom";
9-
import { EmptyState } from "@/components/EmptyState";
10-
import { SuccessStep } from "@/components/survey/SuccessStep";
11-
import { useState } from "react";
13+
import { UsageReasonStep } from "./UsageReasonStep";
1214

1315
export function ActivateWizard() {
1416
const { surveyStep } = useSurveyContext();
@@ -29,12 +31,14 @@ export function ActivateWizard() {
2931
return (
3032
<>
3133
<ActivationProvider initialUser={{ activation_token: token }}>
32-
<StepDisplay stepAmount={4} />
34+
<StepDisplay stepAmount={6} />
3335
{surveyStep === 1 && <AccountDetailsStep />}
3436
{surveyStep === 2 && <SetPasswordStep />}
3537
{surveyStep === 3 && <PrimaryUseStep />}
36-
{surveyStep === 4 && <AwarenessStep setUsername={setUsername} userId={id} />}
37-
{surveyStep === 5 && (
38+
{surveyStep === 4 && <UsageReasonStep />}
39+
{surveyStep === 5 && <InfraStep setUsername={setUsername} userId={id} />}
40+
{surveyStep === 6 && <SlackStep />}
41+
{surveyStep === 7 && (
3842
<SuccessStep subHeader="Your created your ZenML account" username={username} />
3943
)}
4044
</ActivationProvider>

src/app/runs/[id]/_Tabs/Configuration/CodeCollapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Props = {
1414
};
1515

1616
export function CodeCollapsible({ runId }: Props) {
17-
const [open, setOpen] = useState(false);
17+
const [open, setOpen] = useState(true);
1818
const runCode = `from zenml.client import Client
1919
run = Client().get_pipeline_run('${runId}')
2020
config = run.config`;

src/app/runs/[id]/_Tabs/Configuration/EnvironmentCollapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Props = {
1414
};
1515

1616
export function EnvironmentCollapsible({ run }: Props) {
17-
const [open, setOpen] = useState(false);
17+
const [open, setOpen] = useState(true);
1818

1919
return (
2020
<CollapsiblePanel open={open} onOpenChange={setOpen}>

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ export function ConfigurationTab() {
3131

3232
return (
3333
<div className="grid grid-cols-1 gap-5">
34-
<NestedCollapsible title="Parameters" data={data.metadata?.config.parameters ?? undefined} />
34+
<NestedCollapsible
35+
isInitialOpen
36+
title="Parameters"
37+
data={data.metadata?.config.parameters ?? undefined}
38+
/>
3539
{(buildData?.metadata?.images as BuildItemMap)?.orchestrator && (
3640
<DockerImageCollapsible data={buildData?.metadata?.images?.orchestrator as BuildItem} />
3741
)}
3842
<CodeCollapsible runId={runId} />
3943
<EnvironmentCollapsible run={data} />
40-
<NestedCollapsible title="Extra" data={data.metadata?.config.extra} />
44+
<NestedCollapsible isInitialOpen title="Extra" data={data.metadata?.config.extra} />
4145
<NestedCollapsible
46+
isInitialOpen
4247
title="Resources"
4348
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4449
data={(data.metadata?.config.settings as { [key: string]: any })?.resources || {}}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import File from "@/assets/icons/file.svg?react";
2+
import { EmptyState } from "@/components/EmptyState";
3+
import { MetadataCards, UncategorizedCard } from "@/components/MetadataCards";
4+
import { usePipelineRun } from "@/data/pipeline-runs/pipeline-run-detail-query";
5+
import { MetadataMap } from "@/types/common";
6+
import { Skeleton } from "@zenml-io/react-component-library";
7+
import { useParams } from "react-router-dom";
8+
9+
export function MetadataTab() {
10+
const { runId } = useParams() as { runId: string };
11+
const { data, isError } = usePipelineRun({ runId }, { throwOnError: true });
12+
13+
if (isError) return <p>Failed to fetch pipeline run</p>;
14+
15+
if (data && Object.entries(data.metadata?.run_metadata || {}).length < 1) {
16+
return (
17+
<EmptyState icon={<File className="h-[120px] w-[120px] fill-neutral-300" />}>
18+
<div className="text-center">
19+
<p className="mb-2 text-display-xs font-semibold">No metadata found</p>
20+
<p className="text-text-lg text-theme-text-secondary">There are no metadata available.</p>
21+
</div>
22+
</EmptyState>
23+
);
24+
}
25+
26+
return (
27+
<section className="flex flex-col gap-5">
28+
{data ? (
29+
<UncategorizedCard metadata={data.metadata?.run_metadata as any} />
30+
) : (
31+
<Skeleton className="h-[200px] w-full" />
32+
)}
33+
{data ? (
34+
<MetadataCards metadata={data.metadata?.run_metadata as MetadataMap} />
35+
) : (
36+
<Skeleton className="h-[200px] w-full" />
37+
)}
38+
</section>
39+
);
40+
}

0 commit comments

Comments
 (0)