@c8y/ngx-components 1011.0.28 → 1011.0.31

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@c8y/client'), require('@c8y/ngx-components'), require('@c8y/ngx-components/assets-navigator'), require('@ngx-translate/core'), require('@c8y/ngx-components/device-grid'), require('rxjs'), require('@angular/router'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/popover'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('@c8y/ngx-components/sub-assets', ['exports', '@angular/core', '@c8y/client', '@c8y/ngx-components', '@c8y/ngx-components/assets-navigator', '@ngx-translate/core', '@c8y/ngx-components/device-grid', 'rxjs', '@angular/router', 'ngx-bootstrap/modal', 'ngx-bootstrap/popover', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.c8y = global.c8y || {}, global.c8y['ngx-components'] = global.c8y['ngx-components'] || {}, global.c8y['ngx-components']['sub-assets'] = {}), global.ng.core, global.client, global.c8y['ngx-components'], global.c8y['ngx-components']['assets-navigator'], global.core$1, global.c8y['ngx-components']['device-grid'], global.rxjs, global.ng.router, global.modal, global.popover, global.ng.forms));
5
- }(this, (function (exports, core, client, ngxComponents, assetsNavigator, core$1, deviceGrid, rxjs, router, modal, popover, forms) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@c8y/client'), require('@c8y/ngx-components'), require('@c8y/ngx-components/assets-navigator'), require('@ngx-translate/core'), require('@c8y/ngx-components/device-grid'), require('@angular/router'), require('ngx-bootstrap/modal'), require('rxjs'), require('ngx-bootstrap/popover'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@c8y/ngx-components/sub-assets', ['exports', '@angular/core', '@c8y/client', '@c8y/ngx-components', '@c8y/ngx-components/assets-navigator', '@ngx-translate/core', '@c8y/ngx-components/device-grid', '@angular/router', 'ngx-bootstrap/modal', 'rxjs', 'ngx-bootstrap/popover', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.c8y = global.c8y || {}, global.c8y['ngx-components'] = global.c8y['ngx-components'] || {}, global.c8y['ngx-components']['sub-assets'] = {}), global.ng.core, global.client, global.c8y['ngx-components'], global.c8y['ngx-components']['assets-navigator'], global.core$1, global.c8y['ngx-components']['device-grid'], global.ng.router, global.modal, global.rxjs, global.popover, global.ng.forms));
5
+ }(this, (function (exports, core, client, ngxComponents, assetsNavigator, core$1, deviceGrid, router, modal, rxjs, popover, forms) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -365,7 +365,6 @@
365
365
  _this.alertService = alertService;
366
366
  _this.permissionsService = permissionsService;
367
367
  _this.modal = modal;
368
- _this.uiOnlyCountersUpdate = new rxjs.BehaviorSubject(null);
369
368
  _this.GRID_CONFIG_DEFAULT_STORAGE_KEY = 'sub-assets-grid-config';
370
369
  _this.IS_DEVICE_GROUP_FRAGMENT = 'c8y_IsDeviceGroup';
371
370
  _this.IS_DYNAMIC_GROUP_FRAGMENT = 'c8y_IsDynamicGroup';
@@ -1147,8 +1146,9 @@
1147
1146
  };
1148
1147
 
1149
1148
  var SubAssetsGridComponent = /** @class */ (function () {
1150
- function SubAssetsGridComponent(subAssetsGridService, bsModalService, smartGroupsService) {
1149
+ function SubAssetsGridComponent(subAssetsGridService, alert, bsModalService, smartGroupsService) {
1151
1150
  this.subAssetsGridService = subAssetsGridService;
1151
+ this.alert = alert;
1152
1152
  this.bsModalService = bsModalService;
1153
1153
  this.smartGroupsService = smartGroupsService;
1154
1154
  this.title = ngxComponents.gettext('Subassets');
@@ -1335,10 +1335,10 @@
1335
1335
  switch (_a.label) {
1336
1336
  case 0:
1337
1337
  if (!result) return [3 /*break*/, 2];
1338
- this.subAssetsGridService.uiOnlyCountersUpdate.next('DECREASE');
1339
1338
  return [4 /*yield*/, this.subAssetsGridService.deleteAsset(asset, parentRef, result)];
1340
1339
  case 1:
1341
1340
  _a.sent();
1341
+ this.alert.warning(ngxComponents.gettext('The counter for the total number of items might be inaccurate.'));
1342
1342
  this.refresh.emit();
1343
1343
  _a.label = 2;
1344
1344
  case 2: return [2 /*return*/];
@@ -1359,21 +1359,14 @@
1359
1359
  };
1360
1360
  SubAssetsGridComponent.prototype.onDataSourceModifier = function (dataSourceModifier) {
1361
1361
  return __awaiter(this, void 0, void 0, function () {
1362
- var promises, counters, action, _a, dataResponse, size, filteredSize;
1362
+ var promises, counters, _a, dataResponse, size, filteredSize;
1363
1363
  return __generator(this, function (_b) {
1364
1364
  switch (_b.label) {
1365
1365
  case 0:
1366
1366
  promises = [];
1367
1367
  promises.push(this.subAssetsGridService.getData(dataSourceModifier.columns, dataSourceModifier.pagination, this.parentGroup, this.baseQuery));
1368
- action = this.subAssetsGridService.uiOnlyCountersUpdate.value;
1369
- if (action) {
1370
- counters = this.uiOnlyCountersUpdate(action);
1371
- this.subAssetsGridService.uiOnlyCountersUpdate.next(null);
1372
- }
1373
- else {
1374
- promises.push(this.subAssetsGridService.getTotal(this.parentGroup, this.baseQuery));
1375
- promises.push(this.subAssetsGridService.getCount(dataSourceModifier.columns, dataSourceModifier.pagination, this.parentGroup, this.baseQuery));
1376
- }
1368
+ promises.push(this.subAssetsGridService.getTotal(this.parentGroup, this.baseQuery));
1369
+ promises.push(this.subAssetsGridService.getCount(dataSourceModifier.columns, dataSourceModifier.pagination, this.parentGroup, this.baseQuery));
1377
1370
  return [4 /*yield*/, Promise.all(promises)];
1378
1371
  case 1:
1379
1372
  _a = __read.apply(void 0, [_b.sent(), 3]), dataResponse = _a[0], size = _a[1], filteredSize = _a[2];
@@ -1392,25 +1385,6 @@
1392
1385
  SubAssetsGridComponent.prototype.configChange = function (config) {
1393
1386
  this.subAssetsGridService.saveConfig(config);
1394
1387
  };
1395
- // workaround since the totalPages value is cached on the BE
1396
- SubAssetsGridComponent.prototype.uiOnlyCountersUpdate = function (action) {
1397
- var currentAllItemsCount = this.dataGrid.filteringLabelsParams.allItemsCount;
1398
- var currentFilteredItemsCount = this.dataGrid.filteringLabelsParams.filteredItemsCount;
1399
- var counters;
1400
- if (action === 'DECREASE') {
1401
- counters = {
1402
- size: currentAllItemsCount - 1,
1403
- filteredSize: currentFilteredItemsCount - 1
1404
- };
1405
- }
1406
- if (action === 'INCREASE') {
1407
- counters = {
1408
- size: currentAllItemsCount + 1,
1409
- filteredSize: currentFilteredItemsCount + 1
1410
- };
1411
- }
1412
- return counters;
1413
- };
1414
1388
  return SubAssetsGridComponent;
1415
1389
  }());
1416
1390
  SubAssetsGridComponent.decorators = [
@@ -1421,6 +1395,7 @@
1421
1395
  ];
1422
1396
  SubAssetsGridComponent.ctorParameters = function () { return [
1423
1397
  { type: SubAssetsService },
1398
+ { type: ngxComponents.AlertService },
1424
1399
  { type: modal.BsModalService },
1425
1400
  { type: client.SmartGroupsService }
1426
1401
  ]; };
@@ -1588,7 +1563,6 @@
1588
1563
  return [2 /*return*/];
1589
1564
  }
1590
1565
  this.pendingStatus = true;
1591
- this.subAssetsService.uiOnlyCountersUpdate.next('INCREASE');
1592
1566
  return [4 /*yield*/, this.addGroupService.createGroupAndAssignDevices(this.formGroupStepOne.value, this.currentGroupId, this.selected)];
1593
1567
  case 1:
1594
1568
  _a.sent();