architwin 1.13.7 → 1.13.8
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 +2 -1
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +4 -2
- package/lib/atwinui/components/toolbar/menuBar.js +2 -2
- package/lib/atwinui/components/toolbar/pipeFormPane.js +8 -3
- package/lib/atwinui/components/toolbar/pipeListPane.js +5 -2
- package/lib/atwinui/components/toolbar/screenSharePane.d.ts +1 -0
- package/lib/atwinui/components/toolbar/screenSharePane.js +30 -9
- package/lib/atwinui/components/toolbar/tagFormPane.js +6 -3
- package/lib/atwinui/components/toolbar/tagIotFormPane.d.ts +0 -1
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +75 -121
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.js +15 -11
- package/lib/atwinui/events.js +4 -2
- package/lib/loaders/pathLoader.js +1 -1
- package/lib/loaders/polydrawerLoader.js +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
- package/static/atwinui.css +22 -51
|
@@ -168,6 +168,7 @@ i18n
|
|
|
168
168
|
"General Settings": "General Settings",
|
|
169
169
|
"UploadImage": "Upload Image",
|
|
170
170
|
"Unsend": "Unsend",
|
|
171
|
+
"PipesMenu": "Pipes",
|
|
171
172
|
"Pipes": "Pipes",
|
|
172
173
|
"SelectPipeType": "Select Pipe Type",
|
|
173
174
|
"AddPipeType": "Add Pipe Type",
|
|
@@ -364,7 +365,8 @@ i18n
|
|
|
364
365
|
"Search...": "検索...",
|
|
365
366
|
"UploadImage": "画像をアップロード",
|
|
366
367
|
"Unsend": "取り消し",
|
|
367
|
-
"
|
|
368
|
+
"PipesMenu": "矢印マーカー",
|
|
369
|
+
"Pipes": "配管マーカー",
|
|
368
370
|
"SelectPipeType": "配管種別選択",
|
|
369
371
|
"AddPipeType": "配管種別を追加",
|
|
370
372
|
"EditPipeType": "配管種別を編集",
|
|
@@ -391,7 +393,7 @@ i18n
|
|
|
391
393
|
"PipeCategoryName": "配管種別を入力",
|
|
392
394
|
"HideShowAllPipes": "全ての配管を表示/非表示",
|
|
393
395
|
"PipePlaceHolder": "配管種別名を入力",
|
|
394
|
-
"Pipe": "
|
|
396
|
+
"Pipe": "矢印マーカー",
|
|
395
397
|
"Vertex": "頂点"
|
|
396
398
|
}
|
|
397
399
|
}
|
|
@@ -47,8 +47,8 @@ export function renderMenuBar(iFrame) {
|
|
|
47
47
|
<div class="at_icon_tooltip" data-cy="at-tooltip-screenshot">${i18n.t('Screenshot')}</div>
|
|
48
48
|
</div>
|
|
49
49
|
<div class="at_sidebar_button_icon" style="display:${isPipeEnabled ? 'block' : 'none'}">
|
|
50
|
-
<span class="mdi mdi-
|
|
51
|
-
<div class="at_icon_tooltip" data-cy="at-tooltip-pipe">${i18n.t('
|
|
50
|
+
<span class="mdi mdi-arrow-decision" id="at-pipe-btn" data-cy="at-pipe-btn" target-pane="at-pipe-list-pane"></span>
|
|
51
|
+
<div class="at_icon_tooltip" data-cy="at-tooltip-pipe">${i18n.t('PipesMenu')}</div>
|
|
52
52
|
</div>
|
|
53
53
|
<div class="at_sidebar_button_icon" style="display:${isThemeEnabled ? 'block' : 'none'}">
|
|
54
54
|
<span class="mdi mdi-palette" id="at-theme-picker-btn" data-cy="at-theme-picker-btn" target-pane="at-theme-pane"></span>
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { _3DXObjects, _pipes, _selectedPipe, _selectedPipeCategory, _undoDrawActions, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, redoDrawAction, renderPath, setModelVisibility, setPathLineOptions, setPipeIsDrawingMode, setPipes, startDraw, undoDrawAction } from "../../../architwin";
|
|
10
|
+
import { _3DXObjects, _pathConfig, _pipes, _selectedPipe, _selectedPipeCategory, _undoDrawActions, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, redoDrawAction, renderPath, setModelVisibility, setPathLineOptions, setPipeIsDrawingMode, setPipes, startDraw, undoDrawAction } from "../../../architwin";
|
|
11
11
|
import i18n from './i18n';
|
|
12
12
|
import { COLLAPSE, SPACE_EVENTS } from "../../../types";
|
|
13
13
|
import { Collapse } from "./collapse";
|
|
@@ -20,7 +20,7 @@ export class PipeForm {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
this.category = {};
|
|
22
22
|
this.collapse = new Collapse(undefined);
|
|
23
|
-
this.colorCategory = ['
|
|
23
|
+
this.colorCategory = ['blue', 'green', 'gray', 'silver', 'red', 'yellow', 'black', 'brown', 'pink', 'orange'];
|
|
24
24
|
}
|
|
25
25
|
// Render the main form pane
|
|
26
26
|
renderPane() {
|
|
@@ -385,7 +385,9 @@ export class PipeForm {
|
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
387
|
setPipeIsDrawingMode(true);
|
|
388
|
-
startDraw(
|
|
388
|
+
startDraw({
|
|
389
|
+
lineTypeComponentConfig: Object.assign(Object.assign({}, _pathConfig.lineTypeComponentConfig), { scrollSpeed: 0.70, radialSegments: 3, radius: 0.11 })
|
|
390
|
+
});
|
|
389
391
|
notyf.success(`${i18n.t('DrawingModeIsNowActive')}`);
|
|
390
392
|
if (_selectedPipe.uuid) {
|
|
391
393
|
console.log("EDIT PIPE ACTIVE", _selectedPipe.uuid);
|
|
@@ -564,6 +566,9 @@ export class PipeForm {
|
|
|
564
566
|
uuid: pipe.uuid,
|
|
565
567
|
fillColor: 'none',
|
|
566
568
|
textColor: category.color,
|
|
569
|
+
scrollSpeed: 0.70,
|
|
570
|
+
radialSegments: 3,
|
|
571
|
+
radius: 0.11
|
|
567
572
|
});
|
|
568
573
|
});
|
|
569
574
|
}
|
|
@@ -99,7 +99,7 @@ export class PipeList {
|
|
|
99
99
|
}).map(pipe => `
|
|
100
100
|
<div class="at_locate_area_container at_flex at_justify_end at_gap_2" id="at-collapsible-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
|
|
101
101
|
<div id="at-locate-area-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
|
|
102
|
-
<span>${pipe.name}</span>
|
|
102
|
+
<span>${pipe.name.split(' ')[0] === 'Pipe' ? i18n.t('Pipe') + ' ' + pipe.name.split(' ')[1] : pipe.name}</span>
|
|
103
103
|
<span class="mdi mdi-trash-can-outline at-pipe-filter-chevron" id="at-delete-btn-${COLLAPSE.LIST}-${pipe.uuid}" data-cy="at-pipe-delete-btn" data-type="${COLLAPSE.LIST}" data-uuid="${pipe.uuid}"></span>
|
|
104
104
|
<span class="mdi mdi-eye at-pipe-filter-chevron" id="at-view-btn-${COLLAPSE.LIST}-${pipe.uuid}" data-cy="at-pipe-view-btn" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}"></span>
|
|
105
105
|
</div>
|
|
@@ -327,7 +327,10 @@ export class PipeList {
|
|
|
327
327
|
renderPath(_pipe.vertices, {
|
|
328
328
|
uuid: pipe.uuid,
|
|
329
329
|
textColor: _categories.color,
|
|
330
|
-
fillColor: 'none'
|
|
330
|
+
fillColor: 'none',
|
|
331
|
+
scrollSpeed: 0.70,
|
|
332
|
+
radialSegments: 3,
|
|
333
|
+
radius: 0.11
|
|
331
334
|
});
|
|
332
335
|
}
|
|
333
336
|
});
|
|
@@ -17,3 +17,4 @@ export declare function handleScreenShareUsersUpdated(payload: {
|
|
|
17
17
|
export declare function handleScreenShareEndSessionEvent(): void;
|
|
18
18
|
export declare function handleScreenShareBackUserListPane(): void;
|
|
19
19
|
export declare function handleScreenShareAcceptRequest(payload: ScreenShareRequest): void;
|
|
20
|
+
export declare function removeScreenShareSessionData(): void;
|
|
@@ -16,7 +16,7 @@ export function renderScreenSharePane() {
|
|
|
16
16
|
element.setAttribute('id', 'at-screen-share-pane');
|
|
17
17
|
element.setAttribute('data-cy', 'at-screen-share-pane');
|
|
18
18
|
element.innerHTML = `
|
|
19
|
-
<div
|
|
19
|
+
<div class="at_flex at_flex_column">
|
|
20
20
|
<div id="at-screen-share-pane-content" class="at_form_container">
|
|
21
21
|
<div class="at_flex at_justify_start">
|
|
22
22
|
<span class="at_bolder at_text_base">${i18n.t('Users')}</span>
|
|
@@ -63,14 +63,26 @@ export function renderOnlineUserRow(user) {
|
|
|
63
63
|
const iconOrSharingText = user.onlineStatus === 'in_session'
|
|
64
64
|
? `
|
|
65
65
|
<div class="at_flex at_items_center at_justify_center">
|
|
66
|
-
<p>
|
|
66
|
+
<p>In Session</p>
|
|
67
67
|
</div>
|
|
68
68
|
`
|
|
69
|
-
:
|
|
70
|
-
|
|
71
|
-
<div class="
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
: user.onlineStatus === 'pending'
|
|
70
|
+
? `
|
|
71
|
+
<div class="at_flex at_items_center at_justify_center">
|
|
72
|
+
<p>Pending</p>
|
|
73
|
+
</div>
|
|
74
|
+
`
|
|
75
|
+
: user.onlineStatus === 'sharing'
|
|
76
|
+
? `
|
|
77
|
+
<div class="at_flex at_items_center at_justify_center">
|
|
78
|
+
<p>Now Sharing</p>
|
|
79
|
+
</div>
|
|
80
|
+
`
|
|
81
|
+
: `
|
|
82
|
+
<div class="at_user_screen_sharing_state at_flex at_items_center at_justify_center">
|
|
83
|
+
<div class="mdi mdi-monitor-share"></div>
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
74
86
|
element.innerHTML = `
|
|
75
87
|
<td id="at_user_row_${user.id}">
|
|
76
88
|
<div class="at_flex at_flex_row at_items_center">
|
|
@@ -111,7 +123,14 @@ export function handleClickEventUserRow() {
|
|
|
111
123
|
_screenShareUser = user;
|
|
112
124
|
if (user.onlineStatus === 'offline')
|
|
113
125
|
return;
|
|
126
|
+
if (user.onlineStatus === 'sharing')
|
|
127
|
+
return;
|
|
128
|
+
if (user.onlineStatus === 'pending')
|
|
129
|
+
return;
|
|
114
130
|
if (user.onlineStatus === 'in_session') {
|
|
131
|
+
if (!_screenShareSession) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
115
134
|
const usersPaneContent = document.getElementById('at-screen-share-pane-content');
|
|
116
135
|
usersPaneContent.innerHTML = '';
|
|
117
136
|
const sessionUser = {
|
|
@@ -123,6 +142,9 @@ export function handleClickEventUserRow() {
|
|
|
123
142
|
renderSharingSpaceDetail(sessionUser);
|
|
124
143
|
}
|
|
125
144
|
else {
|
|
145
|
+
if (_screenShareSession) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
126
148
|
const nowEpochSeconds = Math.floor(Date.now() / 1000);
|
|
127
149
|
const screenShareInvitation = {
|
|
128
150
|
user: user,
|
|
@@ -138,7 +160,6 @@ export function handleClickEventUserRow() {
|
|
|
138
160
|
}
|
|
139
161
|
}
|
|
140
162
|
export function renderSharingSpaceDetail(user) {
|
|
141
|
-
console.log('*** _screenShareSession: ', _screenShareSession);
|
|
142
163
|
_onDisplayComponent = 'SPACE_SHARING_DETAILS';
|
|
143
164
|
_screenShareSessionUser = user;
|
|
144
165
|
const usersPaneContent = document.getElementById('at-screen-share-pane-content');
|
|
@@ -339,7 +360,7 @@ function showEndSessionBtn() {
|
|
|
339
360
|
btn.style.display = 'block';
|
|
340
361
|
}
|
|
341
362
|
}
|
|
342
|
-
function removeScreenShareSessionData() {
|
|
363
|
+
export function removeScreenShareSessionData() {
|
|
343
364
|
const screenShareSessionUserIds = _screenShareSessionUsers.map(u => u.id);
|
|
344
365
|
const updateUsersData = _screenShareUsers.map(user => {
|
|
345
366
|
if (screenShareSessionUserIds.includes(user.id)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _tagCategories, _tags, getMpTags } from "../../../architwin";
|
|
2
2
|
import { convertToCssRgb, stringContains } from "../../../utils";
|
|
3
|
-
import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId } from './tagListPane';
|
|
3
|
+
import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
|
|
4
4
|
import i18n from './i18n';
|
|
5
5
|
let mode = 'adding';
|
|
6
6
|
let tagNameInput, tagDescriptionInput, tagEmbedInput, tagCategoryDropdown, tagSubcategoryDropdown;
|
|
@@ -283,7 +283,8 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
283
283
|
setSelectedSubcategoryFilter(undefined); //reset selected subcategory
|
|
284
284
|
const tags = getMpTags();
|
|
285
285
|
const filteredTags = filterTagList(tags);
|
|
286
|
-
|
|
286
|
+
const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
|
|
287
|
+
renderTags(sortedTags);
|
|
287
288
|
}
|
|
288
289
|
else if (categoryType == 'subcategory' && isFilterDropdown == false) {
|
|
289
290
|
selectedSubCategoryId = categoryUUID;
|
|
@@ -292,6 +293,7 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
292
293
|
setSelectedSubcategoryFilter(categoryUUID);
|
|
293
294
|
const tags = getMpTags();
|
|
294
295
|
const filteredTags = filterTagList(tags);
|
|
296
|
+
const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
|
|
295
297
|
renderTags(filteredTags);
|
|
296
298
|
}
|
|
297
299
|
//Populate subcategory dropdown
|
|
@@ -341,7 +343,8 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
341
343
|
}
|
|
342
344
|
const tags = getMpTags();
|
|
343
345
|
const filteredTags = filterTagList(tags);
|
|
344
|
-
|
|
346
|
+
const sortedTags = sortTags(filteredTags ? filteredTags : tags, selectedTagSortOption);
|
|
347
|
+
renderTags(sortedTags);
|
|
345
348
|
}
|
|
346
349
|
let toggleId = '';
|
|
347
350
|
if (elementId === 'at-category-dropdown-toggle') {
|
|
@@ -4,7 +4,6 @@ export declare let selectedIoTSystem: string;
|
|
|
4
4
|
export declare let selectedIotTag: any;
|
|
5
5
|
export declare function renderTagIOTFormPane(): HTMLDivElement;
|
|
6
6
|
export declare function setIotCategoryOptions(): void;
|
|
7
|
-
export declare function getIotCategoryOption(): ITagIOTCategory;
|
|
8
7
|
export declare function toggleIoTCategoryOptions(): void;
|
|
9
8
|
export declare function toggleIoTDevicesOptions(): void;
|
|
10
9
|
/**
|
|
@@ -11,7 +11,7 @@ import { IOT_LINKED_SYSTEMS, SPACE_EVENTS, TAG_TYPE } from '../../../types';
|
|
|
11
11
|
import log from 'loglevel';
|
|
12
12
|
import i18n from './i18n';
|
|
13
13
|
import { dispatchSpaceEvent, _tagIotCategoryTypes, _tagIotDevices, _tags } from '../../../architwin';
|
|
14
|
-
import { stringContains
|
|
14
|
+
import { stringContains } from "../../../utils";
|
|
15
15
|
import { batchAddEventListenerByClassName } from '../../events';
|
|
16
16
|
let selectedIoTCatOption;
|
|
17
17
|
let selectedIoTDeviceOption;
|
|
@@ -19,7 +19,7 @@ export let iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
|
19
19
|
export let selectedIoTSystem = '';
|
|
20
20
|
export let selectedIotTag = undefined;
|
|
21
21
|
let tagIotName, iotModelName, iotSerialNumber, iotMfrName, iotSystemLink;
|
|
22
|
-
let
|
|
22
|
+
let selectedIoTCatId;
|
|
23
23
|
let linkedDevicesArray = [];
|
|
24
24
|
let iotCategoryIconList = ['mdi-power', 'mdi-thermometer', 'mdi-water-percent', 'mdi-gauge', 'mdi-leak', 'mdi-water', 'mdi-lightbulb-on', 'mdi-gas-cylinder', 'mdi-flask', 'mdi-meter-electric', 'mdi-information-symbol', 'mdi-sine-wave'];
|
|
25
25
|
export function renderTagIOTFormPane() {
|
|
@@ -99,8 +99,8 @@ export function renderTagIOTFormPane() {
|
|
|
99
99
|
|
|
100
100
|
<div class="at_field at_flex_column" id="at-iot-device-main-container">
|
|
101
101
|
<label for="">${i18n.t('IOT Devices')}</label>
|
|
102
|
-
<div id="at-iot-devices-dropdown" data-cy="at-iot-devices-dropdown"
|
|
103
|
-
<div id="at-
|
|
102
|
+
<div id="at-iot-devices-dropdown" data-cy="at-iot-devices-dropdown">
|
|
103
|
+
<div id="at-setting-map-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
104
104
|
<div class="at_dropdown_toggle" id="at-iot-selected-device" data-cy="at-iot-selected-device">${i18n.t(selectedIoTDeviceOption)}</div>
|
|
105
105
|
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
|
|
106
106
|
</div>
|
|
@@ -122,9 +122,7 @@ export function renderTagIOTFormPane() {
|
|
|
122
122
|
<div> </div>
|
|
123
123
|
</div>
|
|
124
124
|
|
|
125
|
-
<div>
|
|
126
|
-
<div class="at_linked_device_container" id="at-device-item-container">
|
|
127
|
-
</div>
|
|
125
|
+
<div class="at_linked_device_container" id="at-linked-device-row">
|
|
128
126
|
</div>
|
|
129
127
|
|
|
130
128
|
</div>
|
|
@@ -157,24 +155,19 @@ function displayFormTitle() {
|
|
|
157
155
|
title.innerHTML = '';
|
|
158
156
|
const span = document.createElement('span');
|
|
159
157
|
span.textContent = iotTagFormMode === "ADD" /* FORM_MODE.ADD */
|
|
160
|
-
? i18n.t('
|
|
161
|
-
: i18n.t('
|
|
158
|
+
? i18n.t('Add IOT Tag')
|
|
159
|
+
: i18n.t('Edit IOT Tag');
|
|
162
160
|
title.appendChild(span);
|
|
163
161
|
}
|
|
164
|
-
// displays selected Category in the dropdown
|
|
165
162
|
function setSelectedIoTCat(payload) {
|
|
166
163
|
log.info('setSelectedIoTCat()', payload);
|
|
167
164
|
const selectedOption = document.getElementById('at-iot-selected-cat');
|
|
168
|
-
selectedOption.innerText = payload
|
|
165
|
+
selectedOption.innerText = payload;
|
|
169
166
|
}
|
|
170
|
-
// displays selected Device in the dropdown
|
|
171
167
|
function setSelectedIoTDevice(payload) {
|
|
172
168
|
log.info('setSelectedIoTDevice()', payload);
|
|
173
169
|
const selectedDevice = document.getElementById('at-iot-selected-device');
|
|
174
|
-
selectedDevice.innerText =
|
|
175
|
-
if (payload) {
|
|
176
|
-
selectedDevice.innerText = payload;
|
|
177
|
-
}
|
|
170
|
+
selectedDevice.innerText = payload;
|
|
178
171
|
}
|
|
179
172
|
function setInputFields() {
|
|
180
173
|
log.info('setInputFields()');
|
|
@@ -187,34 +180,17 @@ function setInputFields() {
|
|
|
187
180
|
export function setIotCategoryOptions() {
|
|
188
181
|
log.info('setIotCategoryOptions()');
|
|
189
182
|
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CATEGORIES, { payload: 'hello from library' });
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
// gets selected Category and returns the object
|
|
203
|
-
export function getIotCategoryOption() {
|
|
204
|
-
log.info('getIotCategoryOption()');
|
|
205
|
-
let foundCat = {};
|
|
206
|
-
if (linkedDevicesArray.length > 1) {
|
|
207
|
-
foundCat = _tagIotCategoryTypes.find((cat) => {
|
|
208
|
-
return i18n.t(cat.name) === 'Multiple';
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
foundCat = _tagIotCategoryTypes.find((cat) => {
|
|
213
|
-
return i18n.t(cat.uuid) === selectedIoTCat.uuid;
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
log.info('foundCat: ', foundCat);
|
|
217
|
-
return foundCat;
|
|
183
|
+
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
184
|
+
batchAddEventListenerByClassName('at_iot_cat_option', (event) => {
|
|
185
|
+
//@ts-ignore
|
|
186
|
+
const selectedCat = event.target;
|
|
187
|
+
const dataCy = selectedCat.getAttribute('data-cy');
|
|
188
|
+
const match = dataCy.match(/^at-iot-category-option-(.+)$/);
|
|
189
|
+
const selectedId = match ? match[1] : null;
|
|
190
|
+
selectedIoTCatId = selectedCat.innerText; // this is set to inner text as uuid for category changes due to dummy data
|
|
191
|
+
setSelectedIoTCat(selectedCat.innerText);
|
|
192
|
+
log.info('cat id: ', selectedIoTCatId);
|
|
193
|
+
});
|
|
218
194
|
}
|
|
219
195
|
export function toggleIoTCategoryOptions() {
|
|
220
196
|
log.info('toggleIoTCategoryOptions');
|
|
@@ -284,14 +260,12 @@ export function clearIoTDropdowns() {
|
|
|
284
260
|
export function initIoTFormData(tagId) {
|
|
285
261
|
log.info('initIoTFormData()');
|
|
286
262
|
displayFormTitle();
|
|
287
|
-
const iotSave = document.getElementById('at-save-iot-btn');
|
|
288
|
-
iotSave.classList.remove('at_disabled');
|
|
289
263
|
// Add Mode
|
|
290
264
|
if (!tagId) {
|
|
291
|
-
|
|
292
|
-
clearIotFields();
|
|
265
|
+
log.info('initIoTFormData() tagId not Exist: ', iotTagFormMode);
|
|
293
266
|
if (iotTagFormMode == "ADD" /* FORM_MODE.ADD */) {
|
|
294
267
|
if (tagIotName === null || tagIotName == undefined) {
|
|
268
|
+
log.info('initIoTFormData() tagname check', tagIotName);
|
|
295
269
|
setInputFields();
|
|
296
270
|
}
|
|
297
271
|
tagIotName.value = '';
|
|
@@ -299,12 +273,11 @@ export function initIoTFormData(tagId) {
|
|
|
299
273
|
iotSerialNumber.value = '';
|
|
300
274
|
iotMfrName.value = '';
|
|
301
275
|
iotSystemLink.value = '';
|
|
302
|
-
linkedDevicesArray = [];
|
|
303
|
-
setIotDeviceOptions();
|
|
304
276
|
}
|
|
305
277
|
}
|
|
306
278
|
else {
|
|
307
279
|
const foundTag = _tags.find(tag => tag.json_data.id === tagId);
|
|
280
|
+
log.info('initIoTFormData() foundTag: ', foundTag, _tags);
|
|
308
281
|
if (foundTag) {
|
|
309
282
|
selectedIotTag = foundTag;
|
|
310
283
|
if (tagIotName === null || tagIotName == undefined) {
|
|
@@ -326,23 +299,23 @@ export function initIoTFormData(tagId) {
|
|
|
326
299
|
setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
|
|
327
300
|
}
|
|
328
301
|
if (iotData.iot_category) {
|
|
329
|
-
const cat = _tagIotCategoryTypes.find(cat => cat.name
|
|
302
|
+
const cat = _tagIotCategoryTypes.find(cat => cat.name === iotData.iot_category);
|
|
330
303
|
if (cat) {
|
|
331
|
-
setSelectedIoTCat(
|
|
332
|
-
|
|
304
|
+
setSelectedIoTCat(cat.name);
|
|
305
|
+
selectedIoTCatId = cat.name;
|
|
333
306
|
}
|
|
334
307
|
else {
|
|
335
308
|
// for the Dummy data from App Side
|
|
336
|
-
setSelectedIoTCat(
|
|
309
|
+
setSelectedIoTCat(i18n.t('NoSelection'));
|
|
337
310
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
338
311
|
}
|
|
339
312
|
}
|
|
340
313
|
log.info("iotData.linked_devices: ", iotData.linked_devices);
|
|
341
314
|
if (iotData.linked_devices && iotData.linked_devices.length > 0) {
|
|
342
|
-
setIotDeviceOptions();
|
|
343
315
|
// renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices)
|
|
344
316
|
setSelectedIoTDevice(iotData.linked_devices[0].name);
|
|
345
317
|
linkedDevicesArray = iotData.linked_devices;
|
|
318
|
+
log.info("EDIT linkedDevicesArray: ", linkedDevicesArray);
|
|
346
319
|
renderLinkedDevices(linkedDevicesArray);
|
|
347
320
|
}
|
|
348
321
|
else {
|
|
@@ -355,7 +328,7 @@ export function initIoTFormData(tagId) {
|
|
|
355
328
|
// this is due to selecting the tags created from James
|
|
356
329
|
log.info('initIoTFormData()', iotData);
|
|
357
330
|
setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
|
|
358
|
-
setSelectedIoTCat(
|
|
331
|
+
setSelectedIoTCat('No Selection');
|
|
359
332
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
360
333
|
renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
|
|
361
334
|
}
|
|
@@ -397,10 +370,8 @@ export function renderIotCategoryDropdownOptions(elementId, items) {
|
|
|
397
370
|
return;
|
|
398
371
|
}
|
|
399
372
|
items.forEach((item, index) => {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
element.appendChild(option);
|
|
403
|
-
}
|
|
373
|
+
const option = createCatOptionElement(item, 'iotcategory', index);
|
|
374
|
+
element.appendChild(option);
|
|
404
375
|
});
|
|
405
376
|
}
|
|
406
377
|
function createCatOptionElement(item, dropdownType, index) {
|
|
@@ -423,33 +394,28 @@ function createCatOptionElement(item, dropdownType, index) {
|
|
|
423
394
|
return option;
|
|
424
395
|
}
|
|
425
396
|
function selectCatOption(option, elementId) {
|
|
426
|
-
|
|
397
|
+
log.info('selectCatOption()', option, elementId);
|
|
427
398
|
}
|
|
428
|
-
// selects Devices from Arrayat-device-item-container
|
|
429
399
|
export function setIotDeviceOptions() {
|
|
430
400
|
log.info('setIotDeviceOptions()');
|
|
431
401
|
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_DEVICES, { payload: 'hello from library' });
|
|
432
402
|
renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
|
|
433
403
|
batchAddEventListenerByClassName('at_iot_dev_option', (event) => {
|
|
434
404
|
//@ts-ignore
|
|
435
|
-
const selectedDev =
|
|
436
|
-
const parent = selectedDev.
|
|
405
|
+
const selectedDev = event.target;
|
|
406
|
+
const parent = selectedDev.parentElement;
|
|
407
|
+
log.info('@caroline parent: ', parent);
|
|
437
408
|
const deviceId = parent.getAttribute('iot-device-uuid');
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
//hides the selected device in dropdown
|
|
445
|
-
parent.style.display = 'none'; //hides
|
|
446
|
-
renderDeviceRow(devFound);
|
|
447
|
-
selectedDev.setAttribute('disabled', 'false');
|
|
448
|
-
}
|
|
409
|
+
log.info('@caroline deviceId: ', deviceId);
|
|
410
|
+
const device = _tagIotDevices.find(device => device.id == deviceId);
|
|
411
|
+
log.info("device", device);
|
|
412
|
+
setSelectedIoTDevice(selectedDev.innerText);
|
|
413
|
+
linkedDevicesArray.push(device);
|
|
414
|
+
renderLinkedDevices(linkedDevicesArray);
|
|
449
415
|
});
|
|
450
416
|
}
|
|
451
417
|
export function renderIotDeviceDropdownOptions(elementId, items) {
|
|
452
|
-
log.info("renderIotDeviceDropdownOptions: ");
|
|
418
|
+
log.info("renderIotDeviceDropdownOptions: ", items);
|
|
453
419
|
const element = document.getElementById(elementId);
|
|
454
420
|
if (!element) {
|
|
455
421
|
console.error("Parameter element is undefined");
|
|
@@ -476,7 +442,7 @@ export function renderIotDeviceDropdownOptions(elementId, items) {
|
|
|
476
442
|
<span></span> ${i18n.t('Select Device')}
|
|
477
443
|
`;
|
|
478
444
|
selectDevice.onclick = () => {
|
|
479
|
-
log.info('
|
|
445
|
+
log.info('@caroline onClick');
|
|
480
446
|
selectDeviceOption(selectDevice, isFilterDropdown ? 'at-iot-device-filter-dropdown-toggle' : 'at-iot-device-filter-dropdown-toggle');
|
|
481
447
|
};
|
|
482
448
|
element.appendChild(selectDevice);
|
|
@@ -505,18 +471,16 @@ function createDeviceOptionElement(item, dropdownType) {
|
|
|
505
471
|
option.setAttribute('iot-device-uuid', item.id);
|
|
506
472
|
option.setAttribute('dropdown-type', dropdownType);
|
|
507
473
|
option.setAttribute('data-cy', `at-iot-category-option-${item.id}`);
|
|
474
|
+
if (dropdownType == 'category') {
|
|
475
|
+
option.innerHTML = `
|
|
476
|
+
<span class="at_colored-indicator"></span>
|
|
477
|
+
${item.name}
|
|
478
|
+
`;
|
|
479
|
+
return option;
|
|
480
|
+
}
|
|
508
481
|
option.innerHTML = `
|
|
509
|
-
<span
|
|
482
|
+
<span>${item.name}</span>
|
|
510
483
|
`;
|
|
511
|
-
if (selectedIotTag) {
|
|
512
|
-
const iotTag = selectedIotTag.iot_tag;
|
|
513
|
-
const hideOption = iotTag.linked_devices.find((dev) => {
|
|
514
|
-
return dev.id === item.id;
|
|
515
|
-
});
|
|
516
|
-
if (hideOption != undefined) {
|
|
517
|
-
option.style.setProperty('display', 'none', 'important');
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
484
|
return option;
|
|
521
485
|
}
|
|
522
486
|
/**
|
|
@@ -535,8 +499,7 @@ export function getIotTagFormData() {
|
|
|
535
499
|
modelName: iotModelName.value,
|
|
536
500
|
serialNumber: iotSerialNumber.value,
|
|
537
501
|
tagMf: iotMfrName.value,
|
|
538
|
-
|
|
539
|
-
tagCategoryId: selectedIoTCat.name,
|
|
502
|
+
tagCategoryId: selectedIoTCatId,
|
|
540
503
|
systemLink: iotSystemLink.value,
|
|
541
504
|
linkedDevices: linkedDevicesArray,
|
|
542
505
|
iotSystem: selectedIoTSystem,
|
|
@@ -545,19 +508,21 @@ export function getIotTagFormData() {
|
|
|
545
508
|
return formData;
|
|
546
509
|
}
|
|
547
510
|
function renderLinkedDevices(linkedDevices) {
|
|
548
|
-
log.info('renderLinkedDevices()');
|
|
511
|
+
log.info('renderLinkedDevices()', linkedDevices);
|
|
549
512
|
if (linkedDevices) {
|
|
550
|
-
const devicesContainer = document.getElementById('at-device-
|
|
513
|
+
const devicesContainer = document.getElementById('at-linked-device-row');
|
|
551
514
|
if (linkedDevices.length > 0) {
|
|
515
|
+
devicesContainer.innerHTML = ``;
|
|
552
516
|
linkedDevices.forEach(device => {
|
|
517
|
+
log.info("@caroline device: ", device);
|
|
553
518
|
renderDeviceRow(device);
|
|
554
519
|
});
|
|
555
520
|
}
|
|
556
521
|
}
|
|
557
522
|
}
|
|
558
523
|
function renderDeviceRow(payload) {
|
|
559
|
-
log.info('renderDeviceRow()');
|
|
560
|
-
const devicesContainer = document.getElementById('at-device-
|
|
524
|
+
log.info('renderDeviceRow()', payload);
|
|
525
|
+
const devicesContainer = document.getElementById('at-linked-device-row');
|
|
561
526
|
if (payload) {
|
|
562
527
|
const deviceRow = document.createElement('div');
|
|
563
528
|
deviceRow.classList.add('at_flex_row');
|
|
@@ -573,37 +538,25 @@ function renderDeviceRow(payload) {
|
|
|
573
538
|
<div></div>
|
|
574
539
|
</div>
|
|
575
540
|
<div class="at_icon_right">
|
|
576
|
-
<span class="mdi mdi-delete-outline at_delete_device_btn" id="at-delete-device-${payload.
|
|
541
|
+
<span class="mdi mdi-delete-outline at_delete_device_btn" id="at-delete-device-${payload.uuid}"></span>
|
|
577
542
|
</div>
|
|
578
543
|
`;
|
|
579
544
|
devicesContainer.appendChild(deviceRow);
|
|
580
545
|
batchAddEventListenerByClassName('at_delete_device_btn', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
546
|
+
log.info('deleteSelectedLinkedDevice is clicked', event);
|
|
581
547
|
//@ts-ignore
|
|
582
|
-
const selectedDevice = event.target;
|
|
548
|
+
const selectedDevice = document.getElementById(event.target.id);
|
|
583
549
|
if (selectedDevice) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
//
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
const devicesDropdown = document.getElementById('at-iot-selected-device');
|
|
595
|
-
if (findHideDev) {
|
|
596
|
-
findHideDev.style.display = "block";
|
|
597
|
-
parent.style.display = 'none';
|
|
598
|
-
linkedDevicesArray.splice(findDevice, 1);
|
|
599
|
-
}
|
|
600
|
-
if (linkedDevicesArray.length === 0) {
|
|
601
|
-
devicesDropdown.innerText = i18n.t('Select Device');
|
|
602
|
-
setIotDeviceOptions();
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
selectedDevice.setAttribute('disabled', 'false');
|
|
606
|
-
}
|
|
550
|
+
log.info('deleteSelectedLinkedDevice', selectedDevice);
|
|
551
|
+
// will be tested when using live data
|
|
552
|
+
// const devId = extractUUID(selectedDevice.id)
|
|
553
|
+
const devId = selectedDevice.id.split('at-delete-partition-')[1];
|
|
554
|
+
const findDevice = linkedDevicesArray.findIndex(dev => dev.id == devId);
|
|
555
|
+
log.info('deleteSelectedLinkedDevice found device', findDevice, devId);
|
|
556
|
+
linkedDevicesArray.splice(findDevice, 1);
|
|
557
|
+
const parent = selectedDevice.closest('.at_partition_item');
|
|
558
|
+
parent.style.display = 'none';
|
|
559
|
+
log.info('deleteSelectedLinkedDevice parent', parent);
|
|
607
560
|
}
|
|
608
561
|
}));
|
|
609
562
|
return;
|
|
@@ -620,7 +573,7 @@ export function clearIotFields() {
|
|
|
620
573
|
iotSerialNumber = document.getElementById('at-iot-serial-input');
|
|
621
574
|
iotMfrName = document.getElementById('at-iot-manufacturer-input');
|
|
622
575
|
iotSystemLink = document.getElementById('at-iot-system-link-input');
|
|
623
|
-
const deviceContainer = document.getElementById(
|
|
576
|
+
const deviceContainer = document.getElementById("linked-devices-container");
|
|
624
577
|
tagIotName.innerText = '';
|
|
625
578
|
iotModelName.innerText = '';
|
|
626
579
|
iotSerialNumber.innerText = '';
|
|
@@ -629,9 +582,10 @@ export function clearIotFields() {
|
|
|
629
582
|
linkedDevicesArray = [];
|
|
630
583
|
selectedIoTSystem = '';
|
|
631
584
|
setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
|
|
632
|
-
deviceContainer
|
|
585
|
+
if (deviceContainer !== null) {
|
|
586
|
+
deviceContainer.innerHTML = '';
|
|
587
|
+
}
|
|
633
588
|
iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
634
|
-
selectedIotTag = undefined;
|
|
635
589
|
}
|
|
636
590
|
/**
|
|
637
591
|
* Sets the form mode for the IOT form.
|