diff --git a/pkgs/webview-ui/app/src/Routes.tsx b/pkgs/webview-ui/app/src/Routes.tsx
index d0c8a27b2..51f0c01d6 100644
--- a/pkgs/webview-ui/app/src/Routes.tsx
+++ b/pkgs/webview-ui/app/src/Routes.tsx
@@ -7,6 +7,7 @@ import { BlockDevicesView } from "./routes/blockdevices/view";
import { Flash } from "./routes/flash/view";
import { Settings } from "./routes/settings";
import { Welcome } from "./routes/welcome";
+import { Deploy } from "./routes/deploy";
export type Route = keyof typeof routes;
@@ -51,6 +52,11 @@ export const routes = {
label: "welcome",
icon: "settings",
},
+ deploy: {
+ child: Deploy,
+ label: "deploy",
+ icon: "content_copy",
+ },
};
interface RouterProps {
diff --git a/pkgs/webview-ui/app/src/layout/header.tsx b/pkgs/webview-ui/app/src/layout/header.tsx
index badb57a34..bc9234d75 100644
--- a/pkgs/webview-ui/app/src/layout/header.tsx
+++ b/pkgs/webview-ui/app/src/layout/header.tsx
@@ -1,6 +1,21 @@
+import { createQuery } from "@tanstack/solid-query";
import { activeURI, setRoute } from "../App";
+import { callApi } from "../api";
+import { Show } from "solid-js";
export const Header = () => {
+ const { isLoading, data } = createQuery(() => ({
+ queryKey: [`${activeURI()}:meta`],
+ queryFn: async () => {
+ const currUri = activeURI();
+ if (currUri) {
+ const result = await callApi("show_clan_meta", { uri: currUri });
+ if (result.status === "error") throw new Error("Failed to fetch data");
+ return result.data;
+ }
+ },
+ }));
+
return (
@@ -14,7 +29,16 @@ export const Header = () => {
diff --git a/pkgs/webview-ui/app/src/routes/deploy/index.tsx b/pkgs/webview-ui/app/src/routes/deploy/index.tsx
new file mode 100644
index 000000000..dc19d723c
--- /dev/null
+++ b/pkgs/webview-ui/app/src/routes/deploy/index.tsx
@@ -0,0 +1,6 @@
+import { callApi } from "@/src/api";
+import { createQuery } from "@tanstack/solid-query";
+
+export const Deploy = () => {
+ return Deloy view
;
+};
diff --git a/pkgs/webview-ui/app/src/routes/flash/view.tsx b/pkgs/webview-ui/app/src/routes/flash/view.tsx
index db80983f4..1a386a509 100644
--- a/pkgs/webview-ui/app/src/routes/flash/view.tsx
+++ b/pkgs/webview-ui/app/src/routes/flash/view.tsx
@@ -1,6 +1,7 @@
import { route } from "@/src/App";
-import { OperationArgs, OperationResponse, pyApi } from "@/src/api";
+import { OperationArgs, OperationResponse, callApi, pyApi } from "@/src/api";
import { SubmitHandler, createForm, required } from "@modular-forms/solid";
+import { createQuery } from "@tanstack/solid-query";
import { For, createSignal } from "solid-js";
import { effect } from "solid-js/web";
@@ -28,36 +29,35 @@ type BlockDevices = Extract<
export const Flash = () => {
const [formStore, { Form, Field }] = createForm({});
- const [devices, setDevices] = createSignal([]);
- // pyApi.show_block_devices.receive((r) => {
- // console.log("block devices", r);
- // if (r.status === "success") {
- // setDevices(r.data.blockdevices);
- // }
- // });
+ const {
+ data: devices,
+ refetch: loadDevices,
+ isFetching,
+ } = createQuery(() => ({
+ queryKey: ["TanStack Query"],
+ queryFn: async () => {
+ const result = await callApi("show_block_devices", {});
+ if (result.status === "error") throw new Error("Failed to fetch data");
+ return result.data;
+ },
+ staleTime: 1000 * 60 * 1, // 1 minutes
+ }));
- const handleSubmit: SubmitHandler = (values, event) => {
- // pyApi.open_file.dispatch({ file_request: { mode: "save" } });
- // pyApi.open_file.receive((r) => {
- // if (r.status === "success") {
- // if (r.data) {
- // pyApi.create_clan.dispatch({
- // options: { directory: r.data, meta: values },
- // });
- // }
- // return;
- // }
+ const handleSubmit = async (values: FlashFormValues) => {
+ // TODO: Rework Flash machine API
+ // Its unusable in its current state
+ // await callApi("flash_machine", {
+ // machine: {
+ // name: "",
+ // },
+ // disks: {values.disk },
+ // dry_run: true,
// });
console.log("submit", values);
};
- // effect(() => {
- // if (route() === "flash") {
- // pyApi.show_block_devices.dispatch({});
- // }
- // });
return (
-