diff --git a/pkgs/webview-ui/app/src/components/TextInput.tsx b/pkgs/webview-ui/app/src/components/TextInput.tsx index c598c5094..18266ac10 100644 --- a/pkgs/webview-ui/app/src/components/TextInput.tsx +++ b/pkgs/webview-ui/app/src/components/TextInput.tsx @@ -16,6 +16,7 @@ interface TextInputProps { position: "start" | "end"; content: JSX.Element; }; + placeholder?: string; } export function TextInput( @@ -51,7 +52,7 @@ export function TextInput( classList={{ "input-disabled": props.formStore.submitting, }} - placeholder="name" + placeholder={`${props.placeholder || props.label}`} required disabled={props.formStore.submitting} /> diff --git a/pkgs/webview-ui/app/src/layout/header.tsx b/pkgs/webview-ui/app/src/layout/header.tsx index 8d98113e4..cb91644a5 100644 --- a/pkgs/webview-ui/app/src/layout/header.tsx +++ b/pkgs/webview-ui/app/src/layout/header.tsx @@ -2,12 +2,14 @@ import { createQuery } from "@tanstack/solid-query"; import { activeURI } from "../App"; import { callApi } from "../api"; import { Accessor, Show } from "solid-js"; +import { useNavigate } from "@solidjs/router"; interface HeaderProps { clan_dir: Accessor; } export const Header = (props: HeaderProps) => { const { clan_dir } = props; + const navigate = useNavigate(); const query = createQuery(() => ({ queryKey: [clan_dir(), "meta"], @@ -63,7 +65,7 @@ export const Header = (props: HeaderProps) => {
- diff --git a/pkgs/webview-ui/app/src/layout/layout.tsx b/pkgs/webview-ui/app/src/layout/layout.tsx index 6355c945d..741576916 100644 --- a/pkgs/webview-ui/app/src/layout/layout.tsx +++ b/pkgs/webview-ui/app/src/layout/layout.tsx @@ -2,12 +2,20 @@ import { Component, createEffect, Show } from "solid-js"; import { Header } from "./header"; import { Sidebar } from "../Sidebar"; import { activeURI, clanList } from "../App"; -import { RouteSectionProps } from "@solidjs/router"; +import { redirect, RouteSectionProps, useNavigate } from "@solidjs/router"; import { Toaster } from "solid-toast"; export const Layout: Component = (props) => { + const navigate = useNavigate(); createEffect(() => { console.log("Layout props", props.location); + console.log( + "empty ClanList, redirect to welcome page", + clanList().length === 0, + ); + if (clanList().length === 0) { + navigate("/welcome"); + } }); return (
diff --git a/pkgs/webview-ui/app/src/routes/machines/create.tsx b/pkgs/webview-ui/app/src/routes/machines/create.tsx index ce3773ad2..3af89edd4 100644 --- a/pkgs/webview-ui/app/src/routes/machines/create.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/create.tsx @@ -98,22 +98,6 @@ export function CreateMachine() { label={"Deployment target"} error={field.error} /> -
- - Must be set before deployment for the following tasks: -
    -
  • - Detect hardware config -
  • -
  • - Detect disk layout -
  • -
  • - Remote installation -
  • -
-
-
)} diff --git a/pkgs/webview-ui/app/src/routes/machines/view.tsx b/pkgs/webview-ui/app/src/routes/machines/view.tsx index 7d409ff3f..6f051e90f 100644 --- a/pkgs/webview-ui/app/src/routes/machines/view.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/view.tsx @@ -8,6 +8,7 @@ import { createQuery, useQueryClient, } from "@tanstack/solid-query"; +import { useNavigate } from "@solidjs/router"; type MachinesModel = Extract< OperationResponse<"list_inventory_machines">, @@ -73,6 +74,7 @@ export const MachineListView: Component = () => { nixosQuery.data?.filter( (name) => !inventoryMachines().some(([key, machine]) => key === name), ); + const navigate = useNavigate(); return (
@@ -83,10 +85,7 @@ export const MachineListView: Component = () => {
-
diff --git a/pkgs/webview-ui/app/src/routes/settings/index.tsx b/pkgs/webview-ui/app/src/routes/settings/index.tsx index c2618c805..214c54070 100644 --- a/pkgs/webview-ui/app/src/routes/settings/index.tsx +++ b/pkgs/webview-ui/app/src/routes/settings/index.tsx @@ -5,6 +5,7 @@ import { createQuery } from "@tanstack/solid-query"; import { useFloating } from "@/src/floating"; import { autoUpdate, flip, hide, offset, shift } from "@floating-ui/dom"; import { EditClanForm } from "../clan/editClan"; +import { useNavigate } from "@solidjs/router"; export const registerClan = async () => { try { @@ -68,6 +69,18 @@ const ClanDetails = (props: ClanDetailsProps) => { ], }); + const handleRemove = () => { + setClanList((s) => + s.filter((v, idx) => { + if (v == clan_dir) { + setActiveURI(clanList()[idx - 1] || clanList()[idx + 1] || null); + return false; + } + return true; + }), + ); + }; + return (
@@ -103,6 +116,7 @@ const ClanDetails = (props: ClanDetailsProps) => {
-
{clan_dir}
+
+ {clan_dir} +
@@ -151,6 +157,7 @@ const ClanDetails = (props: ClanDetailsProps) => { export const Settings = () => { const [editURI, setEditURI] = createSignal(null); + const navigate = useNavigate(); return (
@@ -167,15 +174,31 @@ export const Settings = () => {
-
Registered Clans
- +
+ Registered Clans +
+
+ + + + + + +
diff --git a/pkgs/webview-ui/app/src/routes/welcome/index.tsx b/pkgs/webview-ui/app/src/routes/welcome/index.tsx index 3df2f3940..ce760c366 100644 --- a/pkgs/webview-ui/app/src/routes/welcome/index.tsx +++ b/pkgs/webview-ui/app/src/routes/welcome/index.tsx @@ -1,7 +1,9 @@ -import { setActiveURI } from "@/src/App"; +import { setActiveURI, setClanList } from "@/src/App"; import { registerClan } from "../settings"; +import { useNavigate } from "@solidjs/router"; export const Welcome = () => { + const navigate = useNavigate(); return (
@@ -19,7 +21,10 @@ export const Welcome = () => { class="link w-full text-right text-primary" onClick={async () => { const uri = await registerClan(); - if (uri) setActiveURI(uri); + if (uri) { + setActiveURI(uri); + navigate("/machines"); + } }} > Or select folder @@ -27,7 +32,7 @@ export const Welcome = () => {