From 42fd2f282d8251d6f53e551f9480af6fb47bee50 Mon Sep 17 00:00:00 2001 From: Scott Stancil Date: Thu, 14 Sep 2023 08:12:55 -0400 Subject: [PATCH] Add capability to link directly to an event ID in the web UI --- web/src/routes/Events.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index c28d31cfa..b90c9345f 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -51,7 +51,7 @@ export default function Events({ path, ...props }) { const [searchParams, setSearchParams] = useState({ before: null, after: null, - cameras: props.cameras ?? 'all', + cameras: props.event ? '' : props.cameras ?? 'all', labels: props.labels ?? 'all', zones: props.zones ?? 'all', sub_labels: props.sub_labels ?? 'all', @@ -69,7 +69,7 @@ export default function Events({ path, ...props }) { validBox: null, }); const [uploading, setUploading] = useState([]); - const [viewEvent, setViewEvent] = useState(); + const [viewEvent, setViewEvent] = useState(props.event); const [eventOverlay, setEventOverlay] = useState(); const [eventDetailType, setEventDetailType] = useState('clip'); const [downloadEvent, setDownloadEvent] = useState({ @@ -87,6 +87,10 @@ export default function Events({ path, ...props }) { }); const eventsFetcher = useCallback((path, params) => { + if (props.event) { + path = `${path}/${props.event}`; + return axios.get(path).then((res) => [res.data]); + } params = { ...params, include_thumbnails: 0, limit: API_LIMIT }; return axios.get(path, { params }).then((res) => res.data); }, []);