Feature: Garage Widget
This commit is contained in:
parent
4a3a4c846e
commit
a99b594bd8
17
docs/widgets/services/garage.md
Normal file
17
docs/widgets/services/garage.md
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
title: Garage
|
||||
description: Garage Widget Configuration
|
||||
---
|
||||
|
||||
Learn more about [Garage](https://git.deuxfleurs.fr/Deuxfleurs/garage).
|
||||
|
||||
Use the admin token key. Information about the token can be found in the [Garage configuration file documentation](https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/).
|
||||
|
||||
Allowed fields: `["status", "knownNodes", "connectedNodes", "storageNodes", "storageNodesOk", "partitions", "partitionsQuorum", "partitionsAllOk"]`.
|
||||
|
||||
```yaml
|
||||
widget:
|
||||
type: garage
|
||||
url: http://garage.host.or.ip:port
|
||||
key: token
|
||||
```
|
||||
@ -38,6 +38,7 @@ You can also find a list of all available service widgets in the sidebar navigat
|
||||
- [Frigate](frigate.md)
|
||||
- [Fritz!Box](fritzbox.md)
|
||||
- [GameDig](gamedig.md)
|
||||
- [Garage](garage.md)
|
||||
- [Gatus](gatus.md)
|
||||
- [Ghostfolio](ghostfolio.md)
|
||||
- [Gitea](gitea.md)
|
||||
|
||||
@ -61,6 +61,7 @@ nav:
|
||||
- widgets/services/frigate.md
|
||||
- widgets/services/fritzbox.md
|
||||
- widgets/services/gamedig.md
|
||||
- widgets/services/garage.md
|
||||
- widgets/services/gatus.md
|
||||
- widgets/services/ghostfolio.md
|
||||
- widgets/services/gitea.md
|
||||
|
||||
@ -998,5 +998,18 @@
|
||||
"progressing": "Progressing",
|
||||
"missing": "Missing",
|
||||
"suspended": "Suspended"
|
||||
},
|
||||
"garage": {
|
||||
"status": "Status",
|
||||
"healthy": "Healthy",
|
||||
"degraded": "Degraded",
|
||||
"unavailable": "Unavailable",
|
||||
"knownNodes": "Known nodes",
|
||||
"connectedNodes": "Connected nodes",
|
||||
"storageNodes": "Storage nodes",
|
||||
"storageNodesOk": "Storage OK",
|
||||
"partitions": "Total partitions",
|
||||
"partitionsQuorum": "Quorum reached",
|
||||
"partitionsAllOk": "Partitions OK"
|
||||
}
|
||||
}
|
||||
|
||||
@ -953,5 +953,18 @@
|
||||
"reminders": "Reminders",
|
||||
"nextReminder": "Next Reminder",
|
||||
"none": "None"
|
||||
},
|
||||
"garage": {
|
||||
"status": "Statut",
|
||||
"healthy": "En bonne santé",
|
||||
"degraded": "Dégradé",
|
||||
"unavailable": "Indisponible",
|
||||
"knownNodes": "Nœuds connus",
|
||||
"connectedNodes": "Nœuds connectés",
|
||||
"storageNodes": "Nœuds de stockage",
|
||||
"storageNodesOk": "Stockage OK",
|
||||
"partitions": "Partitions totales",
|
||||
"partitionsQuorum": "Quorum atteint",
|
||||
"partitionsAllOk": "Partitions OK"
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ export default async function credentialedProxyHandler(req, res, map) {
|
||||
"tandoor",
|
||||
"pterodactyl",
|
||||
"vikunja",
|
||||
"garage",
|
||||
].includes(widget.type)
|
||||
) {
|
||||
headers.Authorization = `Bearer ${widget.key}`;
|
||||
|
||||
@ -35,6 +35,7 @@ const components = {
|
||||
frigate: dynamic(() => import("./frigate/component")),
|
||||
fritzbox: dynamic(() => import("./fritzbox/component")),
|
||||
gamedig: dynamic(() => import("./gamedig/component")),
|
||||
garage: dynamic(() => import("./garage/component")),
|
||||
gatus: dynamic(() => import("./gatus/component")),
|
||||
ghostfolio: dynamic(() => import("./ghostfolio/component")),
|
||||
gitea: dynamic(() => import("./gitea/component")),
|
||||
|
||||
45
src/widgets/garage/component.jsx
Normal file
45
src/widgets/garage/component.jsx
Normal file
@ -0,0 +1,45 @@
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
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 { t } = useTranslation();
|
||||
|
||||
const { widget } = service;
|
||||
|
||||
const { data, error } = useWidgetAPI(widget, "health");
|
||||
|
||||
if (error) {
|
||||
return <Container service={service} error={error} />;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="garage.status" />
|
||||
<Block label="garage.knownNodes" />
|
||||
<Block label="garage.connectedNodes" />
|
||||
<Block label="garage.storageNodes" />
|
||||
<Block label="garage.storageNodesOk" />
|
||||
<Block label="garage.partitions" />
|
||||
<Block label="garage.partitionsQuorum" />
|
||||
<Block label="garage.partitionsAllOk" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="garage.status" value={t(`garage.${data.status}`)} />
|
||||
<Block label="garage.knownNodes" value={t("common.number", { value: data.knownNodes })} />
|
||||
<Block label="garage.connectedNodes" value={t("common.number", { value: data.connectedNodes })} />
|
||||
<Block label="garage.storageNodes" value={t("common.number", { value: data.storageNodes })} />
|
||||
<Block label="garage.storageNodesOk" value={t("common.number", { value: data.storageNodesOk })} />
|
||||
<Block label="garage.partitions" value={t("common.number", { value: data.partitions })} />
|
||||
<Block label="garage.partitionsQuorum" value={t("common.number", { value: data.partitionsQuorum })} />
|
||||
<Block label="garage.partitionsAllOk" value={t("common.number", { value: data.partitionsAllOk })} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
14
src/widgets/garage/widget.js
Normal file
14
src/widgets/garage/widget.js
Normal file
@ -0,0 +1,14 @@
|
||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/v1/{endpoint}",
|
||||
proxyHandler: credentialedProxyHandler,
|
||||
|
||||
mappings: {
|
||||
health: {
|
||||
endpoint: "health",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default widget;
|
||||
@ -29,6 +29,7 @@ import freshrss from "./freshrss/widget";
|
||||
import frigate from "./frigate/widget";
|
||||
import fritzbox from "./fritzbox/widget";
|
||||
import gamedig from "./gamedig/widget";
|
||||
import garage from "./garage/widget";
|
||||
import gatus from "./gatus/widget";
|
||||
import ghostfolio from "./ghostfolio/widget";
|
||||
import gitea from "./gitea/widget";
|
||||
@ -160,6 +161,7 @@ const widgets = {
|
||||
frigate,
|
||||
fritzbox,
|
||||
gamedig,
|
||||
garage,
|
||||
gatus,
|
||||
ghostfolio,
|
||||
gitea,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user