UI/install: split initial choice

This commit is contained in:
Johannes Kirschbauer
2025-08-06 16:43:11 +02:00
parent 65101ad55a
commit fa03c190f8
2 changed files with 104 additions and 34 deletions

View File

@@ -7,7 +7,7 @@ import {
import { createForm, FieldValues, SubmitHandler } from "@modular-forms/solid"; import { createForm, FieldValues, SubmitHandler } from "@modular-forms/solid";
import { Show } from "solid-js"; import { Show } from "solid-js";
import { Dynamic } from "solid-js/web"; import { Dynamic } from "solid-js/web";
import { InitialStep } from "./steps/Initial"; import { initialSteps } from "./steps/Initial";
import { createInstallerSteps } from "./steps/createInstaller"; import { createInstallerSteps } from "./steps/createInstaller";
import { installSteps } from "./steps/installSteps"; import { installSteps } from "./steps/installSteps";
@@ -40,10 +40,14 @@ const InstallStepper = () => {
export interface InstallModalProps { export interface InstallModalProps {
machineName: string; machineName: string;
initialStep?: string; initialStep?: InstallSteps[number]["id"];
} }
const steps = [InitialStep, ...createInstallerSteps, ...installSteps] as const; const steps = [
...initialSteps,
...createInstallerSteps,
...installSteps,
] as const;
export type InstallSteps = typeof steps; export type InstallSteps = typeof steps;

View File

@@ -1,32 +1,24 @@
import { useStepper } from "@/src/hooks/stepper"; import { defineSteps, Step, StepBase, useStepper } from "@/src/hooks/stepper";
import { InstallSteps } from "../install"; import { InstallSteps } from "../install";
import { Typography } from "@/src/components/Typography/Typography"; import { Typography } from "@/src/components/Typography/Typography";
import { Button } from "@/src/components/Button/Button"; import { Button } from "@/src/components/Button/Button";
import { Divider } from "@/src/components/Divider/Divider"; import { Divider } from "@/src/components/Divider/Divider";
import { StepLayout } from "../../Steps";
const InitialChoice = () => { const ChoiceLocalOrRemote = () => {
const stepSignal = useStepper<InstallSteps>(); const stepSignal = useStepper<InstallSteps>();
return ( return (
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="flex flex-col gap-6 rounded-md px-4 py-6 text-fg-def-1 bg-def-2"> <div class="flex flex-col gap-6 rounded-md px-4 py-6 text-fg-def-1 bg-def-2">
<div class="flex gap-2"> <div class="flex gap-2 justify-between">
<div class="flex flex-col gap-1 px-1"> <div class="flex flex-col gap-1 px-1 justify-center">
<Typography <Typography
hierarchy="label" hierarchy="label"
size="xs" size="xs"
weight="bold" weight="bold"
color="primary" color="primary"
> >
Remote setup I have physical access to the machine.
</Typography>
<Typography
hierarchy="body"
size="xxs"
weight="normal"
color="secondary"
>
Is your machine currently online? Does it have an IP-address, can
you SSH into it? And does it support Kexec?
</Typography> </Typography>
</div> </div>
<Button <Button
@@ -34,31 +26,105 @@ const InitialChoice = () => {
ghost ghost
hierarchy="secondary" hierarchy="secondary"
icon="CaretRight" icon="CaretRight"
onClick={() => stepSignal.setActiveStep("install:machine-0")} onClick={() => stepSignal.setActiveStep("local:choice")}
></Button> />
</div> </div>
<Divider orientation="horizontal" class="bg-def-3" /> </div>
<div class="flex flex-col gap-6 rounded-md px-4 py-6 text-fg-def-1 bg-def-2">
<div class="flex items-center justify-between gap-2"> <div class="flex gap-2 justify-between">
<Typography hierarchy="label" size="xs" weight="bold"> <div class="flex flex-col gap-1 px-1 justify-center">
I don't have an installer, yet <Typography
hierarchy="label"
size="xs"
weight="bold"
color="primary"
>
The Machine is remote and i have ssh access to it.
</Typography> </Typography>
</div>
<Button <Button
type="button"
ghost ghost
hierarchy="secondary" hierarchy="secondary"
endIcon="Flash" icon="CaretRight"
type="button" onClick={() => stepSignal.setActiveStep("install:address")}
onClick={() => stepSignal.setActiveStep("create:iso-0")} />
>
Create USB Installer
</Button>
</div> </div>
</div> </div>
</div> </div>
); );
}; };
export const InitialStep = { const ChoiceLocalInstaller = () => {
id: "init", const stepSignal = useStepper<InstallSteps>();
content: InitialChoice, return (
<StepLayout
body={
<div class="flex flex-col gap-3">
<div class="flex flex-col gap-6 rounded-md px-4 py-6 text-fg-def-1 bg-def-2">
<div class="flex gap-2 justify-between">
<div class="flex flex-col gap-1 px-1 justify-center">
<Typography
hierarchy="label"
size="xs"
weight="bold"
color="primary"
>
I have an installer
</Typography>
</div>
<Button
type="button"
ghost
hierarchy="secondary"
icon="CaretRight"
onClick={() => stepSignal.setActiveStep("install:address")}
/>
</div>
</div>
<div class="flex flex-col gap-6 rounded-md px-4 py-6 text-fg-def-1 bg-def-2">
<div class="flex gap-2 justify-between">
<div class="flex flex-col gap-1 px-1 justify-center">
<Typography
hierarchy="label"
size="xs"
weight="bold"
color="primary"
>
I don't have an installer, yet
</Typography>
</div>
<Button
type="button"
ghost
hierarchy="secondary"
icon="CaretRight"
onClick={() => stepSignal.setActiveStep("create:prose")}
/>
</div>
</div>
</div>
}
footer={
<div class="flex justify-start">
<Button
hierarchy="secondary"
icon="ArrowLeft"
onClick={() => stepSignal.previous()}
/>
</div>
}
/>
);
}; };
export const initialSteps = defineSteps([
{
id: "init",
content: ChoiceLocalOrRemote,
},
{
id: "local:choice",
content: ChoiceLocalInstaller,
},
] as const);