From b9f60218d794945c499bfcbd535ac6a49ed0f293 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 6 Aug 2025 16:43:48 +0200 Subject: [PATCH 01/12] UI/install: create installer improve wording --- .../src/workflows/Install/steps/Initial.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/clan-app/ui/src/workflows/Install/steps/Initial.tsx b/pkgs/clan-app/ui/src/workflows/Install/steps/Initial.tsx index ebf1d52c9..43bc7e25a 100644 --- a/pkgs/clan-app/ui/src/workflows/Install/steps/Initial.tsx +++ b/pkgs/clan-app/ui/src/workflows/Install/steps/Initial.tsx @@ -1,8 +1,7 @@ -import { defineSteps, Step, StepBase, useStepper } from "@/src/hooks/stepper"; +import { defineSteps, useStepper } from "@/src/hooks/stepper"; import { InstallSteps } from "../install"; import { Typography } from "@/src/components/Typography/Typography"; import { Button } from "@/src/components/Button/Button"; -import { Divider } from "@/src/components/Divider/Divider"; import { StepLayout } from "../../Steps"; const ChoiceLocalOrRemote = () => { @@ -10,8 +9,8 @@ const ChoiceLocalOrRemote = () => { return (
-
-
+
+
{
-
-
+
+
{ body={
-
-
+
+
{
-
-
+
+
Date: Thu, 7 Aug 2025 12:42:09 +0200 Subject: [PATCH 02/12] dirs: add local path to clan_core flake in dirs --- pkgs/clan-cli/clan_lib/dirs/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/clan-cli/clan_lib/dirs/__init__.py b/pkgs/clan-cli/clan_lib/dirs/__init__.py index 1b3593d28..9b6d84b8f 100644 --- a/pkgs/clan-cli/clan_lib/dirs/__init__.py +++ b/pkgs/clan-cli/clan_lib/dirs/__init__.py @@ -56,6 +56,13 @@ def find_toplevel(top_level_files: list[str]) -> Path | None: return None +def clan_core_flake() -> Path: + """ + Returns the path to the clan core flake. + """ + return module_root().parent.parent.parent + + class TemplateType(Enum): CLAN = "clan" DISK = "disk" From 4536a5b4f53ec260824e77e796fb7c7f4acc3ee5 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 7 Aug 2025 12:42:40 +0200 Subject: [PATCH 03/12] clan/flash: provide defaults for verbose flash options --- pkgs/clan-cli/clan_lib/flash/flash.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/flash/flash.py b/pkgs/clan-cli/clan_lib/flash/flash.py index 5dfd50da4..ccec18dc3 100644 --- a/pkgs/clan-cli/clan_lib/flash/flash.py +++ b/pkgs/clan-cli/clan_lib/flash/flash.py @@ -4,7 +4,7 @@ import os from dataclasses import dataclass, field from pathlib import Path from tempfile import TemporaryDirectory -from typing import Any +from typing import Any, Literal from clan_cli.facts.generate import generate_facts from clan_cli.vars.generate import generate_vars @@ -12,7 +12,9 @@ from clan_cli.vars.upload import populate_secret_vars from clan_lib.api import API from clan_lib.cmd import Log, RunOpts, cmd_with_root, run +from clan_lib.dirs import clan_core_flake from clan_lib.errors import ClanError +from clan_lib.flake.flake import Flake from clan_lib.machines.machines import Machine from clan_lib.nix import nix_shell @@ -38,14 +40,16 @@ class Disk: # TODO: unify this with machine install @API.register def run_machine_flash( - machine: Machine, - *, - mode: str, disks: list[Disk], system_config: SystemConfig, - dry_run: bool, - write_efi_boot_entries: bool, - debug: bool, + # Optional parameters + machine: Machine = Machine( + name="flash-installer", flake=Flake(str(clan_core_flake())) + ), + mode: Literal["format", "mount"] = "format", + dry_run: bool = False, + write_efi_boot_entries: bool = False, + debug: bool = False, extra_args: list[str] | None = None, graphical: bool = False, ) -> None: From 86a617712603e6ed2853e9b77be4b542e782391d Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 7 Aug 2025 12:43:13 +0200 Subject: [PATCH 04/12] UI/useClan: add error debugging --- pkgs/clan-app/ui/src/hooks/clan.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/clan-app/ui/src/hooks/clan.ts b/pkgs/clan-app/ui/src/hooks/clan.ts index b3b6e657d..a8e2418d0 100644 --- a/pkgs/clan-app/ui/src/hooks/clan.ts +++ b/pkgs/clan-app/ui/src/hooks/clan.ts @@ -47,7 +47,12 @@ export const navigateToMachine = ( }; export const clanURIParam = (params: Params) => { - return decodeBase64(params.clanURI); + try { + return decodeBase64(params.clanURI); + } catch (e) { + console.error("Failed to decode clan URI:", params.clanURI, e); + throw new Error("Invalid clan URI"); + } }; export const useClanURI = () => clanURIParam(useParams()); From a814a44bc60265036b8fbde9afc4f7bda07e3ae7 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 7 Aug 2025 12:43:45 +0200 Subject: [PATCH 05/12] UI/Select: add async option loading --- .../src/components/Select/Select.module.css | 7 ++ .../src/components/Select/Select.stories.tsx | 47 +++++----- .../ui/src/components/Select/Select.tsx | 90 +++++++++++++++---- 3 files changed, 106 insertions(+), 38 deletions(-) diff --git a/pkgs/clan-app/ui/src/components/Select/Select.module.css b/pkgs/clan-app/ui/src/components/Select/Select.module.css index bff926029..986122bd4 100644 --- a/pkgs/clan-app/ui/src/components/Select/Select.module.css +++ b/pkgs/clan-app/ui/src/components/Select/Select.module.css @@ -11,6 +11,10 @@ @apply outline outline-1 outline-inv-2 } + &[data-loading] { + @apply cursor-wait; + } + &:hover { @apply bg-def-2; @@ -38,6 +42,9 @@ &[data-disabled] { @apply cursor-not-allowed; } + &[data-loading] { + @apply bg-inherit; + } } .options_content { diff --git a/pkgs/clan-app/ui/src/components/Select/Select.stories.tsx b/pkgs/clan-app/ui/src/components/Select/Select.stories.tsx index 3890d998b..38baef30b 100644 --- a/pkgs/clan-app/ui/src/components/Select/Select.stories.tsx +++ b/pkgs/clan-app/ui/src/components/Select/Select.stories.tsx @@ -47,25 +47,28 @@ export const Default: Story = { placeholder: "Select your pet", }, }; - -// -// {(field, input) => ( -//