From c62cf01cc00799fd5b670837a8b73728ad831d6d Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 12 Mar 2025 12:02:50 -0500 Subject: [PATCH] frontend --- .../overlay/detail/SearchDetailDialog.tsx | 23 +++++++++++++++++++ web/src/pages/Explore.tsx | 2 ++ web/src/types/search.ts | 4 ++++ web/src/views/search/SearchView.tsx | 4 +++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index c94c2cd2d..7f69f2ca2 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -333,6 +333,18 @@ function ObjectDetailsTab({ } }, [search]); + const identifierScore = useMemo(() => { + if (!search) { + return undefined; + } + + if (search.data.identifier && search.data?.identifier_score) { + return Math.round((search.data?.identifier_score ?? 0) * 100); + } else { + return undefined; + } + }, [search]); + const averageEstimatedSpeed = useMemo(() => { if (!search || !search.data?.average_estimated_speed) { return undefined; @@ -538,6 +550,17 @@ function ObjectDetailsTab({ + {search?.data.identifier && ( +
+
Identifier
+
+
+ {search.data.identifier}{" "} + {identifierScore && ` (${identifierScore}%)`} +
+
+
+ )}
diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index af23c18f4..cf24ff70d 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -105,6 +105,7 @@ export default function Explore() { cameras: searchSearchParams["cameras"], labels: searchSearchParams["labels"], sub_labels: searchSearchParams["sub_labels"], + identifier: searchSearchParams["identifier"], zones: searchSearchParams["zones"], before: searchSearchParams["before"], after: searchSearchParams["after"], @@ -140,6 +141,7 @@ export default function Explore() { cameras: searchSearchParams["cameras"], labels: searchSearchParams["labels"], sub_labels: searchSearchParams["sub_labels"], + identifier: searchSearchParams["identifier"], zones: searchSearchParams["zones"], before: searchSearchParams["before"], after: searchSearchParams["after"], diff --git a/web/src/types/search.ts b/web/src/types/search.ts index cef7f6aff..90bcd54d7 100644 --- a/web/src/types/search.ts +++ b/web/src/types/search.ts @@ -58,6 +58,8 @@ export type SearchResult = { average_estimated_speed: number; velocity_angle: number; path_data: [number[], number][]; + identifier?: string; + identifier_score?: number; }; }; @@ -66,6 +68,7 @@ export type SearchFilter = { cameras?: string[]; labels?: string[]; sub_labels?: string[]; + identifier?: string[]; zones?: string[]; before?: number; after?: number; @@ -89,6 +92,7 @@ export type SearchQueryParams = { cameras?: string[]; labels?: string[]; sub_labels?: string[]; + identifier?: string[]; zones?: string[]; before?: string; after?: string; diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index adbc96413..7f1b1e4a1 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -121,6 +121,7 @@ export default function SearchView({ }, [config, searchFilter]); const { data: allSubLabels } = useSWR("sub_labels"); + const { data: allIdentifiers } = useSWR("identifiers"); const allZones = useMemo(() => { if (!config) { @@ -160,12 +161,13 @@ export default function SearchView({ max_score: ["100"], min_speed: ["1"], max_speed: ["150"], + identifier: allIdentifiers, has_clip: ["yes", "no"], has_snapshot: ["yes", "no"], ...(config?.plus?.enabled && searchFilter?.has_snapshot && { is_submitted: ["yes", "no"] }), }), - [config, allLabels, allZones, allSubLabels, searchFilter], + [config, allLabels, allZones, allSubLabels, allIdentifiers, searchFilter], ); // remove duplicate event ids