From d3e508e65e81194079274daa49fe79e5657f964f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 15 Jul 2024 09:19:45 -0600 Subject: [PATCH] Simplify and consider birdseye only group in logic --- web/src/views/live/LiveDashboardView.tsx | 29 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/web/src/views/live/LiveDashboardView.tsx b/web/src/views/live/LiveDashboardView.tsx index 0d2650c9d..e40634af0 100644 --- a/web/src/views/live/LiveDashboardView.tsx +++ b/web/src/views/live/LiveDashboardView.tsx @@ -64,20 +64,31 @@ export default function LiveDashboardView({ // recent events const eventUpdate = useFrigateReviews(); + + const alertCameras = useMemo(() => { + if (!config || cameraGroup == "default") { + return null; + } + + if (includeBirdseye && cameras.length == 0) { + return Object.values(config.cameras) + .filter((cam) => cam.birdseye.enabled) + .map((cam) => cam.name) + .join(","); + } + + return cameras + .map((cam) => cam.name) + .filter((cam) => config.camera_groups[cameraGroup].cameras.includes(cam)) + .join(","); + }, [cameras, cameraGroup, config, includeBirdseye]); + const { data: allEvents, mutate: updateEvents } = useSWR([ "review", { limit: 10, severity: "alert", - cameras: - config == undefined || cameraGroup == "default" - ? null - : cameras - .map((cam) => cam.name) - .filter((cam) => - config.camera_groups[cameraGroup].cameras.includes(cam), - ) - .join(","), + cameras: alertCameras, }, ]);