diff --git a/docs/widgets/services/swagdashboard.md b/docs/widgets/services/swagdashboard.md new file mode 100644 index 000000000..2b6c97928 --- /dev/null +++ b/docs/widgets/services/swagdashboard.md @@ -0,0 +1,14 @@ +--- +title: SWAG Dashboard +description: SWAG Dashboard Widget Configuration +--- + +Learn more about [SWAG Dashboard](https://github.com/linuxserver/docker-mods/tree/swag-dashboard). + +Allowed fields: `["proxied", "auth", "outdated", "banned"]`. + +```yaml +widget: + type: swagdashboard + url: http://swagdashboard.host.or.ip:adminport # default port is 81 +``` diff --git a/mkdocs.yml b/mkdocs.yml index 6c6668924..520519c61 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -129,6 +129,7 @@ nav: - widgets/services/sonarr.md - widgets/services/speedtest-tracker.md - widgets/services/stash.md + - widgets/services/swagdashboard.md - widgets/services/syncthing-relay-server.md - widgets/services/tailscale.md - widgets/services/tandoor.md diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 15de0ee94..3e582a4da 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -882,5 +882,11 @@ "enabled": "Enabled", "disabled": "Disabled", "total": "Total" + }, + "swagdashboard": { + "proxied": "Proxied", + "auth": "With Auth", + "outdated": "Outdated", + "banned": "Banned" } } diff --git a/src/widgets/components.js b/src/widgets/components.js index 1b5c4b685..36b9de076 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -103,6 +103,7 @@ const components = { speedtest: dynamic(() => import("./speedtest/component")), stash: dynamic(() => import("./stash/component")), strelaysrv: dynamic(() => import("./strelaysrv/component")), + swagdashboard: dynamic(() => import("./swagdashboard/component")), tailscale: dynamic(() => import("./tailscale/component")), tandoor: dynamic(() => import("./tandoor/component")), tautulli: dynamic(() => import("./tautulli/component")), diff --git a/src/widgets/swagdashboard/component.jsx b/src/widgets/swagdashboard/component.jsx new file mode 100644 index 000000000..d4dbd494a --- /dev/null +++ b/src/widgets/swagdashboard/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: swagData, error: swagError } = useWidgetAPI(widget, "overview"); + + if (swagError) { + return ; + } + + if (!swagData) { + return ( + + + + + + + ); + } + + return ( + + + + + + + ); +} diff --git a/src/widgets/swagdashboard/widget.js b/src/widgets/swagdashboard/widget.js new file mode 100644 index 000000000..626586fe1 --- /dev/null +++ b/src/widgets/swagdashboard/widget.js @@ -0,0 +1,8 @@ +import genericProxyHandler from "utils/proxy/handlers/generic"; + +const widget = { + api: "{url}/?stats=true", + proxyHandler: genericProxyHandler, +}; + +export default widget; diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index d6965f50f..950954b03 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -94,6 +94,7 @@ import sonarr from "./sonarr/widget"; import speedtest from "./speedtest/widget"; import stash from "./stash/widget"; import strelaysrv from "./strelaysrv/widget"; +import swagdashboard from "./swagdashboard/widget"; import tailscale from "./tailscale/widget"; import tandoor from "./tandoor/widget"; import tautulli from "./tautulli/widget"; @@ -213,6 +214,7 @@ const widgets = { speedtest, stash, strelaysrv, + swagdashboard, tailscale, tandoor, tautulli,