From d833b6261483badc5e88f856460b2bc33ff7e856 Mon Sep 17 00:00:00 2001 From: DavHau Date: Wed, 21 May 2025 17:01:49 +0700 Subject: [PATCH] GUI: add credentials page (vars) add it to machine details --- .../ui/src/routes/machines/details.tsx | 11 + .../routes/machines/install/hardware-step.tsx | 1 + .../src/routes/machines/install/vars-step.tsx | 192 +++++++++++------- pkgs/clan-cli/clan_cli/tests/test_vars.py | 2 +- pkgs/clan-cli/clan_cli/vars/generate.py | 16 +- 5 files changed, 135 insertions(+), 87 deletions(-) diff --git a/pkgs/clan-app/ui/src/routes/machines/details.tsx b/pkgs/clan-app/ui/src/routes/machines/details.tsx index 70e3a0575..e33e0f4a2 100644 --- a/pkgs/clan-app/ui/src/routes/machines/details.tsx +++ b/pkgs/clan-app/ui/src/routes/machines/details.tsx @@ -538,6 +538,17 @@ const MachineForm = (props: MachineDetailsProps) => { > Update +
{/* diff --git a/pkgs/clan-app/ui/src/routes/machines/install/hardware-step.tsx b/pkgs/clan-app/ui/src/routes/machines/install/hardware-step.tsx index 3f267b0f2..3605d9bc5 100644 --- a/pkgs/clan-app/ui/src/routes/machines/install/hardware-step.tsx +++ b/pkgs/clan-app/ui/src/routes/machines/install/hardware-step.tsx @@ -13,6 +13,7 @@ import { getValue, submit, setValue, + FormStore, } from "@modular-forms/solid"; import { createEffect, createSignal, JSX, Match, Switch } from "solid-js"; import { TextInput } from "@/src/Form/fields"; diff --git a/pkgs/clan-app/ui/src/routes/machines/install/vars-step.tsx b/pkgs/clan-app/ui/src/routes/machines/install/vars-step.tsx index df8206845..2b793744b 100644 --- a/pkgs/clan-app/ui/src/routes/machines/install/vars-step.tsx +++ b/pkgs/clan-app/ui/src/routes/machines/install/vars-step.tsx @@ -8,12 +8,14 @@ import { import { createQuery, useQueryClient } from "@tanstack/solid-query"; import { Typography } from "@/src/components/Typography"; import { Group } from "@/src/components/group"; -import { For, Match, Show, Switch } from "solid-js"; +import { For, JSX, Match, Show, Switch } from "solid-js"; import { TextInput } from "@/src/Form/fields"; import toast from "solid-toast"; import { useNavigate, useParams, useSearchParams } from "@solidjs/router"; import { activeURI } from "@/src/App"; import { StepProps } from "./hardware-step"; +import { BackButton } from "@/src/components/BackButton"; +import { Button } from "@/src/components/button"; export type VarsValues = FieldValues & Record>; @@ -22,6 +24,7 @@ export interface VarsFormProps { dir: string; handleSubmit: SubmitHandler; generators: SuccessData<"get_generators_closure">; + footer: JSX.Element; } export const VarsForm = (props: VarsFormProps) => { @@ -58,87 +61,98 @@ export const VarsForm = (props: VarsFormProps) => { >
- - {(generator) => ( - - - {generator.name} - -
- Bound to module (shared): {generator.share ? "True" : "False"} -
- - {(prompt) => ( - - - {!prompt.previous_value ? "Required" : "Optional"} - - - {prompt.name} - - - {(field, props) => ( - - } - > - 0} + fallback="No credentials needed" + > + + {(generator) => ( + + + {generator.name} + +
+ Bound to module (shared):{" "} + {generator.share ? "True" : "False"} +
+ + {(prompt) => ( + + + {!prompt.previous_value ? "Required" : "Optional"} + + + {prompt.name} + + + {(field, props) => ( + } > -