diff --git a/pkgs/webview-ui/app/src/Form/form/index.tsx b/pkgs/webview-ui/app/src/Form/form/index.tsx index aad823a6f..021eccd79 100644 --- a/pkgs/webview-ui/app/src/Form/form/index.tsx +++ b/pkgs/webview-ui/app/src/Form/form/index.tsx @@ -2,36 +2,21 @@ import { createForm, Field, FieldArray, - FieldElement, FieldValues, FormStore, - getValue, - minLength, pattern, ResponseData, setValue, getValues, insert, SubmitHandler, - swap, reset, remove, move, - setError, - setValues, } from "@modular-forms/solid"; -import { JSONSchema7, JSONSchema7Type, validate } from "json-schema"; +import { JSONSchema7, JSONSchema7Type } from "json-schema"; import { TextInput } from "../fields/TextInput"; -import { - children, - Component, - createEffect, - For, - JSX, - Match, - Show, - Switch, -} from "solid-js"; +import { createEffect, For, JSX, Match, Show, Switch } from "solid-js"; import cx from "classnames"; import { Label } from "../base/label"; import { SelectInput } from "../fields/Select"; @@ -218,7 +203,7 @@ export function StringField( (r) => r === props.path[props.path.length - 1], ), }; - const readonly = props.readonly; + const readonly = !!props.readonly; return ( }> ( {props.children}
), }} @@ -847,7 +846,7 @@ export function ObjectFields( {key} - - )} - +
+ + {props.title} + +
+
+ {props.toolbar}
); diff --git a/pkgs/webview-ui/app/src/layout/layout.tsx b/pkgs/webview-ui/app/src/layout/layout.tsx index 55cde957e..033035bb2 100644 --- a/pkgs/webview-ui/app/src/layout/layout.tsx +++ b/pkgs/webview-ui/app/src/layout/layout.tsx @@ -1,13 +1,11 @@ -import { Component, createEffect, Show } from "solid-js"; -import { Header } from "./header"; +import { Component, createEffect } from "solid-js"; import { Sidebar } from "@/src/components/Sidebar"; -import { activeURI, clanList } from "../App"; +import { clanList } from "../App"; import { RouteSectionProps, useNavigate } from "@solidjs/router"; 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, @@ -25,10 +23,7 @@ export const Layout: Component = (props) => { type="checkbox" class="drawer-toggle hidden" /> -
- -
- +
{props.children}
{ + return ( +
+
+
+ +
+
+
+ ); +}; diff --git a/pkgs/webview-ui/app/src/routes/machines/create.tsx b/pkgs/webview-ui/app/src/routes/machines/create.tsx index 1c87c569b..7580555e2 100644 --- a/pkgs/webview-ui/app/src/routes/machines/create.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/create.tsx @@ -3,11 +3,14 @@ import { activeURI } from "@/src/App"; import { Button } from "@/src/components/button"; import Icon from "@/src/components/icon"; import { TextInput } from "@/src/components/TextInput"; +import { Header } from "@/src/layout/header"; import { createForm, required, reset } from "@modular-forms/solid"; import { useNavigate } from "@solidjs/router"; -import { createQuery, useQueryClient } from "@tanstack/solid-query"; +import { useQueryClient } from "@tanstack/solid-query"; import { Match, Switch } from "solid-js"; import toast from "solid-toast"; +import { MachineAvatar } from "./avatar"; +import { DynForm } from "@/src/Form/form"; type CreateMachineForm = OperationArgs<"create_machine">; @@ -66,68 +69,111 @@ export function CreateMachine() { } }; return ( -
-
- Create new Machine -
- - {(field, props) => ( - - )} - - - {(field, props) => ( - - )} - - - {(field, props) => ( - <> + <> +
+
+
+ + + {(field, props) => ( + <> +
+ +
+ + + )} +
+ + {(field, props) => ( - - )} - -
- -
- + )} + + + {(field, props) => ( +
+ Tags
, + }} + schema={{ + type: "object", + properties: { + tags: { + type: "array", + items: { + title: "Tag", + type: "string", + }, + uniqueItems: true, + }, + }, + }} + /> +
+ )} + +
+ + +
+ + {(field, props) => ( + <> + + + )} + +
+
+
+ +
+ +
-
+ ); } diff --git a/pkgs/webview-ui/app/src/routes/machines/details.tsx b/pkgs/webview-ui/app/src/routes/machines/details.tsx index edfa3d7c6..b8bda0488 100644 --- a/pkgs/webview-ui/app/src/routes/machines/details.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/details.tsx @@ -1,12 +1,9 @@ -import { callApi, ClanService, SuccessData, SuccessQuery } from "@/src/api"; -import { get_iwd_service } from "@/src/api/wifi"; +import { callApi, SuccessData, SuccessQuery } from "@/src/api"; import { activeURI } from "@/src/App"; import { BackButton } from "@/src/components/BackButton"; import { Button } from "@/src/components/button"; import { FileInput } from "@/src/components/FileInput"; import Icon from "@/src/components/icon"; -import { RndThumbnail } from "@/src/components/noiseThumbnail"; -import { SelectInput } from "@/src/components/SelectInput"; import { TextInput } from "@/src/components/TextInput"; import { selectSshKeys } from "@/src/hooks"; import { @@ -16,9 +13,10 @@ import { setValue, } from "@modular-forms/solid"; import { useParams } from "@solidjs/router"; -import { createQuery, useQueryClient } from "@tanstack/solid-query"; -import { createSignal, For, Show, Switch, Match, JSXElement } from "solid-js"; +import { createQuery } from "@tanstack/solid-query"; +import { createSignal, For, Show } from "solid-js"; import toast from "solid-toast"; +import { MachineAvatar } from "./avatar"; type MachineFormInterface = MachineData & { sshKey?: File; @@ -305,24 +303,9 @@ const MachineForm = (props: MachineDetailsProps) => { return ( <>
-
-
-
- -
-
-
General - + {(field, props) => ( , @@ -65,96 +66,124 @@ export const MachineListView: Component = () => { const navigate = useNavigate(); return ( -
-
-
- -
+ <> +
+ + + -
- -
- {/* */} -
-
- -
- - {(tag) => ( - - - )} - -
- {/*
*/} - - - {/* Loading skeleton */} -
-
-
-
-
-
-

-
-

-
+ + + +
+ + + + + } + /> +
+ {/* */} +
+
+ +
+ + {(tag) => ( + + )} + +
+ {/*
*/} + + + {/* Loading skeleton */} +
+
+
+
+
+
+

+
+

+
+
-
- - -
- - No machines defined yet. Click below to define one. - - -
-
- -
    - - {([name, info]) => ( - - )} - -
-
- -
+ + +
+ + No machines defined yet. Click below to define one. + + +
+
+ +
    + + {([name, info]) => ( + + )} + +
+
+ +
+ ); };