Skip to content

Commit 33bc5d7

Browse files
feat: update Connect Command (#702)
1 parent 3489bdf commit 33bc5d7

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/app/onboarding/Setup/Items.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { Codesnippet } from "@/components/CodeSnippet";
44
import { HelpBox } from "@/components/fallback-pages/Helpbox";
55
import { ChecklistItem } from "@/components/onboarding/ChecklistItem";
66
import { useServerInfo } from "@/data/server/info-query";
7+
import { getLoginCommand } from "@/lib/login-command";
78
import { routes } from "@/router/routes";
89
import { OnboardingStep } from "@/types/onboarding";
910
import { Box, Button, Skeleton, buttonVariants } from "@zenml-io/react-component-library";
1011
import { Link } from "react-router-dom";
1112

1213
export function ConnectZenMLStep({ completed, hasDownstreamStep, active }: OnboardingStep) {
1314
const { data } = useServerInfo({ throwOnError: true });
15+
1416
return (
1517
<ChecklistItem
1618
active={active}
@@ -27,7 +29,7 @@ export function ConnectZenMLStep({ completed, hasDownstreamStep, active }: Onboa
2729
</div>
2830
<div>
2931
<p className="mb-1 text-text-sm text-theme-text-secondary">Login to your ZenML Server</p>
30-
<Codesnippet code={`zenml connect --url ${window.location.origin}`} />
32+
<Codesnippet code={getLoginCommand(data?.deployment_type || "other")} />
3133
</div>
3234
<HelpBox link="https://docs.zenml.io/user-guide/production-guide/deploying-zenml#connecting-to-a-deployed-zenml" />
3335
</div>

src/app/page.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import External from "@/assets/icons/link-external.svg?react";
12
import CloudSquares from "@/assets/illustrations/cloud-squares.svg";
3+
import { useServerInfo } from "@/data/server/info-query";
4+
import { getLoginCommand } from "@/lib/login-command";
5+
import { routes } from "@/router/routes";
26
import { Badge, Box, Button } from "@zenml-io/react-component-library";
7+
import { Link } from "react-router-dom";
38
import { Codesnippet } from "../components/CodeSnippet";
4-
import External from "@/assets/icons/link-external.svg?react";
59
import { OverviewHeader } from "./Header";
6-
import { Link } from "react-router-dom";
7-
import { routes } from "@/router/routes";
810

911
export default function IndexPage() {
1012
return (
@@ -19,6 +21,7 @@ export default function IndexPage() {
1921
}
2022

2123
function OverviewContent() {
24+
const { data } = useServerInfo();
2225
return (
2326
<Box className="flex flex-col-reverse overflow-hidden lg:flex-row">
2427
<div className="w-full px-7 py-5 lg:w-2/3">
@@ -40,7 +43,7 @@ function OverviewContent() {
4043
<Codesnippet
4144
codeClasses="truncate"
4245
className="truncate"
43-
code={`zenml connect --url=${window.location.origin}`}
46+
code={getLoginCommand(data?.deployment_type || "other")}
4447
/>
4548
</div>
4649
</div>

src/lib/login-command.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { DeploymentType } from "../types/server";
2+
3+
export function getLoginCommand(deploymentType: DeploymentType) {
4+
switch (deploymentType) {
5+
case "local":
6+
return "zenml login --local";
7+
8+
case "docker":
9+
return "zenml login --local --docker";
10+
default:
11+
return `zenml login ${window.location.origin}`;
12+
}
13+
}

0 commit comments

Comments
 (0)