architwin 1.17.0 → 1.17.1
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/actionPathHistory.js +4 -0
- package/lib/architwin.d.ts +3 -1
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/tagIotFormPane.d.ts +3 -1
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +84 -66
- package/lib/atwinui/components/toolbar/tagListPane.d.ts +5 -1
- package/lib/atwinui/components/toolbar/tagListPane.js +142 -4
- package/lib/atwinui/events.js +23 -29
- package/lib/atwinui/index.js +2 -0
- package/lib/types.d.ts +12 -1
- package/lib/types.js +2 -0
- package/package.json +1 -1
- package/static/atwinui.css +27 -0
|
@@ -11,7 +11,7 @@ export declare function toggleIoTDevicesOptions(): void;
|
|
|
11
11
|
* Sets Radio Button of the IoT's the Linked System
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function setSelectedIoTSystem(payload: string): void;
|
|
15
15
|
/**
|
|
16
16
|
* Clears dropdowns for both Category and Devices
|
|
17
17
|
*
|
|
@@ -43,6 +43,8 @@ export declare function getIotTagFormData(): {
|
|
|
43
43
|
iotSystem: string;
|
|
44
44
|
tag_type: TAG_TYPE;
|
|
45
45
|
};
|
|
46
|
+
export declare function initIoTLinkedSystemOptions(): void;
|
|
47
|
+
export declare function selectIoTLinkedSystemOptions(): void;
|
|
46
48
|
/**
|
|
47
49
|
* Clears all Fields Input Fields including the Linked Devices Table
|
|
48
50
|
*
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { IOT_LINKED_SYSTEMS, SPACE_EVENTS, TAG_TYPE } from '../../../types';
|
|
11
11
|
import log from 'loglevel';
|
|
12
12
|
import i18n from './i18n';
|
|
13
|
-
import { dispatchSpaceEvent, _tagIotCategoryTypes, _tagIotDevices, _tags } from '../../../architwin';
|
|
13
|
+
import { dispatchSpaceEvent, _tagIotCategoryTypes, _tagIotDevices, _tags, _iotLinkedSyatemOptions } from '../../../architwin';
|
|
14
14
|
import { stringContains, generateUUID } from "../../../utils";
|
|
15
15
|
import { batchAddEventListenerByClassName } from '../../events';
|
|
16
16
|
import { toggleModal, setModalAction } from "./modal";
|
|
@@ -18,12 +18,13 @@ import { Notyf } from 'notyf';
|
|
|
18
18
|
let selectedIoTCatOption;
|
|
19
19
|
let selectedIoTDeviceOption;
|
|
20
20
|
export let iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
21
|
-
export let selectedIoTSystem =
|
|
21
|
+
export let selectedIoTSystem = IOT_LINKED_SYSTEMS.BEMAC;
|
|
22
22
|
export let selectedIotTag = undefined;
|
|
23
23
|
let tagIotName, iotModelName, iotSerialNumber, iotMfrName, iotSystemLink;
|
|
24
24
|
let selectedIoTCat;
|
|
25
25
|
let linkedDevicesArray = [];
|
|
26
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', 'mdi-camera', 'mdi-dots-horizontal'];
|
|
27
|
+
let iotLinkedSystemOptions = ['BEMAC', 'HANASYS', 'Url Link', 'i-MTEC'];
|
|
27
28
|
let notify = new Notyf({ position: { x: 'left', y: 'bottom' } });
|
|
28
29
|
export function renderTagIOTFormPane() {
|
|
29
30
|
const element = document.createElement('div');
|
|
@@ -37,38 +38,27 @@ export function renderTagIOTFormPane() {
|
|
|
37
38
|
</div>
|
|
38
39
|
|
|
39
40
|
<div class="at_form_container at_scrollable_container at_h-min-70">
|
|
40
|
-
<
|
|
41
|
-
<div class="at_linked_systems_options_contianer at_gap_2" style="display: inline-flex">
|
|
42
|
-
<label class="at_flex at_align_center at_text_xs at_gap_1">
|
|
43
|
-
<input type="radio" id="at-linked-radio-bemac" name="iot-link-system" checked value=${IOT_LINKED_SYSTEMS.BEMAC} selected />
|
|
44
|
-
${i18n.t("BEMAC")}
|
|
45
|
-
</label>
|
|
46
|
-
<label class="at_flex at_align_center at_text_xs at_gap_1">
|
|
47
|
-
<input type="radio" id="at-linked-radio-hanasys" name="iot-link-system" value=${IOT_LINKED_SYSTEMS.HANASYS} />
|
|
48
|
-
${i18n.t("HANASYS")}
|
|
49
|
-
</label>
|
|
50
|
-
<label class="at_flex at_align_center at_text_xs at_gap_1">
|
|
51
|
-
<input type="radio" id="at-linked-radio-link" name="iot-link-system" value=${IOT_LINKED_SYSTEMS.URL_LINK} />
|
|
52
|
-
${i18n.t("URLLink")}
|
|
53
|
-
</label>
|
|
54
|
-
</div>
|
|
41
|
+
<div class="at_field at_flex_column">
|
|
55
42
|
|
|
56
|
-
<
|
|
57
|
-
<label for="">${i18n.t('Category')}</label>
|
|
58
|
-
<div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
|
|
59
|
-
<div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
60
|
-
<div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
|
|
61
|
-
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div style="position:absolute;">
|
|
65
|
-
<div class="at_dropdown_options" id="at-iot-category-options" data-cy="at-iot-category-options">
|
|
43
|
+
<label>${i18n.t('LinkedSystems')}</label>
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
<div id="at-iot-linked-system-listbox" class="at_listbox" data-cy="at-iot-linked-system-listbox">
|
|
46
|
+
<ul class="at_listbox_options" role="listbox" aria-label="Linked Systems">
|
|
47
|
+
|
|
48
|
+
</ul>
|
|
49
|
+
</div>
|
|
69
50
|
|
|
70
|
-
|
|
51
|
+
<label for="">${i18n.t('Category')}</label>
|
|
52
|
+
<div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
|
|
53
|
+
<div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
54
|
+
<div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
|
|
55
|
+
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
|
|
56
|
+
</div>
|
|
57
|
+
<div style="position:absolute;">
|
|
58
|
+
<div class="at_dropdown_options" id="at-iot-category-options" data-cy="at-iot-category-options"></div>
|
|
71
59
|
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
72
62
|
|
|
73
63
|
<div class="at-field at_flex_row at_justify_between">
|
|
74
64
|
<label for="">${i18n.t('TagName')}</label>
|
|
@@ -189,7 +179,6 @@ function setInputFields() {
|
|
|
189
179
|
}
|
|
190
180
|
export function setIotCategoryOptions() {
|
|
191
181
|
log.info('setIotCategoryOptions()');
|
|
192
|
-
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CATEGORIES, { payload: 'hello from library' });
|
|
193
182
|
if (_tagIotCategoryTypes) {
|
|
194
183
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
195
184
|
batchAddEventListenerByClassName('at_iot_cat_option', (event) => {
|
|
@@ -242,34 +231,21 @@ export function toggleIoTDevicesOptions() {
|
|
|
242
231
|
* Sets Radio Button of the IoT's the Linked System
|
|
243
232
|
*
|
|
244
233
|
*/
|
|
245
|
-
export function
|
|
246
|
-
log.info('
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (linkedRadio) {
|
|
261
|
-
selectedIoTSystem = payload;
|
|
262
|
-
linkedRadio.checked = true;
|
|
263
|
-
}
|
|
264
|
-
if (payload === IOT_LINKED_SYSTEMS.URL_LINK) {
|
|
265
|
-
log.info('payload == IOT_LINKED_SYSTEMS.URL_LINK', payload, IOT_LINKED_SYSTEMS.URL_LINK);
|
|
266
|
-
linkedDeviceContainer.style.display = 'none';
|
|
267
|
-
systemLinkContainer.style.display = 'block';
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
linkedDeviceContainer.style.display = 'block';
|
|
271
|
-
systemLinkContainer.style.display = 'none';
|
|
272
|
-
}
|
|
234
|
+
export function setSelectedIoTSystem(payload) {
|
|
235
|
+
log.info('setSelectedIoTSystem()', payload);
|
|
236
|
+
selectedIoTSystem = payload;
|
|
237
|
+
const options = document.querySelectorAll('.at_listbox_option');
|
|
238
|
+
options.forEach(option => {
|
|
239
|
+
log.info("option.getAttribute('data-value') == selectedIoTSystem", option.getAttribute('data-value'), selectedIoTSystem);
|
|
240
|
+
if (option.getAttribute('data-value') == selectedIoTSystem) {
|
|
241
|
+
log.info("selected");
|
|
242
|
+
option.classList.add('is-selected');
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
log.info("unselected");
|
|
246
|
+
option.classList.remove('is-selected');
|
|
247
|
+
}
|
|
248
|
+
});
|
|
273
249
|
}
|
|
274
250
|
/**
|
|
275
251
|
* Clears dropdowns for both Category and Devices
|
|
@@ -321,15 +297,16 @@ export function initIoTFormData(tagId) {
|
|
|
321
297
|
const iotData = foundTag.iot_tag;
|
|
322
298
|
//@ts-ignore
|
|
323
299
|
if (iotData) {
|
|
300
|
+
log.info("iotData", iotData);
|
|
324
301
|
iotModelName.value = iotData.model_name;
|
|
325
302
|
iotSerialNumber.value = iotData.serial_number;
|
|
326
303
|
iotMfrName.value = iotData.manufacturer_site;
|
|
327
304
|
iotSystemLink.value = iotData.system_link;
|
|
328
305
|
if (iotData.linked_system) {
|
|
329
|
-
|
|
306
|
+
setSelectedIoTSystem(iotData.linked_system);
|
|
330
307
|
}
|
|
331
308
|
else {
|
|
332
|
-
|
|
309
|
+
setSelectedIoTSystem(IOT_LINKED_SYSTEMS.BEMAC);
|
|
333
310
|
}
|
|
334
311
|
if (iotData.iot_category) {
|
|
335
312
|
log.info('found cat 1: ', i18n.t(iotData.iot_category), iotData.iot_category, _tagIotCategoryTypes);
|
|
@@ -362,7 +339,7 @@ export function initIoTFormData(tagId) {
|
|
|
362
339
|
else {
|
|
363
340
|
// this is due to selecting the tags created from James
|
|
364
341
|
log.info('initIoTFormData()', iotData);
|
|
365
|
-
|
|
342
|
+
setSelectedIoTSystem(IOT_LINKED_SYSTEMS.BEMAC);
|
|
366
343
|
setSelectedIoTCat({ uuid: generateUUID(), name: i18n.t('NoSelection') });
|
|
367
344
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
368
345
|
renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
|
|
@@ -424,9 +401,18 @@ function createCatOptionElement(item, dropdownType, index) {
|
|
|
424
401
|
option.setAttribute('iot-category-uuid', item.uuid);
|
|
425
402
|
option.setAttribute('dropdown-type', dropdownType);
|
|
426
403
|
option.setAttribute('data-cy', `at-iot-category-option-${item.uuid}`);
|
|
404
|
+
// option.innerHTML = `
|
|
405
|
+
// <span id="at-device-${item.name}" class="mdi ${iotCategoryIconList[index]}"></span>
|
|
406
|
+
// ${i18n.t(item.name)}
|
|
407
|
+
// `
|
|
427
408
|
option.innerHTML = `
|
|
428
|
-
|
|
429
|
-
|
|
409
|
+
<img
|
|
410
|
+
id="at-device-${item.name}"
|
|
411
|
+
src="data:image/png;base64,${item.json_data.iconBase64}"
|
|
412
|
+
alt="${item.name}"
|
|
413
|
+
style="width: 1.2em; height: 1.2em; vertical-align: middle; margin-right: 0.3em;"
|
|
414
|
+
/>
|
|
415
|
+
${i18n.t(item.name)}
|
|
430
416
|
`;
|
|
431
417
|
return option;
|
|
432
418
|
}
|
|
@@ -545,7 +531,7 @@ export function getIotTagFormData() {
|
|
|
545
531
|
tagMf: iotMfrName.value,
|
|
546
532
|
// tagCategoryId: selectedIoTCat.uuid,
|
|
547
533
|
tagCategoryId: selectedIoTCat ? selectedIoTCat.name : undefined,
|
|
548
|
-
systemLink:
|
|
534
|
+
systemLink: selectedIoTSystem,
|
|
549
535
|
linkedDevices: linkedDevicesArray,
|
|
550
536
|
iotSystem: selectedIoTSystem,
|
|
551
537
|
tag_type: TAG_TYPE.IOT
|
|
@@ -659,6 +645,38 @@ function deleteDeviceRow(deviceId) {
|
|
|
659
645
|
}
|
|
660
646
|
}
|
|
661
647
|
}
|
|
648
|
+
export function initIoTLinkedSystemOptions() {
|
|
649
|
+
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_LINKED_SYSTEM_OPTIONS, { payload: 'hello from library' });
|
|
650
|
+
const listbox = document.querySelector('#at-iot-linked-system-listbox .at_listbox_options');
|
|
651
|
+
iotLinkedSystemOptions = _iotLinkedSyatemOptions;
|
|
652
|
+
log.info("_iotLinkedSyatemOptions", _iotLinkedSyatemOptions);
|
|
653
|
+
log.info("iotLinkedSystemOptions", iotLinkedSystemOptions);
|
|
654
|
+
listbox.innerHTML = iotLinkedSystemOptions
|
|
655
|
+
.map((option, index) => `
|
|
656
|
+
<li
|
|
657
|
+
class="at_listbox_option ${index === 0 ? 'is-selected' : ''}"
|
|
658
|
+
role="option"
|
|
659
|
+
data-value="${option}"
|
|
660
|
+
tabindex="0"
|
|
661
|
+
>
|
|
662
|
+
${option}
|
|
663
|
+
</li>
|
|
664
|
+
`)
|
|
665
|
+
.join('');
|
|
666
|
+
}
|
|
667
|
+
export function selectIoTLinkedSystemOptions() {
|
|
668
|
+
log.info("selectIoTLinkedSystemOptions");
|
|
669
|
+
const options = document.querySelectorAll('.at_listbox_option');
|
|
670
|
+
options.forEach(option => {
|
|
671
|
+
option.addEventListener('click', () => {
|
|
672
|
+
log.info("option", option);
|
|
673
|
+
options.forEach(o => o.classList.remove('is-selected'));
|
|
674
|
+
option.classList.add('is-selected');
|
|
675
|
+
selectedIoTSystem = option.getAttribute('data-value');
|
|
676
|
+
log.info("selectedLinkedSystem", selectedIoTSystem);
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
}
|
|
662
680
|
/**
|
|
663
681
|
* Clears all Fields Input Fields including the Linked Devices Table
|
|
664
682
|
*
|
|
@@ -679,7 +697,7 @@ export function clearIotFields() {
|
|
|
679
697
|
linkedDevicesArray = [];
|
|
680
698
|
selectedIoTSystem = '';
|
|
681
699
|
selectedIoTCat = undefined;
|
|
682
|
-
|
|
700
|
+
setSelectedIoTSystem(IOT_LINKED_SYSTEMS.BEMAC);
|
|
683
701
|
deviceContainer.innerHTML = '';
|
|
684
702
|
iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
685
703
|
selectedIotTag = undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITag, ITagCategory, SortConfig, TAG_TYPE } from "../../../types";
|
|
1
|
+
import { ITag, ITagCategory, SortConfig, TAG_TYPE, ITagIOTCategory } from "../../../types";
|
|
2
2
|
import { MpSdk } from "../../../../bundle/sdk";
|
|
3
3
|
export declare const tagVisibility: Record<TAG_TYPE, Record<string, boolean>>;
|
|
4
4
|
export declare let selectedCategoryFilterId: any;
|
|
@@ -31,3 +31,7 @@ export declare function saveTagVisibilityToStorage(tagVisibility: Record<TAG_TYP
|
|
|
31
31
|
export declare function initializeTagVisibility(): void;
|
|
32
32
|
export declare function updateShowAllButton(): void;
|
|
33
33
|
export declare function clearTagVisibilityStorage(): void;
|
|
34
|
+
export declare function setIotCategoryFilterOptions(): void;
|
|
35
|
+
export declare function filterIotTagByCategory(tags: ITag[]): void;
|
|
36
|
+
export declare function setSelectedIoTCategoryFilter(payload: ITagIOTCategory): void;
|
|
37
|
+
export declare function renderIotCategoryDropdownFilterOptions(elementId: string, items: Array<ITagIOTCategory>): void;
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { SPACE_EVENTS, sortTagOptions, TAG_TYPE } from "../../../types";
|
|
11
11
|
import { batchAddEventListenerByClassName, toggleDisplayPane, batchAddEventListenerByDataAttribute } from "../../events";
|
|
12
|
-
import { convertToCssRgb, getBundleVersion } from "../../../utils";
|
|
13
|
-
import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk, toggleVisibilityTag } from "../../../architwin";
|
|
12
|
+
import { convertToCssRgb, getBundleVersion, stringContains } from "../../../utils";
|
|
13
|
+
import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk, toggleVisibilityTag, _tagIotCategoryTypes } from "../../../architwin";
|
|
14
14
|
import { initFormData, toggleDropdown } from "./tagFormPane";
|
|
15
15
|
import { toggleModal, setModalAction } from "./modal";
|
|
16
16
|
import { initIoTFormData, setIoTFormMode } from './tagIotFormPane';
|
|
@@ -34,12 +34,14 @@ const notify = new Notyf({
|
|
|
34
34
|
let _tagLink;
|
|
35
35
|
let isChevronEventAdded = false;
|
|
36
36
|
let allSubcategories = [];
|
|
37
|
+
let selectedIoTCategoryFilterOption;
|
|
38
|
+
let selectedIoTCategoryFilter;
|
|
39
|
+
let iotTags = [];
|
|
37
40
|
let tagSearchTerm = '';
|
|
38
41
|
export const tagVisibility = {
|
|
39
42
|
[TAG_TYPE.MP]: {},
|
|
40
43
|
[TAG_TYPE.IOT]: {}
|
|
41
44
|
};
|
|
42
|
-
let iotTags = [];
|
|
43
45
|
export let selectedCategoryFilterId = undefined;
|
|
44
46
|
export let selectedSubCategoryFilterId = undefined;
|
|
45
47
|
export let isTagPaneActive = true;
|
|
@@ -89,7 +91,7 @@ export function renderTagListPane() {
|
|
|
89
91
|
</button>
|
|
90
92
|
|
|
91
93
|
</div>
|
|
92
|
-
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}">
|
|
94
|
+
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}" id="at-custom-category-filter-dropdown-container">
|
|
93
95
|
<label for="">${i18n.t('Category')}</label>
|
|
94
96
|
<div id="at-custom-category-filter-dropdown" data-cy="at-custom-category-filter-dropdown">
|
|
95
97
|
<div id="at-category-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
@@ -117,6 +119,19 @@ export function renderTagListPane() {
|
|
|
117
119
|
</div>
|
|
118
120
|
</div>
|
|
119
121
|
</div>
|
|
122
|
+
|
|
123
|
+
<div class="at_field at_flex_column" id="at-custom-iot-category-filter-dropdown-container">
|
|
124
|
+
<label for="">${i18n.t('Category')}</label>
|
|
125
|
+
<div id="at-custom-iot-category-filter-dropdown" data-cy="at-custom-iot-category-filterdropdown">
|
|
126
|
+
<div id="at-custom-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
127
|
+
<div class="at_dropdown_toggle" id="at-custom-iot-selected-filter-category" data-cy="at-custom-iot-selected-filter-category">${i18n.t('NoSelection')}</div>
|
|
128
|
+
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-category-filter-chevron" data-cy="at-iot-category-filter-chevron"></span>
|
|
129
|
+
</div>
|
|
130
|
+
<div style="position:absolute;">
|
|
131
|
+
<div class="at_dropdown_options" id="at-iot-category-filter-options" data-cy="at-iot-category-filter-options"></div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
120
135
|
</div>
|
|
121
136
|
<div class="at_form_container at_scrollable_container at_h-min-45" id="at-tag-list-scrollable-container">
|
|
122
137
|
<table id="at-tag-list-container">
|
|
@@ -596,6 +611,7 @@ export function setSelectedSubcategoryFilter(subcategoryId) {
|
|
|
596
611
|
function initDropdownEventListeners() {
|
|
597
612
|
const categoryChevron = document.getElementById('at-category-filter-dropdown');
|
|
598
613
|
const subcategoryChevron = document.getElementById('at-subcategory-filter-dropdown');
|
|
614
|
+
const iotCategoryChevron = document.getElementById('at-custom-iot-cat-filter-dropdown');
|
|
599
615
|
if (categoryChevron) {
|
|
600
616
|
if (isChevronEventAdded == false) {
|
|
601
617
|
categoryChevron.addEventListener('click', () => {
|
|
@@ -616,6 +632,16 @@ function initDropdownEventListeners() {
|
|
|
616
632
|
console.log("Click event already attached to subcategory chevron");
|
|
617
633
|
}
|
|
618
634
|
}
|
|
635
|
+
if (iotCategoryChevron) {
|
|
636
|
+
if (isChevronEventAdded == false) {
|
|
637
|
+
iotCategoryChevron.addEventListener('click', () => {
|
|
638
|
+
toggleDropdown('at-iot-category-filter-options');
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
console.log("Click event already attached to subcategory chevron");
|
|
643
|
+
}
|
|
644
|
+
}
|
|
619
645
|
isChevronEventAdded = true;
|
|
620
646
|
}
|
|
621
647
|
export function getSearchTagTerm() {
|
|
@@ -825,3 +851,115 @@ export function clearTagVisibilityStorage() {
|
|
|
825
851
|
log.info('No tag in storage found');
|
|
826
852
|
}
|
|
827
853
|
}
|
|
854
|
+
export function setIotCategoryFilterOptions() {
|
|
855
|
+
log.info('setIotCategoryOptions()');
|
|
856
|
+
if (_tagIotCategoryTypes) {
|
|
857
|
+
renderIotCategoryDropdownFilterOptions('at-iot-category-filter-options', _tagIotCategoryTypes);
|
|
858
|
+
batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => {
|
|
859
|
+
log.info("category filter clicked");
|
|
860
|
+
//@ts-ignore
|
|
861
|
+
const selectedCat = event.target;
|
|
862
|
+
const catUUID = selectedCat.getAttribute('iot-category-filter-uuid');
|
|
863
|
+
const iotTags = _tags.filter(tag => tag.tag_type == TAG_TYPE.IOT);
|
|
864
|
+
if (catUUID == '') {
|
|
865
|
+
// no selection selected
|
|
866
|
+
selectedIoTCategoryFilter = { uuid: '', name: 'NoSelection' };
|
|
867
|
+
setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
|
|
868
|
+
renderTags(iotTags);
|
|
869
|
+
}
|
|
870
|
+
const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
|
|
871
|
+
if (getCatName) {
|
|
872
|
+
selectedIoTCategoryFilter = { uuid: catUUID, name: getCatName.name };
|
|
873
|
+
setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
|
|
874
|
+
log.info('cat id: ', selectedIoTCategoryFilter);
|
|
875
|
+
filterIotTagByCategory(iotTags);
|
|
876
|
+
}
|
|
877
|
+
toggleDropdown('at-iot-category-filter-options');
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
export function filterIotTagByCategory(tags) {
|
|
882
|
+
log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
|
|
883
|
+
const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
|
|
884
|
+
renderTags(filteredTags);
|
|
885
|
+
}
|
|
886
|
+
// displays selected Category in the dropdown
|
|
887
|
+
export function setSelectedIoTCategoryFilter(payload) {
|
|
888
|
+
log.info('setSelectedIoTCat()', payload);
|
|
889
|
+
const selectedOption = document.getElementById('at-custom-iot-selected-filter-category');
|
|
890
|
+
selectedOption.innerText = i18n.t(payload.name);
|
|
891
|
+
}
|
|
892
|
+
export function renderIotCategoryDropdownFilterOptions(elementId, items) {
|
|
893
|
+
const element = document.getElementById(elementId);
|
|
894
|
+
if (!element) {
|
|
895
|
+
console.error("Parameter element is undefined");
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
if (!items) {
|
|
899
|
+
console.error("Parameter items is undefined");
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
const isFilterDropdown = stringContains(elementId, 'filter');
|
|
903
|
+
log.info("isFilterDropdown", isFilterDropdown);
|
|
904
|
+
//Clear previosly appended children
|
|
905
|
+
element.innerHTML = ``;
|
|
906
|
+
const selectedIotCategoryOption = document.getElementById(isFilterDropdown ? 'at-iot-category-filter-dropdown-toggle' : 'at-iot-category-dropdown-toggle');
|
|
907
|
+
if (selectedIotCategoryOption) {
|
|
908
|
+
selectedIotCategoryOption.textContent = `${i18n.t('NoSelection')}`;
|
|
909
|
+
selectedIoTCategoryFilterOption = undefined;
|
|
910
|
+
}
|
|
911
|
+
//Add the no selection option
|
|
912
|
+
const noSelection = document.createElement('div');
|
|
913
|
+
noSelection.classList.add('at_option');
|
|
914
|
+
noSelection.classList.add('at_iot_cat_filter_option');
|
|
915
|
+
noSelection.setAttribute('iot-category-filter-uuid', '');
|
|
916
|
+
noSelection.setAttribute('dropdown-type', 'iotcategory');
|
|
917
|
+
noSelection.innerHTML = `
|
|
918
|
+
<span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
|
|
919
|
+
`;
|
|
920
|
+
noSelection.onclick = () => {
|
|
921
|
+
selectCatOption(noSelection, isFilterDropdown ? 'at-iot-category-filter-dropdown-toggle' : 'at-iot-category-filter-dropdown-toggle');
|
|
922
|
+
};
|
|
923
|
+
element.appendChild(noSelection);
|
|
924
|
+
if (items.length <= 0) {
|
|
925
|
+
console.log("No items to render");
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
items.forEach((item, index) => {
|
|
929
|
+
if (item.name != 'Multiple') {
|
|
930
|
+
const option = createCatOptionElement(item, 'iotcategoryfilter', index);
|
|
931
|
+
element.appendChild(option);
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
function selectCatOption(option, elementId) {
|
|
936
|
+
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CAT_ICON, { payload: option });
|
|
937
|
+
}
|
|
938
|
+
function createCatOptionElement(item, dropdownType, index) {
|
|
939
|
+
console.log("createCatOptionElement()", item, index);
|
|
940
|
+
const option = document.createElement('div');
|
|
941
|
+
option.style.display = 'flex';
|
|
942
|
+
option.style.flexDirection = 'row';
|
|
943
|
+
option.style.justifyContent = 'left';
|
|
944
|
+
option.style.alignItems = 'center';
|
|
945
|
+
option.style.gap = '2px';
|
|
946
|
+
option.classList.add('at_option');
|
|
947
|
+
option.classList.add('at_iot_cat_filter_option');
|
|
948
|
+
option.setAttribute('iot-category-filter-uuid', item.uuid);
|
|
949
|
+
option.setAttribute('dropdown-type', dropdownType);
|
|
950
|
+
option.setAttribute('data-cy', `at-iot-category-filter-option-${item.uuid}`);
|
|
951
|
+
// option.innerHTML = `
|
|
952
|
+
// <span id="at-device-${item.name}" class="mdi ${iotCategoryIconList[index]}"></span>
|
|
953
|
+
// ${i18n.t(item.name)}
|
|
954
|
+
// `
|
|
955
|
+
option.innerHTML = `
|
|
956
|
+
<img
|
|
957
|
+
id="at-device-${item.name}"
|
|
958
|
+
src="data:image/png;base64,${item.json_data.iconBase64}"
|
|
959
|
+
alt="${item.name}"
|
|
960
|
+
style="width: 1.2em; height: 1.2em; vertical-align: middle; margin-right: 0.3em;"
|
|
961
|
+
/>
|
|
962
|
+
${i18n.t(item.name)}
|
|
963
|
+
`;
|
|
964
|
+
return option;
|
|
965
|
+
}
|
package/lib/atwinui/events.js
CHANGED
|
@@ -30,14 +30,14 @@ import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMo
|
|
|
30
30
|
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";
|
|
31
31
|
import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
|
|
32
32
|
import { toggleGeneralMapOptions, initGeneralSelectedMap, getSelectedMapOption } from './components/toolbar/generalSettingsMenuPane';
|
|
33
|
-
import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm, sortTags, updateSelectedTagSortOption, resetSelectedTagSortOption, filterIotTagList, setTagPaneActive, isTagPaneActive, setCurrentTagPaneMode, currentTagPaneMode, selectedTagSortOption, tagVisibility, updateShowAllButton, saveTagVisibilityToStorage, initializeTagVisibility } from './components/toolbar/tagListPane';
|
|
33
|
+
import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm, sortTags, updateSelectedTagSortOption, resetSelectedTagSortOption, filterIotTagList, setTagPaneActive, isTagPaneActive, setCurrentTagPaneMode, currentTagPaneMode, selectedTagSortOption, tagVisibility, updateShowAllButton, saveTagVisibilityToStorage, initializeTagVisibility, setIotCategoryFilterOptions } from './components/toolbar/tagListPane';
|
|
34
34
|
import { renderUserRows } from "./components/toolbar/spaceUserListPane";
|
|
35
35
|
import { handleRemoteViewResponsiveChanges, renderRemoteSpaceViewing } from "./components/toolbar/viewingRemoteSpace";
|
|
36
36
|
import { PipeList } from "./components/toolbar/pipeListPane";
|
|
37
37
|
import { PipeForm } from "./components/toolbar/pipeFormPane";
|
|
38
38
|
// import { EditPipeForm, initPipeFormPane, pipeFormData, setPipeFormMode } from "./components/toolbar/pipeFormPane";
|
|
39
39
|
// import { initPipeData } from "./components/toolbar/addPipePane";
|
|
40
|
-
import { toggleIoTCategoryOptions, toggleIoTDevicesOptions,
|
|
40
|
+
import { toggleIoTCategoryOptions, toggleIoTDevicesOptions, clearIoTDropdowns, initIoTFormData, setIotCategoryOptions, getIotTagFormData, iotTagFormMode, selectedIotTag, clearIotFields, getIotCategoryOption, selectIoTLinkedSystemOptions, initIoTLinkedSystemOptions } from './components/toolbar/tagIotFormPane';
|
|
41
41
|
import { getTheseTagMessages, timedoutComment, unsendComment } from "./components/toolbar/tagMessagingPane";
|
|
42
42
|
import { handleScreenShareResponsiveChanges, handleScreenShareAcceptRequest, handleScreenShareBackUserListPane, handleScreenShareEndSessionEvent, handleScreenShareUsersUpdated, renderScreenShareLeaveConfirmationModal } from "./components/toolbar/screenSharePane";
|
|
43
43
|
const pipeList = new PipeList();
|
|
@@ -225,20 +225,11 @@ function toggleDisplayPane(targetId) {
|
|
|
225
225
|
}
|
|
226
226
|
if (paneId === 'at-tag-list-pane') {
|
|
227
227
|
renderTagPaneContent();
|
|
228
|
-
|
|
229
|
-
// clearTagFilterDropdown()
|
|
228
|
+
setIotCategoryFilterOptions();
|
|
230
229
|
const tags = getMpTags();
|
|
231
|
-
// if(selectedCategoryFilterId || selectedSubCategoryFilterId){
|
|
232
|
-
// const filteredTags = filterTagList(tags)
|
|
233
|
-
// const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
|
|
234
|
-
// renderTags(sortedTags)
|
|
235
|
-
// }else if (tags.length > 0) {
|
|
236
|
-
// const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
|
|
237
|
-
// renderTags(sortedTags,true)
|
|
238
|
-
// }
|
|
239
230
|
//Render the category dropdown elements if tagCategories is populated
|
|
240
231
|
if (_tagCategories && _tagCategories.length > 0) {
|
|
241
|
-
log.info("
|
|
232
|
+
log.info("_tagCategories");
|
|
242
233
|
renderCategoryDropdownOptions('at-category-filter-options', _tagCategories, 'at-category-filter-dropdown-toggle');
|
|
243
234
|
}
|
|
244
235
|
// for search
|
|
@@ -521,9 +512,8 @@ function setupIndividualEventListeners() {
|
|
|
521
512
|
handleCloseCustomMinimap();
|
|
522
513
|
handleCustomMapControls();
|
|
523
514
|
handleCloseActiveMinimap();
|
|
524
|
-
|
|
515
|
+
handleIoTOptions();
|
|
525
516
|
handleIoTDeviceDropdown();
|
|
526
|
-
handleSelectedIoTLinkedSystem();
|
|
527
517
|
handlePlaceIotTag();
|
|
528
518
|
handleIotFormClose();
|
|
529
519
|
handleIotFormSave();
|
|
@@ -3453,11 +3443,16 @@ function handleCloseActiveMinimap() {
|
|
|
3453
3443
|
});
|
|
3454
3444
|
}
|
|
3455
3445
|
}
|
|
3456
|
-
function
|
|
3446
|
+
function handleIoTOptions() {
|
|
3457
3447
|
const iotCateogryDropdown = document.getElementById('at-iot-cat-filter-dropdown');
|
|
3448
|
+
const iotLinkedSystemListbox = document.getElementById('at-iot-linked-system-listbox');
|
|
3458
3449
|
if (iotCateogryDropdown) {
|
|
3459
3450
|
toggleIoTCategoryOptions();
|
|
3460
3451
|
}
|
|
3452
|
+
if (iotLinkedSystemListbox) {
|
|
3453
|
+
initIoTLinkedSystemOptions();
|
|
3454
|
+
selectIoTLinkedSystemOptions();
|
|
3455
|
+
}
|
|
3461
3456
|
}
|
|
3462
3457
|
function handleIoTDeviceDropdown() {
|
|
3463
3458
|
const iotDeviceDropdown = document.getElementById('at-iot-cat-filter-dropdown');
|
|
@@ -3465,16 +3460,6 @@ function handleIoTDeviceDropdown() {
|
|
|
3465
3460
|
toggleIoTDevicesOptions();
|
|
3466
3461
|
}
|
|
3467
3462
|
}
|
|
3468
|
-
function handleSelectedIoTLinkedSystem() {
|
|
3469
|
-
document.querySelectorAll('input[name="iot-link-system"]').forEach(input => {
|
|
3470
|
-
input.addEventListener('change', (event) => {
|
|
3471
|
-
const target = event.target;
|
|
3472
|
-
if (target.value) {
|
|
3473
|
-
setSelectedIoTSystemRadio(target.value);
|
|
3474
|
-
}
|
|
3475
|
-
});
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3478
3463
|
function handlePlaceIotTag() {
|
|
3479
3464
|
log.info('handlePlaceIotTag()');
|
|
3480
3465
|
const moveIotTag = document.getElementById('at-iot-move-btn');
|
|
@@ -3648,6 +3633,8 @@ function handleDisplayElements(id) {
|
|
|
3648
3633
|
// hide dropdown sub/categories
|
|
3649
3634
|
handleHideElement('at-custom-category-filter-dropdown-container');
|
|
3650
3635
|
handleHideElement('at-custom-subcategory-filter-dropdown-container');
|
|
3636
|
+
handleHideElement('at-custom-category-filter-dropdown-container');
|
|
3637
|
+
handleDisplayElement('at-custom-iot-category-filter-dropdown-container');
|
|
3651
3638
|
break;
|
|
3652
3639
|
case 'at-expand-btn':
|
|
3653
3640
|
// changep ane height
|
|
@@ -3662,6 +3649,8 @@ function handleDisplayElements(id) {
|
|
|
3662
3649
|
`;
|
|
3663
3650
|
handleDisplayElement('at-custom-category-filter-dropdown-container');
|
|
3664
3651
|
handleDisplayElement('at-custom-subcategory-filter-dropdown-container');
|
|
3652
|
+
handleDisplayElement('at-custom-category-filter-dropdown-container');
|
|
3653
|
+
handleHideElement('at-custom-iot-category-filter-dropdown-container');
|
|
3665
3654
|
break;
|
|
3666
3655
|
default:
|
|
3667
3656
|
break;
|
|
@@ -3705,13 +3694,17 @@ function handleIotFormSave() {
|
|
|
3705
3694
|
if (iotSave) {
|
|
3706
3695
|
iotSave.addEventListener('click', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
3707
3696
|
var _a, _b;
|
|
3708
|
-
log.info('
|
|
3697
|
+
log.info('Saving iot');
|
|
3709
3698
|
let iotTagFormPayload = getIotTagFormData();
|
|
3710
3699
|
const selectedCat = getIotCategoryOption();
|
|
3711
3700
|
log.info('@caroline iotTagFormPayload: ', iotTagFormPayload, iotTagFormMode);
|
|
3712
3701
|
iotSave.classList.add('at_disabled');
|
|
3713
3702
|
if (iotTagFormPayload && iotTagFormMode == "ADD" /* FORM_MODE.ADD */) {
|
|
3714
3703
|
log.info('@caroline saving IOT, Add Mode');
|
|
3704
|
+
if (!currentTag) {
|
|
3705
|
+
notyf.error(`${i18n.t('NoTagSave')}`);
|
|
3706
|
+
iotSave.classList.remove('at_disabled');
|
|
3707
|
+
}
|
|
3715
3708
|
currentTag.json_data.label = iotTagFormPayload.name;
|
|
3716
3709
|
log.info('@caroline current Tag: ', currentTag);
|
|
3717
3710
|
if (!currentTag.iot_tag) {
|
|
@@ -3925,9 +3918,10 @@ function handleWindowVisibility(visibilityBtn, updateStateDB, fromParentVisibili
|
|
|
3925
3918
|
}
|
|
3926
3919
|
else {
|
|
3927
3920
|
const polygonJson = JSON.parse(thisPartition.polygon_json);
|
|
3928
|
-
const wall = polygonJson.walls.find(
|
|
3921
|
+
const wall = polygonJson.walls.find(w => w.uuid === wallId) || null;
|
|
3929
3922
|
const windows = (wall === null || wall === void 0 ? void 0 : wall.windows) || null;
|
|
3930
|
-
windows === null || windows === void 0 ? void 0 : windows.
|
|
3923
|
+
const targetWindow = windows === null || windows === void 0 ? void 0 : windows.find(w => w.index.toString() === windowIndex);
|
|
3924
|
+
targetWindow.options.is_visible = isVisible;
|
|
3931
3925
|
const payload = {
|
|
3932
3926
|
uuid: thisPartition.uuid,
|
|
3933
3927
|
space_uuid: thisPartition.space_uuid,
|
package/lib/atwinui/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { SPACE_EVENTS } from '../types';
|
|
|
14
14
|
import { dispatchSpaceEvent } from '../architwin';
|
|
15
15
|
import log from 'loglevel';
|
|
16
16
|
import { toggleBasepointCalibratePane } from './components/toolbar/basepointCalibratePane';
|
|
17
|
+
import { setSelectedIoTCategoryFilter } from './components/toolbar/tagListPane';
|
|
17
18
|
// let menuBar:HTMLElement,
|
|
18
19
|
// actionBar:HTMLElement,
|
|
19
20
|
// objectListPane:HTMLElement,
|
|
@@ -76,6 +77,7 @@ function initToolbarUI(payload) {
|
|
|
76
77
|
//@ts-expect-error
|
|
77
78
|
if (event.target.id === 'at-tag-iot-btn') {
|
|
78
79
|
handleDisplayElements('at-tag-iot-btn');
|
|
80
|
+
setSelectedIoTCategoryFilter({ uuid: '', name: 'NoSelection' });
|
|
79
81
|
}
|
|
80
82
|
//@ts-ignore
|
|
81
83
|
yield toggleDisplayPane(event.target.id);
|
package/lib/types.d.ts
CHANGED
|
@@ -61,6 +61,15 @@ export interface ITagCategory {
|
|
|
61
61
|
};
|
|
62
62
|
subcategories: Array<ITagCategory>;
|
|
63
63
|
}
|
|
64
|
+
export interface IotCategoryType {
|
|
65
|
+
name: string;
|
|
66
|
+
uuid: string;
|
|
67
|
+
json_data?: {
|
|
68
|
+
icon: string;
|
|
69
|
+
iconURL: string;
|
|
70
|
+
iconBase64: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
64
73
|
export interface ITagColor {
|
|
65
74
|
name: COLOR;
|
|
66
75
|
rgb: {
|
|
@@ -769,6 +778,7 @@ export declare enum SPACE_EVENTS {
|
|
|
769
778
|
SPACE_METADATA_RETRIEVED = "SPACE_METADATA_RETRIEVED",
|
|
770
779
|
GET_IOT_CATEGORIES = "GET_IOT_CATEGORIES",
|
|
771
780
|
GET_IOT_DEVICES = "GET_IOT_DEVICES",
|
|
781
|
+
GET_IOT_LINKED_SYSTEM_OPTIONS = "GET_IOT_LINKED_SYSTEM_OPTIONS",
|
|
772
782
|
IOT_TAG_SAVED = "IOT_TAG_SAVED",
|
|
773
783
|
TAG_SANDBOX_REGISTERED = "TAG_SANDBOX_REGISTERED",
|
|
774
784
|
GET_IOT_TAG_ICON = "GET_IOT_TAG_ICON",
|
|
@@ -1444,7 +1454,8 @@ export declare enum MAP_OPTIONS {
|
|
|
1444
1454
|
export declare enum IOT_LINKED_SYSTEMS {
|
|
1445
1455
|
BEMAC = "BEMAC",
|
|
1446
1456
|
HANASYS = "HANASYS",
|
|
1447
|
-
URL_LINK = "URLLink"
|
|
1457
|
+
URL_LINK = "URLLink",
|
|
1458
|
+
I_MTEC = "i-MTEC"
|
|
1448
1459
|
}
|
|
1449
1460
|
export interface ITagIOTCategory {
|
|
1450
1461
|
name: string;
|