mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-21 03:41:55 +03:00
filter motion review by allowed cameras (#23294)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
This commit is contained in:
parent
910059281f
commit
fa07109a85
@ -44,6 +44,7 @@ import SummaryTimeline from "@/components/timeline/SummaryTimeline";
|
|||||||
import { RecordingStartingPoint } from "@/types/record";
|
import { RecordingStartingPoint } from "@/types/record";
|
||||||
import VideoControls from "@/components/player/VideoControls";
|
import VideoControls from "@/components/player/VideoControls";
|
||||||
import { TimeRange } from "@/types/timeline";
|
import { TimeRange } from "@/types/timeline";
|
||||||
|
import { useAllowedCameras } from "@/hooks/use-allowed-cameras";
|
||||||
import { useCameraMotionNextTimestamp } from "@/hooks/use-camera-activity";
|
import { useCameraMotionNextTimestamp } from "@/hooks/use-camera-activity";
|
||||||
import useOptimisticState from "@/hooks/use-optimistic-state";
|
import useOptimisticState from "@/hooks/use-optimistic-state";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
@ -918,25 +919,26 @@ function MotionReview({
|
|||||||
}: MotionReviewProps) {
|
}: MotionReviewProps) {
|
||||||
const segmentDuration = 30;
|
const segmentDuration = 30;
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
const allowedCameras = useAllowedCameras();
|
||||||
|
|
||||||
const reviewCameras = useMemo(() => {
|
const reviewCameras = useMemo(() => {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let cameras;
|
const selectedCams = filter?.cameras;
|
||||||
if (!filter || !filter.cameras) {
|
const cameras = Object.values(config.cameras).filter((cam) => {
|
||||||
cameras = Object.values(config.cameras);
|
if (!allowedCameras.includes(cam.name)) {
|
||||||
} else {
|
return false;
|
||||||
const filteredCams = filter.cameras;
|
|
||||||
|
|
||||||
cameras = Object.values(config.cameras).filter((cam) =>
|
|
||||||
filteredCams.includes(cam.name),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
if (selectedCams && !selectedCams.includes(cam.name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
return cameras.sort((a, b) => a.ui.order - b.ui.order);
|
return cameras.sort((a, b) => a.ui.order - b.ui.order);
|
||||||
}, [config, filter]);
|
}, [config, filter, allowedCameras]);
|
||||||
|
|
||||||
const videoPlayersRef = useRef<{ [camera: string]: PreviewController }>({});
|
const videoPlayersRef = useRef<{ [camera: string]: PreviewController }>({});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user