diff --git a/src/components/services/widget/block.jsx b/src/components/services/widget/block.jsx index 295330d65..00a507720 100644 --- a/src/components/services/widget/block.jsx +++ b/src/components/services/widget/block.jsx @@ -1,6 +1,9 @@ +import { useTranslation } from "next-i18next"; import classNames from "classnames"; export default function Block({ value, label }) { + const { t } = useTranslation(); + return (
{value === undefined || value === null ? "-" : value}
-
{label}
+
{t(label)}
); } diff --git a/src/components/services/widget/container.jsx b/src/components/services/widget/container.jsx index deb5fdc23..ef2ddcfd2 100644 --- a/src/components/services/widget/container.jsx +++ b/src/components/services/widget/container.jsx @@ -1,4 +1,4 @@ -export default function Container({ error = false, children }) { +export default function Container({ error = false, children, service }) { if (error) { return (
@@ -7,5 +7,12 @@ export default function Container({ error = false, children }) { ); } - return
{children}
; + let visibleChildren = children; + const fields = service?.widget?.fields; + const type = service?.widget?.type; + if (fields && type) { + visibleChildren = children.filter(child => fields.some(field => `${type}.${field}` === child.props?.label)); + } + + return
{visibleChildren}
; } diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index f36e0a56e..813972b21 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -113,6 +113,7 @@ export function cleanServiceGroups(groups) { // whitelisted set of keys to pass to the frontend const { type, // all widgets + fields, server, // docker widget container, currency, // coinmarketcap widget @@ -121,6 +122,7 @@ export function cleanServiceGroups(groups) { cleanedService.widget = { type, + fields: fields || null, service_name: service.name, service_group: serviceGroup.name, }; diff --git a/src/widgets/adguard/component.jsx b/src/widgets/adguard/component.jsx index dbd67644b..0c78113d0 100644 --- a/src/widgets/adguard/component.jsx +++ b/src/widgets/adguard/component.jsx @@ -17,11 +17,11 @@ export default function Component({ service }) { if (!adguardData) { return ( - - - - - + + + + + ); } @@ -30,12 +30,12 @@ export default function Component({ service }) { adguardData.num_replaced_safebrowsing + adguardData.num_replaced_safesearch + adguardData.num_replaced_parental; return ( - - - - + + + + diff --git a/src/widgets/authentik/component.jsx b/src/widgets/authentik/component.jsx index 7087c205b..31f864d17 100644 --- a/src/widgets/authentik/component.jsx +++ b/src/widgets/authentik/component.jsx @@ -19,10 +19,10 @@ export default function Component({ service }) { if (!usersData || !loginsData || !failedLoginsData) { return ( - - - - + + + + ); } @@ -38,10 +38,10 @@ export default function Component({ service }) { ); return ( - - - - + + + + ); } diff --git a/src/widgets/bazarr/component.jsx b/src/widgets/bazarr/component.jsx index 921529da7..24fef1ce2 100644 --- a/src/widgets/bazarr/component.jsx +++ b/src/widgets/bazarr/component.jsx @@ -13,22 +13,22 @@ export default function Component({ service }) { const { data: moviesData, error: moviesError } = useWidgetAPI(widget, "movies"); if (episodesError || moviesError) { - return ; + return ; } if (!episodesData || !moviesData) { return ( - - - + + + ); } return ( - - - + + + ); } diff --git a/src/widgets/coinmarketcap/component.jsx b/src/widgets/coinmarketcap/component.jsx index 113eb40ee..0b970b315 100644 --- a/src/widgets/coinmarketcap/component.jsx +++ b/src/widgets/coinmarketcap/component.jsx @@ -30,7 +30,7 @@ export default function Component({ service }) { if (!symbols || symbols.length === 0) { return ( - + ); @@ -42,7 +42,7 @@ export default function Component({ service }) { if (!statsData || !dateRange) { return ( - + ); @@ -51,7 +51,7 @@ export default function Component({ service }) { const { data } = statsData; return ( - +
diff --git a/src/widgets/docker/component.jsx b/src/widgets/docker/component.jsx index 015a1f253..10e55fcbe 100644 --- a/src/widgets/docker/component.jsx +++ b/src/widgets/docker/component.jsx @@ -31,23 +31,23 @@ export default function Component({ service }) { if (!statsData || !statusData) { return ( - - - - - + + + + + ); } return ( - - - + + + {statsData.stats.networks && ( <> - - + + )} diff --git a/src/widgets/gotify/component.jsx b/src/widgets/gotify/component.jsx index f12b0e116..40f5793bf 100644 --- a/src/widgets/gotify/component.jsx +++ b/src/widgets/gotify/component.jsx @@ -17,11 +17,22 @@ export default function Component({ service }) { return ; } + + if (!appsData || !messagesData || !clientsData) { + return ( + + + + + + ); + } + return ( - - - - + + + + ); } diff --git a/src/widgets/jackett/component.jsx b/src/widgets/jackett/component.jsx index 98f9bc466..9629e2669 100644 --- a/src/widgets/jackett/component.jsx +++ b/src/widgets/jackett/component.jsx @@ -17,9 +17,9 @@ export default function Component({ service }) { if (!indexersData) { return ( - - - + + + ); } @@ -27,9 +27,9 @@ export default function Component({ service }) { const errored = indexersData.filter((indexer) => indexer.last_error); return ( - - - + + + ); } diff --git a/src/widgets/jellyseerr/component.jsx b/src/widgets/jellyseerr/component.jsx index 9e685f648..217e406eb 100644 --- a/src/widgets/jellyseerr/component.jsx +++ b/src/widgets/jellyseerr/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!statsData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/lidarr/component.jsx b/src/widgets/lidarr/component.jsx index 96df170e0..343760e78 100644 --- a/src/widgets/lidarr/component.jsx +++ b/src/widgets/lidarr/component.jsx @@ -19,19 +19,19 @@ export default function Component({ service }) { if (!albumsData || !wantedData || !queueData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/mastodon/component.jsx b/src/widgets/mastodon/component.jsx index aa1dad010..ec12fca11 100644 --- a/src/widgets/mastodon/component.jsx +++ b/src/widgets/mastodon/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!statsData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/npm/component.jsx b/src/widgets/npm/component.jsx index 518fc3eb8..b35e27c85 100644 --- a/src/widgets/npm/component.jsx +++ b/src/widgets/npm/component.jsx @@ -17,10 +17,10 @@ export default function Component({ service }) { if (!infoData) { return ( - - - - + + + + ); } @@ -30,10 +30,10 @@ export default function Component({ service }) { const total = infoData.length; return ( - - - - + + + + ); } diff --git a/src/widgets/nzbget/component.jsx b/src/widgets/nzbget/component.jsx index f69f4cf0a..f9ace707a 100644 --- a/src/widgets/nzbget/component.jsx +++ b/src/widgets/nzbget/component.jsx @@ -17,23 +17,23 @@ export default function Component({ service }) { if (!statusData) { return ( - - - - + + + + ); } return ( - - + + diff --git a/src/widgets/ombi/component.jsx b/src/widgets/ombi/component.jsx index e7402721b..60128c379 100644 --- a/src/widgets/ombi/component.jsx +++ b/src/widgets/ombi/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!statsData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/overseerr/component.jsx b/src/widgets/overseerr/component.jsx index ad46a27e4..47131f6ee 100644 --- a/src/widgets/overseerr/component.jsx +++ b/src/widgets/overseerr/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!statsData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/pihole/component.jsx b/src/widgets/pihole/component.jsx index a956594e5..17a186271 100644 --- a/src/widgets/pihole/component.jsx +++ b/src/widgets/pihole/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!piholeData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/portainer/component.jsx b/src/widgets/portainer/component.jsx index 140078bc3..bd44d77e0 100644 --- a/src/widgets/portainer/component.jsx +++ b/src/widgets/portainer/component.jsx @@ -19,10 +19,10 @@ export default function Component({ service }) { if (!containersData) { return ( - - - - + + + + ); } @@ -36,10 +36,10 @@ export default function Component({ service }) { const total = containersData.length; return ( - - - - + + + + ); } diff --git a/src/widgets/prowlarr/component.jsx b/src/widgets/prowlarr/component.jsx index 85c501860..bb0825193 100644 --- a/src/widgets/prowlarr/component.jsx +++ b/src/widgets/prowlarr/component.jsx @@ -18,12 +18,12 @@ export default function Component({ service }) { if (!indexersData || !grabsData) { return ( - - - - - - + + + + + + ); } @@ -42,12 +42,12 @@ export default function Component({ service }) { }); return ( - - - - - - + + + + + + ); } diff --git a/src/widgets/qbittorrent/component.jsx b/src/widgets/qbittorrent/component.jsx index 284583122..4d3a3585d 100644 --- a/src/widgets/qbittorrent/component.jsx +++ b/src/widgets/qbittorrent/component.jsx @@ -17,11 +17,11 @@ export default function Component({ service }) { if (!torrentData) { return ( - - - - - + + + + + ); } @@ -42,11 +42,11 @@ export default function Component({ service }) { const leech = torrentData.length - completed; return ( - - - - - + + + + + ); } diff --git a/src/widgets/radarr/component.jsx b/src/widgets/radarr/component.jsx index d6df7cf04..4b16f75f2 100644 --- a/src/widgets/radarr/component.jsx +++ b/src/widgets/radarr/component.jsx @@ -18,19 +18,19 @@ export default function Component({ service }) { if (!moviesData || !queuedData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/readarr/component.jsx b/src/widgets/readarr/component.jsx index 794a6ab8e..1e55d7cd9 100644 --- a/src/widgets/readarr/component.jsx +++ b/src/widgets/readarr/component.jsx @@ -19,19 +19,19 @@ export default function Component({ service }) { if (!booksData || !wantedData || !queueData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/rutorrent/component.jsx b/src/widgets/rutorrent/component.jsx index cc0d03f50..279bdf0e5 100644 --- a/src/widgets/rutorrent/component.jsx +++ b/src/widgets/rutorrent/component.jsx @@ -17,10 +17,10 @@ export default function Component({ service }) { if (!statusData) { return ( - - - - + + + + ); } @@ -32,10 +32,10 @@ export default function Component({ service }) { const active = statusData.filter((torrent) => torrent["d.get_state"] === "1"); return ( - - - - + + + + ); } diff --git a/src/widgets/sabnzbd/component.jsx b/src/widgets/sabnzbd/component.jsx index b38cb90f1..c4e64c9ad 100644 --- a/src/widgets/sabnzbd/component.jsx +++ b/src/widgets/sabnzbd/component.jsx @@ -27,19 +27,19 @@ export default function Component({ service }) { if (!queueData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/sonarr/component.jsx b/src/widgets/sonarr/component.jsx index 71aeb69c4..8618b5126 100644 --- a/src/widgets/sonarr/component.jsx +++ b/src/widgets/sonarr/component.jsx @@ -19,19 +19,19 @@ export default function Component({ service }) { if (!wantedData || !queuedData || !seriesData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/speedtest/component.jsx b/src/widgets/speedtest/component.jsx index edf8c66e5..778d31c50 100644 --- a/src/widgets/speedtest/component.jsx +++ b/src/widgets/speedtest/component.jsx @@ -17,26 +17,26 @@ export default function Component({ service }) { if (!speedtestData) { return ( - - - - + + + + ); } return ( - + - - - + + + + ); } return ( - + - + diff --git a/src/widgets/traefik/component.jsx b/src/widgets/traefik/component.jsx index efa0e8fa9..d24edb9e5 100644 --- a/src/widgets/traefik/component.jsx +++ b/src/widgets/traefik/component.jsx @@ -17,19 +17,19 @@ export default function Component({ service }) { if (!traefikData) { return ( - - - - + + + + ); } return ( - - - - + + + + ); } diff --git a/src/widgets/transmission/component.jsx b/src/widgets/transmission/component.jsx index 5e4716666..3c2f38ef1 100644 --- a/src/widgets/transmission/component.jsx +++ b/src/widgets/transmission/component.jsx @@ -17,11 +17,11 @@ export default function Component({ service }) { if (!torrentData) { return ( - - - - - + + + + + ); } @@ -34,11 +34,11 @@ export default function Component({ service }) { const leech = torrents.length - completed || 0; return ( - - - - - + + + + + ); }