@c8y/ngx-components 1017.0.261 → 1017.0.263

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.
@@ -5512,11 +5512,9 @@ class Permissions {
5512
5512
  });
5513
5513
  }
5514
5514
  checkWithRequest(mo) {
5515
- const moName = mo.name;
5516
5515
  const moId = mo.id;
5517
5516
  const partialUpdateObject = {
5518
- id: moId,
5519
- name: moName
5517
+ id: moId
5520
5518
  };
5521
5519
  return this.inventory
5522
5520
  .update(partialUpdateObject)
@@ -18691,7 +18689,8 @@ class PluginsService {
18691
18689
  return __awaiter(this, void 0, void 0, function* () {
18692
18690
  const apps = yield this.listApplicationsByCurrentTenant(params);
18693
18691
  const webApps = apps.filter(app => this.isPackage(app));
18694
- return webApps.sort((a, b) => a.name.localeCompare(b.name));
18692
+ const uniqueWebApps = this.removeDuplicates(webApps, 'contextPath');
18693
+ return uniqueWebApps.sort((a, b) => a.name.localeCompare(b.name));
18695
18694
  });
18696
18695
  }
18697
18696
  /**
@@ -18847,6 +18846,39 @@ class PluginsService {
18847
18846
  var _a;
18848
18847
  return (_a = application === null || application === void 0 ? void 0 : application.config) === null || _a === void 0 ? void 0 : _a.remotes;
18849
18848
  }
18849
+ /**
18850
+ * Verifies if an application is owned by management tenant.
18851
+ *
18852
+ * @param app The application to verify.
18853
+ * @returns True if owned by management tenant.
18854
+ */
18855
+ isOwnedByManagement(app) {
18856
+ const appOwner = get(app, 'owner.tenant.id');
18857
+ return appOwner === 'management';
18858
+ }
18859
+ removeDuplicates(apps, key) {
18860
+ const uniqueList = [];
18861
+ const groupedAppsByKey = groupBy(apps, key);
18862
+ const groupedApps = Object.keys(groupedAppsByKey).map(key => groupedAppsByKey[key]);
18863
+ for (const appsGroup of groupedApps) {
18864
+ if (appsGroup.length < 2) {
18865
+ uniqueList.push(...appsGroup);
18866
+ }
18867
+ else {
18868
+ const appFromCurrentTenant = appsGroup.find(app => this.isFromCurrentTenant(app));
18869
+ if (appFromCurrentTenant) {
18870
+ uniqueList.push(appFromCurrentTenant);
18871
+ continue;
18872
+ }
18873
+ const appNotOwnedByManagement = appsGroup.find(app => !this.isOwnedByManagement(app));
18874
+ uniqueList.push(appNotOwnedByManagement);
18875
+ }
18876
+ }
18877
+ return uniqueList;
18878
+ }
18879
+ isFromCurrentTenant(app) {
18880
+ return app.owner.tenant.id === this.appStateService.currentTenant.value.name;
18881
+ }
18850
18882
  /**
18851
18883
  * Modifies the list of plugins to have additional information such as id.
18852
18884
  * @ignore