architwin 1.18.9 → 1.18.11

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.
@@ -290,7 +290,6 @@ i18n
290
290
  "SuccessUpdatedFloorLevel": "Updated the partition's floor level",
291
291
  "DuplicatePartitionName": "This partition name is already used in this room. Please choose a different name.",
292
292
  "PleaseOnPolygonVisibility": "Action cannot be done, please turn on room visibility.",
293
- "IoTType": "IoT Type"
294
293
  }
295
294
  },
296
295
  ja: {
@@ -575,8 +574,7 @@ i18n
575
574
  "IotCategoryRequired": "IoTカテゴリは必須です",
576
575
  "SuccessUpdatedFloorLevel": "区画のフロアオフセット値が更新されました",
577
576
  "DuplicatePartitionName": "このパーティション名は既にこの部屋で使用されています。別の名前を選択してください。",
578
- "PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。",
579
- "IoTType": "IoTタイプ"
577
+ "PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。"
580
578
  }
581
579
  }
582
580
  },
@@ -213,11 +213,13 @@ export function displayPartitionItems(partitionItems, partitionId, object, paren
213
213
  // This is for the walls
214
214
  partitionItems.forEach((wall, index) => {
215
215
  log.info("__@ partition item: ", wall);
216
+ if (!wall || !wall.name || !(object === null || object === void 0 ? void 0 : object[index]))
217
+ return;
216
218
  if (!wall.options.is_deleted) {
217
219
  if (!wall.hide) {
218
220
  // Split wall name to localize
219
221
  const match = wall.name.match(/wall-(\d+)$/);
220
- const wallNumber = parseInt(match[1]) + 1;
222
+ const wallNumber = match ? parseInt(match[1]) + 1 : index + 1;
221
223
  const isVisible = wall.options.is_visible;
222
224
  const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
223
225
  log.info("__@ objName: ", objName);
@@ -1,4 +1,4 @@
1
- import { FORM_MODE, ITagCategory, ITag } from "../../../types";
1
+ import { FORM_MODE, ITagCategory } from "../../../types";
2
2
  export declare let tagFormMode: FORM_MODE;
3
3
  export declare let selectedTag: any;
4
4
  export declare function renderTagFormPane(): HTMLDivElement;
@@ -13,8 +13,6 @@ export declare function getTagFormData(): {
13
13
  export declare function setTagCategoriesOption(): void;
14
14
  export declare function toggleDropdown(elementId: string): void;
15
15
  export declare function clearInnerHTML(elementId: string): void;
16
- export declare function hideTagsFromSpace(tags?: ITag[]): Promise<void>;
17
- export declare function renderTagsInSpace(tags: ITag[], _withIcon?: boolean, iframeId?: string): Promise<void>;
18
16
  export declare function renderCategoryDropdownOptions(elementId: string, items: Array<ITagCategory>, toggleId?: string): void;
19
17
  export declare function renderSubcategoryDropdownOptions(elementId: string, items: Array<ITagCategory>): void;
20
18
  export declare function clearTagFormDropdown(): void;
@@ -1,20 +1,8 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { _atwin, _atwinConnections, _tagCategories, _tags, attachSandbox, disposeTags, getIoTDeviceTagIcons, getMpTags, renderTag, setTagIcon } from "../../../architwin";
11
- import { convertToCssRgb, stringContains, useHexToRgb } from "../../../utils";
1
+ import { _tagCategories, _tags, getMpTags } from "../../../architwin";
2
+ import { convertToCssRgb, stringContains } from "../../../utils";
12
3
  import { TAG_TYPE } from "../../../types";
13
4
  import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
14
5
  import i18n from './i18n';
15
- import log from "loglevel";
16
- import ShortUniqueId from "short-unique-id";
17
- import * as _tag from './../../../tag';
18
6
  let mode = 'adding';
19
7
  let tagNameInput, tagDescriptionInput, tagEmbedInput, tagCategoryDropdown, tagSubcategoryDropdown;
20
8
  let selectedCategoryId = undefined;
@@ -273,228 +261,109 @@ export function clearInnerHTML(elementId) {
273
261
  targetElement.innerHTML = ``;
274
262
  }
275
263
  function selectOption(option, elementId, skipToggle = false) {
276
- var _a;
277
- return __awaiter(this, void 0, void 0, function* () {
278
- console.log("selectOption()");
279
- //const dropdownToggle = document.querySelector('.at_dropdown_toggle');
280
- if (!elementId || elementId === '' || elementId == null) {
281
- console.error("ElementId is empty or undefined");
282
- return;
264
+ console.log("selectOption()");
265
+ //const dropdownToggle = document.querySelector('.at_dropdown_toggle');
266
+ if (!elementId || elementId === '' || elementId == null) {
267
+ console.error("ElementId is empty or undefined");
268
+ return;
269
+ }
270
+ const dropdownToggle = document.getElementById(elementId);
271
+ //dropdownToggle.textContent = option.textContent;
272
+ dropdownToggle.innerHTML = option.innerHTML;
273
+ //selectedText = option.textContent;
274
+ const isFilterDropdown = stringContains(elementId, 'filter');
275
+ const categoryUUID = option.getAttribute('category-uuid');
276
+ const categoryType = option.getAttribute('dropdown-type');
277
+ console.log("categoryUUID ", categoryUUID);
278
+ console.log("categoryType ", categoryType);
279
+ if (categoryUUID && categoryUUID !== null) {
280
+ if (categoryType == 'category' && isFilterDropdown == false) {
281
+ selectedCategoryId = categoryUUID;
283
282
  }
284
- const dropdownToggle = document.getElementById(elementId);
285
- //dropdownToggle.textContent = option.textContent;
286
- dropdownToggle.innerHTML = option.innerHTML;
287
- //selectedText = option.textContent;
288
- const isFilterDropdown = stringContains(elementId, 'filter');
289
- const categoryUUID = option.getAttribute('category-uuid');
290
- const categoryType = option.getAttribute('dropdown-type');
291
- console.log("categoryUUID ", categoryUUID);
292
- console.log("categoryType ", categoryType);
293
- if (categoryUUID && categoryUUID !== null) {
294
- if (categoryType == 'category' && isFilterDropdown == false) {
295
- selectedCategoryId = categoryUUID;
296
- }
297
- else if (categoryType == 'category' && isFilterDropdown) {
298
- setSelectedCategoryFilter(categoryUUID);
299
- setSelectedSubcategoryFilter(undefined); //reset selected subcategory
300
- const tags = getMpTags();
301
- const filteredTags = filterTagList(tags);
302
- const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
303
- const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
304
- // remove tags that is not part in the sorted Tags
305
- yield hideTagsFromSpace(removeTags);
306
- // show filtered tags only
307
- yield renderTagsInSpace(sortedTags, true);
308
- log.info("sortedTags", sortedTags);
309
- renderTags(sortedTags);
310
- }
311
- else if (categoryType == 'subcategory' && isFilterDropdown == false) {
312
- selectedSubCategoryId = categoryUUID;
313
- }
314
- else if (categoryType == 'subcategory' && isFilterDropdown) {
315
- setSelectedSubcategoryFilter(categoryUUID);
316
- const tags = getMpTags();
317
- const filteredTags = filterTagList(tags);
318
- const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
319
- const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
320
- // remove tags that is not part in the sorted Tags
321
- yield hideTagsFromSpace(removeTags);
322
- // show filtered tags only
323
- yield renderTagsInSpace(filteredTags, true);
324
- renderTags(filteredTags);
325
- }
326
- //Populate subcategory dropdown
327
- const targetCategory = _tagCategories.find(cat => cat.uuid === categoryUUID);
328
- if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
329
- console.log("Subcategories found", targetCategory.subcategories);
330
- renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
331
- }
332
- else {
333
- if (categoryType == 'category') {
334
- const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
335
- const subcatToggleId = isFilterDropdown ? 'at-subcategory-filter-dropdown-toggle' : 'at-subcategory-dropdown-toggle';
336
- const subcategoryToggle = document.getElementById(elementId);
337
- const subcatDropdownToggle = document.getElementById(subcatToggleId);
338
- subcategoryToggle.innerHTML = `
283
+ else if (categoryType == 'category' && isFilterDropdown) {
284
+ setSelectedCategoryFilter(categoryUUID);
285
+ setSelectedSubcategoryFilter(undefined); //reset selected subcategory
286
+ const tags = getMpTags();
287
+ const filteredTags = filterTagList(tags);
288
+ const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
289
+ renderTags(sortedTags);
290
+ }
291
+ else if (categoryType == 'subcategory' && isFilterDropdown == false) {
292
+ selectedSubCategoryId = categoryUUID;
293
+ }
294
+ else if (categoryType == 'subcategory' && isFilterDropdown) {
295
+ setSelectedSubcategoryFilter(categoryUUID);
296
+ const tags = getMpTags();
297
+ const filteredTags = filterTagList(tags);
298
+ const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
299
+ renderTags(filteredTags);
300
+ }
301
+ //Populate subcategory dropdown
302
+ const targetCategory = _tagCategories.find(cat => cat.uuid === categoryUUID);
303
+ if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
304
+ console.log("Subcategories found", targetCategory.subcategories);
305
+ renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
306
+ }
307
+ else {
308
+ if (categoryType == 'category') {
309
+ const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
310
+ const subcatToggleId = isFilterDropdown ? 'at-subcategory-filter-dropdown-toggle' : 'at-subcategory-dropdown-toggle';
311
+ const subcategoryToggle = document.getElementById(elementId);
312
+ const subcatDropdownToggle = document.getElementById(subcatToggleId);
313
+ subcategoryToggle.innerHTML = `
339
314
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
340
315
  `;
341
- subcatDropdownToggle.innerHTML = `
316
+ subcatDropdownToggle.innerHTML = `
342
317
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
343
318
  `;
344
- }
345
319
  }
346
320
  }
347
- else {
348
- console.log("categoryUUID is undefined");
349
- if (categoryType == 'category' && isFilterDropdown) {
350
- console.log("Clearing subcategory filter");
351
- const subcategoryToggle = document.getElementById('at-subcategory-filter-dropdown-toggle');
352
- subcategoryToggle.textContent = `${i18n.t('NoSelection')}`;
353
- subcategoryToggle.innerHTML = `
321
+ }
322
+ else {
323
+ console.log("categoryUUID is undefined");
324
+ if (categoryType == 'category' && isFilterDropdown) {
325
+ console.log("Clearing subcategory filter");
326
+ const subcategoryToggle = document.getElementById('at-subcategory-filter-dropdown-toggle');
327
+ subcategoryToggle.textContent = `${i18n.t('NoSelection')}`;
328
+ subcategoryToggle.innerHTML = `
354
329
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
355
330
  `;
356
- setSelectedCategoryFilter(undefined);
357
- }
358
- if (isFilterDropdown) {
359
- setSelectedSubcategoryFilter(undefined); //reset selected subcategory
360
- }
361
- //Populate subcategory dropdown
362
- const targetCategory = _tagCategories.find(cat => cat.uuid === selectedCategoryFilterId);
363
- if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
364
- console.log("Subcategories found", targetCategory.subcategories);
365
- renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
366
- }
367
- else {
368
- const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
369
- clearInnerHTML(elementId);
370
- }
371
- let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
372
- const filteredTags = (_a = filterTagList(tags)) !== null && _a !== void 0 ? _a : [];
373
- const sortedTags = sortTags(filteredTags.length ? filteredTags : tags, selectedTagSortOption);
374
- const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
375
- if (filteredTags.length > 0) {
376
- // remove tags that is not part in the sorted Tags
377
- yield hideTagsFromSpace(removeTags);
378
- }
379
- // show filtered tags only
380
- yield renderTagsInSpace(sortedTags, true);
381
- renderTags(sortedTags);
382
- }
383
- let toggleId = '';
384
- if (elementId === 'at-category-dropdown-toggle') {
385
- toggleId = 'at-category-options';
386
- }
387
- else if (elementId === 'at-subcategory-dropdown-toggle') {
388
- toggleId = 'at-subcategory-options';
389
- }
390
- else if (elementId === 'at-category-filter-dropdown-toggle') {
391
- toggleId = 'at-category-filter-options';
331
+ setSelectedCategoryFilter(undefined);
392
332
  }
393
- else if (elementId === 'at-subcategory-filter-dropdown-toggle') {
394
- toggleId = 'at-subcategory-filter-options';
333
+ if (isFilterDropdown) {
334
+ setSelectedSubcategoryFilter(undefined); //reset selected subcategory
395
335
  }
396
- if (skipToggle == false) {
397
- toggleDropdown(toggleId);
398
- }
399
- });
400
- }
401
- export function hideTagsFromSpace(tags = null) {
402
- return __awaiter(this, void 0, void 0, function* () {
403
- log.info('hideTagsFromSpace', tags);
404
- if (tags != null) {
405
- tags.map((tag) => __awaiter(this, void 0, void 0, function* () {
406
- yield _tag.disposeTag({ tagId: tag.json_data.id, sdk: _atwin, tags: _tags });
407
- }));
336
+ //Populate subcategory dropdown
337
+ const targetCategory = _tagCategories.find(cat => cat.uuid === selectedCategoryFilterId);
338
+ if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
339
+ console.log("Subcategories found", targetCategory.subcategories);
340
+ renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
408
341
  }
409
342
  else {
410
- disposeTags();
343
+ const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
344
+ clearInnerHTML(elementId);
411
345
  }
412
- });
413
- }
414
- // render tags to space
415
- export function renderTagsInSpace(tags, _withIcon = false, iframeId = undefined) {
416
- var _a;
417
- return __awaiter(this, void 0, void 0, function* () {
418
- log.info('renderTagsInSpace', tags);
419
- let renderedTagIds = [];
420
- const sdk = iframeId ? _atwinConnections[iframeId] : _atwin;
421
- for (let tag of tags) {
422
- log.info('tag', tag);
423
- const isDuplicate = renderedTagIds.includes(tag.json_data.id);
424
- const rsid = new ShortUniqueId({ length: 10 });
425
- if (isDuplicate) {
426
- //assign a different unique id if the existing tag id is a duplicate
427
- tag.json_data.id = rsid.rnd();
428
- }
429
- renderedTagIds.push(tag.json_data.id);
430
- try {
431
- const renderedTag = yield renderTag({ tag: tag.json_data }, false, iframeId);
432
- }
433
- catch (error) {
434
- log.info("Tag is already rendered in space");
435
- continue;
436
- }
437
- // check if tag needs tag icon display
438
- if (_withIcon && tag.tag_icon_base64 !== '') {
439
- // set tag icon
440
- log.info("__@ showTags: ", tags);
441
- yield setTagIcon({ tag: tag.json_data, iconName: tag.tag_icon_name, iconUrl: tag.tag_icon_base64, color: tag.json_data.color, iframeId });
442
- }
443
- if (tag.media_url && tag.media_url !== '') {
444
- try {
445
- const attachments = [tag.media_url];
446
- yield _tag.attachTagMedia({ sdk, tag: tag.json_data, attachments });
447
- }
448
- catch (error) {
449
- log.warn(error);
450
- }
451
- }
452
- if (tag.sandboxId) {
453
- try {
454
- yield attachSandbox({ sandboxId: tag.sandboxId, tagIds: [tag.json_data.id] });
455
- }
456
- catch (error) {
457
- log.error("Attach sandbox error ", error);
458
- }
459
- }
460
- if (tag.tag_type === TAG_TYPE.IOT) {
461
- const icons = getIoTDeviceTagIcons();
462
- let iconUrl = icons.normal;
463
- let iconName = "normal.png";
464
- let color = { r: 0.3, g: 0.5, b: 1.0 }; // default soft royal blue
465
- for (const device of tag.iot_tag.linked_devices) {
466
- if (!device)
467
- continue;
468
- const { quality, status } = device;
469
- // If any device is offline, override color to gray and stop checking further
470
- if (status === "offline") {
471
- iconUrl = icons.normal;
472
- iconName = "normal.png";
473
- color = useHexToRgb("667c89"); // gray
474
- break;
475
- }
476
- // If any device is alert (highest priority), set red and stop
477
- if (quality === 2) {
478
- iconUrl = icons.alert;
479
- iconName = "alert.png";
480
- color = { r: 1, g: 0, b: 0 }; // red
481
- break;
482
- }
483
- // If any device is attention, set orange but keep checking in case of alert
484
- if (quality === 3) {
485
- iconUrl = icons.alert;
486
- iconName = "normal.png";
487
- color = useHexToRgb("ffae42"); // orange
488
- // continue loop to see if alert is present
489
- }
490
- }
491
- tag.tag_icon_url = iconUrl;
492
- tag.tag_icon_name = iconName;
493
- tag.json_data.color = color;
494
- yield setTagIcon({ tag: tag.json_data, iconName: (_a = tag.tag_icon_base64) !== null && _a !== void 0 ? _a : '', iconUrl: tag.tag_icon_url, color: tag.json_data.color });
495
- }
496
- }
497
- });
346
+ let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
347
+ const filteredTags = filterTagList(tags);
348
+ const sortedTags = sortTags(filteredTags ? filteredTags : tags, selectedTagSortOption);
349
+ renderTags(sortedTags);
350
+ }
351
+ let toggleId = '';
352
+ if (elementId === 'at-category-dropdown-toggle') {
353
+ toggleId = 'at-category-options';
354
+ }
355
+ else if (elementId === 'at-subcategory-dropdown-toggle') {
356
+ toggleId = 'at-subcategory-options';
357
+ }
358
+ else if (elementId === 'at-category-filter-dropdown-toggle') {
359
+ toggleId = 'at-category-filter-options';
360
+ }
361
+ else if (elementId === 'at-subcategory-filter-dropdown-toggle') {
362
+ toggleId = 'at-subcategory-filter-options';
363
+ }
364
+ if (skipToggle == false) {
365
+ toggleDropdown(toggleId);
366
+ }
498
367
  }
499
368
  function createOptionElement(item, dropdownType) {
500
369
  console.log("createOptionElement");
@@ -51,7 +51,7 @@ export function renderTagIOTFormPane() {
51
51
  </div>
52
52
  </div>
53
53
 
54
- <label for="">${i18n.t('IoTType')}</label>
54
+ <label for="">${i18n.t('Category')}</label>
55
55
  <div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
56
56
  <div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
57
57
  <div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
@@ -32,6 +32,6 @@ export declare function initializeTagVisibility(): void;
32
32
  export declare function updateShowAllButton(): void;
33
33
  export declare function clearTagVisibilityStorage(): void;
34
34
  export declare function setIotCategoryFilterOptions(): void;
35
- export declare function filterIotTagByCategory(tags: ITag[]): Promise<void>;
35
+ export declare function filterIotTagByCategory(tags: ITag[]): void;
36
36
  export declare function setSelectedIoTCategoryFilter(payload: ITagIOTCategory): void;
37
37
  export declare function renderIotCategoryDropdownFilterOptions(elementId: string, items: Array<ITagIOTCategory>): void;
@@ -11,7 +11,7 @@ import { SPACE_EVENTS, sortTagOptions, TAG_TYPE } from "../../../types";
11
11
  import { batchAddEventListenerByClassName, toggleDisplayPane, batchAddEventListenerByDataAttribute } from "../../events";
12
12
  import { convertToCssRgb, getBundleVersion, stringContains } from "../../../utils";
13
13
  import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk, toggleVisibilityTag, _tagIotCategoryTypes } from "../../../architwin";
14
- import { hideTagsFromSpace, initFormData, renderTagsInSpace, toggleDropdown } from "./tagFormPane";
14
+ import { initFormData, toggleDropdown } from "./tagFormPane";
15
15
  import { toggleModal, setModalAction } from "./modal";
16
16
  import { initIoTFormData, setIoTFormMode } from './tagIotFormPane';
17
17
  import { Notyf } from 'notyf';
@@ -121,7 +121,7 @@ export function renderTagListPane() {
121
121
  </div>
122
122
 
123
123
  <div class="at_field at_flex_column" id="at-custom-iot-category-filter-dropdown-container">
124
- <label for="">${i18n.t('IoTType')}</label>
124
+ <label for="">${i18n.t('Category')}</label>
125
125
  <div id="at-custom-iot-category-filter-dropdown" data-cy="at-custom-iot-category-filterdropdown">
126
126
  <div id="at-custom-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
127
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>
@@ -274,6 +274,11 @@ export function renderTags(tags, showOwnTagsOnly = false) {
274
274
  console.log("TAG DELETE", tagId, _tags);
275
275
  const targetTag = _tags.find(tag => tag.json_data.id.toString() == tagId);
276
276
  yield disposeTag({ tagId: tagId });
277
+ if (targetTag) {
278
+ const tagType = targetTag.tag_type || TAG_TYPE.MP;
279
+ delete tagVisibility[tagType][tagId];
280
+ updateShowAllButton();
281
+ }
277
282
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
278
283
  tagRow.remove();
279
284
  const payload = { tag: targetTag };
@@ -488,7 +493,13 @@ export function addClickEventToTagRow(tag) {
488
493
  if (tag) {
489
494
  const tagId = tag.getAttribute('tag-id');
490
495
  if (tagId && tagId !== null) {
496
+ const deletedTag = _tags.find(t => t.json_data.id.toString() === tagId);
491
497
  yield disposeTag({ tagId: tagId });
498
+ if (deletedTag) {
499
+ const tagType = deletedTag.tag_type || TAG_TYPE.MP;
500
+ delete tagVisibility[tagType][tagId];
501
+ updateShowAllButton();
502
+ }
492
503
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
493
504
  tagRow.remove();
494
505
  notify.success(i18n.t('Successfully deleted tag'));
@@ -853,7 +864,7 @@ export function setIotCategoryFilterOptions() {
853
864
  log.info('setIotCategoryOptions()');
854
865
  if (_tagIotCategoryTypes) {
855
866
  renderIotCategoryDropdownFilterOptions('at-iot-category-filter-options', _tagIotCategoryTypes);
856
- batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => __awaiter(this, void 0, void 0, function* () {
867
+ batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => {
857
868
  log.info("category filter clicked");
858
869
  //@ts-ignore
859
870
  const selectedCat = event.target;
@@ -863,7 +874,6 @@ export function setIotCategoryFilterOptions() {
863
874
  // no selection selected
864
875
  selectedIoTCategoryFilter = { uuid: '', name: 'NoSelection' };
865
876
  setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
866
- yield renderTagsInSpace(iotTags, true);
867
877
  renderTags(iotTags);
868
878
  }
869
879
  const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
@@ -874,18 +884,13 @@ export function setIotCategoryFilterOptions() {
874
884
  filterIotTagByCategory(iotTags);
875
885
  }
876
886
  toggleDropdown('at-iot-category-filter-options');
877
- }));
887
+ });
878
888
  }
879
889
  }
880
890
  export function filterIotTagByCategory(tags) {
881
- return __awaiter(this, void 0, void 0, function* () {
882
- log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
883
- const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
884
- const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
885
- yield hideTagsFromSpace(removeTags);
886
- yield renderTagsInSpace(filteredTags, true);
887
- renderTags(filteredTags);
888
- });
891
+ log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
892
+ const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
893
+ renderTags(filteredTags);
889
894
  }
890
895
  // displays selected Category in the dropdown
891
896
  export function setSelectedIoTCategoryFilter(payload) {