added api fallback for sockets
This commit is contained in:
@@ -9,8 +9,8 @@ import { useVersionContext } from '../../version/versionContext';
|
||||
|
||||
import { getUserData } from '../../../../functions/getUserData';
|
||||
|
||||
// import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
|
||||
function DecalCreator() {
|
||||
const { wallStore, floorStore } = useSceneContext();
|
||||
@@ -63,22 +63,25 @@ function DecalCreator() {
|
||||
setTimeout(() => {
|
||||
const updatedWall = getWallById(wallIntersect.object.userData.wallUuid);
|
||||
if (updatedWall) {
|
||||
if (projectId && updatedWall) {
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
}, 0)
|
||||
@@ -107,21 +110,24 @@ function DecalCreator() {
|
||||
setTimeout(() => {
|
||||
const updatedFloor = getFloorById(floorIntersect.object.userData.floorUuid);
|
||||
if (projectId && updatedFloor) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ import { useSceneContext } from '../../../scene/sceneContext';
|
||||
import { detectModifierKeys } from '../../../../utils/shortcutkeys/detectModifierKeys';
|
||||
import handleDecalPositionSnap from '../functions/handleDecalPositionSnap';
|
||||
|
||||
// import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
|
||||
export function useDecalEventHandlers({
|
||||
parent,
|
||||
@@ -147,22 +147,25 @@ export function useDecalEventHandlers({
|
||||
setTimeout(() => {
|
||||
const updatedWall = getWallById(parent.wallUuid);
|
||||
if (updatedWall) {
|
||||
if (projectId && updatedWall) {
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
}, 0)
|
||||
@@ -171,21 +174,24 @@ export function useDecalEventHandlers({
|
||||
const updatedFloor = parent;
|
||||
|
||||
if (projectId && updatedFloor) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
@@ -197,41 +203,47 @@ export function useDecalEventHandlers({
|
||||
const updatedWall = removeDecalInWall(decalUuid);
|
||||
|
||||
if (projectId && updatedWall) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
} else if ('floorUuid' in parent) {
|
||||
const updatedFloor = removeDecalInFloor(decalUuid);
|
||||
|
||||
if (projectId && updatedFloor) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import ReferenceAisle from './referenceAisle';
|
||||
import ReferencePoint from '../../point/reference/referencePoint';
|
||||
import { getUserData } from '../../../../functions/getUserData';
|
||||
|
||||
// import { upsertAisleApi } from '../../../../services/factoryBuilder/aisle/upsertAisleApi';
|
||||
import { upsertAisleApi } from '../../../../services/factoryBuilder/aisle/upsertAisleApi';
|
||||
|
||||
function AisleCreator() {
|
||||
const { scene, camera, raycaster, gl, pointer } = useThree();
|
||||
@@ -93,431 +93,70 @@ function AisleCreator() {
|
||||
}
|
||||
}
|
||||
|
||||
if (aisleType === 'solid-aisle') {
|
||||
const aisleConfigs: Record<string, (color: string) => any> = {
|
||||
"solid-aisle": (color) => ({ aisleType: "solid-aisle", aisleColor: color, aisleWidth }),
|
||||
"dashed-aisle": (color) => ({ aisleType: "dashed-aisle", aisleColor: color, aisleWidth, dashLength, gapLength }),
|
||||
"dotted-aisle": (color) => ({ aisleType: "dotted-aisle", aisleColor: color, dotRadius, gapLength }),
|
||||
"arrow-aisle": (color) => ({ aisleType: "arrow-aisle", aisleColor: color, aisleWidth }),
|
||||
"arrows-aisle": (color) => ({ aisleType: "arrows-aisle", aisleColor: color, aisleWidth, aisleLength, gapLength }),
|
||||
"arc-aisle": (color) => ({ aisleType: "arc-aisle", aisleColor: color, aisleWidth, isFlipped }),
|
||||
"circle-aisle": (color) => ({ aisleType: "circle-aisle", aisleColor: color, aisleWidth }),
|
||||
"junction-aisle": (color) => ({ aisleType: "junction-aisle", aisleColor: color, aisleWidth, isFlipped })
|
||||
};
|
||||
|
||||
if (!aisleType || !(aisleType in aisleConfigs)) return;
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: aisleConfigs[aisleType](aisleColor)
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: "Draw",
|
||||
actions: [{
|
||||
actionType: "Line-Create",
|
||||
point: { type: "Aisle", lineData: aisle, timeStamp: new Date().toISOString() }
|
||||
}]
|
||||
});
|
||||
|
||||
addAilseToBackend(aisle);
|
||||
|
||||
setTempPoints([newPoint]);
|
||||
};
|
||||
|
||||
const addAilseToBackend = (aisle: Aisle) => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
|
||||
upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'solid-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
// SOCKET
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'dashed-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'dashed-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth,
|
||||
dashLength: dashLength,
|
||||
gapLength: gapLength
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'dotted-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'dotted-aisle',
|
||||
aisleColor: aisleColor,
|
||||
dotRadius: dotRadius,
|
||||
gapLength: gapLength
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'arrow-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'arrow-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'arrows-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'arrows-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth,
|
||||
aisleLength: aisleLength,
|
||||
gapLength: gapLength
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'arc-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'arc-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth,
|
||||
isFlipped: isFlipped
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'circle-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'circle-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
} else if (aisleType === 'junction-aisle') {
|
||||
|
||||
if (tempPoints.length === 0) {
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
const aisle: Aisle = {
|
||||
aisleUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [tempPoints[0], newPoint],
|
||||
type: {
|
||||
aisleType: 'junction-aisle',
|
||||
aisleColor: aisleColor,
|
||||
aisleWidth: aisleWidth,
|
||||
isFlipped: isFlipped
|
||||
}
|
||||
};
|
||||
|
||||
addAisle(aisle);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
{
|
||||
actionType: 'Line-Create',
|
||||
point: {
|
||||
type: 'Aisle',
|
||||
lineData: aisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
],
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
|
||||
// API
|
||||
|
||||
// upsertAisleApi(aisle.aisleUuid, aisle.points, aisle.type, projectId, selectedVersion?.versionId || '')
|
||||
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
})
|
||||
}
|
||||
setTempPoints([newPoint]);
|
||||
socket.emit("v1:model-aisle:add", {
|
||||
projectId,
|
||||
versionId: selectedVersion?.versionId || "",
|
||||
userId,
|
||||
organization,
|
||||
aisleUuid: aisle.aisleUuid,
|
||||
points: aisle.points,
|
||||
type: aisle.type
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const onContext = (event: any) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -7,14 +7,14 @@ import * as CONSTANTS from "../../../../types/world/worldConstants";
|
||||
import PointsCalculator from "../../../simulation/events/points/functions/pointsCalculator";
|
||||
|
||||
import { getUserData } from "../../../../functions/getUserData";
|
||||
// import { setAssetsApi } from '../../../../services/factoryBuilder/asset/floorAsset/setAssetsApi';
|
||||
import { setAssetsApi } from '../../../../services/factoryBuilder/asset/floorAsset/setAssetsApi';
|
||||
|
||||
async function addAssetModel(
|
||||
scene: THREE.Scene,
|
||||
raycaster: THREE.Raycaster,
|
||||
camera: THREE.Camera,
|
||||
pointer: THREE.Vector2,
|
||||
socket: Socket<any>,
|
||||
socket: Socket<any> | null,
|
||||
selectedItem: any,
|
||||
setSelectedItem: any,
|
||||
addEvent: (event: EventsSchema) => void,
|
||||
@@ -106,7 +106,7 @@ async function handleModelLoad(
|
||||
selectedItem: any,
|
||||
addEvent: (event: EventsSchema) => void,
|
||||
addAsset: (asset: Asset) => void,
|
||||
socket: Socket<any>,
|
||||
socket: Socket<any> | null,
|
||||
versionId: string,
|
||||
projectId?: string,
|
||||
userId?: string
|
||||
@@ -140,22 +140,6 @@ async function handleModelLoad(
|
||||
opacity: 1,
|
||||
};
|
||||
|
||||
|
||||
// API
|
||||
|
||||
// await setAssetsApi(
|
||||
// organization,
|
||||
// newFloorItem.modelUuid,
|
||||
// newFloorItem.modelName,
|
||||
// newFloorItem.assetId,
|
||||
// newFloorItem.position,
|
||||
// { x: 0, y: 0, z: 0 },
|
||||
// false,
|
||||
// true,
|
||||
// );
|
||||
|
||||
// SOCKET
|
||||
|
||||
if (selectedItem.type) {
|
||||
const data = PointsCalculator(
|
||||
selectedItem.type,
|
||||
@@ -449,14 +433,34 @@ async function handleModelLoad(
|
||||
rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z, },
|
||||
isLocked: false,
|
||||
isVisible: true,
|
||||
socketId: socket.id,
|
||||
socketId: socket?.id || '',
|
||||
eventData: eventData,
|
||||
versionId: versionId,
|
||||
projectId: projectId,
|
||||
userId: userId,
|
||||
};
|
||||
|
||||
socket.emit("v1:model-asset:add", completeData);
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
setAssetsApi({
|
||||
modelUuid: newFloorItem.modelUuid,
|
||||
modelName: newFloorItem.modelName,
|
||||
position: newFloorItem.position,
|
||||
assetId: newFloorItem.assetId,
|
||||
rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z, },
|
||||
eventData: eventData,
|
||||
isLocked: false,
|
||||
isVisible: true,
|
||||
versionId: versionId,
|
||||
projectId: projectId,
|
||||
});
|
||||
|
||||
} else {
|
||||
// SOCKET
|
||||
|
||||
socket.emit("v1:model-asset:add", completeData);
|
||||
}
|
||||
|
||||
const asset: Asset = {
|
||||
modelUuid: completeData.modelUuid,
|
||||
@@ -482,13 +486,32 @@ async function handleModelLoad(
|
||||
rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z, },
|
||||
isLocked: false,
|
||||
isVisible: true,
|
||||
socketId: socket.id,
|
||||
socketId: socket?.id || '',
|
||||
versionId: versionId,
|
||||
projectId: projectId,
|
||||
userId: userId,
|
||||
};
|
||||
|
||||
socket.emit("v1:model-asset:add", data);
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
setAssetsApi({
|
||||
modelUuid: newFloorItem.modelUuid,
|
||||
modelName: newFloorItem.modelName,
|
||||
position: newFloorItem.position,
|
||||
assetId: newFloorItem.assetId,
|
||||
rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z, },
|
||||
isLocked: false,
|
||||
isVisible: true,
|
||||
versionId: versionId,
|
||||
projectId: projectId,
|
||||
});
|
||||
|
||||
} else {
|
||||
// SOCKET
|
||||
|
||||
socket.emit("v1:model-asset:add", data);
|
||||
}
|
||||
|
||||
const asset = {
|
||||
modelUuid: data.modelUuid,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { useSelectedAsset } from '../../../../../../store/simulation/useSimulati
|
||||
import { useBuilderStore } from '../../../../../../store/builder/useBuilderStore';
|
||||
|
||||
import { upsertProductOrEventApi } from '../../../../../../services/simulation/products/UpsertProductOrEventApi';
|
||||
// import { deleteFloorItem } from '../../../../../../services/factoryBuilder/asset/floorAsset/deleteFloorItemApi';
|
||||
import { deleteFloorItem } from '../../../../../../services/factoryBuilder/asset/floorAsset/deleteFloorItemApi';
|
||||
|
||||
export function useModelEventHandlers({
|
||||
boundingBox,
|
||||
@@ -146,24 +146,28 @@ export function useModelEventHandlers({
|
||||
if (leftDrag.current || toggleView) return;
|
||||
if (activeTool === 'delete' && deletableFloorAsset && deletableFloorAsset.uuid === asset.modelUuid) {
|
||||
|
||||
//REST
|
||||
if (!socket?.active) {
|
||||
|
||||
// const response = await deleteFloorItem(organization, asset.modelUuid, asset.modelName);
|
||||
// REST
|
||||
|
||||
//SOCKET
|
||||
deleteFloorItem(organization, asset.modelUuid, asset.modelName);
|
||||
|
||||
const data = {
|
||||
organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
modelName: asset.modelName,
|
||||
socketId: socket.id,
|
||||
userId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
projectId
|
||||
} else {
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
modelName: asset.modelName,
|
||||
socketId: socket.id,
|
||||
userId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
projectId
|
||||
}
|
||||
|
||||
socket.emit('v1:model-asset:delete', data)
|
||||
}
|
||||
|
||||
const response = socket.emit('v1:model-asset:delete', data)
|
||||
|
||||
removeEvent(asset.modelUuid);
|
||||
const updatedEvents = deleteEvent(asset.modelUuid);
|
||||
|
||||
@@ -176,27 +180,24 @@ export function useModelEventHandlers({
|
||||
);
|
||||
})
|
||||
|
||||
if (response) {
|
||||
removeAsset(asset.modelUuid);
|
||||
|
||||
removeAsset(asset.modelUuid);
|
||||
|
||||
push3D({
|
||||
type: 'Scene',
|
||||
actions: [
|
||||
{
|
||||
module: "builder",
|
||||
actionType: "Asset-Delete",
|
||||
asset: {
|
||||
type: "Asset",
|
||||
assetData: asset,
|
||||
timeStap: new Date().toISOString()
|
||||
}
|
||||
push3D({
|
||||
type: 'Scene',
|
||||
actions: [
|
||||
{
|
||||
module: "builder",
|
||||
actionType: "Asset-Delete",
|
||||
asset: {
|
||||
type: "Asset",
|
||||
assetData: asset,
|
||||
timeStap: new Date().toISOString()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
echo.success("Model Removed!");
|
||||
}
|
||||
echo.success("Model Removed!");
|
||||
|
||||
} else if (activeModule === 'simulation' && subModule === "simulations" && activeTool === 'pen') {
|
||||
if (asset.eventData && asset.eventData.type === 'Conveyor') {
|
||||
|
||||
@@ -9,6 +9,8 @@ import { useVersionContext } from '../version/versionContext';
|
||||
import { useBuilderStore } from '../../../store/builder/useBuilderStore';
|
||||
import { useSceneContext } from '../../scene/sceneContext';
|
||||
|
||||
import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
|
||||
/**
|
||||
* DxfFile component handles the rendering and manipulation of DXf file data in a 3D scene.
|
||||
* It processes the DXF data to create points and lines representing walls and allows
|
||||
@@ -39,20 +41,25 @@ const DxfFile = () => {
|
||||
|
||||
if (dfxWallGenerate) {
|
||||
dfxWallGenerate.map((wall: Wall) => {
|
||||
const data = {
|
||||
wallData: wall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
addWall(wall);
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall);
|
||||
} else {
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: wall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
addWall(wall);
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}, [dfxWallGenerate]);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getUserData } from '../../../../functions/getUserData';
|
||||
import ReferencePoint from '../../point/reference/referencePoint';
|
||||
import ReferenceFloor from './referenceFloor';
|
||||
|
||||
// import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
import { upsertFloorApi } from '../../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
|
||||
function FloorCreator() {
|
||||
const { scene, camera, raycaster, gl, pointer } = useThree();
|
||||
@@ -120,23 +120,25 @@ function FloorCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
|
||||
}
|
||||
setTempPoints([]);
|
||||
setIsCreating(false);
|
||||
@@ -174,23 +176,25 @@ function FloorCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
|
||||
}
|
||||
setTempPoints([]);
|
||||
setIsCreating(false);
|
||||
@@ -238,23 +242,25 @@ function FloorCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
|
||||
}
|
||||
}
|
||||
setTempPoints([]);
|
||||
|
||||
@@ -13,14 +13,14 @@ import { handleCanvasCursors } from '../../../utils/mouseUtils/handleCanvasCurso
|
||||
import { useSelectedPoints } from '../../../store/simulation/useSimulationStore';
|
||||
import { calculateAssetTransformationOnWall } from '../wallAsset/Instances/Instance/functions/calculateAssetTransformationOnWall';
|
||||
|
||||
// import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { deleteWallApi } from '../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
// import { upsertFloorApi } from '../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
// import { deleteFloorApi } from '../../../services/factoryBuilder/floor/deleteFloorApi';
|
||||
// import { deleteZoneApi } from '../../../services/factoryBuilder/zone/deleteZoneApi';
|
||||
// import { upsertZoneApi } from '../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
// import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
// import { deleteWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
import { deleteWallApi } from '../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
import { upsertFloorApi } from '../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
import { deleteFloorApi } from '../../../services/factoryBuilder/floor/deleteFloorApi';
|
||||
import { deleteZoneApi } from '../../../services/factoryBuilder/zone/deleteZoneApi';
|
||||
import { upsertZoneApi } from '../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
import { deleteWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
|
||||
interface LineProps {
|
||||
points: [Point, Point];
|
||||
@@ -120,43 +120,48 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
if (projectId && asset) {
|
||||
|
||||
removeWallAsset(asset.modelUuid);
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallAssetApi(projectId, selectedVersion?.versionId || '', asset.modelUuid, asset.wallUuid);
|
||||
deleteWallAssetApi(projectId, selectedVersion?.versionId || '', asset.modelUuid, asset.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
wallUuid: asset.wallUuid
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
wallUuid: asset.wallUuid
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
|
||||
}
|
||||
})
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallApi(projectId, selectedVersion?.versionId || '', removedWall.wallUuid);
|
||||
deleteWallApi(projectId, selectedVersion?.versionId || '', removedWall.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallUuid: removedWall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallUuid: removedWall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
|
||||
push2D({
|
||||
type: 'Draw',
|
||||
actions: [
|
||||
@@ -180,22 +185,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
if (removedFloors.length > 0) {
|
||||
removedFloors.forEach(floor => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteFloorApi(projectId, selectedVersion?.versionId || '', floor.floorUuid);
|
||||
deleteFloorApi(projectId, selectedVersion?.versionId || '', floor.floorUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorUuid: floor.floorUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorUuid: floor.floorUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:delete', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -218,22 +226,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
if (updatedFloors.length > 0) {
|
||||
updatedFloors.forEach(floor => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -263,22 +274,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
if (removedZones.length > 0) {
|
||||
removedZones.forEach(zone => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteZoneApi(projectId, selectedVersion?.versionId || '', zone.zoneUuid);
|
||||
deleteZoneApi(projectId, selectedVersion?.versionId || '', zone.zoneUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneUuid: zone.zoneUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneUuid: zone.zoneUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:delete', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -301,22 +315,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
if (updatedZones.length > 0) {
|
||||
updatedZones.forEach(zone => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -435,40 +452,47 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
});
|
||||
|
||||
if (projectId && updatedWallAsset) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
// API
|
||||
|
||||
// SOCKET
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
} else {
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
})
|
||||
|
||||
if (initialPositions.walls && initialPositions.walls.length > 0) {
|
||||
@@ -495,22 +519,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
|
||||
if (updatedFloors.length > 0 && projectId) {
|
||||
updatedFloors.forEach(updatedFloor => {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
})
|
||||
|
||||
if (initialPositions.floors && initialPositions.floors.length > 0) {
|
||||
@@ -537,22 +564,25 @@ function Line({ points }: Readonly<LineProps>) {
|
||||
|
||||
if (updatedZones.length > 0 && projectId) {
|
||||
updatedZones.forEach(updatedZone => {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', updatedZone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', updatedZone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: updatedZone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: updatedZone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
})
|
||||
|
||||
if (initialPositions.zones && initialPositions.zones.length > 0) {
|
||||
|
||||
@@ -11,16 +11,16 @@ import { useParams } from 'react-router-dom';
|
||||
import { useVersionContext } from '../version/versionContext';
|
||||
import { useSceneContext } from '../../scene/sceneContext';
|
||||
|
||||
// import { upsertAisleApi } from '../../../services/factoryBuilder/aisle/upsertAisleApi';
|
||||
// import { deleteAisleApi } from '../../../services/factoryBuilder/aisle/deleteAisleApi';
|
||||
// import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { deleteWallApi } from '../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
// import { upsertFloorApi } from '../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
// import { deleteFloorApi } from '../../../services/factoryBuilder/floor/deleteFloorApi';
|
||||
// import { upsertZoneApi } from '../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
// import { deleteZoneApi } from '../../../services/factoryBuilder/zone/deleteZoneApi';
|
||||
// import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
// import { deleteWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
import { upsertAisleApi } from '../../../services/factoryBuilder/aisle/upsertAisleApi';
|
||||
import { deleteAisleApi } from '../../../services/factoryBuilder/aisle/deleteAisleApi';
|
||||
import { upsertWallApi } from '../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
import { deleteWallApi } from '../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
import { upsertFloorApi } from '../../../services/factoryBuilder/floor/upsertFloorApi';
|
||||
import { deleteFloorApi } from '../../../services/factoryBuilder/floor/deleteFloorApi';
|
||||
import { upsertZoneApi } from '../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
import { deleteZoneApi } from '../../../services/factoryBuilder/zone/deleteZoneApi';
|
||||
import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
import { deleteWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
|
||||
import { getUserData } from '../../../functions/getUserData';
|
||||
import { handleCanvasCursors } from '../../../utils/mouseUtils/handleCanvasCursors';
|
||||
@@ -190,22 +190,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
const updatedAisles = getAislesByPointId(point.pointUuid);
|
||||
if (updatedAisles.length > 0 && projectId) {
|
||||
updatedAisles.forEach((updatedAisle) => {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertAisleApi(updatedAisle.aisleUuid, updatedAisle.points, updatedAisle.type, projectId, selectedVersion?.versionId || '');
|
||||
upsertAisleApi(updatedAisle.aisleUuid, updatedAisle.points, updatedAisle.type, projectId, selectedVersion?.versionId || '');
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: updatedAisle.aisleUuid,
|
||||
points: updatedAisle.points,
|
||||
type: updatedAisle.type
|
||||
})
|
||||
socket.emit('v1:model-aisle:add', {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: updatedAisle.aisleUuid,
|
||||
points: updatedAisle.points,
|
||||
type: updatedAisle.type
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (initialStates.aisles && initialStates.aisles.length > 0) {
|
||||
@@ -244,40 +247,47 @@ function Point({ point }: { readonly point: Point }) {
|
||||
});
|
||||
|
||||
if (projectId && updatedWallAsset) {
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// API
|
||||
if (!socket?.active) {
|
||||
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
// API
|
||||
|
||||
// SOCKET
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', updatedWall);
|
||||
} else {
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: updatedWall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -301,22 +311,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
const updatedFloors = getFloorsByPointId(point.pointUuid);
|
||||
if (updatedFloors && updatedFloors.length > 0 && projectId) {
|
||||
updatedFloors.forEach((updatedFloor) => {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', updatedFloor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: updatedFloor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -340,22 +353,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
const updatedZones = getZonesByPointId(point.pointUuid);
|
||||
if (updatedZones && updatedZones.length > 0 && projectId) {
|
||||
updatedZones.forEach((updatedZone) => {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', updatedZone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', updatedZone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: updatedZone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: updatedZone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -388,23 +404,26 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (removedAisles.length > 0) {
|
||||
removedAisles.forEach(aisle => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteAisleApi(aisle.aisleUuid, projectId, selectedVersion?.versionId || '');
|
||||
deleteAisleApi(aisle.aisleUuid, projectId, selectedVersion?.versionId || '');
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
aisleUuid: aisle.aisleUuid
|
||||
}
|
||||
|
||||
socket.emit('v1:model-aisle:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-aisle:delete', data);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -436,44 +455,50 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (projectId && asset) {
|
||||
|
||||
removeWallAsset(asset.modelUuid);
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallAssetApi(projectId, selectedVersion?.versionId || '', asset.modelUuid, asset.wallUuid);
|
||||
deleteWallAssetApi(projectId, selectedVersion?.versionId || '', asset.modelUuid, asset.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
wallUuid: asset.wallUuid
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: asset.modelUuid,
|
||||
wallUuid: asset.wallUuid
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallApi(projectId, selectedVersion?.versionId || '', wall.wallUuid);
|
||||
deleteWallApi(projectId, selectedVersion?.versionId || '', wall.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallUuid: wall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallUuid: wall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -501,22 +526,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (removedFloors.length > 0) {
|
||||
removedFloors.forEach(floor => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteFloorApi(projectId, selectedVersion?.versionId || '', floor.floorUuid);
|
||||
deleteFloorApi(projectId, selectedVersion?.versionId || '', floor.floorUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorUuid: floor.floorUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorUuid: floor.floorUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:delete', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -539,22 +567,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (updatedFloors.length > 0) {
|
||||
updatedFloors.forEach(floor => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
upsertFloorApi(projectId, selectedVersion?.versionId || '', floor);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
floorData: floor,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Floor:add', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -583,22 +614,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (removedZones.length > 0) {
|
||||
removedZones.forEach(zone => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteZoneApi(projectId, selectedVersion?.versionId || '', zone.zoneUuid);
|
||||
deleteZoneApi(projectId, selectedVersion?.versionId || '', zone.zoneUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneUuid: zone.zoneUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneUuid: zone.zoneUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:delete', data);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -621,22 +655,25 @@ function Point({ point }: { readonly point: Point }) {
|
||||
if (updatedZones.length > 0) {
|
||||
updatedZones.forEach(zone => {
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import getClosestIntersection from '../../line/helpers/getClosestIntersection';
|
||||
import ReferencePoint from '../../point/reference/referencePoint';
|
||||
import ReferenceWall from './referenceWall';
|
||||
|
||||
// import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
// import { deleteWallApi } from '../../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
import { upsertWallApi } from '../../../../services/factoryBuilder/wall/upsertWallApi';
|
||||
import { deleteWallApi } from '../../../../services/factoryBuilder/wall/deleteWallApi';
|
||||
|
||||
function WallCreator() {
|
||||
const { scene, camera, raycaster, gl, pointer } = useThree();
|
||||
@@ -94,23 +94,26 @@ function WallCreator() {
|
||||
removeWall(wall.wallUuid);
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallApi(projectId, selectedVersion?.versionId || '', wall.wallUuid);
|
||||
deleteWallApi(projectId, selectedVersion?.versionId || '', wall.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallUuid: wall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallUuid: wall.wallUuid,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:delete', data);
|
||||
|
||||
}
|
||||
|
||||
const point1: Point = {
|
||||
@@ -147,24 +150,27 @@ function WallCreator() {
|
||||
|
||||
addWall(wall2);
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall2);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall2);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: wall2,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: wall2,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
|
||||
const wall3: Wall = {
|
||||
wallUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [point2, newPoint],
|
||||
@@ -204,24 +210,27 @@ function WallCreator() {
|
||||
],
|
||||
})
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall3);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall3);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data2 = {
|
||||
wallData: wall3,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data2 = {
|
||||
wallData: wall3,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data2);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data2);
|
||||
|
||||
setTempPoints([newPoint]);
|
||||
setIsCreating(true);
|
||||
} else {
|
||||
@@ -237,24 +246,27 @@ function WallCreator() {
|
||||
|
||||
addWall(wall1);
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall1);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall1);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: wall1,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: wall1,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
|
||||
const wall2: Wall = {
|
||||
wallUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [point1, newPoint],
|
||||
@@ -267,24 +279,27 @@ function WallCreator() {
|
||||
|
||||
addWall(wall2);
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall2);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall2);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data1 = {
|
||||
wallData: wall2,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data1 = {
|
||||
wallData: wall2,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data1);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data1);
|
||||
|
||||
const wall3: Wall = {
|
||||
wallUuid: THREE.MathUtils.generateUUID(),
|
||||
points: [point2, newPoint],
|
||||
@@ -328,24 +343,27 @@ function WallCreator() {
|
||||
],
|
||||
})
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall3);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall3);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data3 = {
|
||||
wallData: wall3,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data3 = {
|
||||
wallData: wall3,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data3);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data3);
|
||||
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
|
||||
@@ -411,24 +429,27 @@ function WallCreator() {
|
||||
],
|
||||
})
|
||||
|
||||
// API
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
// API
|
||||
|
||||
// if (projectId) {
|
||||
// upsertWallApi(projectId, selectedVersion?.versionId || '', wall);
|
||||
// }
|
||||
upsertWallApi(projectId, selectedVersion?.versionId || '', wall);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallData: wall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallData: wall,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
}
|
||||
}
|
||||
|
||||
socket.emit('v1:model-Wall:add', data);
|
||||
|
||||
setTempPoints([newPoint]);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import { useVersionContext } from '../../../version/versionContext';
|
||||
import { getUserData } from '../../../../../functions/getUserData';
|
||||
import closestPointOnLineSegment from '../../../line/helpers/getClosestPointOnLineSegment';
|
||||
|
||||
// import { upsertWallAssetApi } from '../../../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
// import { deleteWallAssetApi } from '../../../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
import { upsertWallAssetApi } from '../../../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
import { deleteWallAssetApi } from '../../../../../services/factoryBuilder/asset/wallAsset/deleteWallAssetApi';
|
||||
|
||||
function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) {
|
||||
const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`;
|
||||
@@ -126,23 +126,25 @@ function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) {
|
||||
const updatedWallAsset = getWallAssetById(wallAsset.modelUuid);
|
||||
|
||||
if (projectId && updatedWallAsset) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
upsertWallAssetApi(projectId, selectedVersion?.versionId || '', updatedWallAsset);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallAssetData: updatedWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,24 +196,26 @@ function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) {
|
||||
const removedWallAsset = removeWallAsset(wallAsset.modelUuid);
|
||||
|
||||
if (projectId && removedWallAsset) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// deleteWallAssetApi(projectId, selectedVersion?.versionId || '', removedWallAsset.modelUuid, removedWallAsset.wallUuid);
|
||||
deleteWallAssetApi(projectId, selectedVersion?.versionId || '', removedWallAsset.modelUuid, removedWallAsset.wallUuid);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: removedWallAsset.modelUuid,
|
||||
wallUuid: removedWallAsset.wallUuid
|
||||
const data = {
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization,
|
||||
modelUuid: removedWallAsset.modelUuid,
|
||||
wallUuid: removedWallAsset.wallUuid
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:delete', data);
|
||||
|
||||
}
|
||||
}
|
||||
}, [activeTool, activeModule, deletableWallAsset, socket])
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useVersionContext } from '../version/versionContext';
|
||||
import { getUserData } from '../../../functions/getUserData';
|
||||
import closestPointOnLineSegment from '../line/helpers/getClosestPointOnLineSegment';
|
||||
|
||||
// import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
import { upsertWallAssetApi } from '../../../services/factoryBuilder/asset/wallAsset/upsertWallAssetApi';
|
||||
|
||||
function WallAssetCreator() {
|
||||
const { socket } = useSocketStore();
|
||||
@@ -62,23 +62,25 @@ function WallAssetCreator() {
|
||||
|
||||
addWallAsset(newWallAsset);
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertWallAssetApi(projectId, selectedVersion?.versionId || '', newWallAsset);
|
||||
upsertWallAssetApi(projectId, selectedVersion?.versionId || '', newWallAsset);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
wallAssetData: newWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
wallAssetData: newWallAsset,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:wall-asset:add', data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getUserData } from '../../../../functions/getUserData';
|
||||
import ReferencePoint from '../../point/reference/referencePoint';
|
||||
import ReferenceZone from './referenceZone';
|
||||
|
||||
// import { upsertZoneApi } from '../../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
import { upsertZoneApi } from '../../../../services/factoryBuilder/zone/upsertZoneApi';
|
||||
|
||||
function ZoneCreator() {
|
||||
const { scene, camera, raycaster, gl, pointer } = useThree();
|
||||
@@ -33,7 +33,6 @@ function ZoneCreator() {
|
||||
const [isCreating, setIsCreating] = useState(false);
|
||||
const { zoneColor, zoneHeight, snappedPosition, snappedPoint, setSnappedPoint, setSnappedPosition } = useBuilderStore();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const canvasElement = gl.domElement;
|
||||
|
||||
@@ -119,23 +118,25 @@ function ZoneCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
|
||||
}
|
||||
setTempPoints([]);
|
||||
setIsCreating(false);
|
||||
@@ -171,23 +172,25 @@ function ZoneCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
|
||||
}
|
||||
setTempPoints([]);
|
||||
setIsCreating(false);
|
||||
@@ -233,23 +236,25 @@ function ZoneCreator() {
|
||||
})
|
||||
|
||||
if (projectId) {
|
||||
if (!socket?.active) {
|
||||
|
||||
// API
|
||||
// API
|
||||
|
||||
// upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
upsertZoneApi(projectId, selectedVersion?.versionId || '', zone);
|
||||
} else {
|
||||
|
||||
// SOCKET
|
||||
// SOCKET
|
||||
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
const data = {
|
||||
zoneData: zone,
|
||||
projectId: projectId,
|
||||
versionId: selectedVersion?.versionId || '',
|
||||
userId: userId,
|
||||
organization: organization
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
}
|
||||
|
||||
socket.emit('v1:zone:add', data);
|
||||
|
||||
}
|
||||
}
|
||||
setTempPoints([]);
|
||||
|
||||
Reference in New Issue
Block a user