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

This commit is contained in:
Josh Hawkins 2026-05-23 07:47:32 -05:00 committed by GitHub
parent 910059281f
commit fa07109a85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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; }
if (selectedCams && !selectedCams.includes(cam.name)) {
cameras = Object.values(config.cameras).filter((cam) => return false;
filteredCams.includes(cam.name), }
); 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 }>({});