diff --git a/src/App.tsx b/src/App.tsx index f38f67a..063726e 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import { HashRouter as Router, Route, Routes } from "react-router-dom"; import { useCallback, Fragment, useState, useEffect } from "react"; -import { v4 as uuidv4 } from "uuid"; +// import { v4 as uuidv4 } from "uuid"; import Cookies from "js-cookie"; import Navbar from "./components/header/navbar"; import Body from "./root/body"; @@ -19,7 +19,7 @@ function App({ height: window.innerHeight, }); const [uuid, setUuid] = useState(""); - const [container_uuid, setContainerUuid] = useState(""); + // const [container_uuid, setContainerUuid] = useState(""); const [creativeCommonsPopupOpen, setCreativeCommonsPopupOpen] = useState(false); const [switchLanguage, setSwitchLanguage] = useState(false); @@ -48,24 +48,24 @@ function App({ } }, []); - const createContainerUuid = useCallback((): void => { - // create a new uuid for user and set a cookie to remember it for 10 years (it is used to identify user container in azure storage) - const newUuid = uuidv4(); - setContainerUuid(newUuid); - Cookies.set("container-uuid", newUuid, { expires: 365 * 10 }); - }, []); + // const createContainerUuid = useCallback((): void => { + // // create a new uuid for user and set a cookie to remember it for 10 years (it is used to identify user container in azure storage) + // const newUuid = uuidv4(); + // setContainerUuid(newUuid); + // Cookies.set("container-uuid", newUuid, { expires: 365 * 10 }); + // }, []); - const getContainerUuid = useCallback((): void => { - // check if the user has already a uuid (cookie) - const existingUuid = Cookies.get("container-uuid") as string; - if (existingUuid !== undefined) { - setContainerUuid(existingUuid); - console.log("Existing Container UUID: " + existingUuid); - } else { - console.log("Creating new Container UUID"); - createContainerUuid(); - } - }, [createContainerUuid]); + // const getContainerUuid = useCallback((): void => { + // // check if the user has already a uuid (cookie) + // const existingUuid = Cookies.get("container-uuid") as string; + // if (existingUuid !== undefined) { + // setContainerUuid(existingUuid); + // console.log("Existing Container UUID: " + existingUuid); + // } else { + // console.log("Creating new Container UUID"); + // createContainerUuid(); + // } + // }, [createContainerUuid]); // const handleSignIn = (): void => { // setSignedIn(true); @@ -89,9 +89,8 @@ function App({ // }, [signedIn]); useEffect(() => { - getContainerUuid(); getCreativeCommonsAgreement(); - }, [getContainerUuid, getCreativeCommonsAgreement]); + }, [getCreativeCommonsAgreement]); useEffect(() => { // update window size on resize @@ -129,7 +128,6 @@ function App({ { imageObject, curDir, uuid, + uuid, ), ).toEqual("data"); }); diff --git a/src/common/tests/loadresultstocache.test.ts b/src/common/tests/loadresultstocache.test.ts old mode 100644 new mode 100755 index dd0db77..bd0c1be --- a/src/common/tests/loadresultstocache.test.ts +++ b/src/common/tests/loadresultstocache.test.ts @@ -21,13 +21,14 @@ describe("loadResultsToCache", () => { let inferenceData: ApiInferenceData = { filename: "test", imageId: "test", - inferenceId: "test", + inference_id: "test", boxes: [ { score: 0.1, classId: "0", label: "a", - boxId: "0", + box_id: "0", + object_type_id: "0", box: { topX: 1, topY: 1, @@ -42,7 +43,8 @@ describe("loadResultsToCache", () => { score: 0.2, classId: "1", label: "b", - boxId: "1", + box_id: "1", + object_type_id: "1", box: { topX: 2, topY: 2, @@ -57,7 +59,8 @@ describe("loadResultsToCache", () => { score: 0.3, classId: "2", label: "c", - boxId: "2", + box_id: "2", + object_type_id: "2", box: { topX: 3, topY: 3, @@ -92,13 +95,14 @@ describe("loadResultsToCache", () => { inferenceData = { filename: "test", imageId: "test", - inferenceId: "test", + inference_id: "test", boxes: [ { score: 0.1, classId: "0", label: "a", - boxId: "0", + box_id: "0", + object_type_id: "0", box: { topX: 1, topY: 1, @@ -113,7 +117,8 @@ describe("loadResultsToCache", () => { score: 0.2, classId: "1", label: "b", - boxId: "1", + box_id: "1", + object_type_id: "1", box: { topX: 2, topY: 2, @@ -128,7 +133,8 @@ describe("loadResultsToCache", () => { score: 0.3, classId: "2", label: "c", - boxId: "2", + box_id: "2", + object_type_id: "2", box: { topX: 3, topY: 3, diff --git a/src/root/body/body.test.tsx b/src/root/body/body.test.tsx old mode 100644 new mode 100755 index 3073951..0e7a390 --- a/src/root/body/body.test.tsx +++ b/src/root/body/body.test.tsx @@ -2,7 +2,6 @@ import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import Body from "./body"; import axios from "axios"; -import { a } from "vitest/dist/suite-a18diDsI"; process.env.VITE_BACKEND_URL = "somebackendurl"; diff --git a/src/root/body/body.tsx b/src/root/body/body.tsx index a297c6b..f4c6796 100755 --- a/src/root/body/body.tsx +++ b/src/root/body/body.tsx @@ -32,7 +32,6 @@ interface params { height: number; }; uuid: string; - container_uuid: string; creativeCommonsPopupOpen: boolean; setCreativeCommonsPopupOpen: React.Dispatch>; handleCreativeCommonsAgreement: (agree: boolean) => void;