diff --git a/web/src/pages/SubmitPlus.tsx b/web/src/pages/SubmitPlus.tsx index 67dfd5230..7581f8cb3 100644 --- a/web/src/pages/SubmitPlus.tsx +++ b/web/src/pages/SubmitPlus.tsx @@ -1,14 +1,13 @@ import { baseUrl } from "@/api/baseUrl"; +import { Button } from "@/components/ui/button"; import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from "@/components/ui/alert-dialog"; + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; import { Event } from "@/types/event"; import axios from "axios"; import { useCallback, useState } from "react"; @@ -27,64 +26,75 @@ export default function SubmitPlus() { return; } - const resp = (await falsePositive) - ? await axios.put(`events/${upload.id}/false_positive`) - : await axios.post(`events/${upload.id}/plus`, { + falsePositive + ? axios.put(`events/${upload.id}/false_positive`) + : axios.post(`events/${upload.id}/plus`, { include_annotation: 1, }); - if (resp.status == 200) { - refresh(); - } + refresh( + (data: Event[] | undefined) => { + if (!data) { + return data; + } + + const index = data.findIndex((e) => e.id == upload.id); + + if (index == -1) { + return data; + } + + return [...data.slice(0, index), ...data.slice(index + 1)]; + }, + { revalidate: false, populateCache: true }, + ); + setUpload(undefined); }, [refresh, upload], ); return (
- (!open ? setUpload(undefined) : null)} > - - - Submit To Frigate+ - + + + Submit To Frigate+ + Objects in locations you want to avoid are not false positives. Submitting them as false positives will confuse the model. - - + + {`${upload?.label}`} - - Cancel - + + + + + + {events?.map((event) => { return (
setUpload(event)} >