Implement API enhancements for token management and new endpoints
- Added token management for various API calls in the factoryBuilder and visualization services. - Updated deleteLayerApi, deleteLineApi, deletePointApi, getLinesApi, setLineApi, updatePointApi, and version control APIs to handle new access tokens from response headers. - Introduced new API endpoints for 3D widget and floating widget data retrieval. - Enhanced error handling and logging for API responses. - Created new sessionValidity and input retrieval components for better session management and data handling.
This commit is contained in:
@@ -52,7 +52,7 @@ const ProjectSocketRes = ({
|
||||
};
|
||||
|
||||
const handleDuplicate = async (data: any) => {
|
||||
console.log("Project duplicate response:", data);
|
||||
// console.log("Project duplicate response:", data);
|
||||
if (data?.message === "Project Duplicated successfully") {
|
||||
if (setWorkspaceProjects) {
|
||||
const allProjects = await getAllProjects(userId, organization);
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import { zoneCameraUpdate } from "../../../../services/visulization/zone/zoneCameraUpdation";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getUserData } from "../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../modules/builder/version/versionContext";
|
||||
|
||||
const ZoneProperties: React.FC = () => {
|
||||
const { Edit, setEdit } = useEditPosition();
|
||||
@@ -20,6 +21,8 @@ const ZoneProperties: React.FC = () => {
|
||||
const { zones, setZones } = useZones();
|
||||
const { projectId } = useParams();
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
useEffect(() => {
|
||||
setZonePosition(selectedZone.zoneViewPortPosition);
|
||||
@@ -35,7 +38,7 @@ const ZoneProperties: React.FC = () => {
|
||||
viewPortCenter: zoneTarget,
|
||||
};
|
||||
|
||||
let response = await zoneCameraUpdate(zonesdata, organization, projectId);
|
||||
let response = await zoneCameraUpdate(zonesdata, organization, projectId, selectedVersion?.versionId || "");
|
||||
// console.log('response: ', response);
|
||||
if (response.message === "zone updated") {
|
||||
setEdit(false);
|
||||
@@ -57,7 +60,7 @@ const ZoneProperties: React.FC = () => {
|
||||
zoneName: newName,
|
||||
};
|
||||
// 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") {
|
||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||
setZones((prevZones: any[]) =>
|
||||
|
||||
@@ -30,9 +30,9 @@ const VersionHistory = () => {
|
||||
|
||||
getVersionDataApi(projectId, version.versionId).then((verdionData) => {
|
||||
setSelectedVersion(version);
|
||||
console.log(verdionData);
|
||||
// console.log(verdionData);
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
// console.log(err);
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -43,11 +44,11 @@ const BarChartInput = (props: Props) => {
|
||||
setDropDownData(response.data);
|
||||
setLoading(false);
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
echo.log("Failed to fetch zone data");
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
fetchZoneData();
|
||||
@@ -56,33 +57,15 @@ const BarChartInput = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setWidgetName(response.widgetName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fetchSavedInputes();
|
||||
}, [selectedChartId]);
|
||||
|
||||
@@ -118,47 +101,16 @@ const BarChartInput = (props: Props) => {
|
||||
// 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;
|
||||
}else{
|
||||
|
||||
} else {
|
||||
|
||||
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 (
|
||||
@@ -190,7 +142,7 @@ const BarChartInput = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
|
||||
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -27,7 +29,8 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams()
|
||||
|
||||
const isSelected = () => { };
|
||||
@@ -38,15 +41,15 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||
setLoading(true);
|
||||
if (response.status === 200) {
|
||||
// console.log("dropdown data:", response.data);
|
||||
//
|
||||
setDropDownData(response.data);
|
||||
setLoading(false);
|
||||
} else {
|
||||
// console.log("Unexpected response:", response);
|
||||
//
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Failed to fetch zone data");
|
||||
console.error("There was an error!", error);
|
||||
|
||||
}
|
||||
};
|
||||
fetchZoneData();
|
||||
@@ -55,30 +58,15 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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);
|
||||
let response = await getFloatingWidgetInput(selectedChartId.id, organization,projectId,selectedVersion?.versionId||"")
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
||||
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") {
|
||||
return true;
|
||||
} else {
|
||||
console.log("Unexpected response:", response);
|
||||
|
||||
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 (
|
||||
@@ -156,7 +118,7 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||
newSelections[inputKey] = selectedData;
|
||||
}
|
||||
// setMeasurements(newSelections); // Update Zustand store
|
||||
// console.log(newSelections);
|
||||
//
|
||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||
setSelections(newSelections);
|
||||
}
|
||||
@@ -173,7 +135,7 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
console.log("name change requested", name);
|
||||
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -28,6 +30,8 @@ const FlotingWidgetInput = (props: Props) => {
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
const { projectId } = useParams()
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchZoneData = async () => {
|
||||
@@ -35,16 +39,16 @@ const FlotingWidgetInput = (props: Props) => {
|
||||
setLoading(true);
|
||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||
if (response.status === 200) {
|
||||
// console.log("dropdown data:", response.data);
|
||||
//
|
||||
setDropDownData(response.data);
|
||||
setLoading(false);
|
||||
} else {
|
||||
// console.log("Unexpected response:", response);
|
||||
//
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Failed to fetch zone data");
|
||||
|
||||
console.error("There was an error!", error);
|
||||
|
||||
}
|
||||
};
|
||||
fetchZoneData();
|
||||
@@ -53,30 +57,14 @@ const FlotingWidgetInput = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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);
|
||||
let response = await getFloatingWidgetInput(selectedChartId.id, organization, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
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") {
|
||||
return true;
|
||||
} else {
|
||||
// console.log("Unexpected response:", response);
|
||||
//
|
||||
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 (
|
||||
@@ -154,7 +116,7 @@ const FlotingWidgetInput = (props: Props) => {
|
||||
newSelections[inputKey] = selectedData;
|
||||
}
|
||||
// setMeasurements(newSelections); // Update Zustand store
|
||||
// console.log(newSelections);
|
||||
//
|
||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||
setSelections(newSelections);
|
||||
}
|
||||
@@ -171,7 +133,7 @@ const FlotingWidgetInput = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
console.log("name change requested", name);
|
||||
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -128,6 +128,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -159,11 +160,11 @@ const LineGrapInput = (props: Props) => {
|
||||
setDropDownData(response.data);
|
||||
setLoading(false);
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Failed to fetch zone data");
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
fetchZoneData();
|
||||
@@ -172,30 +173,14 @@ const LineGrapInput = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setWidgetName(response.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,7 +209,7 @@ const LineGrapInput = (props: Props) => {
|
||||
duration: inputDuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// const adding3dWidget = {
|
||||
// organization: organization,
|
||||
// widget: newWidget,
|
||||
@@ -235,45 +220,15 @@ const LineGrapInput = (props: Props) => {
|
||||
// visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget);
|
||||
// }
|
||||
let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || "");
|
||||
|
||||
|
||||
if (response.message === "Widget updated successfully") {
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
||||
|
||||
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 (
|
||||
@@ -305,7 +260,7 @@ const LineGrapInput = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
|
||||
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -56,30 +57,14 @@ const PieChartInput = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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");
|
||||
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setWidgetName(response.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -129,37 +114,7 @@ const PieChartInput = (props: Props) => {
|
||||
|
||||
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 (
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -56,30 +57,14 @@ const Progress1Input = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setWidgetName(response.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -127,37 +112,7 @@ const Progress1Input = (props: Props) => {
|
||||
|
||||
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 (
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSocketStore } from "../../../../../store/builder/store";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingWidgets } from "../../../../../services/visulization/zone/addWidgets";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -56,30 +57,14 @@ const Progress2Input = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(selectedChartId.id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setWidgetName(response.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -129,37 +114,7 @@ const Progress2Input = (props: Props) => {
|
||||
|
||||
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 (
|
||||
|
||||
@@ -10,6 +10,8 @@ import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { addingFloatingWidgets } from "../../../../../services/visulization/zone/addFloatingWidgets";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useVersionContext } from "../../../../../modules/builder/version/versionContext";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
|
||||
type Props = {};
|
||||
|
||||
@@ -28,6 +30,8 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
const { projectId } = useParams();
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchZoneData = async () => {
|
||||
@@ -35,15 +39,15 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
setLoading(true);
|
||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||
if (response.status === 200) {
|
||||
// console.log("dropdown data:", response.data);
|
||||
//
|
||||
setDropDownData(response.data);
|
||||
setLoading(false);
|
||||
} else {
|
||||
// console.log("Unexpected response:", response);
|
||||
//
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Failed to fetch zone data");
|
||||
console.error("There was an error!", error);
|
||||
|
||||
}
|
||||
};
|
||||
fetchZoneData();
|
||||
@@ -52,29 +56,14 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
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);
|
||||
let response = await getFloatingWidgetInput(selectedChartId.id, organization,projectId,selectedVersion?.versionId||"")
|
||||
|
||||
if (response) {
|
||||
setSelections(response.Data.Datastructure.measurements);
|
||||
setDuration(response.Data.Datastructure.duration);
|
||||
setWidgetName(response.Data.header);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -102,36 +91,16 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
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") {
|
||||
return true;
|
||||
} else {
|
||||
// console.log("Unexpected response:", response);
|
||||
//
|
||||
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 (
|
||||
@@ -146,7 +115,7 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
newSelections[inputKey] = selectedData;
|
||||
}
|
||||
// setMeasurements(newSelections); // Update Zustand store
|
||||
// console.log(newSelections);
|
||||
//
|
||||
if (await sendInputes(newSelections, duration, widgetName)) {
|
||||
setSelections(newSelections);
|
||||
}
|
||||
@@ -163,7 +132,7 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
// console.log("name change requested", name);
|
||||
//
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||
import axios from "axios";
|
||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
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 = {};
|
||||
|
||||
@@ -24,6 +28,9 @@ const Widget2InputCard3D = (props: Props) => {
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams()
|
||||
|
||||
useEffect(() => {
|
||||
const fetchZoneData = async () => {
|
||||
@@ -48,21 +55,14 @@ const Widget2InputCard3D = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
||||
);
|
||||
if (response.status === 200) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
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);
|
||||
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setWidgetName(response.data.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,6 +81,17 @@ const Widget2InputCard3D = (props: Props) => {
|
||||
inputDuration: 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 {
|
||||
const response = await axios.post(
|
||||
`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) {
|
||||
return true;
|
||||
} else {
|
||||
console.log("Unexpected response:", response);
|
||||
// console.log("Unexpected response:", response);
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -139,7 +150,7 @@ const Widget2InputCard3D = (props: Props) => {
|
||||
};
|
||||
|
||||
const handleNameChange = async (name: any) => {
|
||||
console.log("name change requested", name);
|
||||
// console.log("name change requested", name);
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||
import axios from "axios";
|
||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
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 { selectedChartId } = useWidgetStore();
|
||||
@@ -22,6 +26,9 @@ const Widget3InputCard3D = () => {
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams()
|
||||
|
||||
useEffect(() => {
|
||||
const fetchZoneData = async () => {
|
||||
@@ -46,21 +53,14 @@ const Widget3InputCard3D = () => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
||||
);
|
||||
if (response.status === 200) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
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);
|
||||
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setWidgetName(response.data.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,6 +78,19 @@ const Widget3InputCard3D = () => {
|
||||
inputDuration: 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 {
|
||||
const response = await axios.post(
|
||||
`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) => {
|
||||
console.log("name change requested", name);
|
||||
// console.log("name change requested", name);
|
||||
|
||||
if (await sendInputes(selections, duration, name)) {
|
||||
setWidgetName(name);
|
||||
|
||||
@@ -8,6 +8,10 @@ import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||
import axios from "axios";
|
||||
import RenameInput from "../../../../ui/inputs/RenameInput";
|
||||
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 = {};
|
||||
|
||||
@@ -24,6 +28,9 @@ const Widget4InputCard3D = (props: Props) => {
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
const { userName, userId, organization, email } = getUserData();
|
||||
const [isLoading, setLoading] = useState<boolean>(true);
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams()
|
||||
|
||||
useEffect(() => {
|
||||
const fetchZoneData = async () => {
|
||||
@@ -48,21 +55,14 @@ const Widget4InputCard3D = (props: Props) => {
|
||||
useEffect(() => {
|
||||
const fetchSavedInputes = async () => {
|
||||
if (selectedChartId.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/widget3D/${selectedChartId.id}/${organization}`
|
||||
);
|
||||
if (response.status === 200) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
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);
|
||||
let response = await get3dWidgetInput(selectedChartId.id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setSelections(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setWidgetName(response.data.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,6 +81,17 @@ const Widget4InputCard3D = (props: Props) => {
|
||||
inputDuration: 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 {
|
||||
const response = await axios.post(
|
||||
`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 { getUserData } from "../../../functions/getUserData";
|
||||
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
||||
import { useVersionContext } from "../../../modules/builder/version/versionContext";
|
||||
|
||||
interface Asset {
|
||||
id: string;
|
||||
@@ -52,6 +53,8 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||
const { assetStore } = useSceneContext();
|
||||
const { setName } = assetStore();
|
||||
const { organization } = getUserData();
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
useEffect(() => {
|
||||
useSelectedZoneStore.getState().setSelectedZone({
|
||||
@@ -81,7 +84,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||
|
||||
setSubModule("zoneProperties");
|
||||
|
||||
let response = await getZoneData(id, organization, projectId);
|
||||
let response = await getZoneData(id, organization, projectId, selectedVersion?.versionId || "");
|
||||
setSelectedZone({
|
||||
zoneName: response?.zoneName,
|
||||
activeSides: response?.activeSides ?? [],
|
||||
@@ -117,7 +120,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||
zoneUuid: selectedZone.zoneUuid,
|
||||
zoneName: newName,
|
||||
};
|
||||
const response = await zoneCameraUpdate(zonesdata, organization, projectId);
|
||||
const response = await zoneCameraUpdate(zonesdata, organization, projectId, selectedVersion?.versionId || "");
|
||||
if (response.message === "zone updated") {
|
||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||
setZones((prevZones: any[]) =>
|
||||
|
||||
@@ -14,7 +14,7 @@ import EditWidgetOption from "../../components/ui/menu/EditWidgetOption";
|
||||
import { useEditWidgetOptionsStore, useRightClickSelected, useRightSelected, } from "../../store/visualization/useZone3DWidgetStore";
|
||||
import OuterClick from "../../utils/outerClick";
|
||||
import { useWidgetStore } from "../../store/useWidgetStore";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { getUserData } from "../../functions/getUserData";
|
||||
import { useVersionContext } from "../builder/version/versionContext";
|
||||
|
||||
@@ -63,6 +63,7 @@ const RealTimeVisulization: React.FC = () => {
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
|
||||
OuterClick({
|
||||
contextClassName: [
|
||||
@@ -81,6 +82,12 @@ const RealTimeVisulization: React.FC = () => {
|
||||
useEffect(() => {
|
||||
if (!projectId || !selectedVersion) return;
|
||||
getZone2dData(organization, projectId, selectedVersion?.versionId || '').then((response) => {
|
||||
if (!response) return;
|
||||
// if (response.status === 401) {
|
||||
// console.log("force logout");
|
||||
// navigate("/");
|
||||
// return;
|
||||
// }
|
||||
if (!Array.isArray(response)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
interface ChartComponentProps {
|
||||
id: string;
|
||||
@@ -181,30 +182,14 @@ const BarGraphComponent = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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) {
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setmeasurements(response.Datastructure.measurements);
|
||||
setDuration(response.Datastructure.duration);
|
||||
setName(response.widgetName);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useParams } from "react-router-dom";
|
||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
interface ChartComponentProps {
|
||||
id: string;
|
||||
@@ -164,30 +165,14 @@ const DoughnutGraphComponent = ({
|
||||
const fetchSavedInputes = async () => {
|
||||
|
||||
if (id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setmeasurements(response.Datastructure.measurements)
|
||||
setDuration(response.Datastructure.duration)
|
||||
setName(response.widgetName)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useParams } from "react-router-dom";
|
||||
import { useSelectedZoneStore } from "../../../../../store/visualization/useZoneStore";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
interface ChartComponentProps {
|
||||
id: string;
|
||||
@@ -181,29 +182,12 @@ const LineGraphComponent = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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) {
|
||||
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
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 { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
interface ChartComponentProps {
|
||||
id: string;
|
||||
@@ -181,30 +182,13 @@ const PieChartComponent = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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) {
|
||||
|
||||
}
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
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 { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
interface ChartComponentProps {
|
||||
id: string;
|
||||
@@ -181,30 +182,13 @@ const PolarAreaGraphComponent = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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) {
|
||||
|
||||
}
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
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 { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
const ProgressCard1 = ({ id, title }: { id: string; title: string }) => {
|
||||
const {
|
||||
@@ -61,31 +62,13 @@ const ProgressCard1 = ({ id, title }: { id: string; title: string }) => {
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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") || "",
|
||||
},
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setmeasurements(response.Datastructure.measurements)
|
||||
setDuration(response.Datastructure.duration)
|
||||
setName(response.widgetName)
|
||||
}
|
||||
);
|
||||
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");
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useSelectedZoneStore } from "../../../../../store/visualization/useZone
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
import { getWidgetInputData } from "../../../../../services/visulization/zone/getWidgetInputData";
|
||||
|
||||
const ProgressCard2 = ({ id, title }: { id: string; title: string }) => {
|
||||
const {
|
||||
@@ -65,30 +66,12 @@ const ProgressCard2 = ({ id, title }: { id: string; title: string }) => {
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
try {
|
||||
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");
|
||||
|
||||
let response = await getWidgetInputData(id, selectedZone.zoneUuid, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
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 { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
const activeZoneWidgets = zoneWidgetData[selectedZone.zoneUuid] || [];
|
||||
const { projectId } = useParams();
|
||||
const { userId, organization, email } = getUserData();
|
||||
@@ -107,13 +106,16 @@ export default function Dropped3dWidgets() {
|
||||
const hasEntered = { current: false };
|
||||
|
||||
const handleDragEnter = (event: DragEvent) => {
|
||||
console.log("dragEnter");
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if (hasEntered.current || !widgetSelect.startsWith("ui")) return;
|
||||
console.log('hasEntered.current : ', hasEntered.current );
|
||||
hasEntered.current = true;
|
||||
|
||||
const group1 = scene.getObjectByName("itemsGroup");
|
||||
console.log('group1: ', group1);
|
||||
if (!group1) return;
|
||||
|
||||
const rect = canvasElement.getBoundingClientRect();
|
||||
@@ -137,6 +139,7 @@ export default function Dropped3dWidgets() {
|
||||
intersect.object.type !== "GridHelper"
|
||||
);
|
||||
|
||||
console.log('intersects: ', intersects);
|
||||
if (intersects.length > 0) {
|
||||
const { x, y, z } = intersects[0].point;
|
||||
const newWidget: WidgetData = {
|
||||
|
||||
@@ -17,6 +17,7 @@ import io from "socket.io-client";
|
||||
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||
|
||||
// Register ChartJS components
|
||||
ChartJS.register(
|
||||
@@ -170,20 +171,27 @@ const ProductionCapacity: React.FC<ProductionCapacityProps> = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
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");
|
||||
let response = await get3dWidgetInput(id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setmeasurements(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setName(response.data.widgetName);
|
||||
}
|
||||
// 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 { WavyIcon } from "../../../../../components/icons/3dChartIcons";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||
|
||||
// Register Chart.js components
|
||||
ChartJS.register(
|
||||
@@ -199,21 +200,28 @@ const ReturnOfInvestment: React.FC<ReturnOfInvestmentProps> = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
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);
|
||||
let response = await get3dWidgetInput(id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setmeasurements(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setName(response.data.widgetName);
|
||||
}
|
||||
// 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 useChartStore from "../../../../../store/visualization/useChartStore";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||
|
||||
// import image from "../../../../assets/image/temp/image.png";
|
||||
interface StateWorkingProps {
|
||||
@@ -77,21 +78,28 @@ const StateWorking: React.FC<StateWorkingProps> = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
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);
|
||||
let response = await get3dWidgetInput(id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setmeasurements(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setName(response.data.widgetName);
|
||||
}
|
||||
// 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 { ThroughputIcon } from "../../../../../components/icons/3dChartIcons";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { get3dWidgetInput } from "../../../../../services/visulization/zone/get3dWidgetInput";
|
||||
|
||||
// Register Chart.js components
|
||||
ChartJS.register(
|
||||
@@ -179,21 +180,28 @@ const Throughput: React.FC<ThroughputProps> = ({
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (id !== "") {
|
||||
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);
|
||||
let response = await get3dWidgetInput(id, organization)
|
||||
console.log('response: ', response);
|
||||
if (response) {
|
||||
setmeasurements(response.data.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setName(response.data.widgetName);
|
||||
}
|
||||
// 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 { projectId } = useParams();
|
||||
|
||||
|
||||
const [openKebabId, setOpenKebabId] = useState<string | null>(null);
|
||||
const updateObjectPosition = useDroppedObjectsStore(
|
||||
(state) => state.updateObjectPosition
|
||||
@@ -116,7 +117,7 @@ const DroppedObjects: React.FC = () => {
|
||||
|
||||
function handleDuplicate(zoneName: string, index: number) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -129,7 +130,7 @@ const DroppedObjects: React.FC = () => {
|
||||
organization,
|
||||
zoneUuid: zone.zoneUuid,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId,
|
||||
userId,
|
||||
projectId
|
||||
};
|
||||
|
||||
@@ -168,6 +169,7 @@ const DroppedObjects: React.FC = () => {
|
||||
setActiveEdges({ vertical, horizontal });
|
||||
|
||||
// Store the initial position strategy and active edges
|
||||
|
||||
setDraggingIndex({
|
||||
zone: zoneName,
|
||||
index,
|
||||
@@ -190,6 +192,8 @@ const DroppedObjects: React.FC = () => {
|
||||
offsetX = rect.width - relativeX - (obj.position.right as number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
setOffset([offsetY, offsetX]);
|
||||
|
||||
// Add native event listeners for smoother tracking
|
||||
@@ -254,11 +258,14 @@ const DroppedObjects: React.FC = () => {
|
||||
};
|
||||
|
||||
const handlePointerUpNative = async (e: PointerEvent) => {
|
||||
|
||||
// Clean up native event listeners
|
||||
element.removeEventListener("pointermove", handlePointerMoveNative);
|
||||
element.removeEventListener("pointerup", handlePointerUpNative);
|
||||
element.releasePointerCapture(e.pointerId);
|
||||
|
||||
|
||||
|
||||
if (!draggingIndex || !offset) return;
|
||||
|
||||
const rect = container.getBoundingClientRect();
|
||||
@@ -305,15 +312,18 @@ const DroppedObjects: React.FC = () => {
|
||||
{
|
||||
...zone.objects[draggingIndex.index],
|
||||
position: boundedPosition,
|
||||
}
|
||||
},
|
||||
projectId,
|
||||
selectedVersion?.versionId || ""
|
||||
);
|
||||
|
||||
|
||||
if (response.message === "Widget updated successfully") {
|
||||
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
||||
}
|
||||
} catch (error) {
|
||||
echo.error("Failed to add widget");
|
||||
console.log(error);
|
||||
|
||||
} finally {
|
||||
setDraggingIndex(null);
|
||||
setOffset(null);
|
||||
@@ -449,7 +459,7 @@ const DroppedObjects: React.FC = () => {
|
||||
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
||||
} catch (error) {
|
||||
echo.error("Failed to add widget");
|
||||
console.log(error);
|
||||
|
||||
} finally {
|
||||
// Clean up regardless of success or failure
|
||||
setDraggingIndex(null);
|
||||
|
||||
@@ -7,6 +7,8 @@ import io from "socket.io-client";
|
||||
import { usePlayButtonStore } from "../../../../../store/usePlayButtonStore";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
|
||||
const FleetEfficiencyComponent = ({ object }: any) => {
|
||||
const [progress, setProgress] = useState<any>(0);
|
||||
@@ -18,6 +20,8 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
||||
const { selectedChartId } = useWidgetStore();
|
||||
const { isPlaying } = usePlayButtonStore();
|
||||
const { projectId } = useParams()
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
|
||||
@@ -44,10 +48,10 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
||||
|
||||
socket.on("lastOutput", (response) => {
|
||||
const responseData = response.input1;
|
||||
// console.log(responseData);
|
||||
//
|
||||
|
||||
if (typeof responseData === "number") {
|
||||
// console.log("It's a number!");
|
||||
//
|
||||
setProgress(responseData);
|
||||
}
|
||||
});
|
||||
@@ -61,28 +65,11 @@ const FleetEfficiencyComponent = ({ object }: any) => {
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (object?.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`,
|
||||
{
|
||||
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.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);
|
||||
let response = await getFloatingWidgetInput(object?.id, organization,projectId,selectedVersion?.versionId||"")
|
||||
if (response) {
|
||||
setmeasurements(response.Data.Datastructure.measurements);
|
||||
setDuration(response.Data.Datastructure.duration);
|
||||
setName(response.Data.header);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Line } from "react-chartjs-2";
|
||||
|
||||
import useChartStore from "../../../../../store/visualization/useChartStore";
|
||||
import { useWidgetStore } from "../../../../../store/useWidgetStore";
|
||||
import axios from "axios";
|
||||
import io from "socket.io-client";
|
||||
import {
|
||||
CartIcon,
|
||||
DocumentIcon,
|
||||
GlobeIcon,
|
||||
WalletIcon,
|
||||
} from "../../../../../components/icons/3dChartIcons";
|
||||
import {CartIcon,DocumentIcon,GlobeIcon,WalletIcon,} from "../../../../../components/icons/3dChartIcons";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
|
||||
const TotalCardComponent = ({ object }: any) => {
|
||||
const [progress, setProgress] = useState<any>(0);
|
||||
@@ -22,6 +19,8 @@ const TotalCardComponent = ({ object }: any) => {
|
||||
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
||||
const { selectedChartId } = useWidgetStore();
|
||||
const { projectId } = useParams()
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
|
||||
@@ -60,25 +59,12 @@ const TotalCardComponent = ({ object }: any) => {
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (object?.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`, {
|
||||
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.Data.measurements);
|
||||
setDuration(response.data.Data.duration);
|
||||
setName(response.data.header);
|
||||
} else {
|
||||
echo.error("Failed to fetch saved inputs");
|
||||
}
|
||||
} catch (error) { }
|
||||
let response = await getFloatingWidgetInput(object?.id, organization,projectId,selectedVersion?.versionId||"")
|
||||
if (response) {
|
||||
setmeasurements(response.Data.Datastructure.measurements);
|
||||
setDuration(response.Data.Datastructure.duration);
|
||||
setName(response.Data.header);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import axios from "axios";
|
||||
import io from "socket.io-client";
|
||||
import { getUserData } from "../../../../../functions/getUserData";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getFloatingWidgetInput } from "../../../../../services/visulization/zone/getFloatingWidgetInput";
|
||||
import { useVersionContext } from "../../../../builder/version/versionContext";
|
||||
|
||||
const WarehouseThroughputComponent = ({ object }: any) => {
|
||||
const [measurements, setmeasurements] = useState<any>({});
|
||||
@@ -22,22 +24,12 @@ const WarehouseThroughputComponent = ({ object }: any) => {
|
||||
const { header, flotingDuration, flotingMeasurements } = useChartStore();
|
||||
const { selectedChartId } = useWidgetStore();
|
||||
const { projectId } = useParams()
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||
|
||||
const lineGraphData = {
|
||||
labels: [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec",
|
||||
labels: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",
|
||||
], // Months of the year
|
||||
datasets: [
|
||||
{
|
||||
@@ -159,29 +151,14 @@ const WarehouseThroughputComponent = ({ object }: any) => {
|
||||
|
||||
const fetchSavedInputes = async () => {
|
||||
if (object?.id !== "") {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`,
|
||||
{
|
||||
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.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);
|
||||
let response = await getFloatingWidgetInput(object?.id, organization, projectId, selectedVersion?.versionId || "")
|
||||
|
||||
if (response) {
|
||||
setmeasurements(response.Data.measurements);
|
||||
setDuration(response.Data.duration);
|
||||
setName(response?.header);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ const Project: React.FC = () => {
|
||||
</RenderOverlay>
|
||||
)}
|
||||
{(commentPositionState !== null || selectedComment !== null) && <ThreadChat />}
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ const UserAuth: React.FC = () => {
|
||||
const organization = email.split("@")[1].split(".")[0];
|
||||
try {
|
||||
const res = await signInApi(email, password, organization, fingerprint);
|
||||
// console.log('res: ', res);
|
||||
console.log('res: ', res);
|
||||
if (res.message.message === "login successfull") {
|
||||
setError("");
|
||||
setOrganization(organization);
|
||||
|
||||
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, }),
|
||||
});
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
}
|
||||
|
||||
@@ -21,6 +21,11 @@ export const deleteProject = async (
|
||||
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);
|
||||
if (!response.ok) {
|
||||
throw new 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);
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -19,14 +19,18 @@ export const duplicateProject = async (
|
||||
body: JSON.stringify({ projectUuid, thumbnail, projectName }),
|
||||
}
|
||||
);
|
||||
|
||||
console.log("response: ", response);
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
// console.log("response: ", response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log("result: ", result);
|
||||
// console.log("result: ", result);
|
||||
return result;
|
||||
} catch (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) {
|
||||
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) {
|
||||
throw new Error("Failed to fetch trash data");
|
||||
}
|
||||
|
||||
@@ -5,10 +5,17 @@ export const projectTutorial = async () => {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/tutorials`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"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);
|
||||
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new 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);
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to fetch");
|
||||
|
||||
@@ -18,6 +18,11 @@ export const createAisleApi = async (
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to add project");
|
||||
|
||||
@@ -12,6 +12,11 @@ export const deleteAisleApi = async (aisleUuid: string, projectId: string, versi
|
||||
},
|
||||
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) {
|
||||
throw new 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);
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -11,11 +11,19 @@ export const deleteFloorItem = async (
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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);
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -11,6 +11,11 @@ export const setAssetsApi = async (data: any) => {
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to set or update Floor Item");
|
||||
|
||||
@@ -11,11 +11,19 @@ export const deleteWallItem = async (
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Wall Items");
|
||||
|
||||
@@ -15,7 +15,10 @@ export const setWallItem = async (
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setWallItems`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new 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`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
organization,
|
||||
@@ -21,6 +24,11 @@ export const setCamera = async (
|
||||
rotation,
|
||||
}),
|
||||
});
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set Camera Position and Target");
|
||||
|
||||
@@ -7,10 +7,19 @@ export default async function getActiveUsersData(organization: string) {
|
||||
const response = await fetch(apiUrl, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"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) {
|
||||
throw new Error(`Error: ${response.status} - ${response.statusText}`);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,18 @@ export default async function fetchShareUsers(organization: string) {
|
||||
const response = await fetch(apiUrl, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"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) {
|
||||
throw new 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`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to set Camera Position and Target");
|
||||
|
||||
@@ -27,6 +27,12 @@ export const addCommentsApi = async (
|
||||
body: JSON.stringify({ projectId, comment, threadId, commentId }),
|
||||
}
|
||||
);
|
||||
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
console.log('response: ', response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
|
||||
@@ -18,6 +18,11 @@ export const createThreadApi = async (
|
||||
},
|
||||
body: JSON.stringify({ projectId, state, position, rotation, threadTitle }),
|
||||
});
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ export const deleteCommentApi = async (
|
||||
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) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,11 @@ export const deleteThreadApi = async (projectId: string, threadId: string) => {
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ export const editThreadTitleApi = async (
|
||||
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) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ export const getAllThreads = async (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) {
|
||||
throw new 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) {
|
||||
throw new 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);
|
||||
if (!response.ok) {
|
||||
throw new 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`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to delete point");
|
||||
|
||||
@@ -14,7 +14,12 @@ 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) {
|
||||
throw new Error("Failed to get Lines");
|
||||
}
|
||||
|
||||
@@ -10,11 +10,20 @@ export const setLine = async (
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to set line");
|
||||
}
|
||||
|
||||
@@ -9,11 +9,18 @@ export const updatePoint = async (
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/updatePoint`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new 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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to get Version History");
|
||||
|
||||
@@ -9,11 +9,18 @@ export const deleteZonesApi = async (
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to get Zones");
|
||||
|
||||
@@ -9,11 +9,18 @@ export const setZonesApi = async (
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to set zone");
|
||||
}
|
||||
|
||||
@@ -15,6 +15,11 @@ export const upsertProductOrEventApi = async (body: any) => {
|
||||
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) {
|
||||
throw new Error("Failed to add product or event");
|
||||
|
||||
@@ -15,6 +15,13 @@ export const deleteEventDataApi = async (body: any) => {
|
||||
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) {
|
||||
throw new Error("Failed to delete event data");
|
||||
|
||||
@@ -15,6 +15,11 @@ export const deleteProductApi = async (body: any) => {
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to fetch all products data");
|
||||
|
||||
@@ -17,6 +17,11 @@ export const renameProductApi = async (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) {
|
||||
throw new 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 (
|
||||
zoneUuid: string,
|
||||
organization: string,
|
||||
widget: {}
|
||||
widget: {},
|
||||
projectId?: string,
|
||||
versionId?: string
|
||||
|
||||
) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget3d/save`, {
|
||||
@@ -14,9 +17,16 @@ export const adding3dWidgets = async (
|
||||
token: localStorage.getItem("token") || "",
|
||||
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) {
|
||||
throw new 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://192.168.0.102:5000`;
|
||||
|
||||
export const addingFloatingWidgets = async (
|
||||
zoneUuid: string,
|
||||
organization: string,
|
||||
widget: {},
|
||||
projectId?: string
|
||||
) => {
|
||||
|
||||
export const addingFloatingWidgets = async (zoneUuid: string,organization: string,widget: {},projectId?: string,versionId?: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/V1/floatWidget/save`,
|
||||
@@ -19,10 +11,16 @@ export const addingFloatingWidgets = async (
|
||||
token: localStorage.getItem("token") || "",
|
||||
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) {
|
||||
throw new Error("Failed to add Floatingwidget in the zone");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ export const addingWidgets = async (
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to add widget in the zone");
|
||||
|
||||
@@ -17,6 +17,13 @@ export const clearPanel = async (
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to delete floating widget in the zone");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ export const deleteFloatingWidgetApi = async (
|
||||
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) {
|
||||
throw new Error("Failed to delete floating widget in the zone");
|
||||
|
||||
@@ -18,6 +18,13 @@ export const deletePanelApi = async (
|
||||
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) {
|
||||
throw new 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) {
|
||||
throw new Error("Failed to delete template ");
|
||||
|
||||
@@ -17,6 +17,12 @@ export const deleteWidgetApi = async (
|
||||
},
|
||||
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) {
|
||||
throw new Error("Failed to delete widget in the zone");
|
||||
|
||||
@@ -16,6 +16,11 @@ export const duplicateWidgetApi = async (
|
||||
},
|
||||
body: JSON.stringify({ organization, zoneUuid, widget }),
|
||||
});
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to duplicate widget in the zone");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { projectTutorial } from "../../dashboard/projectTutorial";
|
||||
|
||||
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 get3dWidgetZoneData = async (
|
||||
zoneUuid?: string,
|
||||
organization?: string,
|
||||
@@ -21,6 +19,13 @@ export const get3dWidgetZoneData = async (
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch Zone3dWidgetData");
|
||||
}
|
||||
|
||||
34
app/src/services/visulization/zone/get3dWidgetInput.ts
Normal file
34
app/src/services/visulization/zone/get3dWidgetInput.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
|
||||
|
||||
export const get3dWidgetInput = async (chartId: string, organization: string, projectId?: string, versionId?: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v2/widget3D/${chartId}/${organization}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
"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) {
|
||||
throw new Error("Failed to fetch zoneDatas");
|
||||
}
|
||||
const result = await response.json();
|
||||
console.log('result: ', result);
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
echo.error("Failed to fetch 2d widget data");
|
||||
console.log(error.message);
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user