From eebd3fa4ec71ce69c5eb61196f0b41a35ece2209 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 11 Aug 2025 15:15:00 +0200 Subject: [PATCH] ui/install: hook up {cancel, close} method --- .../ui/src/workflows/Install/install.tsx | 33 ++++++------------- .../Install/steps/createInstaller.tsx | 15 ++++++++- .../workflows/Install/steps/installSteps.tsx | 14 +++++++- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/pkgs/clan-app/ui/src/workflows/Install/install.tsx b/pkgs/clan-app/ui/src/workflows/Install/install.tsx index be2de668f..241edf5d3 100644 --- a/pkgs/clan-app/ui/src/workflows/Install/install.tsx +++ b/pkgs/clan-app/ui/src/workflows/Install/install.tsx @@ -6,38 +6,25 @@ import { useStepper, } from "@/src/hooks/stepper"; import { createForm, FieldValues, SubmitHandler } from "@modular-forms/solid"; -import { Show } from "solid-js"; +import { onMount, Show } from "solid-js"; import { Dynamic } from "solid-js/web"; import { initialSteps } from "./steps/Initial"; import { createInstallerSteps } from "./steps/createInstaller"; import { installSteps } from "./steps/installSteps"; import { ApiCall } from "@/src/hooks/api"; -interface InstallForm extends FieldValues { - data_from_step_1: string; - data_from_step_2?: string; - data_from_step_3?: string; +interface InstallStepperProps { + onDone: () => void; } - -const InstallStepper = () => { +const InstallStepper = (props: InstallStepperProps) => { const stepSignal = useStepper(); + const [store, set] = getStepStore(stepSignal); - const [formStore, { Form, Field, FieldArray }] = createForm(); + onMount(() => { + set("done", props.onDone); + }); - const handleSubmit: SubmitHandler = (values, event) => { - console.log("Installation started (submit)", values); - stepSignal.setActiveStep("install:progress"); - }; - return ( -
-
- -
-
- ); + return ; }; export interface InstallModalProps { @@ -108,7 +95,7 @@ export const InstallModal = (props: InstallModalProps) => { // @ts-expect-error some steps might not have disablePadding={stepper.currentStep()?.isSplash} > - {(ctx) => } + {(ctx) => } ); diff --git a/pkgs/clan-app/ui/src/workflows/Install/steps/createInstaller.tsx b/pkgs/clan-app/ui/src/workflows/Install/steps/createInstaller.tsx index 473931a58..cc78ea09a 100644 --- a/pkgs/clan-app/ui/src/workflows/Install/steps/createInstaller.tsx +++ b/pkgs/clan-app/ui/src/workflows/Install/steps/createInstaller.tsx @@ -308,6 +308,14 @@ const FlashProgress = () => { stepSignal.next(); }); + const handleCancel = async () => { + const progress = store.flash.progress; + if (progress) { + await progress.cancel(); + } + stepSignal.previous(); + }; + return (
@@ -320,7 +328,12 @@ const FlashProgress = () => { USB stick is being flashed -
diff --git a/pkgs/clan-app/ui/src/workflows/Install/steps/installSteps.tsx b/pkgs/clan-app/ui/src/workflows/Install/steps/installSteps.tsx index dfe1e5e0a..f68e13420 100644 --- a/pkgs/clan-app/ui/src/workflows/Install/steps/installSteps.tsx +++ b/pkgs/clan-app/ui/src/workflows/Install/steps/installSteps.tsx @@ -537,6 +537,13 @@ const InstallProgress = () => { const stepSignal = useStepper(); const [store, get] = getStepStore(stepSignal); + const handleCancel = async () => { + const progress = store.install.progress; + if (progress) { + await progress.cancel(); + } + store.done(); + }; return (
@@ -549,7 +556,12 @@ const InstallProgress = () => { Machine is beeing installed -