Skip to content

Commit b5ec4e6

Browse files
feat: wizard for stacks (#635)
1 parent 34857c6 commit b5ec4e6

Some content is hidden

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

67 files changed

+2256
-228
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
"@tanstack/react-table": "^8.17.3",
3131
"@tisoap/react-flow-smart-edge": "^3.0.0",
3232
"@zenml-io/react-component-library": "^0.18.0",
33+
"awesome-debounce-promise": "^2.1.0",
3334
"class-variance-authority": "^0.7.0",
35+
"immer": "^10.1.1",
3436
"lodash.debounce": "^4.0.8",
3537
"papaparse": "^5.4.1",
3638
"prismjs": "^1.29.0",

pnpm-lock.yaml

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

src/app/stacks/create/SmartSetup.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,21 @@ function NewInfrastructure({ isLocalDeployment }: Props) {
5454
}
5555

5656
function ExistingCloud({ isLocalDeployment }: Props) {
57+
const [searchParams] = useSearchParams();
58+
const link =
59+
routes.stacks.create.existingInfra +
60+
(searchParams.size >= 1 ? `?${searchParams.toString()}` : "");
5761
return (
5862
<div className="relative">
5963
{isLocalDeployment && <LocalOverlay />}
60-
<CreateStackOptionCard
61-
comingSoon
62-
title="Use existing Cloud"
63-
subtitle="Connect to your existing Cloud and configure your components manually."
64-
icon={<CloudTenant className="h-6 w-6 fill-primary-400" />}
65-
estimatedTime="15"
66-
/>
64+
<Link to={link}>
65+
<CreateStackOptionCard
66+
title="Use existing Cloud"
67+
subtitle="Connect to your existing Cloud and configure your components manually."
68+
icon={<CloudTenant className="h-6 w-6 fill-primary-400" />}
69+
estimatedTime="15"
70+
/>
71+
</Link>
6772
</div>
6873
);
6974
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Button } from "@zenml-io/react-component-library/components/server";
2+
import { useNavigate } from "react-router-dom";
3+
import { clearWizardData } from "../new-infrastructure/persist";
4+
import { routes } from "@/router/routes";
5+
6+
export function CancelButton() {
7+
const navigate = useNavigate();
8+
9+
function cancel() {
10+
clearWizardData();
11+
navigate(routes.stacks.create.index);
12+
}
13+
return (
14+
<Button onClick={() => cancel()} intent="secondary" size="md">
15+
Cancel
16+
</Button>
17+
);
18+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Badge, cn } from "@zenml-io/react-component-library";
2+
import { InputHTMLAttributes, ReactNode, forwardRef } from "react";
3+
4+
type ProviderRadioProps = InputHTMLAttributes<HTMLInputElement>;
5+
export const CloudProviderRadioButton = forwardRef<HTMLInputElement, ProviderRadioProps>(
6+
({ children, className, id, ...rest }, ref) => (
7+
<div className="min-h-[160px] min-w-[160px]">
8+
<input id={id} {...rest} ref={ref} className={cn("peer sr-only", className)} type="radio" />
9+
<label
10+
htmlFor={id}
11+
className="flex h-full w-full flex-col items-start justify-center space-y-5 rounded-md border border-theme-border-minimal bg-theme-surface-primary p-5 text-text-lg text-theme-text-secondary hover:cursor-pointer peer-checked:border-primary-100 peer-checked:bg-primary-25 peer-focus-visible:border-primary-100 peer-disabled:cursor-default peer-disabled:bg-neutral-50"
12+
>
13+
{children}
14+
</label>
15+
</div>
16+
)
17+
);
18+
19+
CloudProviderRadioButton.displayName = "CloudProviderRadioButton";
20+
21+
type ProviderCardProps = {
22+
icon: ReactNode;
23+
title: ReactNode;
24+
subtitle: ReactNode;
25+
comingSoon?: boolean;
26+
};
27+
export function ProviderCard({ icon, title, subtitle, comingSoon }: ProviderCardProps) {
28+
return (
29+
<div className="space-y-1 text-left">
30+
{icon}
31+
<div className="flex items-center gap-1">
32+
<p className="text-text-lg font-semibold text-theme-text-primary">{title}</p>
33+
{comingSoon && (
34+
<Badge className="font-semibold" color="purple" size="sm">
35+
Coming Soon
36+
</Badge>
37+
)}
38+
</div>
39+
<p className="text-text-sm text-theme-text-secondary">{subtitle}</p>
40+
</div>
41+
);
42+
}

0 commit comments

Comments
 (0)