3d widget editoption function added.

This commit is contained in:
2025-04-03 19:31:25 +05:30
parent 1dc04d19bb
commit 22bb0332ac
16 changed files with 312 additions and 176 deletions

View File

@@ -45,11 +45,12 @@ interface ThroughputProps {
id: string;
type: string;
position: [number, number, number];
onContextMenu?: (event: React.MouseEvent) => void;
}
const Throughput: React.FC<ThroughputProps> = ({ id, type, position }) => {
const Throughput: React.FC<ThroughputProps> = ({ id, type, position, onContextMenu }) => {
const { selectedChartId,setSelectedChartId } = useWidgetStore();
const { selectedChartId, setSelectedChartId } = useWidgetStore();
const { measurements: chartMeasurements, duration: chartDuration, name: widgetName } = useChartStore();
const [measurements, setmeasurements] = useState<any>({});
const [duration, setDuration] = useState("1h")
@@ -121,7 +122,7 @@ const Throughput: React.FC<ThroughputProps> = ({ id, type, position }) => {
};
const startStream = () => {
const startStream = () => {
socket.emit("lineInput", inputData);
};
@@ -154,8 +155,8 @@ const Throughput: React.FC<ThroughputProps> = ({ id, type, position }) => {
};
}, [measurements, duration, iotApiUrl]);
const fetchSavedInputes = async() => {
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}`);
@@ -181,7 +182,7 @@ const Throughput: React.FC<ThroughputProps> = ({ id, type, position }) => {
fetchSavedInputes();
}
}
,[chartMeasurements, chartDuration, widgetName])
, [chartMeasurements, chartDuration, widgetName])
return (
<Html position={[position[0], position[1], position[2]]}
@@ -189,13 +190,10 @@ const Throughput: React.FC<ThroughputProps> = ({ id, type, position }) => {
transform
zIndexRange={[1, 0]}
sprite>
<div className="throughput-wrapper"
onClick={
() => setSelectedChartId({
id: id,
type: type
})
}>
<div className="throughput-wrapper"
onClick={() => setSelectedChartId({ id: id, type: type })}
onContextMenu={onContextMenu}
>
<div className="header">{name}</div>
<div className="display-value">
<div className="left">