mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +01:00
Fix camera filtering logic (#12457)
* Fix camera filtering logic * Cleanup * Simplify and consider birdseye only group in logic * Don't add filter when group is birdseye only
This commit is contained in:
parent
5066fa369d
commit
82d2910039
@ -71,8 +71,10 @@ export default function Events() {
|
||||
useSearchEffect("group", (reviewGroup) => {
|
||||
if (config && reviewGroup) {
|
||||
const group = config.camera_groups[reviewGroup];
|
||||
const isBirdseyeOnly =
|
||||
group.cameras.length == 1 && group.cameras[0] == "birdseye";
|
||||
|
||||
if (group) {
|
||||
if (group && !isBirdseyeOnly) {
|
||||
setReviewFilter({
|
||||
...reviewFilter,
|
||||
cameras: group.cameras,
|
||||
|
@ -113,7 +113,7 @@ function Live() {
|
||||
) : (
|
||||
<LiveDashboardView
|
||||
cameras={cameras}
|
||||
cameraGroup={cameraGroup}
|
||||
cameraGroup={cameraGroup ?? "default"}
|
||||
includeBirdseye={includesBirdseye}
|
||||
onSelectCamera={setSelectedCameraName}
|
||||
fullscreen={fullscreen}
|
||||
|
@ -34,7 +34,7 @@ import { useResizeObserver } from "@/hooks/resize-observer";
|
||||
|
||||
type LiveDashboardViewProps = {
|
||||
cameras: CameraConfig[];
|
||||
cameraGroup?: string;
|
||||
cameraGroup: string;
|
||||
includeBirdseye: boolean;
|
||||
onSelectCamera: (camera: string) => void;
|
||||
fullscreen: boolean;
|
||||
@ -64,12 +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<ReviewSegment[]>([
|
||||
"review",
|
||||
{
|
||||
limit: 10,
|
||||
severity: "alert",
|
||||
cameras: cameraGroup && cameras.filter((cam) => cam.name).join(","),
|
||||
cameras: alertCameras,
|
||||
},
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user