@c8y/ngx-components 1017.0.261 → 1017.0.262
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/core/plugins/plugins.service.d.ts +9 -0
- package/esm2020/core/plugins/plugins.service.mjs +37 -2
- package/fesm2015/c8y-ngx-components.mjs +35 -1
- package/fesm2015/c8y-ngx-components.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components.mjs +35 -1
- package/fesm2020/c8y-ngx-components.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -18511,7 +18511,8 @@ class PluginsService {
|
|
|
18511
18511
|
async listPackages(params = {}) {
|
|
18512
18512
|
const apps = await this.listApplicationsByCurrentTenant(params);
|
|
18513
18513
|
const webApps = apps.filter(app => this.isPackage(app));
|
|
18514
|
-
|
|
18514
|
+
const uniqueWebApps = this.removeDuplicates(webApps, 'contextPath');
|
|
18515
|
+
return uniqueWebApps.sort((a, b) => a.name.localeCompare(b.name));
|
|
18515
18516
|
}
|
|
18516
18517
|
/**
|
|
18517
18518
|
* Checks if an application is a package.
|
|
@@ -18647,6 +18648,39 @@ class PluginsService {
|
|
|
18647
18648
|
getMFRemotes(application) {
|
|
18648
18649
|
return application?.config?.remotes;
|
|
18649
18650
|
}
|
|
18651
|
+
/**
|
|
18652
|
+
* Verifies if an application is owned by management tenant.
|
|
18653
|
+
*
|
|
18654
|
+
* @param app The application to verify.
|
|
18655
|
+
* @returns True if owned by management tenant.
|
|
18656
|
+
*/
|
|
18657
|
+
isOwnedByManagement(app) {
|
|
18658
|
+
const appOwner = get(app, 'owner.tenant.id');
|
|
18659
|
+
return appOwner === 'management';
|
|
18660
|
+
}
|
|
18661
|
+
removeDuplicates(apps, key) {
|
|
18662
|
+
const uniqueList = [];
|
|
18663
|
+
const groupedAppsByKey = groupBy(apps, key);
|
|
18664
|
+
const groupedApps = Object.keys(groupedAppsByKey).map(key => groupedAppsByKey[key]);
|
|
18665
|
+
for (const appsGroup of groupedApps) {
|
|
18666
|
+
if (appsGroup.length < 2) {
|
|
18667
|
+
uniqueList.push(...appsGroup);
|
|
18668
|
+
}
|
|
18669
|
+
else {
|
|
18670
|
+
const appFromCurrentTenant = appsGroup.find(app => this.isFromCurrentTenant(app));
|
|
18671
|
+
if (appFromCurrentTenant) {
|
|
18672
|
+
uniqueList.push(appFromCurrentTenant);
|
|
18673
|
+
continue;
|
|
18674
|
+
}
|
|
18675
|
+
const appNotOwnedByManagement = appsGroup.find(app => !this.isOwnedByManagement(app));
|
|
18676
|
+
uniqueList.push(appNotOwnedByManagement);
|
|
18677
|
+
}
|
|
18678
|
+
}
|
|
18679
|
+
return uniqueList;
|
|
18680
|
+
}
|
|
18681
|
+
isFromCurrentTenant(app) {
|
|
18682
|
+
return app.owner.tenant.id === this.appStateService.currentTenant.value.name;
|
|
18683
|
+
}
|
|
18650
18684
|
/**
|
|
18651
18685
|
* Modifies the list of plugins to have additional information such as id.
|
|
18652
18686
|
* @ignore
|