From e9aa6d2298bfd1aceebba538ee80e536d0f39104 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 11 Dec 2024 11:32:34 +0100 Subject: [PATCH] UI: machine list toggle {list,grid} view --- .../app/src/routes/machines/list.tsx | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pkgs/webview-ui/app/src/routes/machines/list.tsx b/pkgs/webview-ui/app/src/routes/machines/list.tsx index 0d475e5f5..ae126a924 100644 --- a/pkgs/webview-ui/app/src/routes/machines/list.tsx +++ b/pkgs/webview-ui/app/src/routes/machines/list.tsx @@ -15,6 +15,7 @@ import { useNavigate } from "@solidjs/router"; import { Button } from "@/src/components/button"; import Icon from "@/src/components/icon"; import { Header } from "@/src/layout/header"; +import { makePersisted } from "@solid-primitives/storage"; type MachinesModel = Extract< OperationResponse<"list_inventory_machines">, @@ -31,7 +32,7 @@ export const MachineListView: Component = () => { const [filter, setFilter] = createSignal({ tags: [] }); const inventoryQuery = createQuery(() => ({ - queryKey: [activeURI(), "list_machines", "inventory"], + queryKey: [activeURI(), "list_inventory_machines"], placeholderData: {}, enabled: !!activeURI(), queryFn: async () => { @@ -65,6 +66,10 @@ export const MachineListView: Component = () => { }); const navigate = useNavigate(); + const [view, setView] = makePersisted(createSignal<"list" | "grid">("list"), { + name: "machines_view", + storage: localStorage, + }); return ( <>
{ variant="light" size="s" onClick={() => refresh()} - startIcon={} + startIcon={} >
@@ -110,7 +117,6 @@ export const MachineListView: Component = () => { } />
- {/* */}
@@ -170,7 +176,13 @@ export const MachineListView: Component = () => {
-
    +
    {([name, info]) => ( { /> )} -
+