diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 9202c249c..34058db9c 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -439,5 +439,11 @@ "failed_tasks_24h": "Failed Tasks 24h", "cpu_usage": "CPU", "memory_usage": "Memory" + }, + "immich": { + "users": "Users", + "photos": "Photos", + "videos": "Videos", + "storage": "Storage" } } \ No newline at end of file diff --git a/src/widgets/components.js b/src/widgets/components.js index 17a2d7e34..43a46fa90 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -62,6 +62,7 @@ const components = { unifi: dynamic(() => import("./unifi/component")), watchtower: dynamic(() => import("./watchtower/component")), xteve: dynamic(() => import("./xteve/component")), + immich: dynamic(() => import("./immich/component")), }; export default components; diff --git a/src/widgets/immich/component.jsx b/src/widgets/immich/component.jsx new file mode 100644 index 000000000..310ce0b22 --- /dev/null +++ b/src/widgets/immich/component.jsx @@ -0,0 +1,33 @@ +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { widget } = service; + + const { data: immichData, error: immichError } = useWidgetAPI(widget); + + if (immichError || immichData?.statusCode === 401) { + return ; + } + + if (!immichData) { + return ( + + + + + + + ); + } + + return ( + + + + + + + ); +} diff --git a/src/widgets/immich/widget.js b/src/widgets/immich/widget.js new file mode 100644 index 000000000..85867aeb3 --- /dev/null +++ b/src/widgets/immich/widget.js @@ -0,0 +1,8 @@ +import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; + +const widget = { + api: "{url}/api/server-info/stats", + proxyHandler: credentialedProxyHandler, +}; + +export default widget; diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index 42f7aa7b6..133903fbe 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -56,6 +56,7 @@ import truenas from "./truenas/widget"; import unifi from "./unifi/widget"; import watchtower from "./watchtower/widget"; import xteve from "./xteve/widget"; +import immich from "./immich/widget"; const widgets = { adguard, @@ -119,6 +120,7 @@ const widgets = { unifi_console: unifi, watchtower, xteve, + immich, }; export default widgets;