diff --git a/src/components/widgets/unifi_console/unifi_console.jsx b/src/components/widgets/unifi_console/unifi_console.jsx index 156e2866f..13c90bd42 100644 --- a/src/components/widgets/unifi_console/unifi_console.jsx +++ b/src/components/widgets/unifi_console/unifi_console.jsx @@ -20,7 +20,6 @@ export default function Widget({ options }) {
{t("widget.api_error")} - -
@@ -28,7 +27,7 @@ export default function Widget({ options }) { ); } - const defaultSite = statsData?.data?.find(s => s.name === "default"); + const defaultSite = options.site ? statsData?.data.find(s => s.desc === options.site) : statsData?.data?.find(s => s.name === "default"); if (!defaultSite) { return ( diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 352367d2e..e2e3055e0 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -233,6 +233,7 @@ export function cleanServiceGroups(groups) { currency, // coinmarketcap widget symbols, defaultinterval, + site, // unifi widget namespace, // kubernetes widget app, podSelector, @@ -256,6 +257,9 @@ export function cleanServiceGroups(groups) { if (server) cleanedService.widget.server = server; if (container) cleanedService.widget.container = container; } + if (type === "unifi") { + if (site) cleanedService.widget.site = site; + } if (type === "kubernetes") { if (namespace) cleanedService.widget.namespace = namespace; if (app) cleanedService.widget.app = app; diff --git a/src/widgets/unifi/component.jsx b/src/widgets/unifi/component.jsx index 25ba8ea21..ff3185169 100644 --- a/src/widgets/unifi/component.jsx +++ b/src/widgets/unifi/component.jsx @@ -15,7 +15,7 @@ export default function Component({ service }) { return ; } - const defaultSite = statsData?.data?.find(s => s.name === "default"); + const defaultSite = widget.site ? statsData?.data.find(s => s.desc === widget.site) : statsData?.data?.find(s => s.name === "default"); if (!defaultSite) { return (