diff --git a/pkgs/classgen/default.nix b/pkgs/classgen/default.nix index 3d640dd27..6a0e0fc24 100644 --- a/pkgs/classgen/default.nix +++ b/pkgs/classgen/default.nix @@ -1,18 +1 @@ -{ - stdenv, - python3, - lib, -}: - -stdenv.mkDerivation { - name = "classgen"; - src = ./.; - buildInputs = [ python3 ]; - installPhase = '' - install -Dm755 ${./main.py} $out/bin/classgen - ''; - meta = with lib; { - description = "A tool to generate Python dataclasses from JSON Schema definitions"; - license = licenses.mit; - }; -} +{ writers }: writers.writePython3Bin "classgen" { flakeIgnore = [ "E501" ]; } ./main.py diff --git a/pkgs/classgen/main.py b/pkgs/classgen/main.py index 018985c87..b2d138690 100644 --- a/pkgs/classgen/main.py +++ b/pkgs/classgen/main.py @@ -129,6 +129,10 @@ def run_gen(args: argparse.Namespace) -> None: with open(args.output, "w") as f: f.write( """ +# DON NOT EDIT THIS FILE MANUALLY. IT IS GENERATED. +# UPDATE: +# ruff: noqa: N815 +# ruff: noqa: N806 from dataclasses import dataclass from typing import Any\n\n """ diff --git a/pkgs/webview-ui/app/src/api.ts b/pkgs/webview-ui/app/src/api.ts index 1c74e4fa9..602ef26c8 100644 --- a/pkgs/webview-ui/app/src/api.ts +++ b/pkgs/webview-ui/app/src/api.ts @@ -80,9 +80,9 @@ function createFunctions( registry[operationName][id] = fn; window.clan[operationName] = (s: string) => { - const f = (response: GtkResponse>) => { + const f = (response: OperationResponse) => { if (response.op_key === id) { - registry[operationName][id](response.result); + registry[operationName][id](response); } }; deserialize(f)(s); @@ -121,6 +121,7 @@ export const callApi = ( return new Promise>((resolve, reject) => { const id = nanoid(); pyApi[method].receive((response) => { + console.log("Received response: ", { response }); if (response.status === "error") { reject(response); } @@ -132,10 +133,10 @@ export const callApi = ( }; const deserialize = - (fn: (response: GtkResponse) => void) => + (fn: (response: T) => void) => (str: string) => { try { - const r = JSON.parse(str) as GtkResponse; + const r = JSON.parse(str) as T; console.log("Received: ", r); fn(r); } catch (e) { diff --git a/pkgs/webview-ui/app/src/routes/blockdevices/view.tsx b/pkgs/webview-ui/app/src/routes/blockdevices/view.tsx index f7b21a69f..3ff0f7037 100644 --- a/pkgs/webview-ui/app/src/routes/blockdevices/view.tsx +++ b/pkgs/webview-ui/app/src/routes/blockdevices/view.tsx @@ -15,6 +15,7 @@ export const BlockDevicesView: Component = () => { if (result.status === "error") throw new Error("Failed to fetch data"); return result.data; }, + staleTime: 1000 * 60 * 5, })); return (