Add Immich Widget

pull/887/head
Zlendy 1 year ago committed by shamoon
parent e5d65f410c
commit 6b5e8ab0c7

@ -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"
}
}

@ -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;

@ -0,0 +1,22 @@
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) {
return <Container error={immichError} />;
}
return (
<Container service={service}>
<Block label="immich.users" value={immichData?.usageByUser.length} />
<Block label="immich.photos" value={immichData?.photos} />
<Block label="immich.videos" value={immichData?.videos} />
<Block label="immich.storage" value={immichData?.usage} />
</Container>
);
}

@ -0,0 +1,8 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/api/server-info/stats",
proxyHandler: credentialedProxyHandler,
};
export default widget;

@ -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;

Loading…
Cancel
Save