mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Add page for submitting to frigate+ (#10273)
* Add screen for submitting to frigate+ * Fix sizing
This commit is contained in:
parent
68ed18d3f4
commit
55077a0bc9
@ -15,6 +15,7 @@ import Events from "./pages/Events";
|
|||||||
import { isDesktop, isMobile } from "react-device-detect";
|
import { isDesktop, isMobile } from "react-device-detect";
|
||||||
import Statusbar from "./components/Statusbar";
|
import Statusbar from "./components/Statusbar";
|
||||||
import Bottombar from "./components/navigation/Bottombar";
|
import Bottombar from "./components/navigation/Bottombar";
|
||||||
|
import SubmitPlus from "./pages/SubmitPlus";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
@ -34,6 +35,7 @@ function App() {
|
|||||||
<Route path="/events" element={<Events />} />
|
<Route path="/events" element={<Events />} />
|
||||||
<Route path="/export" element={<Export />} />
|
<Route path="/export" element={<Export />} />
|
||||||
<Route path="/storage" element={<Storage />} />
|
<Route path="/storage" element={<Storage />} />
|
||||||
|
<Route path="/plus" element={<SubmitPlus />} />
|
||||||
<Route path="/system" element={<System />} />
|
<Route path="/system" element={<System />} />
|
||||||
<Route path="/settings" element={<Settings />} />
|
<Route path="/settings" element={<Settings />} />
|
||||||
<Route path="/config" element={<ConfigEditor />} />
|
<Route path="/config" element={<ConfigEditor />} />
|
||||||
|
95
web/src/pages/SubmitPlus.tsx
Normal file
95
web/src/pages/SubmitPlus.tsx
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
import { baseUrl } from "@/api/baseUrl";
|
||||||
|
import {
|
||||||
|
AlertDialog,
|
||||||
|
AlertDialogAction,
|
||||||
|
AlertDialogCancel,
|
||||||
|
AlertDialogContent,
|
||||||
|
AlertDialogDescription,
|
||||||
|
AlertDialogFooter,
|
||||||
|
AlertDialogHeader,
|
||||||
|
AlertDialogTitle,
|
||||||
|
} from "@/components/ui/alert-dialog";
|
||||||
|
import { Event } from "@/types/event";
|
||||||
|
import axios from "axios";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import useSWR from "swr";
|
||||||
|
|
||||||
|
export default function SubmitPlus() {
|
||||||
|
const { data: events, mutate: refresh } = useSWR<Event[]>([
|
||||||
|
"events",
|
||||||
|
{ limit: 100, in_progress: 0, is_submitted: 0 },
|
||||||
|
]);
|
||||||
|
const [upload, setUpload] = useState<Event>();
|
||||||
|
|
||||||
|
const onSubmitToPlus = useCallback(
|
||||||
|
async (falsePositive: boolean) => {
|
||||||
|
if (!upload) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const resp = (await falsePositive)
|
||||||
|
? await axios.put(`events/${upload.id}/false_positive`)
|
||||||
|
: await axios.post(`events/${upload.id}/plus`, {
|
||||||
|
include_annotation: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (resp.status == 200) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[refresh, upload],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="size-full p-2 grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-2 overflow-auto">
|
||||||
|
<AlertDialog
|
||||||
|
open={upload != undefined}
|
||||||
|
onOpenChange={(open) => (!open ? setUpload(undefined) : null)}
|
||||||
|
>
|
||||||
|
<AlertDialogContent className="md:max-w-4xl">
|
||||||
|
<AlertDialogHeader>
|
||||||
|
<AlertDialogTitle>Submit To Frigate+</AlertDialogTitle>
|
||||||
|
<AlertDialogDescription>
|
||||||
|
Objects in locations you want to avoid are not false positives.
|
||||||
|
Submitting them as false positives will confuse the model.
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</AlertDialogHeader>
|
||||||
|
<img
|
||||||
|
className="flex-grow-0"
|
||||||
|
src={`${baseUrl}api/events/${upload?.id}/snapshot.jpg`}
|
||||||
|
alt={`${upload?.label}`}
|
||||||
|
/>
|
||||||
|
<AlertDialogFooter>
|
||||||
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||||
|
<AlertDialogAction
|
||||||
|
className="bg-success"
|
||||||
|
onClick={() => onSubmitToPlus(false)}
|
||||||
|
>
|
||||||
|
This is a {upload?.label}
|
||||||
|
</AlertDialogAction>
|
||||||
|
<AlertDialogAction
|
||||||
|
className="bg-danger"
|
||||||
|
onClick={() => onSubmitToPlus(true)}
|
||||||
|
>
|
||||||
|
This is not a {upload?.label}
|
||||||
|
</AlertDialogAction>
|
||||||
|
</AlertDialogFooter>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialog>
|
||||||
|
|
||||||
|
{events?.map((event) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="size-full aspect-video rounded-2xl flex justify-center items-center bg-black cursor-pointer"
|
||||||
|
onClick={() => setUpload(event)}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="h-full object-contain rounded-2xl"
|
||||||
|
src={`${baseUrl}api/events/${event.id}/snapshot.jpg`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import Logo from "@/components/Logo";
|
||||||
import { FaCompactDisc, FaFlag, FaVideo } from "react-icons/fa";
|
import { FaCompactDisc, FaFlag, FaVideo } from "react-icons/fa";
|
||||||
import { LuConstruction } from "react-icons/lu";
|
import { LuConstruction } from "react-icons/lu";
|
||||||
|
|
||||||
@ -20,6 +21,12 @@ export const navbarLinks = [
|
|||||||
title: "Export",
|
title: "Export",
|
||||||
url: "/export",
|
url: "/export",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
icon: Logo,
|
||||||
|
title: "Frigate+",
|
||||||
|
url: "/plus",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
icon: LuConstruction,
|
icon: LuConstruction,
|
||||||
|
Loading…
Reference in New Issue
Block a user