Add mealie widget

pull/1793/head
Jonathan Crangle 1 year ago
parent 63d4c6bdf8
commit 58f4cf6edd

@ -701,5 +701,11 @@
"errored": "Errors", "errored": "Errors",
"noRecent": "Out of Date", "noRecent": "Out of Date",
"totalUsed": "Used Storage" "totalUsed": "Used Storage"
},
"mealie": {
"recipes": "Recipes",
"users": "Users",
"categories": "Categories",
"tags": "Tags"
} }
} }

@ -32,6 +32,7 @@ export default async function credentialedProxyHandler(req, res, map) {
"authentik", "authentik",
"cloudflared", "cloudflared",
"ghostfolio", "ghostfolio",
"mealie",
"tailscale", "tailscale",
"truenas", "truenas",
"pterodactyl", "pterodactyl",

@ -42,6 +42,7 @@ const components = {
kopia: dynamic(() => import("./kopia/component")), kopia: dynamic(() => import("./kopia/component")),
lidarr: dynamic(() => import("./lidarr/component")), lidarr: dynamic(() => import("./lidarr/component")),
mastodon: dynamic(() => import("./mastodon/component")), mastodon: dynamic(() => import("./mastodon/component")),
mealie: dynamic(() => import("./mealie/component")),
medusa: dynamic(() => import("./medusa/component")), medusa: dynamic(() => import("./medusa/component")),
minecraft: dynamic(() => import("./minecraft/component")), minecraft: dynamic(() => import("./minecraft/component")),
miniflux: dynamic(() => import("./miniflux/component")), miniflux: dynamic(() => import("./miniflux/component")),

@ -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: mealieData, error: mealieError } = useWidgetAPI(widget);
if (mealieError || mealieData?.statusCode === 401) {
return <Container service={service} error={mealieError ?? mealieData} />;
}
if (!mealieData) {
return (
<Container service={service}>
<Block label="mealie.recipes" />
<Block label="mealie.users" />
<Block label="mealie.categories" />
<Block label="mealie.tags" />
</Container>
);
}
return (
<Container service={service}>
<Block label="mealie.recipes" value={mealieData.totalRecipes} />
<Block label="mealie.users" value={mealieData.totalUsers} />
<Block label="mealie.categories" value={mealieData.totalCategories} />
<Block label="mealie.tags" value={mealieData.totalTags} />
</Container>
);
}

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

@ -36,6 +36,7 @@ import komga from "./komga/widget";
import kopia from "./kopia/widget"; import kopia from "./kopia/widget";
import lidarr from "./lidarr/widget"; import lidarr from "./lidarr/widget";
import mastodon from "./mastodon/widget"; import mastodon from "./mastodon/widget";
import mealie from "./mealie/widget";
import medusa from "./medusa/widget"; import medusa from "./medusa/widget";
import minecraft from "./minecraft/widget"; import minecraft from "./minecraft/widget";
import miniflux from "./miniflux/widget"; import miniflux from "./miniflux/widget";
@ -131,6 +132,7 @@ const widgets = {
kopia, kopia,
lidarr, lidarr,
mastodon, mastodon,
mealie,
medusa, medusa,
minecraft, minecraft,
miniflux, miniflux,

Loading…
Cancel
Save