Merge remote-tracking branch 'origin/main-dev' into dev-collaboration
This commit is contained in:
@@ -52,7 +52,7 @@ const ProjectSocketRes = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDuplicate = async (data: any) => {
|
const handleDuplicate = async (data: any) => {
|
||||||
console.log("Project duplicate response:", data);
|
// console.log("Project duplicate response:", data);
|
||||||
if (data?.message === "Project Duplicated successfully") {
|
if (data?.message === "Project Duplicated successfully") {
|
||||||
if (setWorkspaceProjects) {
|
if (setWorkspaceProjects) {
|
||||||
const allProjects = await getAllProjects(userId, organization);
|
const allProjects = await getAllProjects(userId, organization);
|
||||||
|
|||||||
@@ -5,16 +5,25 @@ import FileMenu from "../../ui/FileMenu";
|
|||||||
import { useToggleStore } from "../../../store/useUIToggleStore";
|
import { useToggleStore } from "../../../store/useUIToggleStore";
|
||||||
import useModuleStore from "../../../store/useModuleStore";
|
import useModuleStore from "../../../store/useModuleStore";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import useRestStates from "../../../hooks/useResetStates";
|
||||||
|
|
||||||
const Header: React.FC = () => {
|
const Header: React.FC = () => {
|
||||||
const { toggleUILeft, toggleUIRight, setToggleUI } = useToggleStore();
|
const { toggleUILeft, toggleUIRight, setToggleUI } = useToggleStore();
|
||||||
const { activeModule } = useModuleStore();
|
const { activeModule } = useModuleStore();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { resetStates } = useRestStates();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="header-container">
|
<div className="header-container">
|
||||||
<div className="header-content">
|
<div className="header-content">
|
||||||
<button className="logo-container" onClick={() => navigate("/Dashboard")} title="Back to Dashboard">
|
<button
|
||||||
|
className="logo-container"
|
||||||
|
onClick={() => {
|
||||||
|
resetStates();
|
||||||
|
navigate("/Dashboard")
|
||||||
|
}}
|
||||||
|
title="Back to Dashboard"
|
||||||
|
>
|
||||||
<LogoIcon />
|
<LogoIcon />
|
||||||
</button>
|
</button>
|
||||||
<div className="header-title">
|
<div className="header-title">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
import { zoneCameraUpdate } from "../../../../services/visulization/zone/zoneCameraUpdation";
|
import { zoneCameraUpdate } from "../../../../services/visulization/zone/zoneCameraUpdation";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../../functions/getUserData";
|
import { getUserData } from "../../../../functions/getUserData";
|
||||||
|
import { useVersionContext } from "../../../../modules/builder/version/versionContext";
|
||||||
|
|
||||||
const ZoneProperties: React.FC = () => {
|
const ZoneProperties: React.FC = () => {
|
||||||
const { Edit, setEdit } = useEditPosition();
|
const { Edit, setEdit } = useEditPosition();
|
||||||
@@ -20,6 +21,8 @@ const ZoneProperties: React.FC = () => {
|
|||||||
const { zones, setZones } = useZones();
|
const { zones, setZones } = useZones();
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setZonePosition(selectedZone.zoneViewPortPosition);
|
setZonePosition(selectedZone.zoneViewPortPosition);
|
||||||
@@ -35,7 +38,7 @@ const ZoneProperties: React.FC = () => {
|
|||||||
viewPortCenter: zoneTarget,
|
viewPortCenter: zoneTarget,
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = await zoneCameraUpdate(zonesdata, organization, projectId);
|
let response = await zoneCameraUpdate(zonesdata, organization, projectId, selectedVersion?.versionId || "");
|
||||||
// console.log('response: ', response);
|
// console.log('response: ', response);
|
||||||
if (response.message === "zone updated") {
|
if (response.message === "zone updated") {
|
||||||
setEdit(false);
|
setEdit(false);
|
||||||
@@ -57,7 +60,7 @@ const ZoneProperties: React.FC = () => {
|
|||||||
zoneName: newName,
|
zoneName: newName,
|
||||||
};
|
};
|
||||||
// Call your API to update the zone
|
// Call your API to update the zone
|
||||||
let response = await zoneCameraUpdate(zonesdata, organization, projectId);
|
let response = await zoneCameraUpdate(zonesdata, organization, projectId, selectedVersion?.versionId || "");
|
||||||
if (response.message === "zone updated") {
|
if (response.message === "zone updated") {
|
||||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||||
setZones((prevZones: any[]) =>
|
setZones((prevZones: any[]) =>
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ const VersionHistory = () => {
|
|||||||
|
|
||||||
getVersionDataApi(projectId, version.versionId).then((verdionData) => {
|
getVersionDataApi(projectId, version.versionId).then((verdionData) => {
|
||||||
setSelectedVersion(version);
|
setSelectedVersion(version);
|
||||||
console.log(verdionData);
|
// console.log(verdionData);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -56,33 +57,15 @@ const BarChartInput = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${selectedChartId.id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setSelections(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setWidgetName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setSelections(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setWidgetName(response.widgetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
}, [selectedChartId]);
|
}, [selectedChartId]);
|
||||||
|
|
||||||
@@ -118,47 +101,16 @@ const BarChartInput = (props: Props) => {
|
|||||||
// visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget);
|
// visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget,projectId, selectedVersion?.versionId || "");
|
let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "");
|
||||||
|
|
||||||
|
|
||||||
if(response.message==="Widget updated successfully"){
|
if (response.message === "Widget updated successfully") {
|
||||||
return true;
|
return true;
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/save`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: "Bearer <access_token>",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// token: localStorage.getItem("token") || "",
|
|
||||||
// refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// organization: organization,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// panel: selectedChartId.panel,
|
|
||||||
// widgetName: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -27,7 +29,8 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
const { projectId } = useParams()
|
const { projectId } = useParams()
|
||||||
|
|
||||||
const isSelected = () => { };
|
const isSelected = () => { };
|
||||||
@@ -38,15 +41,15 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
//
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
// console.log("Unexpected response:", response);
|
//
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to fetch zone data");
|
echo.error("Failed to fetch zone data");
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchZoneData();
|
fetchZoneData();
|
||||||
@@ -55,30 +58,15 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(selectedChartId.id, organization,projectId,selectedVersion?.versionId||"")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${selectedChartId.id}/${organization}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setWidgetName(response.data.header);
|
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
console.error("There was an error!", error);
|
if (response) {
|
||||||
|
|
||||||
|
setSelections(response.Data.Datastructure.measurements);
|
||||||
|
setDuration(response.Data.Datastructure.duration);
|
||||||
|
setWidgetName(response.Data.header);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,43 +93,17 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
duration: inputDuration,
|
duration: inputDuration,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId)
|
|
||||||
// console.log('response: ', response);
|
|
||||||
|
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "")
|
||||||
|
|
||||||
if (response.message === "Widget updated successfully") {
|
if (response.message === "Widget updated successfully") {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/floatWidget/save`,
|
|
||||||
// {
|
|
||||||
// organization: organization,
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// header: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
// if (response.status === 200) {
|
|
||||||
// return true;
|
|
||||||
// } else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
|
|
||||||
// console.error("There was an error!", error);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
@@ -156,7 +118,7 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
newSelections[inputKey] = selectedData;
|
newSelections[inputKey] = selectedData;
|
||||||
}
|
}
|
||||||
// setMeasurements(newSelections); // Update Zustand store
|
// setMeasurements(newSelections); // Update Zustand store
|
||||||
// console.log(newSelections);
|
//
|
||||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||||
setSelections(newSelections);
|
setSelections(newSelections);
|
||||||
}
|
}
|
||||||
@@ -173,7 +135,7 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNameChange = async (name: any) => {
|
const handleNameChange = async (name: any) => {
|
||||||
console.log("name change requested", name);
|
|
||||||
|
|
||||||
if (await sendInputes(selections, duration, name)) {
|
if (await sendInputes(selections, duration, name)) {
|
||||||
setWidgetName(name);
|
setWidgetName(name);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
const { projectId } = useParams()
|
const { projectId } = useParams()
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
@@ -35,16 +39,16 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
//
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
// console.log("Unexpected response:", response);
|
//
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to fetch zone data");
|
echo.error("Failed to fetch zone data");
|
||||||
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchZoneData();
|
fetchZoneData();
|
||||||
@@ -53,30 +57,14 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(selectedChartId.id, organization, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${selectedChartId.id}/${organization}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setWidgetName(response.data.header);
|
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
console.error("There was an error!", error);
|
if (response) {
|
||||||
|
setSelections(response.Data.Datastructure.measurements);
|
||||||
|
setDuration(response.Data.Datastructure.duration);
|
||||||
|
setWidgetName(response.Data.header);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,42 +92,16 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId)
|
|
||||||
// console.log('response: ', response);
|
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "")
|
||||||
|
|
||||||
if (response.message === "Widget updated successfully") {
|
if (response.message === "Widget updated successfully") {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// console.log("Unexpected response:", response);
|
//
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/floatWidget/save`,
|
|
||||||
// {
|
|
||||||
// organization: organization,
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// header: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
// if (response.status === 200) {
|
|
||||||
// return true;
|
|
||||||
// } else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
|
|
||||||
// console.error("There was an error!", error);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
@@ -154,7 +116,7 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
newSelections[inputKey] = selectedData;
|
newSelections[inputKey] = selectedData;
|
||||||
}
|
}
|
||||||
// setMeasurements(newSelections); // Update Zustand store
|
// setMeasurements(newSelections); // Update Zustand store
|
||||||
// console.log(newSelections);
|
//
|
||||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||||
setSelections(newSelections);
|
setSelections(newSelections);
|
||||||
}
|
}
|
||||||
@@ -171,7 +133,7 @@ const FlotingWidgetInput = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNameChange = async (name: any) => {
|
const handleNameChange = async (name: any) => {
|
||||||
console.log("name change requested", name);
|
|
||||||
|
|
||||||
if (await sendInputes(selections, duration, name)) {
|
if (await sendInputes(selections, duration, name)) {
|
||||||
setWidgetName(name);
|
setWidgetName(name);
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -172,31 +173,15 @@ const LineGrapInput = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${selectedChartId.id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setSelections(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setWidgetName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setSelections(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setWidgetName(response.widgetName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
@@ -243,37 +228,7 @@ const LineGrapInput = (props: Props) => {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/save`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: "Bearer <access_token>",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// token: localStorage.getItem("token") || "",
|
|
||||||
// refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// organization: organization,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// panel: selectedChartId.panel,
|
|
||||||
// widgetName: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -56,31 +57,15 @@ const PieChartInput = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${selectedChartId.id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setSelections(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setWidgetName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setSelections(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setWidgetName(response.widgetName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
@@ -129,37 +114,7 @@ const PieChartInput = (props: Props) => {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/save`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: "Bearer <access_token>",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// token: localStorage.getItem("token") || "",
|
|
||||||
// refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// organization: organization,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// panel: selectedChartId.panel,
|
|
||||||
// widgetName: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -56,31 +57,15 @@ const Progress1Input = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${selectedChartId.id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setSelections(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setWidgetName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setSelections(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setWidgetName(response.widgetName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
@@ -127,37 +112,7 @@ const Progress1Input = (props: Props) => {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/save`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: "Bearer <access_token>",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// token: localStorage.getItem("token") || "",
|
|
||||||
// refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// organization: organization,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// panel: selectedChartId.panel,
|
|
||||||
// widgetName: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -56,31 +57,15 @@ const Progress2Input = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${selectedChartId.id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setSelections(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setWidgetName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setSelections(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setWidgetName(response.widgetName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
@@ -129,37 +114,7 @@ const Progress2Input = (props: Props) => {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/save`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// Authorization: "Bearer <access_token>",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// token: localStorage.getItem("token") || "",
|
|
||||||
// refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// organization: organization,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// panel: selectedChartId.panel,
|
|
||||||
// widgetName: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
|||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -28,6 +30,8 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
@@ -35,15 +39,15 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
//
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
// console.log("Unexpected response:", response);
|
//
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to fetch zone data");
|
echo.error("Failed to fetch zone data");
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchZoneData();
|
fetchZoneData();
|
||||||
@@ -52,29 +56,14 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(selectedChartId.id, organization,projectId,selectedVersion?.versionId||"")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${selectedChartId.id}/${organization}`,
|
if (response) {
|
||||||
{
|
setSelections(response.Data.Datastructure.measurements);
|
||||||
headers: {
|
setDuration(response.Data.Datastructure.duration);
|
||||||
Authorization: "Bearer <access_token>",
|
setWidgetName(response.Data.header);
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setWidgetName(response.data.header);
|
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,36 +91,16 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
duration: inputDuration,
|
duration: inputDuration,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget,projectId)
|
|
||||||
// console.log('response: ', response);
|
const response = await addingFloatingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "")
|
||||||
|
//
|
||||||
if (response.message === "Widget updated successfully") {
|
if (response.message === "Widget updated successfully") {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// console.log("Unexpected response:", response);
|
//
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// const response = await axios.post(
|
|
||||||
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/floatWidget/save`,
|
|
||||||
// {
|
|
||||||
// organization: organization,
|
|
||||||
// zoneUuid: selectedZone.zoneUuid,
|
|
||||||
// widget: {
|
|
||||||
// id: selectedChartId.id,
|
|
||||||
// header: inputName,
|
|
||||||
// Data: {
|
|
||||||
// measurements: inputMeasurement,
|
|
||||||
// duration: inputDuration,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// } as any
|
|
||||||
// );
|
|
||||||
|
|
||||||
// } catch (error) {
|
|
||||||
// echo.error("Failed to send input");
|
|
||||||
// console.error("There was an error!", error);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = async (
|
const handleSelect = async (
|
||||||
@@ -146,7 +115,7 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
newSelections[inputKey] = selectedData;
|
newSelections[inputKey] = selectedData;
|
||||||
}
|
}
|
||||||
// setMeasurements(newSelections); // Update Zustand store
|
// setMeasurements(newSelections); // Update Zustand store
|
||||||
// console.log(newSelections);
|
//
|
||||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||||
setSelections(newSelections);
|
setSelections(newSelections);
|
||||||
}
|
}
|
||||||
@@ -163,7 +132,7 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNameChange = async (name: any) => {
|
const handleNameChange = async (name: any) => {
|
||||||
// console.log("name change requested", name);
|
//
|
||||||
|
|
||||||
if (await sendInputes(selections, duration, name)) {
|
if (await sendInputes(selections, duration, name)) {
|
||||||
setWidgetName(name);
|
setWidgetName(name);
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
import { adding3dWidgets } from "../../../../../services/visulization/zone/add3dWidget";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -24,6 +28,9 @@ const Widget2InputCard3D = (props: Props) => {
|
|||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
const { projectId } = useParams()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
@@ -48,21 +55,14 @@ const Widget2InputCard3D = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
setSelections(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setWidgetName(response.data.widgetName);
|
setWidgetName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,6 +81,17 @@ const Widget2InputCard3D = (props: Props) => {
|
|||||||
inputDuration: any,
|
inputDuration: any,
|
||||||
inputName: any
|
inputName: any
|
||||||
) => {
|
) => {
|
||||||
|
// let newWidget = {
|
||||||
|
// id: selectedChartId.id,
|
||||||
|
// widgetName: inputName,
|
||||||
|
// Data: {
|
||||||
|
// measurements: inputMeasurement,
|
||||||
|
// duration: inputDuration,
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let response = await adding3dWidgets(selectedZone.zoneUuid, organization, newWidget,projectId, selectedVersion?.versionId || "")
|
||||||
|
// console.log('response: ', response);
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
||||||
@@ -100,7 +111,7 @@ const Widget2InputCard3D = (props: Props) => {
|
|||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
// console.log("Unexpected response:", response);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -139,7 +150,7 @@ const Widget2InputCard3D = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNameChange = async (name: any) => {
|
const handleNameChange = async (name: any) => {
|
||||||
console.log("name change requested", name);
|
// console.log("name change requested", name);
|
||||||
|
|
||||||
if (await sendInputes(selections, duration, name)) {
|
if (await sendInputes(selections, duration, name)) {
|
||||||
setWidgetName(name);
|
setWidgetName(name);
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { adding3dWidgets } from "../../../../../services/visulization/zone/add3dWidget";
|
||||||
|
|
||||||
const Widget3InputCard3D = () => {
|
const Widget3InputCard3D = () => {
|
||||||
const { selectedChartId } = useWidgetStore();
|
const { selectedChartId } = useWidgetStore();
|
||||||
@@ -22,6 +26,9 @@ const Widget3InputCard3D = () => {
|
|||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
const { projectId } = useParams()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
@@ -46,21 +53,14 @@ const Widget3InputCard3D = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
setSelections(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setWidgetName(response.data.widgetName);
|
setWidgetName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,6 +78,19 @@ const Widget3InputCard3D = () => {
|
|||||||
inputDuration: any,
|
inputDuration: any,
|
||||||
inputName: any
|
inputName: any
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
|
// let newWidget = {
|
||||||
|
// id: selectedChartId.id,
|
||||||
|
// widgetName: inputName,
|
||||||
|
// Data: {
|
||||||
|
// measurements: inputMeasurement,
|
||||||
|
// duration: inputDuration,
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let response = await adding3dWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "")
|
||||||
|
// console.log('response: ', response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
||||||
@@ -132,7 +145,7 @@ const Widget3InputCard3D = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNameChange = async (name: any) => {
|
const handleNameChange = async (name: any) => {
|
||||||
console.log("name change requested", name);
|
// console.log("name change requested", name);
|
||||||
|
|
||||||
if (await sendInputes(selections, duration, name)) {
|
if (await sendInputes(selections, duration, name)) {
|
||||||
setWidgetName(name);
|
setWidgetName(name);
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { adding3dWidgets } from "../../../../../services/visulization/zone/add3dWidget";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
|
|
||||||
@@ -24,6 +28,9 @@ const Widget4InputCard3D = (props: Props) => {
|
|||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const { userName, userId, organization, email } = getUserData();
|
const { userName, userId, organization, email } = getUserData();
|
||||||
const [isLoading, setLoading] = useState<boolean>(true);
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
const { projectId } = useParams()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
@@ -48,21 +55,14 @@ const Widget4InputCard3D = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (selectedChartId.id !== "") {
|
if (selectedChartId.id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setSelections(response.data.Data.measurements);
|
setSelections(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setWidgetName(response.data.widgetName);
|
setWidgetName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,6 +81,17 @@ const Widget4InputCard3D = (props: Props) => {
|
|||||||
inputDuration: any,
|
inputDuration: any,
|
||||||
inputName: any
|
inputName: any
|
||||||
) => {
|
) => {
|
||||||
|
// let newWidget = {
|
||||||
|
// id: selectedChartId.id,
|
||||||
|
// widgetName: inputName,
|
||||||
|
// Data: {
|
||||||
|
// measurements: inputMeasurement,
|
||||||
|
// duration: inputDuration,
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let response = await adding3dWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "")
|
||||||
|
// console.log('response: ', response);
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget3d/save`,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { setAssetsApi } from "../../../services/factoryBuilder/assest/floorAsset
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../functions/getUserData";
|
import { getUserData } from "../../../functions/getUserData";
|
||||||
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
||||||
|
import { useVersionContext } from "../../../modules/builder/version/versionContext";
|
||||||
|
|
||||||
interface Asset {
|
interface Asset {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -52,6 +53,8 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
|||||||
const { assetStore } = useSceneContext();
|
const { assetStore } = useSceneContext();
|
||||||
const { setName } = assetStore();
|
const { setName } = assetStore();
|
||||||
const { organization } = getUserData();
|
const { organization } = getUserData();
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
useSelectedZoneStore.getState().setSelectedZone({
|
useSelectedZoneStore.getState().setSelectedZone({
|
||||||
@@ -81,7 +84,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
|||||||
|
|
||||||
setSubModule("zoneProperties");
|
setSubModule("zoneProperties");
|
||||||
|
|
||||||
let response = await getZoneData(id, organization, projectId);
|
let response = await getZoneData(id, organization, projectId, selectedVersion?.versionId || "");
|
||||||
setSelectedZone({
|
setSelectedZone({
|
||||||
zoneName: response?.zoneName,
|
zoneName: response?.zoneName,
|
||||||
activeSides: response?.activeSides ?? [],
|
activeSides: response?.activeSides ?? [],
|
||||||
@@ -117,7 +120,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
|||||||
zoneUuid: selectedZone.zoneUuid,
|
zoneUuid: selectedZone.zoneUuid,
|
||||||
zoneName: newName,
|
zoneName: newName,
|
||||||
};
|
};
|
||||||
const response = await zoneCameraUpdate(zonesdata, organization, projectId);
|
const response = await zoneCameraUpdate(zonesdata, organization, projectId, selectedVersion?.versionId || "");
|
||||||
if (response.message === "zone updated") {
|
if (response.message === "zone updated") {
|
||||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||||
setZones((prevZones: any[]) =>
|
setZones((prevZones: any[]) =>
|
||||||
|
|||||||
26
app/src/hooks/useResetStates.ts
Normal file
26
app/src/hooks/useResetStates.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { useVersionContext } from "../modules/builder/version/versionContext";
|
||||||
|
import { useSceneContext } from "../modules/scene/sceneContext";
|
||||||
|
import { useProductContext } from "../modules/simulation/products/productContext";
|
||||||
|
import { useVersionHistoryStore } from "../store/builder/useVersionHistoryStore";
|
||||||
|
|
||||||
|
const useRestStates = () => {
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { clearSelectedVersion } = selectedVersionStore();
|
||||||
|
const { selectedProductStore } = useProductContext();
|
||||||
|
const { clearSelectedProduct } = selectedProductStore();
|
||||||
|
const { clearVersions } = useVersionHistoryStore();
|
||||||
|
const { clearStores } = useSceneContext();
|
||||||
|
|
||||||
|
const resetStates = () => {
|
||||||
|
clearSelectedVersion();
|
||||||
|
clearSelectedProduct();
|
||||||
|
clearVersions();
|
||||||
|
clearStores();
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
resetStates,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useRestStates;
|
||||||
@@ -28,6 +28,8 @@ type SceneContextValue = {
|
|||||||
vehicleStore: VehicleStoreType;
|
vehicleStore: VehicleStoreType;
|
||||||
storageUnitStore: StorageUnitStoreType;
|
storageUnitStore: StorageUnitStoreType;
|
||||||
|
|
||||||
|
clearStores: () => void;
|
||||||
|
|
||||||
layout: 'Main Layout' | 'Comparison Layout';
|
layout: 'Main Layout' | 'Comparison Layout';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,8 +57,17 @@ export function SceneProvider({
|
|||||||
const storageUnitStore = useMemo(() => createStorageUnitStore(), []);
|
const storageUnitStore = useMemo(() => createStorageUnitStore(), []);
|
||||||
|
|
||||||
const clearStores = useMemo(() => () => {
|
const clearStores = useMemo(() => () => {
|
||||||
assetStore().clearAssets();
|
assetStore.getState().clearAssets();
|
||||||
}, [assetStore]);
|
aisleStore.getState().clearAisles();
|
||||||
|
eventStore.getState().clearEvents();
|
||||||
|
productStore.getState().clearProducts();
|
||||||
|
materialStore.getState().clearMaterials();
|
||||||
|
armBotStore.getState().clearArmBots();
|
||||||
|
machineStore.getState().clearMachines();
|
||||||
|
conveyorStore.getState().clearConveyors();
|
||||||
|
vehicleStore.getState().clearVehicles();
|
||||||
|
storageUnitStore.getState().clearStorageUnits();
|
||||||
|
}, [assetStore, aisleStore, eventStore, productStore, materialStore, armBotStore, machineStore, conveyorStore, vehicleStore, storageUnitStore]);
|
||||||
|
|
||||||
const contextValue = useMemo(() => (
|
const contextValue = useMemo(() => (
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import EditWidgetOption from "../../components/ui/menu/EditWidgetOption";
|
|||||||
import { useEditWidgetOptionsStore, useRightClickSelected, useRightSelected, } from "../../store/visualization/useZone3DWidgetStore";
|
import { useEditWidgetOptionsStore, useRightClickSelected, useRightSelected, } from "../../store/visualization/useZone3DWidgetStore";
|
||||||
import OuterClick from "../../utils/outerClick";
|
import OuterClick from "../../utils/outerClick";
|
||||||
import { useWidgetStore } from "../../store/useWidgetStore";
|
import { useWidgetStore } from "../../store/useWidgetStore";
|
||||||
import { useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../functions/getUserData";
|
import { getUserData } from "../../functions/getUserData";
|
||||||
import { useVersionContext } from "../builder/version/versionContext";
|
import { useVersionContext } from "../builder/version/versionContext";
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ const RealTimeVisulization: React.FC = () => {
|
|||||||
const { selectedVersionStore } = useVersionContext();
|
const { selectedVersionStore } = useVersionContext();
|
||||||
const { selectedVersion } = selectedVersionStore();
|
const { selectedVersion } = selectedVersionStore();
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
OuterClick({
|
OuterClick({
|
||||||
contextClassName: [
|
contextClassName: [
|
||||||
@@ -81,6 +82,12 @@ const RealTimeVisulization: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!projectId || !selectedVersion) return;
|
if (!projectId || !selectedVersion) return;
|
||||||
getZone2dData(organization, projectId, selectedVersion?.versionId || '').then((response) => {
|
getZone2dData(organization, projectId, selectedVersion?.versionId || '').then((response) => {
|
||||||
|
if (!response) return;
|
||||||
|
// if (response.status === 401) {
|
||||||
|
// console.log("force logout");
|
||||||
|
// navigate("/");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
if (!Array.isArray(response)) {
|
if (!Array.isArray(response)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import useChartStore from "../../../../../store/visualization/useChartStore";
|
|||||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
interface ChartComponentProps {
|
interface ChartComponentProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -181,31 +182,15 @@ const BarGraphComponent = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ''}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements);
|
||||||
|
setDuration(response.Datastructure.duration);
|
||||||
|
setName(response.widgetName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useParams } from "react-router-dom";
|
|||||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
interface ChartComponentProps {
|
interface ChartComponentProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -164,32 +165,16 @@ const DoughnutGraphComponent = ({
|
|||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
|
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements)
|
|
||||||
setDuration(response.data.Datastructure.duration)
|
|
||||||
setName(response.data.widgetName)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchSavedInputes();
|
fetchSavedInputes();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useParams } from "react-router-dom";
|
|||||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
interface ChartComponentProps {
|
interface ChartComponentProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -181,29 +182,12 @@ const LineGraphComponent = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useSelectedZoneStore } from "../../../../../store/visualization/useZone
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
interface ChartComponentProps {
|
interface ChartComponentProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -181,29 +182,12 @@ const PieChartComponent = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useSelectedZoneStore } from "../../../../../store/visualization/useZone
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
interface ChartComponentProps {
|
interface ChartComponentProps {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -181,29 +182,12 @@ const PolarAreaGraphComponent = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useSelectedZoneStore } from "../../../../../store/visualization/useZone
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
const ProgressCard1 = ({ id, title }: { id: string; title: string }) => {
|
const ProgressCard1 = ({ id, title }: { id: string; title: string }) => {
|
||||||
const {
|
const {
|
||||||
@@ -61,30 +62,12 @@ const ProgressCard1 = ({ id, title }: { id: string; title: string }) => {
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useSelectedZoneStore } from "../../../../../store/visualization/useZone
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||||
|
|
||||||
const ProgressCard2 = ({ id, title }: { id: string; title: string }) => {
|
const ProgressCard2 = ({ id, title }: { id: string; title: string }) => {
|
||||||
const {
|
const {
|
||||||
@@ -65,30 +66,12 @@ const ProgressCard2 = ({ id, title }: { id: string; title: string }) => {
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/V1/widget/data?widgetID=${id}&zoneUuid=${selectedZone.zoneUuid}&projectId=${projectId}&versionId=${selectedVersion?.versionId || ""}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
|
|
||||||
|
|
||||||
setmeasurements(response.data.Datastructure.measurements);
|
|
||||||
setDuration(response.data.Datastructure.duration);
|
|
||||||
setName(response.data.widgetName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
setmeasurements(response.Datastructure.measurements)
|
||||||
|
setDuration(response.Datastructure.duration)
|
||||||
|
setName(response.widgetName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ export default function Dropped3dWidgets() {
|
|||||||
const [horizontalZ, setHorizontalZ] = useState<number | undefined>();
|
const [horizontalZ, setHorizontalZ] = useState<number | undefined>();
|
||||||
const { selectedVersionStore } = useVersionContext();
|
const { selectedVersionStore } = useVersionContext();
|
||||||
const { selectedVersion } = selectedVersionStore();
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
const activeZoneWidgets = zoneWidgetData[selectedZone.zoneUuid] || [];
|
const activeZoneWidgets = zoneWidgetData[selectedZone.zoneUuid] || [];
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
const { userId, organization, email } = getUserData();
|
const { userId, organization, email } = getUserData();
|
||||||
@@ -107,13 +106,16 @@ export default function Dropped3dWidgets() {
|
|||||||
const hasEntered = { current: false };
|
const hasEntered = { current: false };
|
||||||
|
|
||||||
const handleDragEnter = (event: DragEvent) => {
|
const handleDragEnter = (event: DragEvent) => {
|
||||||
|
console.log("dragEnter");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (hasEntered.current || !widgetSelect.startsWith("ui")) return;
|
if (hasEntered.current || !widgetSelect.startsWith("ui")) return;
|
||||||
|
console.log('hasEntered.current : ', hasEntered.current );
|
||||||
hasEntered.current = true;
|
hasEntered.current = true;
|
||||||
|
|
||||||
const group1 = scene.getObjectByName("itemsGroup");
|
const group1 = scene.getObjectByName("itemsGroup");
|
||||||
|
console.log('group1: ', group1);
|
||||||
if (!group1) return;
|
if (!group1) return;
|
||||||
|
|
||||||
const rect = canvasElement.getBoundingClientRect();
|
const rect = canvasElement.getBoundingClientRect();
|
||||||
@@ -137,6 +139,7 @@ export default function Dropped3dWidgets() {
|
|||||||
intersect.object.type !== "GridHelper"
|
intersect.object.type !== "GridHelper"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('intersects: ', intersects);
|
||||||
if (intersects.length > 0) {
|
if (intersects.length > 0) {
|
||||||
const { x, y, z } = intersects[0].point;
|
const { x, y, z } = intersects[0].point;
|
||||||
const newWidget: WidgetData = {
|
const newWidget: WidgetData = {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import io from "socket.io-client";
|
|||||||
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
|
||||||
// Register ChartJS components
|
// Register ChartJS components
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
@@ -170,20 +171,27 @@ const ProductionCapacity: React.FC<ProductionCapacityProps> = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
setmeasurements(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setName(response.data.widgetName);
|
setName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
}
|
}
|
||||||
|
// try {
|
||||||
|
// const response = await axios.get(
|
||||||
|
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (response.status === 200) {
|
||||||
|
// setmeasurements(response.data.Data.measurements);
|
||||||
|
// setDuration(response.data.Data.duration);
|
||||||
|
// setName(response.data.widgetName);
|
||||||
|
// } else {
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// echo.error("Failed to fetch saved inputs");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
|||||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||||
import { WavyIcon } from "../../../../../components/icons/3dChartIcons";
|
import { WavyIcon } from "../../../../../components/icons/3dChartIcons";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
|
||||||
// Register Chart.js components
|
// Register Chart.js components
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
@@ -199,21 +200,28 @@ const ReturnOfInvestment: React.FC<ReturnOfInvestmentProps> = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
setmeasurements(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setName(response.data.widgetName);
|
setName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
// try {
|
||||||
|
// const response = await axios.get(
|
||||||
|
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
||||||
|
// );
|
||||||
|
// if (response.status === 200) {
|
||||||
|
// setmeasurements(response.data.Data.measurements);
|
||||||
|
// setDuration(response.data.Data.duration);
|
||||||
|
// setName(response.data.widgetName);
|
||||||
|
// } else {
|
||||||
|
// // console.log("Unexpected response:", response);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// echo.error("Failed to fetch saved inputs");
|
||||||
|
// console.error("There was an error!", error);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import io from "socket.io-client";
|
|||||||
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
|
||||||
// import image from "../../../../assets/image/temp/image.png";
|
// import image from "../../../../assets/image/temp/image.png";
|
||||||
interface StateWorkingProps {
|
interface StateWorkingProps {
|
||||||
@@ -77,21 +78,28 @@ const StateWorking: React.FC<StateWorkingProps> = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
setmeasurements(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setName(response.data.widgetName);
|
setName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
// try {
|
||||||
|
// const response = await axios.get(
|
||||||
|
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
||||||
|
// );
|
||||||
|
// if (response.status === 200) {
|
||||||
|
// setmeasurements(response.data.Data.measurements);
|
||||||
|
// setDuration(response.data.Data.duration);
|
||||||
|
// setName(response.data.widgetName);
|
||||||
|
// } else {
|
||||||
|
// // console.log("Unexpected response:", response);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// echo.error("Failed to fetch saved inputs");
|
||||||
|
// console.error("There was an error!", error);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
|||||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||||
import { ThroughputIcon } from "../../../../../components/icons/3dChartIcons";
|
import { ThroughputIcon } from "../../../../../components/icons/3dChartIcons";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
|
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||||
|
|
||||||
// Register Chart.js components
|
// Register Chart.js components
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
@@ -179,21 +180,28 @@ const Throughput: React.FC<ThroughputProps> = ({
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (id !== "") {
|
if (id !== "") {
|
||||||
try {
|
let response = await get3dWidgetInput(id, organization)
|
||||||
const response = await axios.get(
|
console.log('response: ', response);
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
if (response) {
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
setmeasurements(response.data.Data.measurements);
|
||||||
setDuration(response.data.Data.duration);
|
setDuration(response.data.Data.duration);
|
||||||
setName(response.data.widgetName);
|
setName(response.data.widgetName);
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
// try {
|
||||||
|
// const response = await axios.get(
|
||||||
|
// `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${id}/${organization}`
|
||||||
|
// );
|
||||||
|
// if (response.status === 200) {
|
||||||
|
// setmeasurements(response.data.Data.measurements);
|
||||||
|
// setDuration(response.data.Data.duration);
|
||||||
|
// setName(response.data.widgetName);
|
||||||
|
// } else {
|
||||||
|
// // console.log("Unexpected response:", response);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// echo.error("Failed to fetch saved inputs");
|
||||||
|
// console.error("There was an error!", error);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const DroppedObjects: React.FC = () => {
|
|||||||
const { selectedVersion } = selectedVersionStore();
|
const { selectedVersion } = selectedVersionStore();
|
||||||
const { projectId } = useParams();
|
const { projectId } = useParams();
|
||||||
|
|
||||||
|
|
||||||
const [openKebabId, setOpenKebabId] = useState<string | null>(null);
|
const [openKebabId, setOpenKebabId] = useState<string | null>(null);
|
||||||
const updateObjectPosition = useDroppedObjectsStore(
|
const updateObjectPosition = useDroppedObjectsStore(
|
||||||
(state) => state.updateObjectPosition
|
(state) => state.updateObjectPosition
|
||||||
@@ -116,7 +117,7 @@ const DroppedObjects: React.FC = () => {
|
|||||||
|
|
||||||
function handleDuplicate(zoneName: string, index: number) {
|
function handleDuplicate(zoneName: string, index: number) {
|
||||||
setOpenKebabId(null);
|
setOpenKebabId(null);
|
||||||
duplicateObject(zoneName, index, projectId, selectedVersion?.versionId ||''); // Call the duplicateObject method from the store
|
duplicateObject(zoneName, index, projectId, selectedVersion?.versionId || ''); // Call the duplicateObject method from the store
|
||||||
setSelectedChartId(null);
|
setSelectedChartId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +169,7 @@ const DroppedObjects: React.FC = () => {
|
|||||||
setActiveEdges({ vertical, horizontal });
|
setActiveEdges({ vertical, horizontal });
|
||||||
|
|
||||||
// Store the initial position strategy and active edges
|
// Store the initial position strategy and active edges
|
||||||
|
|
||||||
setDraggingIndex({
|
setDraggingIndex({
|
||||||
zone: zoneName,
|
zone: zoneName,
|
||||||
index,
|
index,
|
||||||
@@ -190,6 +192,8 @@ const DroppedObjects: React.FC = () => {
|
|||||||
offsetX = rect.width - relativeX - (obj.position.right as number);
|
offsetX = rect.width - relativeX - (obj.position.right as number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setOffset([offsetY, offsetX]);
|
setOffset([offsetY, offsetX]);
|
||||||
|
|
||||||
// Add native event listeners for smoother tracking
|
// Add native event listeners for smoother tracking
|
||||||
@@ -254,11 +258,14 @@ const DroppedObjects: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePointerUpNative = async (e: PointerEvent) => {
|
const handlePointerUpNative = async (e: PointerEvent) => {
|
||||||
|
|
||||||
// Clean up native event listeners
|
// Clean up native event listeners
|
||||||
element.removeEventListener("pointermove", handlePointerMoveNative);
|
element.removeEventListener("pointermove", handlePointerMoveNative);
|
||||||
element.removeEventListener("pointerup", handlePointerUpNative);
|
element.removeEventListener("pointerup", handlePointerUpNative);
|
||||||
element.releasePointerCapture(e.pointerId);
|
element.releasePointerCapture(e.pointerId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!draggingIndex || !offset) return;
|
if (!draggingIndex || !offset) return;
|
||||||
|
|
||||||
const rect = container.getBoundingClientRect();
|
const rect = container.getBoundingClientRect();
|
||||||
@@ -305,15 +312,18 @@ const DroppedObjects: React.FC = () => {
|
|||||||
{
|
{
|
||||||
...zone.objects[draggingIndex.index],
|
...zone.objects[draggingIndex.index],
|
||||||
position: boundedPosition,
|
position: boundedPosition,
|
||||||
}
|
},
|
||||||
|
projectId,
|
||||||
|
selectedVersion?.versionId || ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (response.message === "Widget updated successfully") {
|
if (response.message === "Widget updated successfully") {
|
||||||
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to add widget");
|
echo.error("Failed to add widget");
|
||||||
console.log(error);
|
|
||||||
} finally {
|
} finally {
|
||||||
setDraggingIndex(null);
|
setDraggingIndex(null);
|
||||||
setOffset(null);
|
setOffset(null);
|
||||||
@@ -449,7 +459,7 @@ const DroppedObjects: React.FC = () => {
|
|||||||
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to add widget");
|
echo.error("Failed to add widget");
|
||||||
console.log(error);
|
|
||||||
} finally {
|
} finally {
|
||||||
// Clean up regardless of success or failure
|
// Clean up regardless of success or failure
|
||||||
setDraggingIndex(null);
|
setDraggingIndex(null);
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import io from "socket.io-client";
|
|||||||
import { usePlayButtonStore } from "../../../../../store/usePlayButtonStore";
|
import { usePlayButtonStore } from "../../../../../store/usePlayButtonStore";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
|
||||||
const FleetEfficiencyComponent = ({ object }: any) => {
|
const FleetEfficiencyComponent = ({ object }: any) => {
|
||||||
const [progress, setProgress] = useState<any>(0);
|
const [progress, setProgress] = useState<any>(0);
|
||||||
@@ -18,6 +20,8 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
|||||||
const { selectedChartId } = useWidgetStore();
|
const { selectedChartId } = useWidgetStore();
|
||||||
const { isPlaying } = usePlayButtonStore();
|
const { isPlaying } = usePlayButtonStore();
|
||||||
const { projectId } = useParams()
|
const { projectId } = useParams()
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
|
|
||||||
@@ -44,10 +48,10 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
|||||||
|
|
||||||
socket.on("lastOutput", (response) => {
|
socket.on("lastOutput", (response) => {
|
||||||
const responseData = response.input1;
|
const responseData = response.input1;
|
||||||
// console.log(responseData);
|
//
|
||||||
|
|
||||||
if (typeof responseData === "number") {
|
if (typeof responseData === "number") {
|
||||||
// console.log("It's a number!");
|
//
|
||||||
setProgress(responseData);
|
setProgress(responseData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -61,28 +65,11 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (object?.id !== "") {
|
if (object?.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(object?.id, organization,projectId,selectedVersion?.versionId||"")
|
||||||
const response = await axios.get(
|
if (response) {
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`,
|
setmeasurements(response.Data.Datastructure.measurements);
|
||||||
{
|
setDuration(response.Data.Datastructure.duration);
|
||||||
headers: {
|
setName(response.Data.header);
|
||||||
Authorization: "Bearer <access_token>",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setName(response.data.header);
|
|
||||||
} else {
|
|
||||||
// console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Line } from "react-chartjs-2";
|
|
||||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||||
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import io from "socket.io-client";
|
import io from "socket.io-client";
|
||||||
import {
|
import {CartIcon,DocumentIcon,GlobeIcon,WalletIcon,} from "../../../../../components/icons/3dChartIcons";
|
||||||
CartIcon,
|
|
||||||
DocumentIcon,
|
|
||||||
GlobeIcon,
|
|
||||||
WalletIcon,
|
|
||||||
} from "../../../../../components/icons/3dChartIcons";
|
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
|
||||||
const TotalCardComponent = ({ object }: any) => {
|
const TotalCardComponent = ({ object }: any) => {
|
||||||
const [progress, setProgress] = useState<any>(0);
|
const [progress, setProgress] = useState<any>(0);
|
||||||
@@ -22,6 +19,8 @@ const TotalCardComponent = ({ object }: any) => {
|
|||||||
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
||||||
const { selectedChartId } = useWidgetStore();
|
const { selectedChartId } = useWidgetStore();
|
||||||
const { projectId } = useParams()
|
const { projectId } = useParams()
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
|
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
|
|
||||||
@@ -60,25 +59,12 @@ const TotalCardComponent = ({ object }: any) => {
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (object?.id !== "") {
|
if (object?.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(object?.id, organization,projectId,selectedVersion?.versionId||"")
|
||||||
const response = await axios.get(
|
if (response) {
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`, {
|
setmeasurements(response.Data.Datastructure.measurements);
|
||||||
headers: {
|
setDuration(response.Data.Datastructure.duration);
|
||||||
Authorization: "Bearer <access_token>",
|
setName(response.Data.header);
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setName(response.data.header);
|
|
||||||
} else {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
}
|
|
||||||
} catch (error) { }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import axios from "axios";
|
|||||||
import io from "socket.io-client";
|
import io from "socket.io-client";
|
||||||
import { getUserData } from "../../../../../functions/getUserData";
|
import { getUserData } from "../../../../../functions/getUserData";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||||
|
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||||
|
|
||||||
const WarehouseThroughputComponent = ({ object }: any) => {
|
const WarehouseThroughputComponent = ({ object }: any) => {
|
||||||
const [measurements, setmeasurements] = useState<any>({});
|
const [measurements, setmeasurements] = useState<any>({});
|
||||||
@@ -22,22 +24,12 @@ const WarehouseThroughputComponent = ({ object }: any) => {
|
|||||||
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
||||||
const { selectedChartId } = useWidgetStore();
|
const { selectedChartId } = useWidgetStore();
|
||||||
const { projectId } = useParams()
|
const { projectId } = useParams()
|
||||||
|
const { selectedVersionStore } = useVersionContext();
|
||||||
|
const { selectedVersion } = selectedVersionStore();
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
|
|
||||||
const lineGraphData = {
|
const lineGraphData = {
|
||||||
labels: [
|
labels: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",
|
||||||
"Jan",
|
|
||||||
"Feb",
|
|
||||||
"Mar",
|
|
||||||
"Apr",
|
|
||||||
"May",
|
|
||||||
"Jun",
|
|
||||||
"Jul",
|
|
||||||
"Aug",
|
|
||||||
"Sep",
|
|
||||||
"Oct",
|
|
||||||
"Nov",
|
|
||||||
"Dec",
|
|
||||||
], // Months of the year
|
], // Months of the year
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
@@ -159,29 +151,14 @@ const WarehouseThroughputComponent = ({ object }: any) => {
|
|||||||
|
|
||||||
const fetchSavedInputes = async () => {
|
const fetchSavedInputes = async () => {
|
||||||
if (object?.id !== "") {
|
if (object?.id !== "") {
|
||||||
try {
|
let response = await getFloatingWidgetInput(object?.id, organization, projectId, selectedVersion?.versionId || "")
|
||||||
const response = await axios.get(
|
|
||||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`,
|
if (response) {
|
||||||
{
|
setmeasurements(response.Data.measurements);
|
||||||
headers: {
|
setDuration(response.Data.duration);
|
||||||
Authorization: "Bearer <access_token>",
|
setName(response?.header);
|
||||||
"Content-Type": "application/json",
|
|
||||||
token: localStorage.getItem("token") || "",
|
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (response.status === 200) {
|
|
||||||
setmeasurements(response.data.Data.measurements);
|
|
||||||
setDuration(response.data.Data.duration);
|
|
||||||
setName(response.data.header);
|
|
||||||
} else {
|
|
||||||
console.log("Unexpected response:", response);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
echo.error("Failed to fetch saved inputs");
|
|
||||||
console.error("There was an error!", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ const Project: React.FC = () => {
|
|||||||
<LogList />
|
<LogList />
|
||||||
</RenderOverlay>
|
</RenderOverlay>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
15
app/src/pages/sessionValidity.tsx
Normal file
15
app/src/pages/sessionValidity.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React, { useEffect } from 'react'
|
||||||
|
|
||||||
|
function sessionValidity() {
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default sessionValidity
|
||||||
@@ -13,6 +13,11 @@ export const createProject = async (projectUuid: string, userId: string, thumbna
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ projectUuid, userId, thumbnail, organization, }),
|
body: JSON.stringify({ projectUuid, userId, thumbnail, organization, }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ export const deleteProject = async (
|
|||||||
body: JSON.stringify({ userId, organization }),
|
body: JSON.stringify({ userId, organization }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
console.log("response: ", response);
|
console.log("response: ", response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const deleteTrash = async (organization: string, projectId: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
console.log("restore: ", response);
|
console.log("restore: ", response);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -19,14 +19,18 @@ export const duplicateProject = async (
|
|||||||
body: JSON.stringify({ projectUuid, thumbnail, projectName }),
|
body: JSON.stringify({ projectUuid, thumbnail, projectName }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
console.log("response: ", response);
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
// console.log("response: ", response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
console.log("result: ", result);
|
// console.log("result: ", result);
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getAllProjects = async (userId: string, organization: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Failed to fetch assets");
|
throw new Error("Failed to fetch assets");
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ export const getTrash = async (organization: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch trash data");
|
console.error("Failed to fetch trash data");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,17 @@ export const projectTutorial = async () => {
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/tutorials`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/V1/tutorials`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
// console.log("response: ", response);
|
// console.log("response: ", response);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ export const recentlyViewed = async (organization: string, userId: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch project");
|
console.error("Failed to fetch project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const restoreTrash = async (organization: string, projectId: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch trash data");
|
console.error("Failed to fetch trash data");
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ export const searchProject = async (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("response: ", response);
|
console.log("response: ", response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ export const trashSearchProject = async (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ export const updateProject = async (
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ export const viewProject = async (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch");
|
console.error("Failed to fetch");
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ export const createAisleApi = async (
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ aisleUuid, points, type, projectId, versionId }),
|
body: JSON.stringify({ aisleUuid, points, type, projectId, versionId }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ export const deleteAisleApi = async (aisleUuid: string, projectId: string, versi
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ aisleUuid, projectId }),
|
body: JSON.stringify({ aisleUuid, projectId }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getAisleApi = async (projectId: string, versionId: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
// console.log("response: ", response);
|
// console.log("response: ", response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -11,11 +11,19 @@ export const deleteFloorItem = async (
|
|||||||
{
|
{
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, modelUuid, modelName }),
|
body: JSON.stringify({ organization, modelUuid, modelName }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete Floor Item");
|
console.error("Failed to delete Floor Item");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getFloorAssets = async (organization: string, projectId?: string, v
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
// console.log('response: ', response);
|
// console.log('response: ', response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ export const setAssetsApi = async (data: any) => {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set or update Floor Item");
|
console.error("Failed to set or update Floor Item");
|
||||||
|
|||||||
@@ -11,11 +11,19 @@ export const deleteWallItem = async (
|
|||||||
{
|
{
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, modelUuid, modelName }),
|
body: JSON.stringify({ organization, modelUuid, modelName }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete Wall Item");
|
console.error("Failed to delete Wall Item");
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ export const getWallItems = async (organization: string, projectId?: string, ver
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
// console.log('response: ', response);
|
// console.log('response: ', response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Wall Items");
|
console.error("Failed to get Wall Items");
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ export const setWallItem = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setWallItems`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setWallItems`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
organization,
|
organization,
|
||||||
@@ -30,6 +33,11 @@ export const setWallItem = async (
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set or update Wall Item");
|
console.error("Failed to set or update Wall Item");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getCamera = async (organization: string, userId: string, projectId?
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Camera position and target");
|
console.error("Failed to get Camera position and target");
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ export const setCamera = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setCamera`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setCamera`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
organization,
|
organization,
|
||||||
@@ -21,6 +24,11 @@ export const setCamera = async (
|
|||||||
rotation,
|
rotation,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set Camera Position and Target");
|
console.error("Failed to set Camera Position and Target");
|
||||||
|
|||||||
@@ -7,10 +7,19 @@ export default async function getActiveUsersData(organization: string) {
|
|||||||
const response = await fetch(apiUrl, {
|
const response = await fetch(apiUrl, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error(`Error: ${response.status} - ${response.statusText}`);
|
console.error(`Error: ${response.status} - ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,18 @@ export default async function fetchShareUsers(organization: string) {
|
|||||||
const response = await fetch(apiUrl, {
|
const response = await fetch(apiUrl, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error(`Error: ${response.status} - ${response.statusText}`);
|
console.error(`Error: ${response.status} - ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,18 @@ export default async function giveCollabAccess(
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/shareUser`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/shareUser`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ email, isShare, organization }),
|
body: JSON.stringify({ email, isShare, organization }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set Camera Position and Target");
|
console.error("Failed to set Camera Position and Target");
|
||||||
|
|||||||
@@ -29,7 +29,13 @@ export const addCommentsApi = async (
|
|||||||
body: JSON.stringify({ projectId, comment, threadId, commentId }),
|
body: JSON.stringify({ projectId, comment, threadId, commentId }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log("response: ", response);
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ export const createThreadApi = async (
|
|||||||
versionId,
|
versionId,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add project");
|
console.error("Failed to add project");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ export const deleteCommentApi = async (
|
|||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ export const deleteThreadApi = async (
|
|||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ export const editThreadTitleApi = async (
|
|||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getAllThreads = async (projectId: string, versionId: string) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get assets");
|
console.error("Failed to get assets");
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ export const findEnvironment = async (organization: string, userId: string, proj
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get wall and roof visibility");
|
console.error("Failed to get wall and roof visibility");
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ export const setEnvironment = async (
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
// console.log('responseenv: ', response);
|
// console.log('responseenv: ', response);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set wall and roof visibility");
|
console.error("Failed to set wall and roof visibility");
|
||||||
|
|||||||
@@ -5,11 +5,18 @@ export const deleteLayer = async (organization: string, layer: number) => {
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deleteLayer`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deleteLayer`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, layer }),
|
body: JSON.stringify({ organization, layer }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete line");
|
console.error("Failed to delete line");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,18 @@ export const deleteLineApi = async (organization: string, line: Object) => {
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deleteLine`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deleteLine`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, line }),
|
body: JSON.stringify({ organization, line }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete line");
|
console.error("Failed to delete line");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,18 @@ export const deletePointApi = async (organization: string, uuid: string) => {
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deletePoint`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/deletePoint`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, uuid }),
|
body: JSON.stringify({ organization, uuid }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete point");
|
console.error("Failed to delete point");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getLines = async (organization: string, projectId?: string, version
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Lines");
|
console.error("Failed to get Lines");
|
||||||
|
|||||||
@@ -10,11 +10,20 @@ export const setLine = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, layer, line, type }),
|
body: JSON.stringify({ organization, layer, line, type }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set line");
|
console.error("Failed to set line");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ export const updatePoint = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/updatePoint`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/updatePoint`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, position, uuid }),
|
body: JSON.stringify({ organization, position, uuid }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to update point");
|
console.error("Failed to update point");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ export const createVersionApi = async (projectId: string, createdBy: string, hie
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to create Version History");
|
console.error("Failed to create Version History");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getVersionDataApi = async (projectId: string, versionId: string) =>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Version Data");
|
console.error("Failed to get Version Data");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getVersionHistoryApi = async (projectId: string, page?: number, lim
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Version History");
|
console.error("Failed to get Version History");
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ export const deleteZonesApi = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ userId, organization, zoneUuid }),
|
body: JSON.stringify({ userId, organization, zoneUuid }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete zone");
|
console.error("Failed to delete zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const getZonesApi = async (organization: string, projectId?: string, vers
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to get Zones");
|
console.error("Failed to get Zones");
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ export const setZonesApi = async (
|
|||||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Authorization: "Bearer <access_token>",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
token: localStorage.getItem("token") || "",
|
||||||
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ userId, organization, zoneData }),
|
body: JSON.stringify({ userId, organization, zoneData }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to set zone");
|
console.error("Failed to set zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const upsertProductOrEventApi = async (body: any) => {
|
|||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add product or event");
|
console.error("Failed to add product or event");
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ export const deleteEventDataApi = async (body: any) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete event data");
|
console.error("Failed to delete event data");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const deleteProductApi = async (body: any) => {
|
|||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete product data");
|
console.error("Failed to delete product data");
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ export const getProductApi = async (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch product data");
|
console.error("Failed to fetch product data");
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export const getAllProductsApi = async (projectId: string, versionId: string) =>
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to fetch all products data");
|
console.error("Failed to fetch all products data");
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ export const renameProductApi = async (body: {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to rename product");
|
console.error("Failed to rename product");
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
|||||||
export const adding3dWidgets = async (
|
export const adding3dWidgets = async (
|
||||||
zoneUuid: string,
|
zoneUuid: string,
|
||||||
organization: string,
|
organization: string,
|
||||||
widget: {}
|
widget: {},
|
||||||
|
projectId?: string,
|
||||||
|
versionId?: string
|
||||||
|
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget3d/save`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget3d/save`, {
|
||||||
@@ -14,9 +17,16 @@ export const adding3dWidgets = async (
|
|||||||
token: localStorage.getItem("token") || "",
|
token: localStorage.getItem("token") || "",
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, zoneUuid, widget }),
|
body: JSON.stringify({ organization, zoneUuid, widget, projectId, versionId }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add 3dwidget in the zone");
|
console.error("Failed to add 3dwidget in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||||
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
|
export const addingFloatingWidgets = async (zoneUuid: string,organization: string,widget: {},projectId?: string,versionId?: string) => {
|
||||||
|
|
||||||
export const addingFloatingWidgets = async (
|
|
||||||
zoneUuid: string,
|
|
||||||
organization: string,
|
|
||||||
widget: {},
|
|
||||||
projectId?: string
|
|
||||||
) => {
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${url_Backend_dwinzo}/api/V1/floatWidget/save`,
|
`${url_Backend_dwinzo}/api/V1/floatWidget/save`,
|
||||||
@@ -19,10 +11,16 @@ export const addingFloatingWidgets = async (
|
|||||||
token: localStorage.getItem("token") || "",
|
token: localStorage.getItem("token") || "",
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, zoneUuid, widget ,projectId}),
|
body: JSON.stringify({ organization, zoneUuid, widget, projectId, versionId }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add Floatingwidget in the zone");
|
console.error("Failed to add Floatingwidget in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ export const addingWidgets = async (
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, zoneUuid, widget, projectId, versionId }),
|
body: JSON.stringify({ organization, zoneUuid, widget, projectId, versionId }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to add widget in the zone");
|
console.error("Failed to add widget in the zone");
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ export const clearPanel = async (
|
|||||||
body: JSON.stringify({ organization, zoneUuid, panelName }),
|
body: JSON.stringify({ organization, zoneUuid, panelName }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to clearPanel in the zone");
|
console.error("Failed to clearPanel in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ export const delete3dWidgetApi = async (
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete floating widget in the zone");
|
console.error("Failed to delete floating widget in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ export const deleteFloatingWidgetApi = async (
|
|||||||
body: JSON.stringify({ organization, floatWidgetID }),
|
body: JSON.stringify({ organization, floatWidgetID }),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete floating widget in the zone");
|
console.error("Failed to delete floating widget in the zone");
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ export const deletePanelApi = async (
|
|||||||
body: JSON.stringify({ organization, zoneUuid, panelName }),
|
body: JSON.stringify({ organization, zoneUuid, panelName }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete widget in the zone");
|
console.error("Failed to delete widget in the zone");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ export const deleteTemplateApi = async (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete template ");
|
console.error("Failed to delete template ");
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ export const deleteWidgetApi = async (
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ organization, widgetID, zoneUuid }),
|
body: JSON.stringify({ organization, widgetID, zoneUuid }),
|
||||||
});
|
});
|
||||||
|
const newAccessToken = response.headers.get("x-access-token");
|
||||||
|
if (newAccessToken) {
|
||||||
|
//console.log("New token received:", newAccessToken);
|
||||||
|
localStorage.setItem("token", newAccessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to delete widget in the zone");
|
console.error("Failed to delete widget in the zone");
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user