From 9b15648fb5bf20187742db74977ebed127ff5681 Mon Sep 17 00:00:00 2001 From: gabriel Date: Thu, 10 Apr 2025 10:17:54 +0530 Subject: [PATCH 1/4] data not connected border --- .../zoneData/addFloatingWidgets.ts | 2 +- app/src/styles/pages/realTimeViz.scss | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/services/realTimeVisulization/zoneData/addFloatingWidgets.ts b/app/src/services/realTimeVisulization/zoneData/addFloatingWidgets.ts index 9b03dbe..beaa1b3 100644 --- a/app/src/services/realTimeVisulization/zoneData/addFloatingWidgets.ts +++ b/app/src/services/realTimeVisulization/zoneData/addFloatingWidgets.ts @@ -8,7 +8,7 @@ export const addingFloatingWidgets = async ( ) => { - + try { const response = await fetch( `${url_Backend_dwinzo}/api/v2/floatwidget/save`, diff --git a/app/src/styles/pages/realTimeViz.scss b/app/src/styles/pages/realTimeViz.scss index 6909081..c9ea2d4 100644 --- a/app/src/styles/pages/realTimeViz.scss +++ b/app/src/styles/pages/realTimeViz.scss @@ -173,9 +173,11 @@ overflow: auto; z-index: $z-index-tools; overflow: auto; + &::-webkit-scrollbar { display: none; } + .panel-content { position: relative; height: 100%; @@ -265,9 +267,6 @@ } } - .chart-container.notLinked { - border-color: red; - } .close-btn { position: absolute; @@ -718,6 +717,13 @@ z-index: 2 !important; } +.chart-container.notLinked { + + outline: 1px solid red; + + +} + .connectionSuccess { outline-color: #43C06D; } @@ -739,7 +745,8 @@ border-radius: 6px; overflow: hidden; -min-width: 150px; + min-width: 150px; + .option { padding: 8px 10px; color: var(--text-color); -- 2.49.1 From 1cf7703f07075d33a71f742ec90f450d38093e95 Mon Sep 17 00:00:00 2001 From: gabriel Date: Thu, 10 Apr 2025 17:41:25 +0530 Subject: [PATCH 2/4] fixed bug and added functionality to duplicate with iot data selection --- app/.env | 4 +- .../IotInputCards/BarChartInput.tsx | 9 +++ .../ui/componets/DraggableWidget.tsx | 65 ++++++++++++------- app/src/components/ui/componets/Panel.tsx | 18 +++-- 4 files changed, 61 insertions(+), 35 deletions(-) diff --git a/app/.env b/app/.env index c50d174..47176f6 100644 --- a/app/.env +++ b/app/.env @@ -2,10 +2,10 @@ PORT=8200 # Base URL for the server socket API, used for real-time communication (e.g., WebSockets). -REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000 +REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.111:8000 # Base URL for the server REST API, used for HTTP requests to the backend server. -REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000 +REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.111:5000 # Base URL for the server marketplace, used for market place model blob. REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx index e5debde..7d55396 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx @@ -61,11 +61,20 @@ const BarChartInput = (props: Props) => { }, [selectedChartId.id]); + useEffect(() => { + setMeasurements(selections); + updateDuration(duration); + updateName(widgetName); + console.log('Initial set state'); + }, []); + // Sync Zustand state when component mounts useEffect(() => { setMeasurements(selections); updateDuration(duration); updateName(widgetName); + console.log('change set state'); + }, [selections, duration, widgetName]); diff --git a/app/src/components/ui/componets/DraggableWidget.tsx b/app/src/components/ui/componets/DraggableWidget.tsx index fb20169..0ebc224 100644 --- a/app/src/components/ui/componets/DraggableWidget.tsx +++ b/app/src/components/ui/componets/DraggableWidget.tsx @@ -1,5 +1,6 @@ import { useWidgetStore } from "../../../store/useWidgetStore"; import ProgressCard from "../realTimeVis/charts/ProgressCard"; +import useChartStore from "../../../store/useChartStore"; import PieGraphComponent from "../realTimeVis/charts/PieGraphComponent"; import BarGraphComponent from "../realTimeVis/charts/BarGraphComponent"; import LineGraphComponent from "../realTimeVis/charts/LineGraphComponent"; @@ -80,6 +81,16 @@ export const DraggableWidget = ({ const [panelDimensions, setPanelDimensions] = useState<{ [side in Side]?: { width: number; height: number }; }>({}); + const { measurements, duration, name } = useChartStore(); + const { isPlaying } = usePlayButtonStore(); + + const [canvasDimensions, setCanvasDimensions] = useState({ + width: 0, + height: 0, + }); + useEffect(() => { + console.log("changes loggggg", measurements, duration, name); + }, [measurements, duration, name]) const handlePointerDown = () => { if (selectedChartId?.id !== widget.id) { setSelectedChartId(widget); @@ -94,6 +105,9 @@ export const DraggableWidget = ({ "floating", "sidebar-right-wrapper", "card", + "dropdown-menu", + "sidebar-right-content-container", + "dropdown-options" ], setMenuVisible: () => setSelectedChartId(null), }); @@ -137,40 +151,50 @@ export const DraggableWidget = ({ } }; + // Calculate panel size + const panelSize = Math.max( + Math.min(canvasDimensions.width * 0.25, canvasDimensions.height * 0.25), + 170 // Min 170px + ); + const getCurrentWidgetCount = (panel: Side) => selectedZone.widgets.filter((w) => w.panel === panel).length; - + // Calculate panel capacity + const calculatePanelCapacity = (panel: Side) => { - const CHART_WIDTH = 150; - const CHART_HEIGHT = 150; - const FALLBACK_HORIZONTAL_CAPACITY = 5; - const FALLBACK_VERTICAL_CAPACITY = 3; + const CHART_WIDTH = panelSize; + const CHART_HEIGHT = panelSize; const dimensions = panelDimensions[panel]; if (!dimensions) { - return panel === "top" || panel === "bottom" - ? FALLBACK_HORIZONTAL_CAPACITY - : FALLBACK_VERTICAL_CAPACITY; + return panel === "top" || panel === "bottom" ? 5 : 3; // Fallback capacities } return panel === "top" || panel === "bottom" - ? Math.floor(dimensions.width / CHART_WIDTH) - : Math.floor(dimensions.height / CHART_HEIGHT); + ? Math.max(1, Math.floor(dimensions.width / CHART_WIDTH)) + : Math.max(1, Math.floor(dimensions.height / CHART_HEIGHT)); }; const isPanelFull = (panel: Side) => { const currentWidgetCount = getCurrentWidgetCount(panel); const panelCapacity = calculatePanelCapacity(panel); - return currentWidgetCount >= panelCapacity; + + return currentWidgetCount > panelCapacity; }; const duplicateWidget = async () => { try { const email = localStorage.getItem("email") || ""; const organization = email?.split("@")[1]?.split(".")[0]; + console.log("widget data sent", widget); + const duplicatedWidget: Widget = { ...widget, + Data: { + duration: duration, + measurements: { ...measurements } + }, id: `${widget.id}-copy-${Date.now()}`, }; @@ -180,6 +204,8 @@ export const DraggableWidget = ({ widget: duplicatedWidget, }; if (visualizationSocket) { + console.log("duplecate widget", duplicateWidget); + visualizationSocket.emit("v2:viz-widget:add", duplicateWidget); } setSelectedZone((prevZone: any) => ({ @@ -252,12 +278,7 @@ export const DraggableWidget = ({ // useClickOutside(chartWidget, () => { // setSelectedChartId(null); // }); - const { isPlaying } = usePlayButtonStore(); - const [canvasDimensions, setCanvasDimensions] = useState({ - width: 0, - height: 0, - }); // Track canvas dimensions // Current: Two identical useEffect hooks for canvas dimensions @@ -295,9 +316,8 @@ export const DraggableWidget = ({
diff --git a/app/src/components/ui/componets/Panel.tsx b/app/src/components/ui/componets/Panel.tsx index 30136e5..4d64405 100644 --- a/app/src/components/ui/componets/Panel.tsx +++ b/app/src/components/ui/componets/Panel.tsx @@ -106,9 +106,8 @@ const Panel: React.FC = ({ case "bottom": return { minWidth: "170px", - width: `calc(100% - ${ - (leftActive ? panelSize : 0) + (rightActive ? panelSize : 0) - }px)`, + width: `calc(100% - ${(leftActive ? panelSize : 0) + (rightActive ? panelSize : 0) + }px)`, minHeight: "170px", height: `${panelSize}px`, left: leftActive ? `${panelSize}px` : "0", @@ -121,9 +120,8 @@ const Panel: React.FC = ({ minWidth: "170px", width: `${panelSize}px`, minHeight: "170px", - height: `calc(100% - ${ - (topActive ? panelSize : 0) + (bottomActive ? panelSize : 0) - }px)`, + height: `calc(100% - ${(topActive ? panelSize : 0) + (bottomActive ? panelSize : 0) + }px)`, top: topActive ? `${panelSize}px` : "0", bottom: bottomActive ? `${panelSize}px` : "0", [side]: "0", @@ -149,6 +147,7 @@ const Panel: React.FC = ({ const currentWidgetsCount = getCurrentWidgetCount(panel); const maxCapacity = calculatePanelCapacity(panel); + if (currentWidgetsCount < maxCapacity) { addWidgetToPanel(draggedAsset, panel); } @@ -282,9 +281,8 @@ const Panel: React.FC = ({
handleDrop(e, side)} onDragOver={(e) => e.preventDefault()} @@ -301,7 +299,7 @@ const Panel: React.FC = ({ style={{ pointerEvents: selectedZone.lockedPanels.includes(side) || - hiddenPanels[selectedZone.zoneId]?.includes(side) + hiddenPanels[selectedZone.zoneId]?.includes(side) ? "none" : "auto", opacity: selectedZone.lockedPanels.includes(side) ? "0.8" : "1", -- 2.49.1 From 8f5837ec9fd13eff105d87e207b46022b2c384bf Mon Sep 17 00:00:00 2001 From: gabriel Date: Fri, 11 Apr 2025 18:01:27 +0530 Subject: [PATCH 3/4] fixed floting and 3d widget buges --- app/.env | 4 ++-- .../3D-cards/cards/ProductionCapacity.tsx | 6 ++++-- .../3D-cards/cards/ReturnOfInvestment.tsx | 6 ++++-- .../layout/3D-cards/cards/StateWorking.tsx | 6 ++++-- .../layout/3D-cards/cards/Throughput.tsx | 6 ++++-- .../visualization/widgets/Widgets2D.tsx | 5 ++++- .../IotInputCards/BarChartInput.tsx | 9 --------- .../ui/componets/Dropped3dWidget.tsx | 19 +++++++++++++++++-- .../realTimeVis/charts/LineGraphComponent.tsx | 2 ++ .../floating/TotalCardComponent.tsx | 4 +++- app/src/store/useDroppedObjectsStore.ts | 11 ++++++++++- app/src/store/useWidgetStore.ts | 18 ++---------------- 12 files changed, 56 insertions(+), 40 deletions(-) diff --git a/app/.env b/app/.env index 47176f6..c50d174 100644 --- a/app/.env +++ b/app/.env @@ -2,10 +2,10 @@ PORT=8200 # Base URL for the server socket API, used for real-time communication (e.g., WebSockets). -REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.111:8000 +REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000 # Base URL for the server REST API, used for HTTP requests to the backend server. -REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.111:5000 +REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000 # Base URL for the server marketplace, used for market place model blob. REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 diff --git a/app/src/components/layout/3D-cards/cards/ProductionCapacity.tsx b/app/src/components/layout/3D-cards/cards/ProductionCapacity.tsx index a6343ed..b56350a 100644 --- a/app/src/components/layout/3D-cards/cards/ProductionCapacity.tsx +++ b/app/src/components/layout/3D-cards/cards/ProductionCapacity.tsx @@ -31,6 +31,7 @@ interface ProductionCapacityProps { type: string; position: [number, number, number]; rotation: [number, number, number]; + Data?: any, onContextMenu?: (event: React.MouseEvent) => void; // onPointerDown:any } @@ -38,6 +39,7 @@ interface ProductionCapacityProps { const ProductionCapacity: React.FC = ({ id, type, + Data, position, rotation, onContextMenu, @@ -48,8 +50,8 @@ const ProductionCapacity: React.FC = ({ duration: chartDuration, name: widgetName, } = useChartStore(); - const [measurements, setmeasurements] = useState({}); - const [duration, setDuration] = useState("1h"); + const [measurements, setmeasurements] = useState(Data?.measurements ? Data.measurements : {}); + const [duration, setDuration] = useState(Data?.duration ? Data.duration : "1h"); const [name, setName] = useState("Widget"); const [chartData, setChartData] = useState<{ labels: string[]; diff --git a/app/src/components/layout/3D-cards/cards/ReturnOfInvestment.tsx b/app/src/components/layout/3D-cards/cards/ReturnOfInvestment.tsx index 3d5d291..86734f7 100644 --- a/app/src/components/layout/3D-cards/cards/ReturnOfInvestment.tsx +++ b/app/src/components/layout/3D-cards/cards/ReturnOfInvestment.tsx @@ -44,11 +44,13 @@ interface ReturnOfInvestmentProps { type: string; position: [number, number, number]; rotation: [number, number, number]; + Data?: any; onContextMenu?: (event: React.MouseEvent) => void; } const ReturnOfInvestment: React.FC = ({ id, type, + Data, position, rotation, onContextMenu, @@ -59,8 +61,8 @@ const ReturnOfInvestment: React.FC = ({ duration: chartDuration, name: widgetName, } = useChartStore(); - const [measurements, setmeasurements] = useState({}); - const [duration, setDuration] = useState("1h"); + const [measurements, setmeasurements] = useState(Data?.measurements ? Data.measurements : {}); + const [duration, setDuration] = useState(Data?.duration ? Data.duration : "1h"); const [name, setName] = useState("Widget"); const [chartData, setChartData] = useState<{ labels: string[]; diff --git a/app/src/components/layout/3D-cards/cards/StateWorking.tsx b/app/src/components/layout/3D-cards/cards/StateWorking.tsx index 829d7bf..d6520ff 100644 --- a/app/src/components/layout/3D-cards/cards/StateWorking.tsx +++ b/app/src/components/layout/3D-cards/cards/StateWorking.tsx @@ -11,11 +11,13 @@ interface StateWorkingProps { type: string; position: [number, number, number]; rotation: [number, number, number]; + Data?:any; onContextMenu?: (event: React.MouseEvent) => void; } const StateWorking: React.FC = ({ id, type, + Data, position, rotation, onContextMenu, @@ -26,8 +28,8 @@ const StateWorking: React.FC = ({ duration: chartDuration, name: widgetName, } = useChartStore(); - const [measurements, setmeasurements] = useState({}); - const [duration, setDuration] = useState("1h"); + const [measurements, setmeasurements] = useState(Data?.measurements ? Data.measurements : {}); + const [duration, setDuration] = useState(Data?.duration ? Data.duration : "1h"); const [name, setName] = useState("Widget"); const [datas, setDatas] = useState({}); const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL; diff --git a/app/src/components/layout/3D-cards/cards/Throughput.tsx b/app/src/components/layout/3D-cards/cards/Throughput.tsx index a99d171..28437bf 100644 --- a/app/src/components/layout/3D-cards/cards/Throughput.tsx +++ b/app/src/components/layout/3D-cards/cards/Throughput.tsx @@ -46,12 +46,14 @@ interface ThroughputProps { type: string; position: [number, number, number]; rotation: [number, number, number]; + Data?:any; onContextMenu?: (event: React.MouseEvent) => void; } const Throughput: React.FC = ({ id, type, + Data, position, rotation, onContextMenu, @@ -62,8 +64,8 @@ const Throughput: React.FC = ({ duration: chartDuration, name: widgetName, } = useChartStore(); - const [measurements, setmeasurements] = useState({}); - const [duration, setDuration] = useState("1h"); + const [measurements, setmeasurements] = useState(Data?.measurements ? Data.measurements : {}); + const [duration, setDuration] = useState(Data?.duration ? Data.duration : "1h"); const [name, setName] = useState("Widget"); const [chartData, setChartData] = useState<{ labels: string[]; diff --git a/app/src/components/layout/sidebarLeft/visualization/widgets/Widgets2D.tsx b/app/src/components/layout/sidebarLeft/visualization/widgets/Widgets2D.tsx index c411ffd..9e6e65e 100644 --- a/app/src/components/layout/sidebarLeft/visualization/widgets/Widgets2D.tsx +++ b/app/src/components/layout/sidebarLeft/visualization/widgets/Widgets2D.tsx @@ -45,7 +45,10 @@ const ChartWidget: React.FC = ({ type, index, title }) => { ), title, panel: "top", - data: sampleData, + Data: { + measurements:{}, + duration:'1h' + }, }); }} onDragEnd={() => setDraggedAsset(null)} diff --git a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx index 7d55396..e5debde 100644 --- a/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx +++ b/app/src/components/layout/sidebarRight/visualization/IotInputCards/BarChartInput.tsx @@ -61,20 +61,11 @@ const BarChartInput = (props: Props) => { }, [selectedChartId.id]); - useEffect(() => { - setMeasurements(selections); - updateDuration(duration); - updateName(widgetName); - console.log('Initial set state'); - }, []); - // Sync Zustand state when component mounts useEffect(() => { setMeasurements(selections); updateDuration(duration); updateName(widgetName); - console.log('change set state'); - }, [selections, duration, widgetName]); diff --git a/app/src/components/ui/componets/Dropped3dWidget.tsx b/app/src/components/ui/componets/Dropped3dWidget.tsx index 5dbdb5b..bba3013 100644 --- a/app/src/components/ui/componets/Dropped3dWidget.tsx +++ b/app/src/components/ui/componets/Dropped3dWidget.tsx @@ -5,6 +5,7 @@ import { useSocketStore, useWidgetSubOption, } from "../../../store/store"; +import useChartStore from "../../../store/useChartStore"; import useModuleStore from "../../../store/useModuleStore"; import { ThreeState } from "../../../types/world/worldTypes"; import * as THREE from "three"; @@ -30,6 +31,7 @@ import { update3dWidget, update3dWidgetRotation, } from "../../../services/realTimeVisulization/zoneData/update3dWidget"; +import { useWidgetStore } from "../../../store/useWidgetStore"; type WidgetData = { id: string; type: string; @@ -57,6 +59,8 @@ export default function Dropped3dWidgets() { const planeIntersect = useRef(new THREE.Vector3()); const rotationStartRef = useRef<[number, number, number]>([0, 0, 0]); const mouseStartRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 }); + const { setSelectedChartId } = useWidgetStore(); + const { measurements, duration} = useChartStore(); const activeZoneWidgets = zoneWidgetData[selectedZone.zoneId] || []; useEffect(() => { @@ -240,8 +244,10 @@ export default function Dropped3dWidgets() { const widgetToDuplicate = activeZoneWidgets.find( (w: WidgetData) => w.id === rightClickSelected ); + console.log("3d widget to duplecate", widgetToDuplicate); + if (!widgetToDuplicate) return; - const newWidget: WidgetData = { + const newWidget: any = { id: generateUniqueId(), type: widgetToDuplicate.type, position: [ @@ -250,6 +256,10 @@ export default function Dropped3dWidgets() { widgetToDuplicate.position[2] + 0.5, ], rotation: widgetToDuplicate.rotation || [0, 0, 0], + Data:{ + measurements: measurements, + duration: duration + }, }; const adding3dWidget = { organization: organization, @@ -497,8 +507,9 @@ export default function Dropped3dWidgets() { return ( <> {activeZoneWidgets.map( - ({ id, type, position, rotation = [0, 0, 0] }: WidgetData) => { + ({ id, type, position, Data, rotation = [0, 0, 0] }: any) => { const handleRightClick = (event: React.MouseEvent, id: string) => { + setSelectedChartId({ id: id, type: type }) event.preventDefault(); const canvasElement = document.getElementById( "real-time-vis-canvas" @@ -522,6 +533,7 @@ export default function Dropped3dWidgets() { type={type} position={position} rotation={rotation} + Data={Data} onContextMenu={(e) => handleRightClick(e, id)} /> ); @@ -533,6 +545,7 @@ export default function Dropped3dWidgets() { type={type} position={position} rotation={rotation} + Data={Data} onContextMenu={(e) => handleRightClick(e, id)} /> ); @@ -544,6 +557,7 @@ export default function Dropped3dWidgets() { type={type} position={position} rotation={rotation} + Data={Data} onContextMenu={(e) => handleRightClick(e, id)} /> ); @@ -555,6 +569,7 @@ export default function Dropped3dWidgets() { type={type} position={position} rotation={rotation} + Data={Data} onContextMenu={(e) => handleRightClick(e, id)} /> ); diff --git a/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx b/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx index c7f7252..8d4d4e9 100644 --- a/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx +++ b/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx @@ -160,6 +160,8 @@ const LineGraphComponent = ({ try { const response = await axios.get(`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/WidgetData/${id}/${organization}`); if (response.status === 200) { + console.log('line chart res',response); + setmeasurements(response.data.Data.measurements) setDuration(response.data.Data.duration) setName(response.data.widgetName) diff --git a/app/src/components/ui/realTimeVis/floating/TotalCardComponent.tsx b/app/src/components/ui/realTimeVis/floating/TotalCardComponent.tsx index da03fce..56f70f4 100644 --- a/app/src/components/ui/realTimeVis/floating/TotalCardComponent.tsx +++ b/app/src/components/ui/realTimeVis/floating/TotalCardComponent.tsx @@ -12,7 +12,7 @@ const TotalCardComponent = ({ }: any) => { const [ progress, setProgress ] = useState(0) - const [measurements, setmeasurements] = useState({}); + const [measurements, setmeasurements] = useState(object?.Data?.measurements ? object.Data.measurements : {}); const [duration, setDuration] = useState("1h") const [name, setName] = useState(object.header ? object.header : '') const email = localStorage.getItem("email") || ""; @@ -61,6 +61,8 @@ const TotalCardComponent = ({ try { const response = await axios.get(`http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}/api/v2/A_floatWidget/${object?.id}/${organization}`); if (response.status === 200) { + console.log(response); + setmeasurements(response.data.Data.measurements) setDuration(response.data.Data.duration) setName(response.data.header) diff --git a/app/src/store/useDroppedObjectsStore.ts b/app/src/store/useDroppedObjectsStore.ts index 8f0067e..ca39d9f 100644 --- a/app/src/store/useDroppedObjectsStore.ts +++ b/app/src/store/useDroppedObjectsStore.ts @@ -1,6 +1,7 @@ import { create } from "zustand"; import { addingFloatingWidgets } from "../services/realTimeVisulization/zoneData/addFloatingWidgets"; import { useSocketStore } from "./store"; +import useChartStore from "./useChartStore"; type DroppedObject = { className: string; @@ -96,7 +97,10 @@ export const useDroppedObjectsStore = create((set) => ({ const state = useDroppedObjectsStore.getState(); // Get the current state const zone = state.zones[zoneName]; let socketState = useSocketStore.getState(); + let iotData = useChartStore.getState(); let visualizationSocket = socketState.visualizationSocket; + let iotMeasurements = iotData.flotingMeasurements; + let iotDuration = iotData.flotingDuration; if (!zone) return; @@ -109,6 +113,10 @@ export const useDroppedObjectsStore = create((set) => ({ // Create a shallow copy of the object with a unique ID and slightly adjusted position const duplicatedObject: DroppedObject = { ...originalObject, + Data:{ + measurements: iotMeasurements, + duration: iotDuration, + }, id: `${originalObject.id}-copy-${Date.now()}`, // Unique ID position: { ...originalObject.position, @@ -122,7 +130,8 @@ export const useDroppedObjectsStore = create((set) => ({ : originalObject.position.left, }, }; - + console.log("duplicated object",duplicatedObject); + let duplicateFloatingWidget = { organization: organization, widget: duplicatedObject, diff --git a/app/src/store/useWidgetStore.ts b/app/src/store/useWidgetStore.ts index 047b57b..2d73c77 100644 --- a/app/src/store/useWidgetStore.ts +++ b/app/src/store/useWidgetStore.ts @@ -8,22 +8,8 @@ export interface Widget { fontFamily?: string; fontSize?: string; fontWeight?: string; - data: { - // Chart data - labels?: string[]; - datasets?: Array<{ - data: number[]; - backgroundColor: string; - borderColor: string; - borderWidth: number; - }>; - // Progress card data - stocks?: Array<{ - key: string; - value: number; - description: string; - }>; - }; + data?: any; + Data?:any; } interface WidgetStore { -- 2.49.1 From 4192cef089324f4a4549460893aa43ed855e782c Mon Sep 17 00:00:00 2001 From: gabriel Date: Fri, 11 Apr 2025 18:11:20 +0530 Subject: [PATCH 4/4] resolved conflicts with bug fix --- app/package-lock.json | 48 ++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 8be748e..2c1f714 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -2020,7 +2020,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -2032,7 +2032,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -4135,6 +4135,26 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@testing-library/dom": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", + "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "chalk": "^4.1.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@testing-library/jest-dom": { "version": "5.17.0", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", @@ -4246,25 +4266,25 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "devOptional": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "devOptional": true }, "node_modules/@turf/along": { "version": "7.2.0", @@ -9007,7 +9027,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "devOptional": true }, "node_modules/cross-env": { "version": "7.0.3", @@ -9884,7 +9904,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.3.1" } @@ -15247,7 +15267,7 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "devOptional": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -20715,7 +20735,7 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, + "devOptional": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -20758,7 +20778,7 @@ "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "dev": true, + "devOptional": true, "dependencies": { "acorn": "^8.11.0" }, @@ -20770,7 +20790,7 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "devOptional": true }, "node_modules/tsconfig-paths": { "version": "3.15.0", @@ -21266,7 +21286,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "devOptional": true }, "node_modules/v8-to-istanbul": { "version": "8.1.1", @@ -22325,7 +22345,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6" } -- 2.49.1