mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-29 04:04:16 -06: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) => {
|
useSearchEffect("group", (reviewGroup) => {
|
||||||
if (config && reviewGroup) {
|
if (config && reviewGroup) {
|
||||||
const group = config.camera_groups[reviewGroup];
|
const group = config.camera_groups[reviewGroup];
|
||||||
|
const isBirdseyeOnly =
|
||||||
|
group.cameras.length == 1 && group.cameras[0] == "birdseye";
|
||||||
|
|
||||||
if (group) {
|
if (group && !isBirdseyeOnly) {
|
||||||
setReviewFilter({
|
setReviewFilter({
|
||||||
...reviewFilter,
|
...reviewFilter,
|
||||||
cameras: group.cameras,
|
cameras: group.cameras,
|
||||||
|
@ -113,7 +113,7 @@ function Live() {
|
|||||||
) : (
|
) : (
|
||||||
<LiveDashboardView
|
<LiveDashboardView
|
||||||
cameras={cameras}
|
cameras={cameras}
|
||||||
cameraGroup={cameraGroup}
|
cameraGroup={cameraGroup ?? "default"}
|
||||||
includeBirdseye={includesBirdseye}
|
includeBirdseye={includesBirdseye}
|
||||||
onSelectCamera={setSelectedCameraName}
|
onSelectCamera={setSelectedCameraName}
|
||||||
fullscreen={fullscreen}
|
fullscreen={fullscreen}
|
||||||
|
@ -34,7 +34,7 @@ import { useResizeObserver } from "@/hooks/resize-observer";
|
|||||||
|
|
||||||
type LiveDashboardViewProps = {
|
type LiveDashboardViewProps = {
|
||||||
cameras: CameraConfig[];
|
cameras: CameraConfig[];
|
||||||
cameraGroup?: string;
|
cameraGroup: string;
|
||||||
includeBirdseye: boolean;
|
includeBirdseye: boolean;
|
||||||
onSelectCamera: (camera: string) => void;
|
onSelectCamera: (camera: string) => void;
|
||||||
fullscreen: boolean;
|
fullscreen: boolean;
|
||||||
@ -64,12 +64,31 @@ export default function LiveDashboardView({
|
|||||||
// recent events
|
// recent events
|
||||||
|
|
||||||
const eventUpdate = useFrigateReviews();
|
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[]>([
|
const { data: allEvents, mutate: updateEvents } = useSWR<ReviewSegment[]>([
|
||||||
"review",
|
"review",
|
||||||
{
|
{
|
||||||
limit: 10,
|
limit: 10,
|
||||||
severity: "alert",
|
severity: "alert",
|
||||||
cameras: cameraGroup && cameras.filter((cam) => cam.name).join(","),
|
cameras: alertCameras,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user