diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx index e100b08..d8cb41e 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx @@ -118,7 +118,7 @@ const BarChartInput = (props: Props) => { // visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget); // } - let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget,projectId); + let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget,projectId, selectedVersion?.versionId || ""); if(response.message==="Widget updated successfully"){ diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/LineGrapInput.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/LineGrapInput.tsx index 324d76a..83cfb75 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/LineGrapInput.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/LineGrapInput.tsx @@ -234,7 +234,7 @@ const LineGrapInput = (props: Props) => { // if (visualizationSocket) { // visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget); // } - let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId); + let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || ""); if (response.message === "Widget updated successfully") { diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/PieChartInput.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/PieChartInput.tsx index 894be7f..701be3a 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/PieChartInput.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/PieChartInput.tsx @@ -119,7 +119,7 @@ const PieChartInput = (props: Props) => { // visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget); // } - let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId); + let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || ""); if (response.message === "Widget updated successfully") { diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress1Input.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress1Input.tsx index 90c138b..b2103b5 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress1Input.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress1Input.tsx @@ -117,7 +117,7 @@ const Progress1Input = (props: Props) => { // if (visualizationSocket) { // visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget); // } - let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId); + let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || ""); if (response.message === "Widget updated successfully") { diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress2Input.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress2Input.tsx index 4c4caa5..3382ebe 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress2Input.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/Progress2Input.tsx @@ -43,11 +43,11 @@ const Progress2Input = (props: Props) => { setDropDownData(response.data); setLoading(false); } else { - + } } catch (error) { echo.error("Failed to fetch zone data"); - + } }; fetchZoneData(); @@ -69,16 +69,16 @@ const Progress2Input = (props: Props) => { } ); 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"); - + } } }; @@ -108,7 +108,7 @@ const Progress2Input = (props: Props) => { duration: inputDuration, } } - + // const adding3dWidget = { // organization: organization, // widget: newWidget, @@ -119,14 +119,14 @@ const Progress2Input = (props: Props) => { // visualizationSocket.emit("v1:viz-3D-widget:add", adding3dWidget); // } - let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget,projectId); - - if(response.message==="Widget updated successfully"){ + let response = await addingWidgets(selectedZone.zoneUuid, organization, newWidget, projectId, selectedVersion?.versionId || ""); + + if (response.message === "Widget updated successfully") { return true; - }else{ + } else { + - return false; } // try { diff --git a/app/src/services/visulization/zone/addWidgets.ts b/app/src/services/visulization/zone/addWidgets.ts index affccbd..f325311 100644 --- a/app/src/services/visulization/zone/addWidgets.ts +++ b/app/src/services/visulization/zone/addWidgets.ts @@ -4,7 +4,8 @@ export const addingWidgets = async ( zoneUuid: string, organization: string, widget: {}, - projectId?: string + projectId?: string, + versionId?: string ) => { try { @@ -16,7 +17,7 @@ export const addingWidgets = 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 }), }); if (!response.ok) {