diff --git a/README.md b/README.md index 97ae462ee..97406b2f8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - Status light + CPU, Memory & Network Reporting *(click on the status light)* - Service Integration - Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, NZBGet, ruTorrent - - Portainer, Speedtest Tracker, PiHole + - Portainer, Traefik, Speedtest Tracker, PiHole * Homepage Widgets - System Stats (Disk, CPU, Memory) - Weather (via weatherapi.com) diff --git a/src/components/services/widget.jsx b/src/components/services/widget.jsx index 5c1dd449c..142d790dc 100644 --- a/src/components/services/widget.jsx +++ b/src/components/services/widget.jsx @@ -9,6 +9,7 @@ import Pihole from "./widgets/service/pihole"; import Rutorrent from "./widgets/service/rutorrent"; import Jellyfin from "./widgets/service/jellyfin"; import Speedtest from "./widgets/service/speedtest"; +import Traefik from "./widgets/service/traefik"; const widgetMappings = { docker: Docker, @@ -22,6 +23,7 @@ const widgetMappings = { pihole: Pihole, rutorrent: Rutorrent, speedtest: Speedtest, + traefik: Traefik, }; export default function Widget({ service }) { diff --git a/src/components/services/widgets/service/traefik.jsx b/src/components/services/widgets/service/traefik.jsx new file mode 100644 index 000000000..05811ebb4 --- /dev/null +++ b/src/components/services/widgets/service/traefik.jsx @@ -0,0 +1,38 @@ +import useSWR from "swr"; + +import Widget from "../widget"; +import Block from "../block"; + +export default function Traefik({ service }) { + const config = service.widget; + + function buildApiUrl(endpoint) { + const { url } = config; + const fullUrl = `${url}/api/${endpoint}`; + return `/api/proxy?url=${encodeURIComponent(fullUrl)}`; + } + + const { data: traefikData, error: traefikError } = useSWR(buildApiUrl("overview")); + + if (traefikError) { + return ; + } + + if (!traefikData) { + return ( + + + + + + ); + } + + return ( + + + + + + ); +}