architwin 1.14.16 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/architwin.d.ts +13 -2
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +71 -3
- package/lib/atwinui/components/toolbar/index.js +5 -1
- package/lib/atwinui/components/toolbar/menuBar.d.ts +1 -0
- package/lib/atwinui/components/toolbar/menuBar.js +12 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.d.ts +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +41 -12
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +21 -2
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +32 -12
- package/lib/atwinui/components/toolbar/tagFormPane.js +2 -1
- package/lib/atwinui/components/toolbar/tagListPane.d.ts +7 -2
- package/lib/atwinui/components/toolbar/tagListPane.js +126 -38
- package/lib/atwinui/events.d.ts +3 -1
- package/lib/atwinui/events.js +629 -107
- package/lib/atwinui/index.js +9 -1
- package/lib/color.js +12 -1
- package/lib/loaders/polydrawerLoader.js +3 -0
- package/lib/types.d.ts +75 -1
- package/lib/types.js +17 -0
- package/package.json +1 -1
- package/static/atwinui.css +55 -7
- package/static/colors/SOFT_ROYAL_BLUE.png +0 -0
- package/static/colors/YELLOW_ORANGE.png +0 -0
- package/static/utility.css +156 -537
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.d.ts +0 -68
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.js +0 -798
- package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.d.ts +0 -33
- package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.js +0 -447
- package/lib/atwinui/components/toolbar/tagIotForm.d.ts +0 -20
- package/lib/atwinui/components/toolbar/tagIotForm.js +0 -391
- package/lib/atwinui/components/toolbar/usersPane.d.ts +0 -14
- package/lib/atwinui/components/toolbar/usersPane.js +0 -273
- package/lib/convert.d.ts +0 -13
- package/lib/convert.js +0 -54
package/lib/atwinui/events.js
CHANGED
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { actionBar, renderObjectCards, renderLibraryCards, renderTags, renderTagRow, getTagFormData, addClickEventToTagRow, setActiveCard, setActiveMenu, removeObjectCard, clearActiveMenu, setTagCategoriesOption, toggleDropdown, tagFormMode, selectedTag, renderRecepientOptions, renderTagMessages, createTagMessage, setTagLink, setTagMessagingDetails, renderCategoryDropdownOptions, clearTagFormDropdown, clearActiveActionBtn, clearActiveCard, toggleActionBarButtons, selectedCategoryFilterId, selectedSubCategoryFilterId, filterTagList, toggleModal, setModalAction, } from "./components/toolbar";
|
|
11
|
-
import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, _modelDetails, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, clearFloorBaseHeight, isToolbarFeatureEnabled, captureCurrentView, getCurrentFloor, _spaceUsers, setPipeCategories, setPipes, detachTagMedia, getTagDataCollection, setVertexPath, _screenSharingHostUser, toggleMeshChildrenVisibility } from "../architwin";
|
|
11
|
+
import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, _modelDetails, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, clearFloorBaseHeight, isToolbarFeatureEnabled, captureCurrentView, getCurrentFloor, _spaceUsers, setPipeCategories, setPipes, detachTagMedia, getTagDataCollection, setVertexPath, _screenSharingHostUser, _tagIotCategoryTypes, getIoTDeviceTagIcons, toggleMeshChildrenVisibility, set3DXObjects } from "../architwin";
|
|
12
12
|
import { Notyf } from 'notyf';
|
|
13
13
|
import 'notyf/notyf.min.css';
|
|
14
|
-
import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE } from "../types";
|
|
14
|
+
import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE, TAG_TYPE } from "../types";
|
|
15
15
|
import { initFormData, setTagFormMode } from "./components/toolbar/tagFormPane";
|
|
16
16
|
import { renderObjectList, resetSelectedObjectSortOption, selectedObjectSortOption, sortShowcaseObjects, updateSelectedObjectSortOption } from "./components/toolbar/objectListPane";
|
|
17
17
|
import { renderLibraryList } from "./components/toolbar/libraryPane";
|
|
@@ -19,21 +19,24 @@ import { renderObjectCard } from "./components/toolbar/card";
|
|
|
19
19
|
import { toggleModelControl, getCoordinateValues, showCurrentCoordinateValue, handleModelControlInputs, setSelectedObjectCoordinateSystem, getSelectedObjectCoordinateSystem, getCurrentTransformationValues, setCurrentTransformationValues, getTransformValues, clearCurrentTransformationValues } from "./components/toolbar/modelControlsPane";
|
|
20
20
|
import { attachTagMedia, handleTagPlacerCreated, cancelMoveTag } from "../tag";
|
|
21
21
|
import i18n from './components/toolbar/i18n';
|
|
22
|
-
import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader, isVec3Equal, isQuatEqual } from "../utils";
|
|
22
|
+
import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader, isVec3Equal, isQuatEqual, useHexToRgb } from "../utils";
|
|
23
23
|
import log from 'loglevel';
|
|
24
24
|
import * as minimap from '../minimap';
|
|
25
25
|
import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
|
|
26
|
-
import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild,
|
|
27
|
-
import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getDrawingMode } from "./components/toolbar/spacePartition/roomFormPane";
|
|
26
|
+
import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild, highlightSelectedWindow, getRoomData } from "./components/toolbar/spacePartition/roomTreePane";
|
|
27
|
+
import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getIsDrawing, getDrawingMode, getCurrentPolygonData, setTempCurrentRoomEditData } from "./components/toolbar/spacePartition/roomFormPane";
|
|
28
28
|
import { actionSettingsSelectOption, getTempCoordinateSystem, getTempMeasurementUnit, getTempRotationUnit, setCoordinateSystem, setMeasurementUnit, setRotationUnit, initSettingsValues, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, toggleActionSettingsDropdown, toggleCalibrateBasepoint, setScaleFactor, getTempScaleFactor, setTempScaleFactor, setBasepoint, getTempBasepoint, setTempBasepoint, getBasepoint, toggleActionSettings, getBasepointObjectPayload, displayConvertedCoordinates, getCoordinateSystem, getScaleFactor, getMeasurementUnit, getRotationUnit, setBasepointObjectPayload } from "./components/toolbar/actionSettingsPane";
|
|
29
29
|
import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
|
|
30
30
|
import { toggleGeneralMapOptions, initGeneralSelectedMap, getSelectedMapOption } from './components/toolbar/generalSettingsMenuPane';
|
|
31
|
-
import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm, sortTags, updateSelectedTagSortOption, resetSelectedTagSortOption } from './components/toolbar/tagListPane';
|
|
31
|
+
import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm, sortTags, updateSelectedTagSortOption, resetSelectedTagSortOption, filterIotTagList, setTagPaneActive, isTagPaneActive, setCurrentTagPaneMode, currentTagPaneMode } from './components/toolbar/tagListPane';
|
|
32
32
|
import { renderUserRows } from "./components/toolbar/spaceUserListPane";
|
|
33
33
|
import { handleRemoteViewResponsiveChanges, renderRemoteSpaceViewing } from "./components/toolbar/viewingRemoteSpace";
|
|
34
34
|
import { PipeList } from "./components/toolbar/pipeListPane";
|
|
35
35
|
import { PipeForm } from "./components/toolbar/pipeFormPane";
|
|
36
|
-
import {
|
|
36
|
+
// import { EditPipeForm, initPipeFormPane, pipeFormData, setPipeFormMode } from "./components/toolbar/pipeFormPane";
|
|
37
|
+
// import { initPipeData } from "./components/toolbar/addPipePane";
|
|
38
|
+
import { toggleIoTCategoryOptions, toggleIoTDevicesOptions, setSelectedIoTSystemRadio, clearIoTDropdowns, initIoTFormData, setIotCategoryOptions, getIotTagFormData, iotTagFormMode, selectedIotTag, clearIotFields, getIotCategoryOption } from './components/toolbar/tagIotFormPane';
|
|
39
|
+
import { getTheseTagMessages, timedoutComment, unsendComment } from "./components/toolbar/tagMessagingPane";
|
|
37
40
|
import { handleScreenShareResponsiveChanges, handleScreenShareAcceptRequest, handleScreenShareBackUserListPane, handleScreenShareEndSessionEvent, handleScreenShareUsersUpdated, renderScreenShareLeaveConfirmationModal } from "./components/toolbar/screenSharePane";
|
|
38
41
|
const pipeList = new PipeList();
|
|
39
42
|
const pipeForm = new PipeForm();
|
|
@@ -56,6 +59,7 @@ let iTag = null;
|
|
|
56
59
|
let _currentPaneId;
|
|
57
60
|
let isPlacingTag = false;
|
|
58
61
|
let isCustomMapControlsVisible = false;
|
|
62
|
+
let _currentSandboxId = undefined;
|
|
59
63
|
let isNotyfExecuted = false; // flag for notification
|
|
60
64
|
let pipeColor = "";
|
|
61
65
|
function batchAddEventListenerByClassName(className, callback) {
|
|
@@ -139,7 +143,15 @@ function toggleDisplayPane(targetId) {
|
|
|
139
143
|
const clickedElement = document.getElementById(targetId);
|
|
140
144
|
console.log("Testing: ", clickedElement);
|
|
141
145
|
const paneId = clickedElement.getAttribute('target-pane');
|
|
146
|
+
const btnId = clickedElement.getAttribute('id');
|
|
147
|
+
if (btnId === 'at-expand-btn') {
|
|
148
|
+
setTagPaneActive(true);
|
|
149
|
+
}
|
|
150
|
+
else if (btnId === 'at-tag-iot-btn') {
|
|
151
|
+
setTagPaneActive(false);
|
|
152
|
+
}
|
|
142
153
|
console.log("Testing: ", paneId);
|
|
154
|
+
console.log("Testing: ", btnId);
|
|
143
155
|
if (paneId != null && paneId != '') {
|
|
144
156
|
log.info("paneElement", paneId);
|
|
145
157
|
_currentPaneId = paneId;
|
|
@@ -148,7 +160,11 @@ function toggleDisplayPane(targetId) {
|
|
|
148
160
|
log.error("Pane element is not defined");
|
|
149
161
|
return;
|
|
150
162
|
}
|
|
151
|
-
|
|
163
|
+
const isPaneVisible = paneElement.offsetWidth > 0 && paneElement.offsetHeight > 0;
|
|
164
|
+
const isTagListPane = paneId === 'at-tag-list-pane';
|
|
165
|
+
const isExpandBtn = btnId === 'at-expand-btn';
|
|
166
|
+
const isIotBtn = btnId === 'at-tag-iot-btn';
|
|
167
|
+
if (!isPaneVisible) {
|
|
152
168
|
paneElement.style.display = 'block';
|
|
153
169
|
if (activePane) {
|
|
154
170
|
activePane.style.display = 'none';
|
|
@@ -204,17 +220,18 @@ function toggleDisplayPane(targetId) {
|
|
|
204
220
|
renderLibraryCards(assets);
|
|
205
221
|
}
|
|
206
222
|
if (paneId === 'at-tag-list-pane') {
|
|
223
|
+
renderTagPaneContent();
|
|
224
|
+
setIotCategoryOptions();
|
|
207
225
|
// clearTagFilterDropdown()
|
|
208
226
|
const tags = getMpTags();
|
|
209
|
-
if
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
227
|
+
// if(selectedCategoryFilterId || selectedSubCategoryFilterId){
|
|
228
|
+
// const filteredTags = filterTagList(tags)
|
|
229
|
+
// const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
|
|
230
|
+
// renderTags(sortedTags)
|
|
231
|
+
// }else if (tags.length > 0) {
|
|
232
|
+
// const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
|
|
233
|
+
// renderTags(sortedTags,true)
|
|
234
|
+
// }
|
|
218
235
|
//Render the category dropdown elements if tagCategories is populated
|
|
219
236
|
if (_tagCategories && _tagCategories.length > 0) {
|
|
220
237
|
log.info("Has categories");
|
|
@@ -283,6 +300,13 @@ function toggleDisplayPane(targetId) {
|
|
|
283
300
|
//setup pipe list pane initialization
|
|
284
301
|
pipeList.init();
|
|
285
302
|
}
|
|
303
|
+
if (paneId === 'at-tag-iot-form-pane') {
|
|
304
|
+
log.info("Tag IoT Form");
|
|
305
|
+
// clearIoTDropdowns()
|
|
306
|
+
// clearIotFields()
|
|
307
|
+
initIoTFormData();
|
|
308
|
+
setIotCategoryOptions();
|
|
309
|
+
}
|
|
286
310
|
if (paneId === 'at-screen-share-pane') {
|
|
287
311
|
log.info('at-screen-share-pane');
|
|
288
312
|
dispatchSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_PANE_OPEN);
|
|
@@ -293,6 +317,9 @@ function toggleDisplayPane(targetId) {
|
|
|
293
317
|
console.log("paneId", paneId);
|
|
294
318
|
return;
|
|
295
319
|
}
|
|
320
|
+
else if ((isTagListPane && isExpandBtn && currentTagPaneMode === TAG_TYPE.IOT) || (isTagListPane && !isExpandBtn && currentTagPaneMode === TAG_TYPE.MP)) {
|
|
321
|
+
renderTagPaneContent();
|
|
322
|
+
}
|
|
296
323
|
else {
|
|
297
324
|
activePane = null;
|
|
298
325
|
paneElement.style.display = 'none';
|
|
@@ -303,6 +330,43 @@ function toggleDisplayPane(targetId) {
|
|
|
303
330
|
return;
|
|
304
331
|
});
|
|
305
332
|
}
|
|
333
|
+
function renderTagPaneContent() {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
const tags = getMpTags();
|
|
336
|
+
// log.info("_currentSandboxId ", _currentSandboxId)
|
|
337
|
+
// if (_currentSandboxId) {
|
|
338
|
+
// const tagIds = tags.map(tag => tag.json_data.id)
|
|
339
|
+
// await attachSandbox({sandboxId:_currentSandboxId,tagIds})
|
|
340
|
+
// }
|
|
341
|
+
log.info("tags", tags);
|
|
342
|
+
if ((selectedCategoryFilterId || selectedSubCategoryFilterId) && isTagPaneActive) {
|
|
343
|
+
log.info("1 content", tags);
|
|
344
|
+
setTagPaneActive(true);
|
|
345
|
+
setCurrentTagPaneMode(TAG_TYPE.MP);
|
|
346
|
+
renderTags(filterTagList(tags));
|
|
347
|
+
}
|
|
348
|
+
else if (tags.length > 0 && isTagPaneActive) {
|
|
349
|
+
log.info("2 content", tags);
|
|
350
|
+
setTagPaneActive(true);
|
|
351
|
+
setCurrentTagPaneMode(TAG_TYPE.MP);
|
|
352
|
+
renderTags(tags, true);
|
|
353
|
+
}
|
|
354
|
+
else if (!isTagPaneActive) {
|
|
355
|
+
log.info("3 content", tags);
|
|
356
|
+
setTagPaneActive(false);
|
|
357
|
+
setCurrentTagPaneMode(TAG_TYPE.IOT);
|
|
358
|
+
renderTags(filterIotTagList(tags));
|
|
359
|
+
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_TAG_ICON, { payload: 'hello from library' });
|
|
360
|
+
}
|
|
361
|
+
if ((_tagCategories === null || _tagCategories === void 0 ? void 0 : _tagCategories.length) > 0) {
|
|
362
|
+
log.info("Has categories");
|
|
363
|
+
renderCategoryDropdownOptions('at-category-filter-options', _tagCategories, 'at-category-filter-dropdown-toggle');
|
|
364
|
+
}
|
|
365
|
+
if (tags.length > 0) {
|
|
366
|
+
searchTagList(tags);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
306
370
|
function toggleActionBar(state) {
|
|
307
371
|
log.info('toggleActionBar()');
|
|
308
372
|
if (actionBar.offsetWidth == 0 && state === 'show') {
|
|
@@ -446,6 +510,12 @@ function setupIndividualEventListeners() {
|
|
|
446
510
|
handleCloseCustomMinimap();
|
|
447
511
|
handleCustomMapControls();
|
|
448
512
|
handleCloseActiveMinimap();
|
|
513
|
+
handleIoTCategoryDropdown();
|
|
514
|
+
handleIoTDeviceDropdown();
|
|
515
|
+
handleSelectedIoTLinkedSystem();
|
|
516
|
+
handlePlaceIotTag();
|
|
517
|
+
handleIotFormClose();
|
|
518
|
+
handleIotFormSave();
|
|
449
519
|
handleEndUserSession();
|
|
450
520
|
handleUserCardContainer();
|
|
451
521
|
handleLeaveSessionClick();
|
|
@@ -730,7 +800,7 @@ function handlePlaceTag() {
|
|
|
730
800
|
moveTag(iTag.id, onTagPlaced);
|
|
731
801
|
function onTagPlaced() {
|
|
732
802
|
return __awaiter(this, void 0, void 0, function* () {
|
|
733
|
-
log.info("tag placed");
|
|
803
|
+
log.info("tag placed", iTag);
|
|
734
804
|
const tagContainer = document.getElementById('at-tag-list-container');
|
|
735
805
|
const row = renderTagRow(iTag, targetIconUrl);
|
|
736
806
|
tagContainer.appendChild(row);
|
|
@@ -1433,6 +1503,7 @@ function setupSpaceEventSubscriptions() {
|
|
|
1433
1503
|
subscribeSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, handleDrawHistory);
|
|
1434
1504
|
subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOADED, handleCustomMapFloorImageUploaded);
|
|
1435
1505
|
subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOAD_FAILED, handleCustomMapFloorUploadFailed);
|
|
1506
|
+
subscribeSpaceEvent(SPACE_EVENTS.TAG_SANDBOX_REGISTERED, handleSandboxRegistered);
|
|
1436
1507
|
subscribeSpaceEvent(SPACE_EVENTS.PATH_UPDATED, handlePathUpdated),
|
|
1437
1508
|
subscribeSpaceEvent(SPACE_EVENTS.PARTITION_COLLIDER_CLICKED, handlePartitionColiderClickSelected),
|
|
1438
1509
|
subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_USERS_UPDATE, handleScreenShareUsersUpdated);
|
|
@@ -1452,7 +1523,7 @@ function handlePartitionColiderClickSelected(payload) {
|
|
|
1452
1523
|
}
|
|
1453
1524
|
if (polygonName.includes('window')) {
|
|
1454
1525
|
const index = polygonName.split('_')[1].split('-')[1];
|
|
1455
|
-
|
|
1526
|
+
highlightSelectedWindow(polygonId, index);
|
|
1456
1527
|
}
|
|
1457
1528
|
if (polygonName.includes('wall') || polygonName.includes('floor')) {
|
|
1458
1529
|
highlightSelectedPartitionChild(polygonId, payload.collider.name);
|
|
@@ -1787,6 +1858,9 @@ function handlePartitionVisibility(targetId) {
|
|
|
1787
1858
|
console.log("__@ containerId:", containerId);
|
|
1788
1859
|
const objectId = Number.parseInt(targetId);
|
|
1789
1860
|
const isVisible = visibilityBtn.classList.contains('mdi-eye-off');
|
|
1861
|
+
const partitionContainer = document.getElementById(containerId);
|
|
1862
|
+
const visibilityIcons = partitionContainer === null || partitionContainer === void 0 ? void 0 : partitionContainer.querySelectorAll('.mdi-eye, .mdi-eye-off');
|
|
1863
|
+
const iconsArray = Array.from(visibilityIcons || []);
|
|
1790
1864
|
// Toggle visibility icon
|
|
1791
1865
|
toggleVisibilityState(visibilityBtn, isVisible);
|
|
1792
1866
|
const updatePartitionVisibility = (targetObject) => {
|
|
@@ -1838,11 +1912,8 @@ function handlePartitionVisibility(targetId) {
|
|
|
1838
1912
|
updateRoomVisibilityUI(parentId, isVisible);
|
|
1839
1913
|
}
|
|
1840
1914
|
// Update child elements visibility icons
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (childIcon) {
|
|
1844
|
-
toggleVisibilityState(childIcon, isVisible);
|
|
1845
|
-
}
|
|
1915
|
+
iconsArray.forEach(icon => {
|
|
1916
|
+
toggleVisibilityState(icon, isVisible);
|
|
1846
1917
|
});
|
|
1847
1918
|
// Get target partition
|
|
1848
1919
|
let thisPartition = null;
|
|
@@ -2104,9 +2175,25 @@ function handleSavePartition() {
|
|
|
2104
2175
|
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: partitionEditPayload });
|
|
2105
2176
|
break;
|
|
2106
2177
|
}
|
|
2178
|
+
const currentRoomData = getCurrentEditRoomData();
|
|
2179
|
+
if (currentRoomData) {
|
|
2180
|
+
let objects = get3DXObjects();
|
|
2181
|
+
const partitionsUUIDs = currentRoomData.children.map(child => child.uuid);
|
|
2182
|
+
if (objects) {
|
|
2183
|
+
objects.map((obj, index) => {
|
|
2184
|
+
if (partitionsUUIDs.includes(obj.object.object_data.uuid)) {
|
|
2185
|
+
if (obj.children) {
|
|
2186
|
+
obj.children = [];
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
set3DXObjects(objects);
|
|
2192
|
+
}
|
|
2107
2193
|
clearTempCurrentPolygon();
|
|
2108
2194
|
clearSelectedObject();
|
|
2109
2195
|
clearFloorBaseHeight();
|
|
2196
|
+
setTempCurrentRoomEditData(null);
|
|
2110
2197
|
notyf.success(`${i18n.t('SuccessRoomSaved')}`);
|
|
2111
2198
|
});
|
|
2112
2199
|
}
|
|
@@ -2147,64 +2234,98 @@ function handleDeletePartition(targetId) {
|
|
|
2147
2234
|
}
|
|
2148
2235
|
function handleCancelPartition() {
|
|
2149
2236
|
const cancelRoomBtn = document.getElementById('at-cancel-room-form-btn');
|
|
2150
|
-
cancelRoomBtn.addEventListener('click', () => {
|
|
2151
|
-
|
|
2237
|
+
cancelRoomBtn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
2238
|
+
const isDrawing = getIsDrawing();
|
|
2239
|
+
const drawMode = getDrawingMode();
|
|
2240
|
+
if (isDrawing) {
|
|
2241
|
+
if (drawMode == 'partition') {
|
|
2242
|
+
toggleDrawPartitionButton();
|
|
2243
|
+
}
|
|
2244
|
+
else if (drawMode == 'window') {
|
|
2245
|
+
toggleDrawWindowButton();
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
// delete newly added partition
|
|
2249
|
+
const newlyAddedPartition = getNewlyAddedPartition();
|
|
2250
|
+
newlyAddedPartition.map((partition) => __awaiter(this, void 0, void 0, function* () {
|
|
2251
|
+
// update room tree
|
|
2252
|
+
const filteredRoomNodes = _partitionNodes.map((roomNode) => {
|
|
2253
|
+
if (!roomNode.children)
|
|
2254
|
+
return roomNode;
|
|
2255
|
+
return Object.assign(Object.assign({}, roomNode), { children: roomNode.children.filter((child) => child.uuid !== partition.uuid) });
|
|
2256
|
+
}).filter((roomNode) => !roomNode.children || roomNode.children.length > 0);
|
|
2257
|
+
log.info("filteredRoomNodes", filteredRoomNodes);
|
|
2258
|
+
// set node to update room tree
|
|
2259
|
+
yield setSpacePartitionNodes(filteredRoomNodes);
|
|
2260
|
+
// delete the object in the space
|
|
2152
2261
|
const target = _3DXObjects.find(obj => obj.object.object_data.uuid === partition.uuid);
|
|
2153
2262
|
yield disposeModel(target);
|
|
2263
|
+
// delete partition (object) in the db
|
|
2154
2264
|
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_DISPOSED, partition);
|
|
2155
|
-
const filteredRoomNodes = _partitionNodes.map((roomNode) => {
|
|
2156
|
-
// Filter children based on partitionUuid if children exist
|
|
2157
|
-
if (roomNode.children) {
|
|
2158
|
-
return Object.assign(Object.assign({}, roomNode), { children: roomNode.children.filter((child) => child.uuid !== partition.uuid) });
|
|
2159
|
-
}
|
|
2160
|
-
});
|
|
2161
|
-
setSpacePartitionNodes(filteredRoomNodes);
|
|
2162
2265
|
}));
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
if (currentPartitionData) {
|
|
2266
|
+
const currentRoomData = getCurrentEditRoomData();
|
|
2267
|
+
log.info("currentRoomData", currentRoomData);
|
|
2268
|
+
if (currentRoomData) {
|
|
2167
2269
|
let partitionsUUIDs = [];
|
|
2168
|
-
|
|
2169
|
-
const
|
|
2170
|
-
log.info("
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
yield disposeModel(win);
|
|
2270
|
+
const objects = get3DXObjects();
|
|
2271
|
+
const roomArray = getRoomData();
|
|
2272
|
+
log.info("objects", objects);
|
|
2273
|
+
partitionsUUIDs = currentRoomData.children.map(child => child.uuid);
|
|
2274
|
+
log.info("partitionsUUIDs", partitionsUUIDs);
|
|
2275
|
+
if (objects) {
|
|
2276
|
+
let isWindowRemoved = false;
|
|
2277
|
+
objects.map((obj, index) => {
|
|
2278
|
+
if (partitionsUUIDs.includes(obj.object.object_data.uuid)) {
|
|
2279
|
+
const currentPartition = currentRoomData.children.find(child => child.uuid == obj.object.object_data.uuid);
|
|
2280
|
+
const polyJson = typeof currentPartition.polygon_json === 'string' ? JSON.parse(currentPartition.polygon_json) : currentPartition.polygon_json;
|
|
2281
|
+
log.info("polyJson", polyJson);
|
|
2282
|
+
if (obj.children) {
|
|
2283
|
+
obj.children.map((win) => __awaiter(this, void 0, void 0, function* () {
|
|
2284
|
+
log.info("window", win);
|
|
2285
|
+
// await disposeModel(win as IObjectData)
|
|
2185
2286
|
// Find the wall that owns this window
|
|
2186
2287
|
const wall = polyJson.walls.find(wall => wall.uuid === win.wallUUID);
|
|
2187
2288
|
if (wall && wall.windows) {
|
|
2188
2289
|
// Remove this specific window (by its index) from that wall
|
|
2189
2290
|
wall.windows = wall.windows.filter(w => w.index !== win.index);
|
|
2190
2291
|
log.info(`Removed window ${win.index} from wall ${wall.uuid}`);
|
|
2292
|
+
isWindowRemoved = true;
|
|
2191
2293
|
}
|
|
2192
2294
|
}));
|
|
2295
|
+
obj.children = [];
|
|
2193
2296
|
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2297
|
+
if (polyJson && polyJson.path) {
|
|
2298
|
+
const payload = {
|
|
2299
|
+
uuid: currentPartition.uuid,
|
|
2300
|
+
polygon_json: polyJson
|
|
2301
|
+
};
|
|
2302
|
+
renderPolygon(payload);
|
|
2303
|
+
//@ts-ignore
|
|
2304
|
+
payload.polygon_json = JSON.stringify(polyJson);
|
|
2305
|
+
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: payload });
|
|
2306
|
+
// Update currentRoomData polygon for this partition
|
|
2307
|
+
currentPartition.polygon_json = JSON.stringify(polyJson);
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
});
|
|
2311
|
+
set3DXObjects(objects);
|
|
2312
|
+
if (isWindowRemoved) {
|
|
2313
|
+
// Update the current room in the roomArray
|
|
2314
|
+
const roomIndex = roomArray.findIndex(room => room.uuid === currentRoomData.uuid);
|
|
2315
|
+
if (roomIndex !== -1) {
|
|
2316
|
+
roomArray[roomIndex] = currentRoomData;
|
|
2317
|
+
// setRoomData(roomArray)
|
|
2318
|
+
log.info("roomArray updated for currentRoomData", roomArray[roomIndex]);
|
|
2201
2319
|
}
|
|
2320
|
+
//Update Room Tree
|
|
2321
|
+
yield setSpacePartitionNodes(roomArray);
|
|
2202
2322
|
}
|
|
2203
2323
|
}
|
|
2204
2324
|
}
|
|
2205
2325
|
else {
|
|
2206
|
-
log.warn('
|
|
2326
|
+
log.warn('currentRoomData is undefined');
|
|
2207
2327
|
}
|
|
2328
|
+
clearWallBaseHeight();
|
|
2208
2329
|
clearTempCurrentPolygon();
|
|
2209
2330
|
clearPartitionForm();
|
|
2210
2331
|
clearSelectedObject();
|
|
@@ -2215,7 +2336,7 @@ function handleCancelPartition() {
|
|
|
2215
2336
|
undoDrawActions: [],
|
|
2216
2337
|
};
|
|
2217
2338
|
handleDrawHistory(drawHistory);
|
|
2218
|
-
});
|
|
2339
|
+
}));
|
|
2219
2340
|
}
|
|
2220
2341
|
/**
|
|
2221
2342
|
* Handles updating the room tree.
|
|
@@ -3087,15 +3208,26 @@ function handleClearSearchTagName() {
|
|
|
3087
3208
|
if (searchTagName) {
|
|
3088
3209
|
searchTagName.addEventListener('click', () => {
|
|
3089
3210
|
searchClearfield();
|
|
3090
|
-
|
|
3211
|
+
// commented out due to iot Dummy Data
|
|
3212
|
+
// const tags = getMpTags()
|
|
3213
|
+
const tags = [..._tags];
|
|
3091
3214
|
const filteredTags = filterTagList(tags);
|
|
3092
|
-
if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
|
|
3093
|
-
const
|
|
3094
|
-
renderTags(
|
|
3095
|
-
}
|
|
3096
|
-
else if (tags.length > 0) {
|
|
3097
|
-
|
|
3098
|
-
|
|
3215
|
+
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3216
|
+
const filteredTags = filterTagList(tags);
|
|
3217
|
+
renderTags(filteredTags);
|
|
3218
|
+
}
|
|
3219
|
+
else if (tags.length > 0 && isTagPaneActive) {
|
|
3220
|
+
renderTags(tags, true);
|
|
3221
|
+
}
|
|
3222
|
+
else if (!isTagPaneActive) {
|
|
3223
|
+
const filteredIotTags = filterIotTagList(tags);
|
|
3224
|
+
renderTags(filteredIotTags);
|
|
3225
|
+
// if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
|
|
3226
|
+
// const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
|
|
3227
|
+
// renderTags(sortedTags)
|
|
3228
|
+
// } else if (tags.length > 0) {
|
|
3229
|
+
// const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
|
|
3230
|
+
// renderTags(sortedTags,true)
|
|
3099
3231
|
}
|
|
3100
3232
|
});
|
|
3101
3233
|
}
|
|
@@ -3112,8 +3244,17 @@ function handleSearchFromTagListButton() {
|
|
|
3112
3244
|
setSearchTagTerm(tagSearch);
|
|
3113
3245
|
const foundTag = filterTagList(tags);
|
|
3114
3246
|
if (foundTag) {
|
|
3115
|
-
|
|
3116
|
-
|
|
3247
|
+
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3248
|
+
const filteredTags = filterTagList(foundTag);
|
|
3249
|
+
renderTags(filteredTags);
|
|
3250
|
+
}
|
|
3251
|
+
else if (foundTag.length > 0 && isTagPaneActive) {
|
|
3252
|
+
renderTags(foundTag, true);
|
|
3253
|
+
}
|
|
3254
|
+
else if (!isTagPaneActive) {
|
|
3255
|
+
const filteredIotTags = filterIotTagList(foundTag);
|
|
3256
|
+
renderTags(filteredIotTags);
|
|
3257
|
+
}
|
|
3117
3258
|
}
|
|
3118
3259
|
}
|
|
3119
3260
|
});
|
|
@@ -3147,6 +3288,10 @@ function handleCustomMapFloorImageUploaded(payload) {
|
|
|
3147
3288
|
function handleCustomMapFloorUploadFailed() {
|
|
3148
3289
|
notyf.error("Failed to upload custom floor image. Please try again later");
|
|
3149
3290
|
}
|
|
3291
|
+
function handleSandboxRegistered(payload) {
|
|
3292
|
+
log.info("handleSandboxRegistered _currentSandboxId", payload);
|
|
3293
|
+
_currentSandboxId = payload.sandboxId;
|
|
3294
|
+
}
|
|
3150
3295
|
function handleUploadMinimapImage() {
|
|
3151
3296
|
log.info('handleUploadMinimapImage()');
|
|
3152
3297
|
const uploadImageBtn = document.getElementById('at-custom-upload-image-btn');
|
|
@@ -3237,6 +3382,385 @@ function handleCloseActiveMinimap() {
|
|
|
3237
3382
|
});
|
|
3238
3383
|
}
|
|
3239
3384
|
}
|
|
3385
|
+
function handleIoTCategoryDropdown() {
|
|
3386
|
+
const iotCateogryDropdown = document.getElementById('at-iot-cat-filter-dropdown');
|
|
3387
|
+
if (iotCateogryDropdown) {
|
|
3388
|
+
toggleIoTCategoryOptions();
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
function handleIoTDeviceDropdown() {
|
|
3392
|
+
const iotDeviceDropdown = document.getElementById('at-iot-cat-filter-dropdown');
|
|
3393
|
+
if (iotDeviceDropdown) {
|
|
3394
|
+
toggleIoTDevicesOptions();
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
function handleSelectedIoTLinkedSystem() {
|
|
3398
|
+
document.querySelectorAll('input[name="iot-link-system"]').forEach(input => {
|
|
3399
|
+
input.addEventListener('change', (event) => {
|
|
3400
|
+
const target = event.target;
|
|
3401
|
+
if (target.value) {
|
|
3402
|
+
setSelectedIoTSystemRadio(target.value);
|
|
3403
|
+
}
|
|
3404
|
+
});
|
|
3405
|
+
});
|
|
3406
|
+
}
|
|
3407
|
+
function handlePlaceIotTag() {
|
|
3408
|
+
log.info('handlePlaceIotTag()');
|
|
3409
|
+
const moveIotTag = document.getElementById('at-iot-move-btn');
|
|
3410
|
+
const initTagData = {
|
|
3411
|
+
id: '',
|
|
3412
|
+
label: '',
|
|
3413
|
+
description: '',
|
|
3414
|
+
anchorPosition: {
|
|
3415
|
+
x: 0, y: 0, z: 0,
|
|
3416
|
+
},
|
|
3417
|
+
color: {
|
|
3418
|
+
r: 0,
|
|
3419
|
+
g: 0,
|
|
3420
|
+
b: 1,
|
|
3421
|
+
},
|
|
3422
|
+
stemVector: {
|
|
3423
|
+
x: 0,
|
|
3424
|
+
y: 0.30,
|
|
3425
|
+
z: 0
|
|
3426
|
+
},
|
|
3427
|
+
stemVisible: true,
|
|
3428
|
+
};
|
|
3429
|
+
moveIotTag.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
3430
|
+
log.info('move button is clicked');
|
|
3431
|
+
if (isPlacingTag) {
|
|
3432
|
+
notyf.open({
|
|
3433
|
+
type: 'info',
|
|
3434
|
+
message: `${i18n.t('PleaseWaitTagPlacement')}`
|
|
3435
|
+
});
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
isPlacingTag = true;
|
|
3439
|
+
const tag = Object.assign({}, initTagData);
|
|
3440
|
+
const payload = getIotTagFormData();
|
|
3441
|
+
log.info('@caroline getIotTagFormData', payload);
|
|
3442
|
+
if (!cancelTagPlacementPrompt) {
|
|
3443
|
+
cancelTagPlacementPrompt = document.getElementById('at-cancel-tag-placement-prompt');
|
|
3444
|
+
}
|
|
3445
|
+
cancelTagPlacementPrompt.style.display = 'block';
|
|
3446
|
+
if (iotTagFormMode == "ADD" /* FORM_MODE.ADD */) {
|
|
3447
|
+
log.info('handlePlaceIotTag() Add Mode');
|
|
3448
|
+
if (_tagIotCategoryTypes) {
|
|
3449
|
+
log.info('@caroline iotTagForm Data: ', payload);
|
|
3450
|
+
const targetIotCategory = _tagIotCategoryTypes.find(cat => cat.name == payload.tagCategoryId);
|
|
3451
|
+
if (payload && payload.name && payload.tagCategoryId) {
|
|
3452
|
+
tag.label = payload.name;
|
|
3453
|
+
if (targetIotCategory) {
|
|
3454
|
+
log.info('@caroline Target Category is: ', targetIotCategory, iTag);
|
|
3455
|
+
}
|
|
3456
|
+
log.info("tag1", tag);
|
|
3457
|
+
if (iTag == null) {
|
|
3458
|
+
iTag = yield renderTag({ tag: tag }, true);
|
|
3459
|
+
}
|
|
3460
|
+
moveTag(iTag.id, onIotTagPlaced);
|
|
3461
|
+
function onIotTagPlaced() {
|
|
3462
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3463
|
+
log.info('Iot Tag Placed', iTag);
|
|
3464
|
+
const iotTagContainer = document.getElementById('at-tag-list-container');
|
|
3465
|
+
const row = renderTagRow(iTag, '');
|
|
3466
|
+
iotTagContainer.appendChild(row);
|
|
3467
|
+
addClickEventToTagRow(iTag);
|
|
3468
|
+
notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
|
|
3469
|
+
handleMobilePlaceTag();
|
|
3470
|
+
const tags = getMpTags();
|
|
3471
|
+
currentTag = _tags[tags.length - 1];
|
|
3472
|
+
_tags[tags.length - 1].category_uuid = payload.tagCategoryId;
|
|
3473
|
+
cancelTagPlacementPrompt.style.display = 'none';
|
|
3474
|
+
isPlacingTag = false;
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
else {
|
|
3479
|
+
notyf.error(`${i18n.t('RequiredFieldsEmpty')}`);
|
|
3480
|
+
isPlacingTag = false;
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
else {
|
|
3484
|
+
if (payload && payload.name) {
|
|
3485
|
+
tag.label = payload.name;
|
|
3486
|
+
log.info("tag123", tag);
|
|
3487
|
+
const iTag = yield renderTag({ tag: tag }, true);
|
|
3488
|
+
moveTag(iTag.id, onIotTagPlaced);
|
|
3489
|
+
function onIotTagPlaced() {
|
|
3490
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3491
|
+
log.info('Iot Tag Placed', iTag);
|
|
3492
|
+
const iotTagContainer = document.getElementById('at-tag-list-container');
|
|
3493
|
+
const row = renderTagRow(iTag, '');
|
|
3494
|
+
iotTagContainer.appendChild(row);
|
|
3495
|
+
addClickEventToTagRow(iTag);
|
|
3496
|
+
notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
|
|
3497
|
+
const tags = getMpTags();
|
|
3498
|
+
currentTag = tags[tags.length - 1];
|
|
3499
|
+
log.info("Last IoT Tag Pushed", tags[tags.length - 1]);
|
|
3500
|
+
cancelTagPlacementPrompt.style.display = 'none';
|
|
3501
|
+
isPlacingTag = false;
|
|
3502
|
+
handleMobilePlaceTag();
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
else {
|
|
3507
|
+
notyf.error(`${i18n.t('RequiredFieldsEmpty')}`);
|
|
3508
|
+
isPlacingTag = false;
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
else if (iotTagFormMode == "EDIT" /* FORM_MODE.EDIT */) {
|
|
3513
|
+
log.info('handlePlaceIotTag() Edit Mode');
|
|
3514
|
+
const iTag = selectedIotTag;
|
|
3515
|
+
log.info('iotTag', iTag);
|
|
3516
|
+
moveTag(iTag.json_data.id, onTagPlaced);
|
|
3517
|
+
function onTagPlaced() {
|
|
3518
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3519
|
+
log.info('Iiot tag placed');
|
|
3520
|
+
const iotTagContainer = document.getElementById('at-tag-list-container');
|
|
3521
|
+
const row = renderTagRow(iTag, '');
|
|
3522
|
+
iotTagContainer.appendChild(row);
|
|
3523
|
+
addClickEventToTagRow(iTag);
|
|
3524
|
+
notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
|
|
3525
|
+
const tags = getMpTags();
|
|
3526
|
+
currentTag = tags[tags.length - 1];
|
|
3527
|
+
// renderTags(tags)
|
|
3528
|
+
log.info("Last IoT Tag Pushe", tags[tags.length - 1]);
|
|
3529
|
+
cancelTagPlacementPrompt.style.display = 'none';
|
|
3530
|
+
isPlacingTag = false;
|
|
3531
|
+
});
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
else {
|
|
3535
|
+
notyf.error(`${i18n.t('RequiredFieldsEmpty')}`);
|
|
3536
|
+
isPlacingTag = false;
|
|
3537
|
+
}
|
|
3538
|
+
}));
|
|
3539
|
+
}
|
|
3540
|
+
function handleHideElement(id) {
|
|
3541
|
+
const element = document.getElementById(id);
|
|
3542
|
+
if (!element) {
|
|
3543
|
+
log.error(`Element with ID "${id}" not found.`);
|
|
3544
|
+
return;
|
|
3545
|
+
}
|
|
3546
|
+
element.style.display = 'none';
|
|
3547
|
+
}
|
|
3548
|
+
function handleDisplayElement(id, value = "flex") {
|
|
3549
|
+
const element = document.getElementById(id);
|
|
3550
|
+
if (!element) {
|
|
3551
|
+
log.error(`Element with ID "${id}" not found.`);
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
element.style.display = value;
|
|
3555
|
+
}
|
|
3556
|
+
function handleDisplayElements(id) {
|
|
3557
|
+
log.info("handleDisplayElements()", id);
|
|
3558
|
+
const title = document.getElementById('at-tag-list-title');
|
|
3559
|
+
const addTagButton = document.getElementById('at-add-tag-btn');
|
|
3560
|
+
const tableContainer = document.getElementById('at-tag-list-scrollable-container');
|
|
3561
|
+
switch (id) {
|
|
3562
|
+
case 'at-tag-iot-btn':
|
|
3563
|
+
// change pane height
|
|
3564
|
+
tableContainer.classList.replace('at_h-min-45', 'at_h-min-64');
|
|
3565
|
+
// title to Iot Tag
|
|
3566
|
+
title.innerText = `${i18n.t('IoTTags')}`;
|
|
3567
|
+
// add iot tag button to navigate to iot form pane
|
|
3568
|
+
addTagButton.setAttribute('target-pane', 'at-tag-iot-form-pane');
|
|
3569
|
+
addTagButton.innerHTML = `${i18n.t('AddIoTTag')}
|
|
3570
|
+
<span class="mdi mdi-plus-circle-outline" id="at-add-tag-btn"></span>
|
|
3571
|
+
`;
|
|
3572
|
+
// hide dropdown sub/categories
|
|
3573
|
+
handleHideElement('at-custom-category-filter-dropdown-container');
|
|
3574
|
+
handleHideElement('at-custom-subcategory-filter-dropdown-container');
|
|
3575
|
+
break;
|
|
3576
|
+
case 'at-expand-btn':
|
|
3577
|
+
// changep ane height
|
|
3578
|
+
tableContainer.classList.replace('at_h-min-64', 'at_h-min-45');
|
|
3579
|
+
// title to Tag
|
|
3580
|
+
title.innerText = `${i18n.t('Tags')}`;
|
|
3581
|
+
// add tag button to navigate to tag form pane
|
|
3582
|
+
addTagButton.setAttribute('target-pane', 'at-tag-form-pane');
|
|
3583
|
+
addTagButton.innerHTML = `
|
|
3584
|
+
${i18n.t('AddTag')}
|
|
3585
|
+
<span class="mdi mdi-plus-circle-outline" id="at-add-tag-btn"></span>
|
|
3586
|
+
`;
|
|
3587
|
+
handleDisplayElement('at-custom-category-filter-dropdown-container');
|
|
3588
|
+
handleDisplayElement('at-custom-subcategory-filter-dropdown-container');
|
|
3589
|
+
break;
|
|
3590
|
+
default:
|
|
3591
|
+
break;
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
// Cancels placed Tags when Esc is pressed
|
|
3595
|
+
// Moves User to IoT List when clicking Close
|
|
3596
|
+
function handleIotFormClose() {
|
|
3597
|
+
log.info('handleIotFormClose()');
|
|
3598
|
+
const cancelIotForm = document.getElementById('at-cancel-iot-tag-form-btn');
|
|
3599
|
+
if (cancelIotForm) {
|
|
3600
|
+
cancelIotForm.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
3601
|
+
if (iotTagFormMode === "ADD" /* FORM_MODE.ADD */) {
|
|
3602
|
+
yield onDisposeTag();
|
|
3603
|
+
clearIoTDropdowns();
|
|
3604
|
+
clearIotFields();
|
|
3605
|
+
currentTag = undefined;
|
|
3606
|
+
yield toggleDisplayPane('at-cancel-iot-tag-form-btn');
|
|
3607
|
+
}
|
|
3608
|
+
else {
|
|
3609
|
+
clearIoTDropdowns();
|
|
3610
|
+
clearIotFields();
|
|
3611
|
+
currentTag = undefined;
|
|
3612
|
+
yield toggleDisplayPane('at-cancel-iot-tag-form-btn');
|
|
3613
|
+
}
|
|
3614
|
+
}));
|
|
3615
|
+
}
|
|
3616
|
+
document.addEventListener('keydown', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
3617
|
+
if (event.key == 'Escape') {
|
|
3618
|
+
if (iTag !== null || iotTagFormMode === "EDIT" /* FORM_MODE.EDIT */) {
|
|
3619
|
+
currentTag = undefined;
|
|
3620
|
+
yield onDisposeTag();
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}));
|
|
3624
|
+
}
|
|
3625
|
+
// Saves IoT-Tag
|
|
3626
|
+
function handleIotFormSave() {
|
|
3627
|
+
log.info('handleIotFormSave()');
|
|
3628
|
+
const iotSave = document.getElementById('at-save-iot-btn');
|
|
3629
|
+
if (iotSave) {
|
|
3630
|
+
iotSave.addEventListener('click', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
3631
|
+
var _a, _b;
|
|
3632
|
+
log.info('@caroline saving iot');
|
|
3633
|
+
let iotTagFormPayload = getIotTagFormData();
|
|
3634
|
+
const selectedCat = getIotCategoryOption();
|
|
3635
|
+
log.info('@caroline iotTagFormPayload: ', iotTagFormPayload, iotTagFormMode);
|
|
3636
|
+
iotSave.classList.add('at_disabled');
|
|
3637
|
+
if (iotTagFormPayload && iotTagFormMode == "ADD" /* FORM_MODE.ADD */) {
|
|
3638
|
+
log.info('@caroline saving IOT, Add Mode');
|
|
3639
|
+
currentTag.json_data.label = iotTagFormPayload.name;
|
|
3640
|
+
log.info('@caroline current Tag: ', currentTag);
|
|
3641
|
+
if (!currentTag.iot_tag) {
|
|
3642
|
+
currentTag.iot_tag = {};
|
|
3643
|
+
}
|
|
3644
|
+
// validates url
|
|
3645
|
+
// if (iotTagFormPayload.tagMf && !iotTagFormPayload.systemLink && await isValidUrl(iotTagFormPayload.tagMf)) {
|
|
3646
|
+
// log.info('iotTagpayload Manufacturer Link URL is valid')
|
|
3647
|
+
// } else if (iotTagFormPayload.systemLink && ! iotTagFormPayload.tagMf && await isValidUrl(iotTagFormPayload.systemLink)) {
|
|
3648
|
+
// log.info('iotTagpayload systemlLink URL is valid')
|
|
3649
|
+
// } else if ((iotTagFormPayload.systemLink && iotTagFormPayload.tagMf) && (await isValidUrl(iotTagFormPayload.systemLink) && (await isValidUrl(iotTagFormPayload.tagMf)))) {
|
|
3650
|
+
// log.info('iotTagpayload Manufacturer and systemlLink URL are valid')
|
|
3651
|
+
// } else {
|
|
3652
|
+
// notyf.error(`${i18n.t('InvalidURL')}`)
|
|
3653
|
+
// iotSave.classList.remove('at_disabled')
|
|
3654
|
+
// return
|
|
3655
|
+
// }
|
|
3656
|
+
currentTag.iot_tag.linked_system = iotTagFormPayload.iotSystem;
|
|
3657
|
+
currentTag.iot_tag.serial_number = iotTagFormPayload.serialNumber;
|
|
3658
|
+
currentTag.iot_tag.manufacturer_site = iotTagFormPayload.tagMf;
|
|
3659
|
+
currentTag.iot_tag.system_link = iotTagFormPayload.systemLink;
|
|
3660
|
+
// currentTag.iot_tag.iot_category = selectedCat.json_data.icon.split('.')[0]
|
|
3661
|
+
currentTag.iot_tag.iot_category = iotTagFormPayload.tagCategoryId;
|
|
3662
|
+
currentTag.iot_tag.linked_devices = iotTagFormPayload.linkedDevices;
|
|
3663
|
+
currentTag.iot_tag.model_name = iotTagFormPayload.modelName;
|
|
3664
|
+
currentTag.tag_type = TAG_TYPE.IOT;
|
|
3665
|
+
const icons = getIoTDeviceTagIcons();
|
|
3666
|
+
let iconUrl = icons.normal;
|
|
3667
|
+
let iconName = "normal.png";
|
|
3668
|
+
let color = { r: 0.3, g: 0.5, b: 1.0 }; // default soft royal blue
|
|
3669
|
+
for (const device of iotTagFormPayload.linkedDevices) {
|
|
3670
|
+
if (!device)
|
|
3671
|
+
continue;
|
|
3672
|
+
const { quality, status } = device;
|
|
3673
|
+
// If any device is offline, override color to gray and stop checking further
|
|
3674
|
+
if (status === "offline") {
|
|
3675
|
+
iconUrl = icons.normal;
|
|
3676
|
+
iconName = "normal.png";
|
|
3677
|
+
color = useHexToRgb("667c89"); // gray
|
|
3678
|
+
break;
|
|
3679
|
+
}
|
|
3680
|
+
// If any device is alert (highest priority), set red and stop
|
|
3681
|
+
if (quality === 2) {
|
|
3682
|
+
iconUrl = icons.alert;
|
|
3683
|
+
iconName = "alert.png";
|
|
3684
|
+
color = { r: 1, g: 0, b: 0 }; // red
|
|
3685
|
+
break;
|
|
3686
|
+
}
|
|
3687
|
+
// If any device is attention, set orange but keep checking in case of alert
|
|
3688
|
+
if (quality === 3) {
|
|
3689
|
+
iconUrl = icons.alert;
|
|
3690
|
+
iconName = "normal.png";
|
|
3691
|
+
color = useHexToRgb("ffae42"); // orange
|
|
3692
|
+
// continue loop to see if alert is present
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
currentTag.tag_icon_url = iconUrl;
|
|
3696
|
+
currentTag.tag_icon_name = iconName;
|
|
3697
|
+
currentTag.json_data.color = color;
|
|
3698
|
+
currentTag.tag_icon_base64 = selectedCat.json_data.iconBase64;
|
|
3699
|
+
let payload = { tag: currentTag };
|
|
3700
|
+
console.log("@caroline handleIotFormSave payload ", payload);
|
|
3701
|
+
yield setTagIcon({ tag: currentTag.json_data, iconName: (_a = selectedCat.json_data.icon) !== null && _a !== void 0 ? _a : '', iconUrl: selectedCat.json_data.iconBase64, color: currentTag.json_data.color });
|
|
3702
|
+
dispatchSpaceEvent(SPACE_EVENTS.IOT_TAG_SAVED, payload);
|
|
3703
|
+
iotSave.classList.remove('at_disabled');
|
|
3704
|
+
clearIoTDropdowns();
|
|
3705
|
+
clearIotFields();
|
|
3706
|
+
isPlacingTag = false;
|
|
3707
|
+
iotTagFormPayload = {};
|
|
3708
|
+
currentTag = undefined;
|
|
3709
|
+
yield toggleDisplayPane('at-cancel-iot-tag-form-btn');
|
|
3710
|
+
}
|
|
3711
|
+
else if (iotTagFormPayload && iotTagFormMode == "EDIT" /* FORM_MODE.EDIT */) {
|
|
3712
|
+
log.info('saving IOT, Edit Mode');
|
|
3713
|
+
const index = _tags.findIndex(tag => tag.id == selectedIotTag.id);
|
|
3714
|
+
const tagPayload = getIotTagFormData();
|
|
3715
|
+
const cat = getIotCategoryOption();
|
|
3716
|
+
if (index !== -1) {
|
|
3717
|
+
editTagLabel({ tagId: selectedIotTag.json_data.id, label: tagPayload.name });
|
|
3718
|
+
log.info('@caroline found tag to edit: ', tagPayload, cat);
|
|
3719
|
+
// validates url
|
|
3720
|
+
// if (iotTagFormPayload.tagMf && !iotTagFormPayload.systemLink && await isValidUrl(iotTagFormPayload.tagMf)) {
|
|
3721
|
+
// log.info('iotTagpayload Manufacturer Link URL is valid')
|
|
3722
|
+
// } else if (iotTagFormPayload.systemLink && ! iotTagFormPayload.tagMf && await isValidUrl(iotTagFormPayload.systemLink)) {
|
|
3723
|
+
// log.info('iotTagpayload systemlLink URL is valid')
|
|
3724
|
+
// } else if ((iotTagFormPayload.systemLink && iotTagFormPayload.tagMf) && (await isValidUrl(iotTagFormPayload.systemLink) && (await isValidUrl(iotTagFormPayload.tagMf)))) {
|
|
3725
|
+
// log.info('iotTagpayload Manufacturer and systemlLink URL are valid')
|
|
3726
|
+
// } else {
|
|
3727
|
+
// notyf.error(`${i18n.t('InvalidURL')}`)
|
|
3728
|
+
// iotSave.classList.remove('at_disabled')
|
|
3729
|
+
// return
|
|
3730
|
+
// }
|
|
3731
|
+
_tags[index].tag_name = tagPayload.name,
|
|
3732
|
+
_tags[index].json_data.label = tagPayload.name;
|
|
3733
|
+
_tags[index].uuid = _tags[index].id.toString();
|
|
3734
|
+
if (tagPayload.tagCategoryId != selectedIotTag.category_uuid) {
|
|
3735
|
+
// set icon here
|
|
3736
|
+
}
|
|
3737
|
+
_tags[index].iot_tag.linked_system = iotTagFormPayload.iotSystem;
|
|
3738
|
+
_tags[index].iot_tag.serial_number = iotTagFormPayload.serialNumber;
|
|
3739
|
+
_tags[index].iot_tag.manufacturer_site = iotTagFormPayload.tagMf;
|
|
3740
|
+
_tags[index].iot_tag.system_link = iotTagFormPayload.systemLink;
|
|
3741
|
+
_tags[index].iot_tag.iot_category = iotTagFormPayload.tagCategoryId;
|
|
3742
|
+
_tags[index].iot_tag.linked_devices = iotTagFormPayload.linkedDevices;
|
|
3743
|
+
_tags[index].iot_tag.model_name = iotTagFormPayload.modelName;
|
|
3744
|
+
_tags[index].tag_icon_base64 = selectedCat.json_data.iconBase64;
|
|
3745
|
+
let payload = { tag: _tags[index] };
|
|
3746
|
+
yield setTagIcon({ tag: _tags[index].json_data, iconName: (_b = cat.json_data.icon) !== null && _b !== void 0 ? _b : '', iconUrl: cat.json_data.iconBase64, color: _tags[index].json_data.color });
|
|
3747
|
+
log.info('@caroline iotTagPayload EDIT: ', payload);
|
|
3748
|
+
dispatchSpaceEvent(SPACE_EVENTS.IOT_TAG_SAVED, payload);
|
|
3749
|
+
log.info('@caroline iotTagPayload after splice: ', payload, _tags);
|
|
3750
|
+
// =============== splicing to update Tag
|
|
3751
|
+
currentTag = undefined;
|
|
3752
|
+
isPlacingTag = false;
|
|
3753
|
+
iotTagFormPayload = {};
|
|
3754
|
+
iotSave.classList.remove('at_disabled');
|
|
3755
|
+
clearIoTDropdowns();
|
|
3756
|
+
clearIotFields();
|
|
3757
|
+
yield toggleDisplayPane('at-cancel-iot-tag-form-btn');
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
iTag = null;
|
|
3761
|
+
}));
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3240
3764
|
function handleClickEventInTagSortOption() {
|
|
3241
3765
|
const sortIcon = document.getElementById('at-tag-sort-icon');
|
|
3242
3766
|
let clickListenerAdded = false;
|
|
@@ -3310,38 +3834,36 @@ function handleWindowVisibility(visibilityBtn, updateStateDB, fromParentVisibili
|
|
|
3310
3834
|
const isVisible = fromParentVisibilityState !== undefined ? fromParentVisibilityState : visibilityBtn.classList.toggle('mdi-eye');
|
|
3311
3835
|
toggleVisibilityState(visibilityBtn, isVisible);
|
|
3312
3836
|
toggleMeshChildrenVisibility(component, windowNameAsMeshChild, isVisible);
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
// }
|
|
3344
|
-
// <END_COMMENT> TODO: 16032 - uncomment when polygon loader window visibility update is implemented
|
|
3837
|
+
if (updateStateDB) {
|
|
3838
|
+
const thisPartition = _partitionNodes.flatMap(item => item.children || []).find(child => child.uuid === partitionId);
|
|
3839
|
+
if (!thisPartition) {
|
|
3840
|
+
log.warn('Partition not found');
|
|
3841
|
+
}
|
|
3842
|
+
else {
|
|
3843
|
+
const polygonJson = JSON.parse(thisPartition.polygon_json);
|
|
3844
|
+
const wall = polygonJson.walls.find(item => item.uuid === wallId) || null;
|
|
3845
|
+
const windows = (wall === null || wall === void 0 ? void 0 : wall.windows) || null;
|
|
3846
|
+
windows === null || windows === void 0 ? void 0 : windows.forEach(w => w.options.is_visible = isVisible);
|
|
3847
|
+
const payload = {
|
|
3848
|
+
uuid: thisPartition.uuid,
|
|
3849
|
+
space_uuid: thisPartition.space_uuid,
|
|
3850
|
+
name: thisPartition.name,
|
|
3851
|
+
parent_uuid: thisPartition.parent_uuid,
|
|
3852
|
+
polygon_json: polygonJson
|
|
3853
|
+
};
|
|
3854
|
+
renderPolygon(payload);
|
|
3855
|
+
setTimeout(() => {
|
|
3856
|
+
const updatedPolygonJson = getCurrentPolygonData();
|
|
3857
|
+
if (updatedPolygonJson) {
|
|
3858
|
+
thisPartition.polygon_json = JSON.stringify(updatedPolygonJson);
|
|
3859
|
+
}
|
|
3860
|
+
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, {
|
|
3861
|
+
data: thisPartition,
|
|
3862
|
+
isUpdateTree: false
|
|
3863
|
+
});
|
|
3864
|
+
}, 1000);
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3345
3867
|
}
|
|
3346
3868
|
catch (e) {
|
|
3347
3869
|
console.error("Error window visibility: ", e);
|
|
@@ -3359,6 +3881,6 @@ export {
|
|
|
3359
3881
|
//state
|
|
3360
3882
|
activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor,
|
|
3361
3883
|
//methods
|
|
3362
|
-
batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap,
|
|
3884
|
+
batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, renderTagPaneContent,
|
|
3363
3885
|
// partition
|
|
3364
|
-
handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleWindowVisibility, clearActivePane };
|
|
3886
|
+
handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleDisplayElements, handleWindowVisibility, clearActivePane };
|