pre-commit, organize widget params

This commit is contained in:
shamoon 2023-11-22 09:13:26 -08:00
parent 4194b57698
commit 8c1c7f5d97
4 changed files with 81 additions and 43 deletions

View File

@ -336,49 +336,87 @@ export function cleanServiceGroups(groups) {
if (cleanedService.widget) {
// whitelisted set of keys to pass to the frontend
// alphabetical, grouped by widget(s)
const {
type, // all widgets
// all widgets
fields,
hideErrors,
server, // docker widget
container,
currency, // coinmarketcap widget
symbols,
slugs,
defaultinterval,
site, // unifi widget
namespace, // kubernetes widget
app,
podSelector,
wan, // opnsense widget, pfsense widget
enableBlocks, // emby/jellyfin
enableNowPlaying,
volume, // diskstation widget,
enableQueue, // sonarr/radarr
node, // Proxmox
snapshotHost, // kopia
snapshotPath,
userEmail, // azuredevops
type,
// azuredevops
repositoryId,
metric, // glances
chart, // glances
pointsLimit, // glances
stream, // mjpeg
fit,
method, // openmediavault widget
mappings, // customapi widget
refreshInterval,
integrations, // calendar widget
userEmail,
// calendar
firstDayInWeek,
view,
integrations,
maxEvents,
src, // iframe widget
classes,
referrerPolicy,
allowPolicy,
view,
// coinmarketcap
currency,
defaultinterval,
slugs,
symbols,
// customapi
mappings,
// diskstation
volume,
// docker
container,
server,
// emby, jellyfin
enableBlocks,
enableNowPlaying,
// glances
chart,
metric,
pointsLimit,
// glances, customapi
refreshInterval,
// iframe
allowFullscreen,
loadingStrategy,
allowPolicy,
allowScrolling,
classes,
loadingStrategy,
referrerPolicy,
src,
// kopia
snapshotHost,
snapshotPath,
// kubernetes
app,
namespace,
podSelector,
// mjpeg
fit,
stream,
// openmediavault
method,
// opnsense, pfsense
wan,
// proxmox
node,
// sonarr, radarr
enableQueue,
// unifi
site,
} = cleanedService.widget;
let fieldsList = fields;

View File

@ -21,7 +21,7 @@ export default function Component({ service }) {
const [dataPoints, setDataPoints] = useState(new Array(pointsLimit).fill({ value: 0 }, 0, pointsLimit));
const { data, error } = useWidgetAPI(service.widget, "cpu", {
refreshInterval
refreshInterval,
});
const { data: systemData, error: systemError } = useWidgetAPI(service.widget, "system");

View File

@ -11,7 +11,7 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
const ChartDual = dynamic(() => import("../components/chart_dual"), { ssr: false });
const defaultPointsLimit = 15;
const defaultInterval = (isChart) => isChart ? 1000 : 5000;
const defaultInterval = (isChart) => (isChart ? 1000 : 5000);
export default function Component({ service }) {
const { t } = useTranslation();

View File

@ -11,7 +11,7 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
const ChartDual = dynamic(() => import("../components/chart_dual"), { ssr: false });
const defaultPointsLimit = 15;
const defaultInterval = (isChart) => isChart ? 1000 : 5000;
const defaultInterval = (isChart) => (isChart ? 1000 : 5000);
export default function Component({ service }) {
const { t } = useTranslation();