Skip to content

Commit

Permalink
feat: update Connect Command (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cahllagerfeld authored Dec 2, 2024
1 parent 3489bdf commit 33bc5d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/app/onboarding/Setup/Items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { Codesnippet } from "@/components/CodeSnippet";
import { HelpBox } from "@/components/fallback-pages/Helpbox";
import { ChecklistItem } from "@/components/onboarding/ChecklistItem";
import { useServerInfo } from "@/data/server/info-query";
import { getLoginCommand } from "@/lib/login-command";
import { routes } from "@/router/routes";
import { OnboardingStep } from "@/types/onboarding";
import { Box, Button, Skeleton, buttonVariants } from "@zenml-io/react-component-library";
import { Link } from "react-router-dom";

export function ConnectZenMLStep({ completed, hasDownstreamStep, active }: OnboardingStep) {
const { data } = useServerInfo({ throwOnError: true });

return (
<ChecklistItem
active={active}
Expand All @@ -27,7 +29,7 @@ export function ConnectZenMLStep({ completed, hasDownstreamStep, active }: Onboa
</div>
<div>
<p className="mb-1 text-text-sm text-theme-text-secondary">Login to your ZenML Server</p>
<Codesnippet code={`zenml connect --url ${window.location.origin}`} />
<Codesnippet code={getLoginCommand(data?.deployment_type || "other")} />
</div>
<HelpBox link="https://docs.zenml.io/user-guide/production-guide/deploying-zenml#connecting-to-a-deployed-zenml" />
</div>
Expand Down
11 changes: 7 additions & 4 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import External from "@/assets/icons/link-external.svg?react";
import CloudSquares from "@/assets/illustrations/cloud-squares.svg";
import { useServerInfo } from "@/data/server/info-query";
import { getLoginCommand } from "@/lib/login-command";
import { routes } from "@/router/routes";
import { Badge, Box, Button } from "@zenml-io/react-component-library";
import { Link } from "react-router-dom";
import { Codesnippet } from "../components/CodeSnippet";
import External from "@/assets/icons/link-external.svg?react";
import { OverviewHeader } from "./Header";
import { Link } from "react-router-dom";
import { routes } from "@/router/routes";

export default function IndexPage() {
return (
Expand All @@ -19,6 +21,7 @@ export default function IndexPage() {
}

function OverviewContent() {
const { data } = useServerInfo();
return (
<Box className="flex flex-col-reverse overflow-hidden lg:flex-row">
<div className="w-full px-7 py-5 lg:w-2/3">
Expand All @@ -40,7 +43,7 @@ function OverviewContent() {
<Codesnippet
codeClasses="truncate"
className="truncate"
code={`zenml connect --url=${window.location.origin}`}
code={getLoginCommand(data?.deployment_type || "other")}
/>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/lib/login-command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { DeploymentType } from "../types/server";

export function getLoginCommand(deploymentType: DeploymentType) {
switch (deploymentType) {
case "local":
return "zenml login --local";

case "docker":
return "zenml login --local --docker";
default:
return `zenml login ${window.location.origin}`;
}
}

0 comments on commit 33bc5d7

Please sign in to comment.