architwin 1.17.0 → 1.17.2
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/i18n.js +20 -1
- package/lib/atwinui/components/toolbar/tagIotFormPane.d.ts +3 -1
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +127 -95
- 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 +34 -0
|
@@ -173,6 +173,7 @@ i18n
|
|
|
173
173
|
"BEMAC": "BEMAC",
|
|
174
174
|
"HANASYS": "HANASYS",
|
|
175
175
|
"URLLink": "URL Link",
|
|
176
|
+
"i-MTEC": "i-MTEC",
|
|
176
177
|
"ModelName": "Model Name",
|
|
177
178
|
"SerialNumber": "Serial Number",
|
|
178
179
|
"ManufacturerSite": "Manufacturer Site",
|
|
@@ -193,6 +194,14 @@ i18n
|
|
|
193
194
|
"Frequency": "Frequency",
|
|
194
195
|
"Camera": "Camera",
|
|
195
196
|
"Others": "Others",
|
|
197
|
+
"Outlet": "Outlet",
|
|
198
|
+
"Amp": "Amp",
|
|
199
|
+
"RPM": "RPM",
|
|
200
|
+
"Level": "Level",
|
|
201
|
+
"Alert": "Alert",
|
|
202
|
+
"Status": "Status",
|
|
203
|
+
"Selection": "Selection",
|
|
204
|
+
"Monitor": "Monitor",
|
|
196
205
|
"DeleteDevice": "Delete Device",
|
|
197
206
|
"ConfirmDeleteDevice": "Are you sure you want to delete this device? This action cannot be reversed",
|
|
198
207
|
"SuccessDeleteDevice": "Successfully deleted device",
|
|
@@ -453,6 +462,8 @@ i18n
|
|
|
453
462
|
"BEMAC": "BEMAC",
|
|
454
463
|
"HANASYS": "HANASYS",
|
|
455
464
|
"URLLink": "URLリンク",
|
|
465
|
+
"URL Link": "URLリンク",
|
|
466
|
+
"i-MTEC": "i-MTEC",
|
|
456
467
|
"ModelName": "機器名",
|
|
457
468
|
"SerialNumber": "シリアルナンバー",
|
|
458
469
|
"ManufacturerSite": "メーカーURL",
|
|
@@ -461,7 +472,7 @@ i18n
|
|
|
461
472
|
"SystemLink": "システムリンク",
|
|
462
473
|
"LinkedIoTDevices": "設定済みIoT",
|
|
463
474
|
"EditIoTTag": "IoTタグ編集",
|
|
464
|
-
"Power": "
|
|
475
|
+
"Power": "発停",
|
|
465
476
|
"Temperature": "温度",
|
|
466
477
|
"Humidity": "湿度",
|
|
467
478
|
"Pressure": "圧力",
|
|
@@ -474,6 +485,14 @@ i18n
|
|
|
474
485
|
"Frequency": "周波数",
|
|
475
486
|
"Camera": "カメラ",
|
|
476
487
|
"Others": "その他",
|
|
488
|
+
"Outlet": "出力",
|
|
489
|
+
"Amp": "電流値",
|
|
490
|
+
"RPM": "回転数",
|
|
491
|
+
"Level": "レベル",
|
|
492
|
+
"Alert": "警報",
|
|
493
|
+
"Status": "状態",
|
|
494
|
+
"Selection": "選択",
|
|
495
|
+
"Monitor": "モニタ",
|
|
477
496
|
"DeleteDevice": "デバイス削除",
|
|
478
497
|
"ConfirmDeleteDevice": "この操作は元に戻せません。このデバイスを削除しますか?",
|
|
479
498
|
"SuccessDeleteDevice": "デバイスを削除しました",
|
|
@@ -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 toggleIoTLinkedSystemOptions(): 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,101 +38,88 @@ 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
|
-
|
|
58
|
-
<div id="at-iot-
|
|
59
|
-
<div id="at-iot-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
43
|
+
<label>${i18n.t('LinkedSystems')}</label>
|
|
44
|
+
<div id="at-iot-linked-system-dropdown" data-cy="at-iot-linked-system-dropdown">
|
|
45
|
+
<div id="at-iot-linked-system-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
46
|
+
<div class="at_dropdown_toggle" id="at-iot-selected-linked-system" data-cy="at-iot-selected-linked-system">${i18n.t('NoSelection')}</div>
|
|
47
|
+
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-linked-system-filter-chevron" data-cy="at-iot-linked-system-filter-chevron"></span>
|
|
48
|
+
</div>
|
|
49
|
+
<div style="position:absolute;">
|
|
50
|
+
<div class="at_dropdown_options" id="at-iot-linked-system-options" data-cy="at-iot-linked-system-options"></div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
69
53
|
|
|
70
|
-
|
|
54
|
+
<label for="">${i18n.t('Category')}</label>
|
|
55
|
+
<div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
|
|
56
|
+
<div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
57
|
+
<div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
|
|
58
|
+
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
|
|
59
|
+
</div>
|
|
60
|
+
<div style="position:absolute;">
|
|
61
|
+
<div class="at_dropdown_options" id="at-iot-category-options" data-cy="at-iot-category-options"></div>
|
|
71
62
|
</div>
|
|
63
|
+
</div>
|
|
72
64
|
|
|
73
65
|
<div class="at-field at_flex_row at_justify_between">
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
<label for="">${i18n.t('TagName')}</label>
|
|
67
|
+
<input class="at_field_input at_w-full" type="text" name="tag_name" id="at-iot-name-input" data-cy="at-iot-name-input" />
|
|
76
68
|
</div>
|
|
77
69
|
|
|
78
70
|
<div class="at-field at_flex_row at_justify_between">
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
<label for="">${i18n.t('ModelName')}</label>
|
|
72
|
+
<input class="at_field_input at_w-full" type="text" name="model_name" id="at-iot-model-input" data-cy="at-iot-model-input" />
|
|
81
73
|
</div>
|
|
82
74
|
|
|
83
75
|
<div class="at-field at_flex_row at_justify_between">
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
<label for="">${i18n.t('SerialNumber')}</label>
|
|
77
|
+
<input class="at_field_input at_w-full" type="text" name="serial_name" id="at-iot-serial-input" data-cy="at-iot-serial-input" />
|
|
86
78
|
</div>
|
|
87
79
|
|
|
88
80
|
<div class="at-field at_flex_row at_justify_between">
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
<label for="">${i18n.t('ManufacturerSite')}</label>
|
|
82
|
+
<input class="at_field_input at_w-full" type="text" name="manufacturer_site" id="at-iot-manufacturer-input" data-cy="at-iot-manufacturer-input" />
|
|
91
83
|
</div>
|
|
92
84
|
|
|
93
85
|
<div class="at-field at_flex_row at_justify_between" id="at-iot-system-link-container" style="display: none">
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
<label for="">${i18n.t('SystemLink')}</label>
|
|
87
|
+
<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" />
|
|
96
88
|
</div>
|
|
97
89
|
|
|
98
90
|
<div class="at_button at_ghost" id="at-iot-move-btn" data-cy="at-iot-move-btn" style="top: 4px !important">
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
<label for="" style="bottom: 10px !important" class="at_comment_unsend_container">${i18n.t('MoveTag')}</label>
|
|
92
|
+
<span class="mdi mdi-map-marker at_icon" style="bottom: 9px !important"></span>
|
|
101
93
|
</div>
|
|
102
94
|
|
|
103
95
|
<div class="at_field at_flex_column" id="at-iot-device-main-container">
|
|
104
|
-
|
|
96
|
+
<label for="">${i18n.t('IoTDevices')}</label>
|
|
105
97
|
<div id="at-iot-devices-dropdown" data-cy="at-iot-devices-dropdown" class="at-device-dropdown">
|
|
106
98
|
<div id="at-iot-devices-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
107
99
|
<div class="at_dropdown_toggle" id="at-iot-selected-device" data-cy="at-iot-selected-device">${i18n.t(selectedIoTDeviceOption)}</div>
|
|
108
100
|
<span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
|
|
109
|
-
</div>
|
|
110
101
|
|
|
111
102
|
<div style="position:absolute;">
|
|
112
103
|
<div class="at_dropdown_options" id="at-iot-device-options" data-cy="at-iot-device-options">
|
|
113
104
|
|
|
105
|
+
</div>
|
|
114
106
|
</div>
|
|
107
|
+
</div>
|
|
115
108
|
</div>
|
|
116
109
|
</div>
|
|
117
110
|
|
|
118
111
|
<div class="at_iot_list_container at_h-min-40" id="at-iot-device-list-container" data-cy="at-iot-device-list-container">
|
|
119
|
-
|
|
120
|
-
<div class="
|
|
121
|
-
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<div>
|
|
129
|
-
<div class="at_body at_linked_device_container" id="at-device-item-container">
|
|
130
|
-
</div>
|
|
112
|
+
<div class="at_section at_iot_item_container at_scrollable_container" id="at-linked-device-container" data-cy="at-linked-device-container">
|
|
113
|
+
<div class="at_title" style="padding-left: 20px !important;">
|
|
114
|
+
<div> </div>
|
|
115
|
+
<label for="">${i18n.t('LinkedIoTDevices')}</label>
|
|
116
|
+
<div> </div>
|
|
117
|
+
</div>
|
|
118
|
+
<div>
|
|
119
|
+
<div class="at_body at_linked_device_container" id="at-device-item-container">
|
|
131
120
|
</div>
|
|
132
|
-
|
|
133
121
|
</div>
|
|
134
|
-
|
|
122
|
+
</div>
|
|
135
123
|
</div>
|
|
136
124
|
|
|
137
125
|
</div>
|
|
@@ -189,7 +177,6 @@ function setInputFields() {
|
|
|
189
177
|
}
|
|
190
178
|
export function setIotCategoryOptions() {
|
|
191
179
|
log.info('setIotCategoryOptions()');
|
|
192
|
-
dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CATEGORIES, { payload: 'hello from library' });
|
|
193
180
|
if (_tagIotCategoryTypes) {
|
|
194
181
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
195
182
|
batchAddEventListenerByClassName('at_iot_cat_option', (event) => {
|
|
@@ -242,33 +229,13 @@ export function toggleIoTDevicesOptions() {
|
|
|
242
229
|
* Sets Radio Button of the IoT's the Linked System
|
|
243
230
|
*
|
|
244
231
|
*/
|
|
245
|
-
export function
|
|
246
|
-
log.info('
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
else if (payload == IOT_LINKED_SYSTEMS.HANASYS) {
|
|
254
|
-
targetId = 'at-linked-radio-hanasys';
|
|
255
|
-
}
|
|
256
|
-
else if (payload == IOT_LINKED_SYSTEMS.URL_LINK) {
|
|
257
|
-
targetId = 'at-linked-radio-link';
|
|
258
|
-
}
|
|
259
|
-
const linkedRadio = document.getElementById(targetId);
|
|
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';
|
|
232
|
+
export function setSelectedIoTSystem(payload) {
|
|
233
|
+
log.info('setSelectedIoTSystem()', payload);
|
|
234
|
+
selectedIoTSystem = payload;
|
|
235
|
+
// Update dropdown toggle text
|
|
236
|
+
const selectedToggle = document.getElementById('at-iot-selected-linked-system');
|
|
237
|
+
if (selectedToggle) {
|
|
238
|
+
selectedToggle.textContent = payload ? i18n.t(payload) : i18n.t('NoSelection');
|
|
272
239
|
}
|
|
273
240
|
}
|
|
274
241
|
/**
|
|
@@ -321,15 +288,16 @@ export function initIoTFormData(tagId) {
|
|
|
321
288
|
const iotData = foundTag.iot_tag;
|
|
322
289
|
//@ts-ignore
|
|
323
290
|
if (iotData) {
|
|
291
|
+
log.info("iotData", iotData);
|
|
324
292
|
iotModelName.value = iotData.model_name;
|
|
325
293
|
iotSerialNumber.value = iotData.serial_number;
|
|
326
294
|
iotMfrName.value = iotData.manufacturer_site;
|
|
327
295
|
iotSystemLink.value = iotData.system_link;
|
|
328
296
|
if (iotData.linked_system) {
|
|
329
|
-
|
|
297
|
+
setSelectedIoTSystem(iotData.linked_system);
|
|
330
298
|
}
|
|
331
299
|
else {
|
|
332
|
-
|
|
300
|
+
setSelectedIoTSystem('');
|
|
333
301
|
}
|
|
334
302
|
if (iotData.iot_category) {
|
|
335
303
|
log.info('found cat 1: ', i18n.t(iotData.iot_category), iotData.iot_category, _tagIotCategoryTypes);
|
|
@@ -362,7 +330,7 @@ export function initIoTFormData(tagId) {
|
|
|
362
330
|
else {
|
|
363
331
|
// this is due to selecting the tags created from James
|
|
364
332
|
log.info('initIoTFormData()', iotData);
|
|
365
|
-
|
|
333
|
+
setSelectedIoTSystem('');
|
|
366
334
|
setSelectedIoTCat({ uuid: generateUUID(), name: i18n.t('NoSelection') });
|
|
367
335
|
renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
|
|
368
336
|
renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
|
|
@@ -424,9 +392,18 @@ function createCatOptionElement(item, dropdownType, index) {
|
|
|
424
392
|
option.setAttribute('iot-category-uuid', item.uuid);
|
|
425
393
|
option.setAttribute('dropdown-type', dropdownType);
|
|
426
394
|
option.setAttribute('data-cy', `at-iot-category-option-${item.uuid}`);
|
|
395
|
+
// option.innerHTML = `
|
|
396
|
+
// <span id="at-device-${item.name}" class="mdi ${iotCategoryIconList[index]}"></span>
|
|
397
|
+
// ${i18n.t(item.name)}
|
|
398
|
+
// `
|
|
427
399
|
option.innerHTML = `
|
|
428
|
-
|
|
429
|
-
|
|
400
|
+
<img
|
|
401
|
+
id="at-device-${item.name}"
|
|
402
|
+
src="data:image/png;base64,${item.json_data.iconBase64}"
|
|
403
|
+
alt="${item.name}"
|
|
404
|
+
style="width: 1.2em; height: 1.2em; vertical-align: middle; margin-right: 0.3em;"
|
|
405
|
+
/>
|
|
406
|
+
${i18n.t(item.name)}
|
|
430
407
|
`;
|
|
431
408
|
return option;
|
|
432
409
|
}
|
|
@@ -545,7 +522,7 @@ export function getIotTagFormData() {
|
|
|
545
522
|
tagMf: iotMfrName.value,
|
|
546
523
|
// tagCategoryId: selectedIoTCat.uuid,
|
|
547
524
|
tagCategoryId: selectedIoTCat ? selectedIoTCat.name : undefined,
|
|
548
|
-
systemLink:
|
|
525
|
+
systemLink: selectedIoTSystem,
|
|
549
526
|
linkedDevices: linkedDevicesArray,
|
|
550
527
|
iotSystem: selectedIoTSystem,
|
|
551
528
|
tag_type: TAG_TYPE.IOT
|
|
@@ -578,7 +555,7 @@ function renderDeviceRow(payload) {
|
|
|
578
555
|
|
|
579
556
|
<div class="at_name">
|
|
580
557
|
<div></div>
|
|
581
|
-
<
|
|
558
|
+
<span for="">${payload.name}</span>
|
|
582
559
|
<div></div>
|
|
583
560
|
</div>
|
|
584
561
|
<div class="at_subitem_right">
|
|
@@ -659,6 +636,61 @@ function deleteDeviceRow(deviceId) {
|
|
|
659
636
|
}
|
|
660
637
|
}
|
|
661
638
|
}
|
|
639
|
+
export function initIoTLinkedSystemOptions() {
|
|
640
|
+
const element = document.getElementById('at-iot-linked-system-options');
|
|
641
|
+
if (!element) {
|
|
642
|
+
console.error('Linked system options container not found');
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
// Clear previous options
|
|
646
|
+
element.innerHTML = ``;
|
|
647
|
+
const selectedToggle = document.getElementById('at-iot-selected-linked-system');
|
|
648
|
+
if (selectedToggle) {
|
|
649
|
+
selectedToggle.textContent = i18n.t('NoSelection');
|
|
650
|
+
}
|
|
651
|
+
/* ---------- NO SELECTION OPTION ---------- */
|
|
652
|
+
const noSelection = document.createElement('div');
|
|
653
|
+
noSelection.classList.add('at_option');
|
|
654
|
+
noSelection.setAttribute('dropdown-type', 'iot-linkedsystem');
|
|
655
|
+
noSelection.setAttribute('data-value', '');
|
|
656
|
+
noSelection.innerHTML = `
|
|
657
|
+
<span class="mdi mdi-circle-slice-1"></span>
|
|
658
|
+
${i18n.t('NoSelection')}
|
|
659
|
+
`;
|
|
660
|
+
noSelection.onclick = () => {
|
|
661
|
+
if (selectedToggle) {
|
|
662
|
+
setSelectedIoTSystem('');
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
element.appendChild(noSelection);
|
|
666
|
+
/* ---------- LINKED SYSTEM OPTIONS ---------- */
|
|
667
|
+
if (!_iotLinkedSyatemOptions || _iotLinkedSyatemOptions.length === 0) {
|
|
668
|
+
console.log('No linked systems to render');
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
_iotLinkedSyatemOptions.forEach((option) => {
|
|
672
|
+
const opt = document.createElement('div');
|
|
673
|
+
opt.classList.add('at_option');
|
|
674
|
+
opt.setAttribute('dropdown-type', 'iot-linkedsystem');
|
|
675
|
+
opt.setAttribute('data-value', option);
|
|
676
|
+
opt.textContent = i18n.t(option);
|
|
677
|
+
opt.onclick = () => {
|
|
678
|
+
if (selectedToggle) {
|
|
679
|
+
setSelectedIoTSystem(option);
|
|
680
|
+
selectedIoTSystem = option;
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
element.appendChild(opt);
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
export function toggleIoTLinkedSystemOptions() {
|
|
687
|
+
log.info('toggleIoTCategoryOptions');
|
|
688
|
+
const linkedSystemDropdown = document.getElementById('at-iot-linked-system-dropdown');
|
|
689
|
+
const linkedSystemOptions = document.getElementById('at-iot-linked-system-options');
|
|
690
|
+
linkedSystemDropdown.addEventListener('click', () => {
|
|
691
|
+
linkedSystemOptions.classList.toggle('open');
|
|
692
|
+
});
|
|
693
|
+
}
|
|
662
694
|
/**
|
|
663
695
|
* Clears all Fields Input Fields including the Linked Devices Table
|
|
664
696
|
*
|
|
@@ -679,7 +711,7 @@ export function clearIotFields() {
|
|
|
679
711
|
linkedDevicesArray = [];
|
|
680
712
|
selectedIoTSystem = '';
|
|
681
713
|
selectedIoTCat = undefined;
|
|
682
|
-
|
|
714
|
+
setSelectedIoTSystem('');
|
|
683
715
|
deviceContainer.innerHTML = '';
|
|
684
716
|
iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
|
|
685
717
|
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
|
+
}
|