Tracked object metadata changes (#15055)

* add enum and change topic name

* frontend renaming

* docs

* only display sublabel score if it it exists

* remove debug print
This commit is contained in:
Josh Hawkins
2024-11-18 12:26:44 -06:00
committed by GitHub
parent 66f71aecf7
commit 9ae839ad72
8 changed files with 41 additions and 14 deletions

View File

@@ -407,9 +407,9 @@ export function useImproveContrast(camera: string): {
return { payload: payload as ToggleableSetting, send };
}
export function useEventUpdate(): { payload: string } {
export function useTrackedObjectUpdate(): { payload: string } {
const {
value: { payload },
} = useWs("event_update", "");
} = useWs("tracked_object_update", "");
return useDeepMemo(JSON.parse(payload as string));
}

View File

@@ -309,7 +309,7 @@ function ObjectDetailsTab({
return undefined;
}
if (search.sub_label) {
if (search.sub_label && search.data?.sub_label_score) {
return Math.round((search.data?.sub_label_score ?? 0) * 100);
} else {
return undefined;

View File

@@ -1,6 +1,6 @@
import {
useEmbeddingsReindexProgress,
useEventUpdate,
useTrackedObjectUpdate,
useModelState,
} from "@/api/ws";
import ActivityIndicator from "@/components/indicators/activity-indicator";
@@ -227,15 +227,15 @@ export default function Explore() {
// mutation and revalidation
const eventUpdate = useEventUpdate();
const trackedObjectUpdate = useTrackedObjectUpdate();
useEffect(() => {
if (eventUpdate) {
if (trackedObjectUpdate) {
mutate();
}
// mutate / revalidate when event description updates come in
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [eventUpdate]);
}, [trackedObjectUpdate]);
// embeddings reindex progress

View File

@@ -15,7 +15,7 @@ import { SearchResult } from "@/types/search";
import ImageLoadingIndicator from "@/components/indicators/ImageLoadingIndicator";
import useImageLoaded from "@/hooks/use-image-loaded";
import ActivityIndicator from "@/components/indicators/activity-indicator";
import { useEventUpdate } from "@/api/ws";
import { useTrackedObjectUpdate } from "@/api/ws";
import { isEqual } from "lodash";
import TimeAgo from "@/components/dynamic/TimeAgo";
import SearchResultActions from "@/components/menu/SearchResultActions";
@@ -72,13 +72,13 @@ export default function ExploreView({
}, {});
}, [events]);
const eventUpdate = useEventUpdate();
const trackedObjectUpdate = useTrackedObjectUpdate();
useEffect(() => {
mutate();
// mutate / revalidate when event description updates come in
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [eventUpdate]);
}, [trackedObjectUpdate]);
// update search detail when results change