From 80f0ced0b01d196f70bd295a9ce74984ca5fe8bd Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 14 Jul 2025 12:06:04 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20Added=20Docker=20vars=20in=20the?= =?UTF-8?q?=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Settings/DockerVars/DockerVars.tsx | 38 ++++ src/client/components/Settings/Settings.tsx | 178 +++++++++--------- .../constants/settings/settingsMenu.json | 4 +- 3 files changed, 125 insertions(+), 95 deletions(-) create mode 100644 src/client/components/Settings/DockerVars/DockerVars.tsx diff --git a/src/client/components/Settings/DockerVars/DockerVars.tsx b/src/client/components/Settings/DockerVars/DockerVars.tsx new file mode 100644 index 0000000..c1aa051 --- /dev/null +++ b/src/client/components/Settings/DockerVars/DockerVars.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { useQuery, useQueryClient } from "@tanstack/react-query"; +import axios from "axios"; + +export const DockerVars = (): React.ReactElement => { + const [environmentVariables, setEnvironmentVariables] = React.useState< + Record + >({}); + const { data } = useQuery({ + queryKey: ["docker-vars"], + queryFn: async () => { + await axios({ + method: "GET", + url: "http://localhost:3000/api/settings/getEnvironmentVariables", + }).then((response) => { + setEnvironmentVariables(response.data); + }); + }, + refetchOnWindowFocus: false, + refetchOnReconnect: false, + }); + console.log("Docker Vars: ", environmentVariables); + return ( +
+

Docker Environment Variables

+

+

+          {Object.entries(environmentVariables).length > 0
+            ? JSON.stringify(environmentVariables, null, 2)
+            : "No environment variables found."}
+        
+

+ {/* Add your form or content for Docker environment variables here */} +
+ ); +}; + +export default DockerVars; diff --git a/src/client/components/Settings/Settings.tsx b/src/client/components/Settings/Settings.tsx index d47966f..d1f8d0e 100644 --- a/src/client/components/Settings/Settings.tsx +++ b/src/client/components/Settings/Settings.tsx @@ -4,6 +4,7 @@ import { AirDCPPHubsForm } from "./AirDCPPSettings/AirDCPPHubsForm"; import { QbittorrentConnectionForm } from "./QbittorrentSettings/QbittorrentConnectionForm"; import { SystemSettingsForm } from "./SystemSettings/SystemSettingsForm"; import ProwlarrSettingsForm from "./ProwlarrSettings/ProwlarrSettingsForm"; +import DockerVars from "./DockerVars/DockerVars"; import { ServiceStatuses } from "../ServiceStatuses/ServiceStatuses"; import settingsObject from "../../constants/settings/settingsMenu.json"; import { isUndefined, map } from "lodash"; @@ -12,139 +13,130 @@ interface ISettingsProps {} export const Settings = (props: ISettingsProps): ReactElement => { const [active, setActive] = useState("gen-db"); - console.log(active); + const [expanded, setExpanded] = useState>({}); + + const toggleExpanded = (id: string) => { + setExpanded((prev) => ({ + ...prev, + [id]: !prev[id], + })); + }; + const settingsContent = [ - { - id: "adc-hubs", - content: ( -
- -
- ), - }, - { - id: "adc-connection", - content: ( -
- -
- ), - }, - { - id: "qbt-connection", - content: ( -
- -
- ), - }, - { - id: "prwlr-connection", - content: ( - <> - - - ), - }, - { - id: "core-service", - content: <>a, - }, - { - id: "flushdb", - content: ( -
- -
- ), - }, + { id: "adc-hubs", content: }, + { id: "adc-connection", content: }, + {id: "gen-docker-vars", content: }, + { id: "qbt-connection", content: }, + { id: "prwlr-connection", content: }, + { id: "core-service", content: <>a }, + { id: "flushdb", content: }, ]; + return (
+ {/* Header */}
-
+
-

+

Settings

- -

+

Import comics into the ThreeTwo library.

-
-
-
diff --git a/src/client/constants/settings/settingsMenu.json b/src/client/constants/settings/settingsMenu.json index 5b21641..c410464 100644 --- a/src/client/constants/settings/settingsMenu.json +++ b/src/client/constants/settings/settingsMenu.json @@ -9,8 +9,8 @@ "displayName": "Dashboard" }, { - "id": "gen-gls", - "displayName": "Global Search" + "id": "gen-docker-vars", + "displayName": "Docker ENV vars" } ] },