diff --git a/pkgs/clan-cli/clan_cli/machines/list.py b/pkgs/clan-cli/clan_cli/machines/list.py index bc754d661..0ebe9ec5b 100644 --- a/pkgs/clan-cli/clan_cli/machines/list.py +++ b/pkgs/clan-cli/clan_cli/machines/list.py @@ -8,12 +8,21 @@ from typing import Literal from clan_cli.api import API from clan_cli.cmd import run_no_stdout from clan_cli.errors import ClanCmdError, ClanError -from clan_cli.inventory import Machine, load_inventory_eval +from clan_cli.inventory import Machine, load_inventory_eval, save_inventory from clan_cli.nix import nix_eval, nix_shell log = logging.getLogger(__name__) +@API.register +def set_machine(flake_url: str | Path, machine_name: str, machine: Machine) -> None: + inventory = load_inventory_eval(flake_url) + + inventory.machines[machine_name] = machine + + save_inventory(inventory, flake_url, "machines: edit '{machine_name}'") + + @API.register def list_inventory_machines(flake_url: str | Path) -> dict[str, Machine]: inventory = load_inventory_eval(flake_url) @@ -86,7 +95,7 @@ def check_machine_online( if not hostname: raise ClanError(f"Machine {machine_name} does not specify a targetHost") - timeout = opts.timeout if opts and opts.timeout else 2 + timeout = opts.timeout if opts and opts.timeout else 20 cmd = nix_shell( ["nixpkgs#util-linux", *(["nixpkgs#openssh"] if hostname else [])], diff --git a/pkgs/webview-ui/app/src/components/FileInput.tsx b/pkgs/webview-ui/app/src/components/FileInput.tsx index 6c92a5d9f..fddfa83b5 100644 --- a/pkgs/webview-ui/app/src/components/FileInput.tsx +++ b/pkgs/webview-ui/app/src/components/FileInput.tsx @@ -16,6 +16,7 @@ interface FileInputProps { label?: string; error?: string; helperText?: string; + placeholder?: JSX.Element; } /** @@ -30,6 +31,7 @@ export function FileInput(props: FileInputProps) { "value", "label", "error", + "placeholder", ]); // Create file list @@ -68,7 +70,11 @@ export function FileInput(props: FileInputProps) { > Click to select file{props.multiple && "s"}} + fallback={ + props.placeholder || ( + <>Click to select file{props.multiple && "s"} + ) + } > Selected file{props.multiple && "s"}:{" "} {getFiles() diff --git a/pkgs/webview-ui/app/src/components/SelectInput.tsx b/pkgs/webview-ui/app/src/components/SelectInput.tsx index 6f04577ee..cd08908cd 100644 --- a/pkgs/webview-ui/app/src/components/SelectInput.tsx +++ b/pkgs/webview-ui/app/src/components/SelectInput.tsx @@ -1,6 +1,7 @@ import { FieldValues, FormStore, ResponseData } from "@modular-forms/solid"; import { Show } from "solid-js"; import { type JSX } from "solid-js"; +import cx from "classnames"; interface SelectInputProps { formStore: FormStore; @@ -11,6 +12,7 @@ interface SelectInputProps { error?: string; required?: boolean; topRightLabel?: JSX.Element; + class?: string; } export function SelectInput( @@ -18,7 +20,7 @@ export function SelectInput( ) { return (