From 1706d2907bfade9728bb45d1db34b892eae682b2 Mon Sep 17 00:00:00 2001 From: leccelecce <24962424+leccelecce@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:01:41 +0000 Subject: [PATCH] UI tweaks: add width and height, fix select --- web/src/types/frigateConfig.ts | 2 + .../settings/FrigatePlusSettingsView.tsx | 92 ++++++++++++------- 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/web/src/types/frigateConfig.ts b/web/src/types/frigateConfig.ts index 8ae92afff..947c5cde9 100644 --- a/web/src/types/frigateConfig.ts +++ b/web/src/types/frigateConfig.ts @@ -397,6 +397,8 @@ export interface FrigateConfig { trainDate: string; baseModel: string; supportedDetectors: string[]; + width: number; + height: number; }; }; diff --git a/web/src/views/settings/FrigatePlusSettingsView.tsx b/web/src/views/settings/FrigatePlusSettingsView.tsx index 1ee4fef84..f2abca85e 100644 --- a/web/src/views/settings/FrigatePlusSettingsView.tsx +++ b/web/src/views/settings/FrigatePlusSettingsView.tsx @@ -29,6 +29,8 @@ type FrigatePlusModel = { supportedDetectors: string[]; trainDate: string; baseModel: string; + width: number; + height: number; }; type FrigatePlusSettings = { @@ -67,15 +69,20 @@ export default function FrigatePlusSettingsView({ }, ); - const { data: availableModels } = useSWR("/plus/models", { - fallbackData: [], - fetcher: (url) => - axios - .get(url, { - params: { filterByCurrentModelDetector: true }, - withCredentials: true, - }) - .then((res) => res.data), + const { data: availableModels = {} } = useSWR< + Record + >("/plus/models", { + fallbackData: {}, + fetcher: async (url) => { + const res = await axios.get(url, { withCredentials: true }); + return res.data.reduce( + (obj: Record, model: FrigatePlusModel) => { + obj[model.id] = model; + return obj; + }, + {}, + ); + }, }); useEffect(() => { @@ -260,7 +267,13 @@ export default function FrigatePlusSettingsView({ -

{config.model.plus.name}

+

+ {config.model.plus.name} ( + {config.model.plus.width + + "x" + + config.model.plus.height} + ) +