Merge remote-tracking branch 'origin/main-dev' into dev-collaboration

This commit is contained in:
2025-06-25 09:36:22 +05:30
117 changed files with 1067 additions and 868 deletions

View File

@@ -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);

View File

@@ -5,16 +5,25 @@ import FileMenu from "../../ui/FileMenu";
import { useToggleStore } from "../../../store/useUIToggleStore";
import useModuleStore from "../../../store/useModuleStore";
import { useNavigate } from "react-router-dom";
import useRestStates from "../../../hooks/useResetStates";
const Header: React.FC = () => {
const { toggleUILeft, toggleUIRight, setToggleUI } = useToggleStore();
const { activeModule } = useModuleStore();
const navigate = useNavigate();
const { resetStates } = useRestStates();
return (
<div className="header-container">
<div className="header-content">
<button className="logo-container" onClick={() => navigate("/Dashboard")} title="Back to Dashboard">
<button
className="logo-container"
onClick={() => {
resetStates();
navigate("/Dashboard")
}}
title="Back to Dashboard"
>
<LogoIcon />
</button>
<div className="header-title">

View File

@@ -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[]) =>

View File

@@ -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);
})
};

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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`,

View File

@@ -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[]) =>