Merge pull request #1820 from joncrangle/feature/mealie-widget
Feature: mealie widget
This commit is contained in:
commit
70ffe63e59
6 changed files with 51 additions and 0 deletions
|
@ -702,6 +702,12 @@
|
||||||
"noRecent": "Out of Date",
|
"noRecent": "Out of Date",
|
||||||
"totalUsed": "Used Storage"
|
"totalUsed": "Used Storage"
|
||||||
},
|
},
|
||||||
|
"mealie": {
|
||||||
|
"recipes": "Recipes",
|
||||||
|
"users": "Users",
|
||||||
|
"categories": "Categories",
|
||||||
|
"tags": "Tags"
|
||||||
|
},
|
||||||
"openmediavault": {
|
"openmediavault": {
|
||||||
"downloading": "Downloading",
|
"downloading": "Downloading",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
|
|
|
@ -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")),
|
||||||
|
|
33
src/widgets/mealie/component.jsx
Normal file
33
src/widgets/mealie/component.jsx
Normal file
|
@ -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>
|
||||||
|
);
|
||||||
|
}
|
8
src/widgets/mealie/widget.js
Normal file
8
src/widgets/mealie/widget.js
Normal file
|
@ -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";
|
||||||
|
@ -132,6 +133,7 @@ const widgets = {
|
||||||
kopia,
|
kopia,
|
||||||
lidarr,
|
lidarr,
|
||||||
mastodon,
|
mastodon,
|
||||||
|
mealie,
|
||||||
medusa,
|
medusa,
|
||||||
minecraft,
|
minecraft,
|
||||||
miniflux,
|
miniflux,
|
||||||
|
|
Loading…
Add table
Reference in a new issue