architwin 1.14.8 → 1.14.10

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.
@@ -11,17 +11,20 @@ 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 } from "../../../utils";
14
+ import { stringContains, generateUUID } from "../../../utils";
15
15
  import { batchAddEventListenerByClassName } from '../../events';
16
+ import { toggleModal, setModalAction } from "./modal";
17
+ import { Notyf } from 'notyf';
16
18
  let selectedIoTCatOption;
17
19
  let selectedIoTDeviceOption;
18
20
  export let iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
19
21
  export let selectedIoTSystem = '';
20
22
  export let selectedIotTag = undefined;
21
23
  let tagIotName, iotModelName, iotSerialNumber, iotMfrName, iotSystemLink;
22
- let selectedIoTCatId;
24
+ let selectedIoTCat;
23
25
  let linkedDevicesArray = [];
24
26
  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'];
27
+ let notify = new Notyf({ position: { x: 'left', y: 'bottom' } });
25
28
  export function renderTagIOTFormPane() {
26
29
  const element = document.createElement('div');
27
30
  element.classList.add('at_container');
@@ -34,7 +37,7 @@ export function renderTagIOTFormPane() {
34
37
  </div>
35
38
 
36
39
  <div class="at_form_container at_scrollable_container at_h-min-70">
37
- <label for="">${i18n.t('Linked Systems')}</label>
40
+ <label for="">${i18n.t('LinkedSystems')}</label>
38
41
  <div class="at_gap_2" style="display: inline-flex">
39
42
  <label class="at_flex at_align_center at_text_xs at_gap_1">
40
43
  <input type="radio" id="at-linked-radio-bemac" name="iot-link-system" checked value=${IOT_LINKED_SYSTEMS.BEMAC} selected />
@@ -46,7 +49,7 @@ export function renderTagIOTFormPane() {
46
49
  </label>
47
50
  <label class="at_flex at_align_center at_text_xs at_gap_1">
48
51
  <input type="radio" id="at-linked-radio-link" name="iot-link-system" value=${IOT_LINKED_SYSTEMS.URL_LINK} />
49
- ${i18n.t("URL Link")}
52
+ ${i18n.t("URLLink")}
50
53
  </label>
51
54
  </div>
52
55
 
@@ -73,22 +76,22 @@ export function renderTagIOTFormPane() {
73
76
  </div>
74
77
 
75
78
  <div class="at-field at_flex_row at_justify_between">
76
- <label for="">${i18n.t('Model Name')}</label>
79
+ <label for="">${i18n.t('ModelName')}</label>
77
80
  <input class="at_field_input at_w-full" type="text" name="model_name" id="at-iot-model-input" data-cy="at-iot-model-input" />
78
81
  </div>
79
82
 
80
83
  <div class="at-field at_flex_row at_justify_between">
81
- <label for="">${i18n.t('Serial Number')}</label>
84
+ <label for="">${i18n.t('SerialNumber')}</label>
82
85
  <input class="at_field_input at_w-full" type="text" name="serial_name" id="at-iot-serial-input" data-cy="at-iot-serial-input" />
83
86
  </div>
84
87
 
85
88
  <div class="at-field at_flex_row at_justify_between">
86
- <label for="">${i18n.t('Manufacturer Site')}</label>
89
+ <label for="">${i18n.t('ManufacturerSite')}</label>
87
90
  <input class="at_field_input at_w-full" type="text" name="manufacturer_site" id="at-iot-manufacturer-input" data-cy="at-iot-manufacturer-input" />
88
91
  </div>
89
92
 
90
93
  <div class="at-field at_flex_row at_justify_between" id="at-iot-system-link-container" style="display: none">
91
- <label for="">${i18n.t('System Link')}</label>
94
+ <label for="">${i18n.t('SystemLink')}</label>
92
95
  <input class="at_field_input at_w-full" type="text" name="system_link" id="at-iot-system-link-input" data-cy="at-iot-system-link-input" />
93
96
  </div>
94
97
 
@@ -98,9 +101,9 @@ export function renderTagIOTFormPane() {
98
101
  </div>
99
102
 
100
103
  <div class="at_field at_flex_column" id="at-iot-device-main-container">
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-setting-map-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
104
+ <label for="">${i18n.t('IoTDevices')}</label>
105
+ <div id="at-iot-devices-dropdown" data-cy="at-iot-devices-dropdown" class="at-device-dropdown">
106
+ <div id="at-iot-devices-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
104
107
  <div class="at_dropdown_toggle" id="at-iot-selected-device" data-cy="at-iot-selected-device">${i18n.t(selectedIoTDeviceOption)}</div>
105
108
  <span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
106
109
  </div>
@@ -112,17 +115,19 @@ export function renderTagIOTFormPane() {
112
115
  </div>
113
116
  </div>
114
117
 
115
- <div class="at_partition_list_container at_h-min-40" id="at-iot-device-list-container" data-cy="at-iot-device-list-container">
118
+ <div class="at_iot_list_container at_h-min-40" id="at-iot-device-list-container" data-cy="at-iot-device-list-container">
116
119
 
117
- <div class="at_partition_item_container at_scrollable_container" id="at-linked-device-container" data-cy="at-linked-device-container">
120
+ <div class="at_section at_iot_item_container at_scrollable_container" id="at-linked-device-container" data-cy="at-linked-device-container">
118
121
 
119
- <div class="at_partition_title" style="padding-left: 20px !important;">
122
+ <div class="at_title" style="padding-left: 20px !important;">
120
123
  <div> </div>
121
- <label for="">${i18n.t('Linked IOT Devices')}</label>
124
+ <label for="">${i18n.t('LinkedIoTDevices')}</label>
122
125
  <div> </div>
123
126
  </div>
124
127
 
125
- <div class="at_linked_device_container" id="at-linked-device-row">
128
+ <div>
129
+ <div class="at_body at_linked_device_container" id="at-device-item-container">
130
+ </div>
126
131
  </div>
127
132
 
128
133
  </div>
@@ -155,19 +160,24 @@ function displayFormTitle() {
155
160
  title.innerHTML = '';
156
161
  const span = document.createElement('span');
157
162
  span.textContent = iotTagFormMode === "ADD" /* FORM_MODE.ADD */
158
- ? i18n.t('Add IOT Tag')
159
- : i18n.t('Edit IOT Tag');
163
+ ? i18n.t('AddIoTTag')
164
+ : i18n.t('EditIoTTag');
160
165
  title.appendChild(span);
161
166
  }
167
+ // displays selected Category in the dropdown
162
168
  function setSelectedIoTCat(payload) {
163
169
  log.info('setSelectedIoTCat()', payload);
164
170
  const selectedOption = document.getElementById('at-iot-selected-cat');
165
- selectedOption.innerText = payload;
171
+ selectedOption.innerText = i18n.t(payload.name);
166
172
  }
173
+ // displays selected Device in the dropdown
167
174
  function setSelectedIoTDevice(payload) {
168
175
  log.info('setSelectedIoTDevice()', payload);
169
176
  const selectedDevice = document.getElementById('at-iot-selected-device');
170
- selectedDevice.innerText = payload;
177
+ selectedDevice.innerText = '';
178
+ if (payload) {
179
+ selectedDevice.innerText = payload;
180
+ }
171
181
  }
172
182
  function setInputFields() {
173
183
  log.info('setInputFields()');
@@ -180,17 +190,37 @@ function setInputFields() {
180
190
  export function setIotCategoryOptions() {
181
191
  log.info('setIotCategoryOptions()');
182
192
  dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CATEGORIES, { payload: 'hello from library' });
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
- });
193
+ if (_tagIotCategoryTypes) {
194
+ renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
195
+ batchAddEventListenerByClassName('at_iot_cat_option', (event) => {
196
+ //@ts-ignore
197
+ const selectedCat = event.target;
198
+ const catUUID = selectedCat.getAttribute('iot-category-uuid');
199
+ const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
200
+ if (getCatName) {
201
+ selectedIoTCat = { uuid: catUUID, name: getCatName.name };
202
+ setSelectedIoTCat(selectedIoTCat);
203
+ log.info('cat id: ', selectedIoTCat);
204
+ }
205
+ });
206
+ }
207
+ }
208
+ // gets selected Category and returns the object
209
+ export function getIotCategoryOption() {
210
+ log.info('getIotCategoryOption()');
211
+ let foundCat = {};
212
+ if (linkedDevicesArray.length > 1) {
213
+ foundCat = _tagIotCategoryTypes.find((cat) => {
214
+ return i18n.t(cat.name) === 'Multiple';
215
+ });
216
+ }
217
+ else {
218
+ foundCat = _tagIotCategoryTypes.find((cat) => {
219
+ return i18n.t(cat.uuid) === selectedIoTCat.uuid;
220
+ });
221
+ }
222
+ log.info('foundCat: ', foundCat);
223
+ return foundCat;
194
224
  }
195
225
  export function toggleIoTCategoryOptions() {
196
226
  log.info('toggleIoTCategoryOptions');
@@ -250,7 +280,7 @@ export function clearIoTDropdowns() {
250
280
  const catDropdown = document.getElementById('at-iot-selected-cat');
251
281
  const devicesDropdown = document.getElementById('at-iot-selected-device');
252
282
  catDropdown.innerText = i18n.t('NoSelection');
253
- devicesDropdown.innerText = i18n.t('Select Device');
283
+ devicesDropdown.innerText = i18n.t('SelectDevice');
254
284
  }
255
285
  /**
256
286
  * Initializes Form Data
@@ -260,12 +290,14 @@ export function clearIoTDropdowns() {
260
290
  export function initIoTFormData(tagId) {
261
291
  log.info('initIoTFormData()');
262
292
  displayFormTitle();
293
+ const iotSave = document.getElementById('at-save-iot-btn');
294
+ iotSave.classList.remove('at_disabled');
263
295
  // Add Mode
264
296
  if (!tagId) {
265
- log.info('initIoTFormData() tagId not Exist: ', iotTagFormMode);
297
+ clearIoTDropdowns();
298
+ clearIotFields();
266
299
  if (iotTagFormMode == "ADD" /* FORM_MODE.ADD */) {
267
300
  if (tagIotName === null || tagIotName == undefined) {
268
- log.info('initIoTFormData() tagname check', tagIotName);
269
301
  setInputFields();
270
302
  }
271
303
  tagIotName.value = '';
@@ -273,11 +305,12 @@ export function initIoTFormData(tagId) {
273
305
  iotSerialNumber.value = '';
274
306
  iotMfrName.value = '';
275
307
  iotSystemLink.value = '';
308
+ linkedDevicesArray = [];
309
+ setIotDeviceOptions();
276
310
  }
277
311
  }
278
312
  else {
279
313
  const foundTag = _tags.find(tag => tag.json_data.id === tagId);
280
- log.info('initIoTFormData() foundTag: ', foundTag, _tags);
281
314
  if (foundTag) {
282
315
  selectedIotTag = foundTag;
283
316
  if (tagIotName === null || tagIotName == undefined) {
@@ -299,23 +332,25 @@ export function initIoTFormData(tagId) {
299
332
  setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
300
333
  }
301
334
  if (iotData.iot_category) {
302
- const cat = _tagIotCategoryTypes.find(cat => cat.name === iotData.iot_category);
335
+ log.info('found cat 1: ', i18n.t(iotData.iot_category), iotData.iot_category, _tagIotCategoryTypes);
336
+ const cat = _tagIotCategoryTypes.find(cat => i18n.t(cat.name.toLocaleLowerCase()) === iotData.iot_category.toLocaleLowerCase());
303
337
  if (cat) {
304
- setSelectedIoTCat(cat.name);
305
- selectedIoTCatId = cat.name;
338
+ log.info('found cat: ', cat);
339
+ setSelectedIoTCat({ uuid: cat.uuid, name: cat.name });
340
+ selectedIoTCat = { uuid: cat.uuid, name: cat.name };
306
341
  }
307
342
  else {
308
343
  // for the Dummy data from App Side
309
- setSelectedIoTCat(i18n.t('NoSelection'));
344
+ setSelectedIoTCat({ uuid: generateUUID(), name: i18n.t('NoSelection') });
310
345
  renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
311
346
  }
312
347
  }
313
348
  log.info("iotData.linked_devices: ", iotData.linked_devices);
314
349
  if (iotData.linked_devices && iotData.linked_devices.length > 0) {
350
+ setIotDeviceOptions();
315
351
  // renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices)
316
352
  setSelectedIoTDevice(iotData.linked_devices[0].name);
317
353
  linkedDevicesArray = iotData.linked_devices;
318
- log.info("EDIT linkedDevicesArray: ", linkedDevicesArray);
319
354
  renderLinkedDevices(linkedDevicesArray);
320
355
  }
321
356
  else {
@@ -328,7 +363,7 @@ export function initIoTFormData(tagId) {
328
363
  // this is due to selecting the tags created from James
329
364
  log.info('initIoTFormData()', iotData);
330
365
  setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
331
- setSelectedIoTCat('No Selection');
366
+ setSelectedIoTCat({ uuid: generateUUID(), name: i18n.t('NoSelection') });
332
367
  renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
333
368
  renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
334
369
  }
@@ -370,8 +405,10 @@ export function renderIotCategoryDropdownOptions(elementId, items) {
370
405
  return;
371
406
  }
372
407
  items.forEach((item, index) => {
373
- const option = createCatOptionElement(item, 'iotcategory', index);
374
- element.appendChild(option);
408
+ if (item.name != 'Multiple') {
409
+ const option = createCatOptionElement(item, 'iotcategory', index);
410
+ element.appendChild(option);
411
+ }
375
412
  });
376
413
  }
377
414
  function createCatOptionElement(item, dropdownType, index) {
@@ -394,28 +431,33 @@ function createCatOptionElement(item, dropdownType, index) {
394
431
  return option;
395
432
  }
396
433
  function selectCatOption(option, elementId) {
397
- log.info('selectCatOption()', option, elementId);
434
+ dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CAT_ICON, { payload: option });
398
435
  }
436
+ // selects Devices from Arrayat-device-item-container
399
437
  export function setIotDeviceOptions() {
400
438
  log.info('setIotDeviceOptions()');
401
439
  dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_DEVICES, { payload: 'hello from library' });
402
440
  renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
403
- batchAddEventListenerByClassName('at_iot_dev_option', (event) => {
441
+ batchAddEventListenerByClassName('at_option', (event) => {
404
442
  //@ts-ignore
405
- const selectedDev = event.target;
406
- const parent = selectedDev.parentElement;
407
- log.info('@caroline parent: ', parent);
443
+ const selectedDev = document.getElementById(event.target.id);
444
+ const parent = selectedDev.closest('div');
408
445
  const deviceId = parent.getAttribute('iot-device-uuid');
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);
446
+ // adds selected device to array
447
+ const devFound = _tagIotDevices.find(device => device.id === deviceId);
448
+ if (devFound) {
449
+ selectedDev.setAttribute('disabled', 'true');
450
+ setSelectedIoTDevice(selectedDev.innerText);
451
+ linkedDevicesArray.push(devFound);
452
+ //hides the selected device in dropdown
453
+ parent.style.display = 'none'; //hides
454
+ renderDeviceRow(devFound);
455
+ selectedDev.setAttribute('disabled', 'false');
456
+ }
415
457
  });
416
458
  }
417
459
  export function renderIotDeviceDropdownOptions(elementId, items) {
418
- log.info("renderIotDeviceDropdownOptions: ", items);
460
+ log.info("renderIotDeviceDropdownOptions: ");
419
461
  const element = document.getElementById(elementId);
420
462
  if (!element) {
421
463
  console.error("Parameter element is undefined");
@@ -430,19 +472,19 @@ export function renderIotDeviceDropdownOptions(elementId, items) {
430
472
  element.innerHTML = ``;
431
473
  const selectedIotDeviceOption = document.getElementById(isFilterDropdown ? 'at-iot-device-filter-dropdown-toggle' : 'at-iot-device-dropdown-toggle');
432
474
  if (selectedIotDeviceOption) {
433
- selectedIotDeviceOption.textContent = `${i18n.t('Select Device')}`;
475
+ selectedIotDeviceOption.textContent = `${i18n.t('SelectDevice')}`;
434
476
  selectedIoTDeviceOption = undefined;
435
477
  }
436
478
  //Add the no selection option
437
479
  const selectDevice = document.createElement('div');
438
- selectDevice.classList.add('at_iot_dev_option');
480
+ selectDevice.classList.add('at_option');
439
481
  selectDevice.setAttribute('iot-device-uuid', '');
440
482
  selectDevice.setAttribute('dropdown-type', 'iotdevice');
441
483
  selectDevice.innerHTML = `
442
- <span></span> ${i18n.t('Select Device')}
484
+ <span></span> ${i18n.t('SelectDevice')}
443
485
  `;
444
486
  selectDevice.onclick = () => {
445
- log.info('@caroline onClick');
487
+ log.info('item selected: ', selectDevice, linkedDevicesArray);
446
488
  selectDeviceOption(selectDevice, isFilterDropdown ? 'at-iot-device-filter-dropdown-toggle' : 'at-iot-device-filter-dropdown-toggle');
447
489
  };
448
490
  element.appendChild(selectDevice);
@@ -466,21 +508,23 @@ function createDeviceOptionElement(item, dropdownType) {
466
508
  option.style.justifyContent = 'left';
467
509
  option.style.alignItems = 'center';
468
510
  option.style.gap = '2px';
511
+ // option.classList.add('at_option')
469
512
  option.classList.add('at_option');
470
- option.classList.add('at_iot_dev_option');
471
513
  option.setAttribute('iot-device-uuid', item.id);
472
514
  option.setAttribute('dropdown-type', dropdownType);
473
515
  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
- }
481
516
  option.innerHTML = `
482
- <span>${item.name}</span>
517
+ <span style="width: 100%; display: block; padding: 4px 8px; cursor: pointer" id="${item.id}">${item.name}</span>
483
518
  `;
519
+ if (selectedIotTag) {
520
+ const iotTag = selectedIotTag.iot_tag;
521
+ const hideOption = iotTag.linked_devices.find((dev) => {
522
+ return dev.id === item.id;
523
+ });
524
+ if (hideOption != undefined) {
525
+ option.style.setProperty('display', 'none', 'important');
526
+ }
527
+ }
484
528
  return option;
485
529
  }
486
530
  /**
@@ -499,7 +543,8 @@ export function getIotTagFormData() {
499
543
  modelName: iotModelName.value,
500
544
  serialNumber: iotSerialNumber.value,
501
545
  tagMf: iotMfrName.value,
502
- tagCategoryId: selectedIoTCatId,
546
+ // tagCategoryId: selectedIoTCat.uuid,
547
+ tagCategoryId: selectedIoTCat.name,
503
548
  systemLink: iotSystemLink.value,
504
549
  linkedDevices: linkedDevicesArray,
505
550
  iotSystem: selectedIoTSystem,
@@ -508,55 +553,78 @@ export function getIotTagFormData() {
508
553
  return formData;
509
554
  }
510
555
  function renderLinkedDevices(linkedDevices) {
511
- log.info('renderLinkedDevices()', linkedDevices);
556
+ log.info('renderLinkedDevices()');
512
557
  if (linkedDevices) {
513
- const devicesContainer = document.getElementById('at-linked-device-row');
558
+ // const devicesContainer = document.getElementById('at-device-item-container')
514
559
  if (linkedDevices.length > 0) {
515
- devicesContainer.innerHTML = ``;
516
560
  linkedDevices.forEach(device => {
517
- log.info("@caroline device: ", device);
518
561
  renderDeviceRow(device);
519
562
  });
520
563
  }
521
564
  }
522
565
  }
523
566
  function renderDeviceRow(payload) {
524
- log.info('renderDeviceRow()', payload);
525
- const devicesContainer = document.getElementById('at-linked-device-row');
567
+ log.info('renderDeviceRow()');
568
+ const devicesContainer = document.getElementById('at-device-item-container');
526
569
  if (payload) {
527
570
  const deviceRow = document.createElement('div');
528
571
  deviceRow.classList.add('at_flex_row');
529
- deviceRow.classList.add('at_partition_item');
572
+ deviceRow.classList.add('at_item');
530
573
  deviceRow.innerHTML = `
531
- <div class="at_icon_left">
574
+ <div class="at_subitem_left">
532
575
  <span class="mdi mdi-cube-outline"></span>
533
576
  </div>
534
577
 
535
- <div class="at_partition_name">
578
+ <div class="at_name">
536
579
  <div></div>
537
580
  <label for="">${payload.name}</label>
538
581
  <div></div>
539
582
  </div>
540
- <div class="at_icon_right">
541
- <span class="mdi mdi-delete-outline at_delete_device_btn" id="at-delete-device-${payload.uuid}"></span>
583
+ <div class="at_subitem_right">
584
+ <span class="mdi mdi-delete-outline at_delete_device_btn" id="at-delete-device-${payload.id}"></span>
542
585
  </div>
543
586
  `;
544
587
  devicesContainer.appendChild(deviceRow);
545
588
  batchAddEventListenerByClassName('at_delete_device_btn', (event) => __awaiter(this, void 0, void 0, function* () {
546
- log.info('deleteSelectedLinkedDevice is clicked', event);
547
589
  //@ts-ignore
548
- const selectedDevice = document.getElementById(event.target.id);
590
+ const selectedDevice = event.target;
549
591
  if (selectedDevice) {
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);
592
+ toggleModal();
593
+ setModalAction({
594
+ title: `${i18n.t('DeleteDevice')}`,
595
+ description: `${i18n.t('ConfirmDeleteDevice')}`,
596
+ buttonLabel: `${i18n.t('YesDelete')}`
597
+ }, () => __awaiter(this, void 0, void 0, function* () {
598
+ // gets the device id
599
+ const devId = selectedDevice.id.split('at-delete-device-')[1];
600
+ // finds the index of the selected device
601
+ const findDevice = linkedDevicesArray.findIndex(dev => dev.id === devId);
602
+ if (findDevice > -1) {
603
+ selectedDevice.setAttribute('disabled', 'true');
604
+ const parent = selectedDevice.closest('.at_partition_item');
605
+ if (parent) {
606
+ // displays delete Device back in Dropdown List
607
+ const findHideDev = document.querySelector(`div[iot-device-uuid="${devId}"]`);
608
+ const devicesDropdown = document.getElementById('at-iot-selected-device');
609
+ if (findHideDev) {
610
+ findHideDev.style.display = "block";
611
+ parent.style.display = 'none';
612
+ linkedDevicesArray.splice(findDevice, 1);
613
+ }
614
+ if (linkedDevicesArray.length === 0) {
615
+ devicesDropdown.innerText = i18n.t('SelectDevice');
616
+ setIotDeviceOptions();
617
+ }
618
+ }
619
+ toggleModal(false);
620
+ notify.success(`${i18n.t('SuccessDeleteDevice')}`);
621
+ selectedDevice.setAttribute('disabled', 'false');
622
+ }
623
+ else {
624
+ toggleModal(false);
625
+ notify.error("Tag id not found!");
626
+ }
627
+ }));
560
628
  }
561
629
  }));
562
630
  return;
@@ -573,7 +641,7 @@ export function clearIotFields() {
573
641
  iotSerialNumber = document.getElementById('at-iot-serial-input');
574
642
  iotMfrName = document.getElementById('at-iot-manufacturer-input');
575
643
  iotSystemLink = document.getElementById('at-iot-system-link-input');
576
- const deviceContainer = document.getElementById("linked-devices-container");
644
+ const deviceContainer = document.getElementById('at-device-item-container');
577
645
  tagIotName.innerText = '';
578
646
  iotModelName.innerText = '';
579
647
  iotSerialNumber.innerText = '';
@@ -582,10 +650,9 @@ export function clearIotFields() {
582
650
  linkedDevicesArray = [];
583
651
  selectedIoTSystem = '';
584
652
  setSelectedIoTSystemRadio(IOT_LINKED_SYSTEMS.BEMAC);
585
- if (deviceContainer !== null) {
586
- deviceContainer.innerHTML = '';
587
- }
653
+ deviceContainer.innerHTML = '';
588
654
  iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
655
+ selectedIotTag = undefined;
589
656
  }
590
657
  /**
591
658
  * Sets the form mode for the IOT form.
@@ -6,3 +6,4 @@ export declare function renderViewingRemoteSpace(): HTMLElement;
6
6
  */
7
7
  export declare function renderRemoteSpaceViewing(user: ScreenShareUser): void;
8
8
  export declare function handleRemoteViewResponsiveChanges(): void;
9
+ export declare function handleScreenShareRemoteEndSessionEvent(): void;
@@ -100,3 +100,9 @@ export function handleRemoteViewResponsiveChanges() {
100
100
  container.classList.toggle("at_display_flex_end", isMobile);
101
101
  }
102
102
  }
103
+ export function handleScreenShareRemoteEndSessionEvent() {
104
+ const element = document.getElementById("at-viewing-remote-space-pane");
105
+ if (element) {
106
+ element.style.display = 'none';
107
+ }
108
+ }
@@ -23,14 +23,14 @@ import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader, isVec3
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 } from "./components/toolbar/spacePartition/roomTreePane";
27
- import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon } from "./components/toolbar/spacePartition/roomFormPane";
26
+ import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild } from "./components/toolbar/spacePartition/roomTreePane";
27
+ import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getDrawingMode } 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
31
  import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm, sortTags, updateSelectedTagSortOption, resetSelectedTagSortOption } from './components/toolbar/tagListPane';
32
32
  import { renderUserRows } from "./components/toolbar/spaceUserListPane";
33
- import { handleRemoteViewResponsiveChanges, renderRemoteSpaceViewing } from "./components/toolbar/viewingRemoteSpace";
33
+ import { handleRemoteViewResponsiveChanges, handleScreenShareRemoteEndSessionEvent, renderRemoteSpaceViewing } from "./components/toolbar/viewingRemoteSpace";
34
34
  import { PipeList } from "./components/toolbar/pipeListPane";
35
35
  import { PipeForm } from "./components/toolbar/pipeFormPane";
36
36
  import { unsendComment, timedoutComment, getTheseTagMessages } from './components/toolbar/tagMessagingPane';
@@ -415,6 +415,7 @@ function setupIndividualEventListeners() {
415
415
  handleSaveTheme();
416
416
  handlePartitionDisplay();
417
417
  handleDrawPartition();
418
+ handleDrawWindow();
418
419
  handleSavePartition();
419
420
  // handleDeletePartition()
420
421
  handleCancelPartition();
@@ -1432,11 +1433,25 @@ function setupSpaceEventSubscriptions() {
1432
1433
  subscribeSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, handleDrawHistory);
1433
1434
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOADED, handleCustomMapFloorImageUploaded);
1434
1435
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOAD_FAILED, handleCustomMapFloorUploadFailed);
1435
- subscribeSpaceEvent(SPACE_EVENTS.PATH_UPDATED, handlePathUpdated);
1436
- subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_USERS_UPDATE, handleScreenShareUsersUpdated);
1436
+ subscribeSpaceEvent(SPACE_EVENTS.PATH_UPDATED, handlePathUpdated),
1437
+ subscribeSpaceEvent(SPACE_EVENTS.PARTITION_COLLIDER_CLICKED, handlePartitionColiderClickSelected),
1438
+ subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_USERS_UPDATE, handleScreenShareUsersUpdated);
1437
1439
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_HOST_END_SESSION, handleScreenShareEndSessionEvent);
1438
1440
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_ACCEPT_REQUEST, handleScreenShareAcceptRequest);
1439
1441
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_BACK_USER_LIST_PANE, handleScreenShareBackUserListPane);
1442
+ subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_TERMINATED, handleScreenShareRemoteEndSessionEvent);
1443
+ }
1444
+ function handlePartitionColiderClickSelected(payload) {
1445
+ return __awaiter(this, void 0, void 0, function* () {
1446
+ const partitionId = payload.collider.name.split('_')[0];
1447
+ if ((activePane === null || activePane === void 0 ? void 0 : activePane.getAttribute('id')) !== 'at-room-tree-pane') {
1448
+ yield toggleDisplayPane('at-room-creation-btn');
1449
+ }
1450
+ else {
1451
+ yield new Promise(resolve => requestAnimationFrame(resolve));
1452
+ }
1453
+ highlightSelectedPartitionChild(partitionId, payload.collider.name);
1454
+ });
1440
1455
  }
1441
1456
  function handleDragEnd(payload) {
1442
1457
  console.log("handleDragEnd payload", payload);
@@ -1513,9 +1528,14 @@ function handleDrawHistory(payload) {
1513
1528
  function handleVertexPlace(payload) {
1514
1529
  console.log("handleVertexPlace ==>", payload);
1515
1530
  if (isToolbarFeatureEnabled('roomCreation')) {
1531
+ log.info("getDrawingMode()", getDrawingMode());
1532
+ if (getDrawingMode() === 'window') {
1533
+ }
1534
+ if (getDrawingMode() === 'partition') {
1535
+ // setCurrentPartitionData()
1536
+ }
1516
1537
  const undoBtn = document.getElementById('at-draw-undo-btn');
1517
1538
  undoBtn.classList.remove('at_disabled');
1518
- setCurrentPartitionData();
1519
1539
  const redoBtn = document.getElementById('at-draw-redo-btn');
1520
1540
  redoBtn.classList.add('at_disabled');
1521
1541
  }
@@ -2019,6 +2039,18 @@ function handleDrawPartition() {
2019
2039
  toggleDrawPartitionButton();
2020
2040
  });
2021
2041
  }
2042
+ function handleDrawWindow() {
2043
+ log.info("__@ handleDrawWindow()");
2044
+ const addDoorButton = document.getElementById('at-add-window-door-btn');
2045
+ addDoorButton.addEventListener('click', () => {
2046
+ toggleDrawWindowButton();
2047
+ });
2048
+ }
2049
+ function handleSaveWindow() {
2050
+ log.info("handleSaveWindow()");
2051
+ const currentPartitionData = getCurrentPartitionData();
2052
+ dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: currentPartitionData });
2053
+ }
2022
2054
  function handleSavePartition() {
2023
2055
  log.info("__@ handleSavePartition()");
2024
2056
  const saveRoomBtn = document.getElementById('at-save-room-btn');