diff --git a/src/Components/Assets/AssetType/ONVIFCamera.tsx b/src/Components/Assets/AssetType/ONVIFCamera.tsx index 21beb5f7bf8..d5dfff0aac0 100644 --- a/src/Components/Assets/AssetType/ONVIFCamera.tsx +++ b/src/Components/Assets/AssetType/ONVIFCamera.tsx @@ -1,20 +1,20 @@ -import { useEffect, useState } from "react"; -import { AssetData, ResolvedMiddleware } from "../AssetTypes"; +import { SyntheticEvent, useEffect, useState } from "react"; +import useAuthUser from "../../../Common/hooks/useAuthUser"; +import { checkIfValidIP } from "../../../Common/validation"; import * as Notification from "../../../Utils/Notifications.js"; -import { BedModel } from "../../Facility/models"; import { getCameraConfig } from "../../../Utils/transformUtils"; -import CameraConfigure from "../configure/CameraConfigure"; import Loading from "../../Common/Loading"; -import { checkIfValidIP } from "../../../Common/validation"; -import TextFormField from "../../Form/FormFields/TextFormField"; import { Submit } from "../../Common/components/ButtonV2"; -import { SyntheticEvent } from "react"; -import useAuthUser from "../../../Common/hooks/useAuthUser"; +import { BedModel } from "../../Facility/models"; +import TextFormField from "../../Form/FormFields/TextFormField"; +import { AssetData, ResolvedMiddleware } from "../AssetTypes"; +import CameraConfigure from "../configure/CameraConfigure"; -import request from "../../../Utils/request/request"; import routes from "../../../Redux/api"; +import request from "../../../Utils/request/request"; import useQuery from "../../../Utils/request/useQuery"; +import { useTranslation } from "react-i18next"; import CareIcon from "../../../CAREUI/icons/CareIcon"; interface Props { @@ -25,6 +25,7 @@ interface Props { } const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { + const { t } = useTranslation(); const [isLoading, setIsLoading] = useState(true); const [assetType, setAssetType] = useState(""); const [middlewareHostname, setMiddlewareHostname] = useState(""); @@ -40,7 +41,7 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { const [loadingAddPreset, setLoadingAddPreset] = useState(false); const [loadingSetConfiguration, setLoadingSetConfiguration] = useState(false); const [refreshPresetsHash, setRefreshPresetsHash] = useState( - Number(new Date()), + Number(new Date()) ); const { data: facility, loading } = useQuery(routes.getPermittedFacility, { pathParams: { id: facilityId }, @@ -99,15 +100,13 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { }; try { setLoadingAddPreset(true); - const response = await fetch( - `https://${resolvedMiddleware?.hostname}/status?hostname=${config.hostname}&port=${config.port}&username=${config.username}&password=${config.password}`, + `https://${resolvedMiddleware?.hostname}/status?hostname=${config.hostname}&port=${config.port}&username=${config.username}&password=${config.password}` ); if (!response.ok) { throw new Error("Network error"); } const presetData = await response.json(); - const { res } = await request(routes.createAssetBed, { body: { meta: { ...data, ...presetData }, @@ -145,7 +144,7 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { name="middleware_hostname" label={
Middleware Hostname
+{t("middleware_hostname")}
{resolvedMiddleware?.source != "asset" && (- Preset: {toDelete.meta.preset_name} + {t("preset")} {toDelete.preset_name}
- Bed: {toDelete.bed_object.name} + {t("bed")}:{" "} + {toDelete.asset_bed_object?.bed?.name}
} action="Delete" variant="danger" - onClose={() => setToDelete(null)} - onConfirm={() => deletePreset(toDelete.id)} + onClose={() => setToDelete(undefined)} + onConfirm={() => deletePreset(toDelete?.id || "")} /> )} {toUpdate && (- STATUS: OFFLINE + {t("status")}:{" "} + {t("offline")}
- Feed is currently not live. + {t("feed_is_currently_not_live")}
- Click refresh button to try again. + {t("click_refresh_button_to_try_again")}
- STATUS: STOPPED + {t("status")}:{" "} + STOPPED +
++ {t("feed_is_stopped")}
-Feed is Stooped.
- Click refresh button to start feed. + {t("click_refresh_button_to_start_feed")}
- STATUS: LOADING + {t("status")}:{" "} + {t("loading")}
- Fetching latest feed. + {t("fetching_latest_feed")}