@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.
- package/core/plugins/plugins.service.d.ts +9 -0
- package/ecosystem/shared/ecosystem.service.d.ts +1 -1
- package/esm2020/core/common/permissions.service.mjs +2 -4
- package/esm2020/core/plugins/plugins.service.mjs +37 -2
- package/esm2020/ecosystem/shared/ecosystem.service.mjs +7 -9
- package/esm2020/sub-assets/add-group/add-group.component.mjs +3 -4
- package/esm2020/sub-assets/sub-assets.component.mjs +2 -5
- package/fesm2015/c8y-ngx-components-ecosystem-shared.mjs +6 -8
- package/fesm2015/c8y-ngx-components-ecosystem-shared.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components-sub-assets.mjs +3 -7
- package/fesm2015/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2015/c8y-ngx-components.mjs +36 -4
- package/fesm2015/c8y-ngx-components.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-ecosystem-shared.mjs +6 -8
- package/fesm2020/c8y-ngx-components-ecosystem-shared.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-sub-assets.mjs +3 -7
- package/fesm2020/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components.mjs +36 -4
- package/fesm2020/c8y-ngx-components.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -11,8 +11,8 @@ import { ApplicationAvailability, ApplicationType } from '@c8y/client';
|
|
|
11
11
|
import * as i2$1 from '@ngx-translate/core';
|
|
12
12
|
import { saveAs } from 'file-saver';
|
|
13
13
|
import { groupBy, uniqBy, get, pick, kebabCase, cloneDeep } from 'lodash-es';
|
|
14
|
-
import { BehaviorSubject, merge, combineLatest } from 'rxjs';
|
|
15
|
-
import { debounceTime, take, distinctUntilKeyChanged,
|
|
14
|
+
import { BehaviorSubject, defer, merge, combineLatest } from 'rxjs';
|
|
15
|
+
import { map, shareReplay, debounceTime, take, distinctUntilKeyChanged, tap, filter, switchMap } from 'rxjs/operators';
|
|
16
16
|
import { gt, coerce } from 'semver';
|
|
17
17
|
import * as i3$1 from '@angular/common';
|
|
18
18
|
import * as i4 from '@angular/router';
|
|
@@ -185,6 +185,7 @@ class EcosystemService {
|
|
|
185
185
|
this.inventoryService = inventoryService;
|
|
186
186
|
this.appDeleted = new EventEmitter();
|
|
187
187
|
this.progress = new BehaviorSubject(null);
|
|
188
|
+
this.appsGroupedByContextPath$ = defer(() => this.getWebApplications()).pipe(map(webApps => groupBy(webApps, 'contextPath')), shareReplay({ bufferSize: 1, refCount: true }));
|
|
188
189
|
}
|
|
189
190
|
getUniqueAppConfig(srcApp, existingApps) {
|
|
190
191
|
let app = {
|
|
@@ -255,7 +256,6 @@ class EcosystemService {
|
|
|
255
256
|
async getWebApplications(customFilter = {}) {
|
|
256
257
|
const apps = (await this.getApplications(customFilter)).data;
|
|
257
258
|
const webApps = apps.filter(app => this.isApplication(app));
|
|
258
|
-
this.appsGroupedByContextPath = groupBy(webApps, 'contextPath');
|
|
259
259
|
return webApps.sort((a, b) => a.name.localeCompare(b.name));
|
|
260
260
|
}
|
|
261
261
|
async getFeatureApplications(customFilter = {}) {
|
|
@@ -297,7 +297,7 @@ class EcosystemService {
|
|
|
297
297
|
window.open(this.applicationService.getHref(app), '_blank', 'noopener,noreferrer');
|
|
298
298
|
}
|
|
299
299
|
async canDeleteApp(app) {
|
|
300
|
-
return (this.isOwner(app) && (
|
|
300
|
+
return (this.isOwner(app) && (!this.isCurrentApp(app) || (await this.hasSubscribedAppParent(app))));
|
|
301
301
|
}
|
|
302
302
|
isOwner(app) {
|
|
303
303
|
const currentTenant = this.appStateService.currentTenant.value;
|
|
@@ -628,10 +628,8 @@ class EcosystemService {
|
|
|
628
628
|
return !this.isOwner(app) && (await this.hasSubscribedAppParent(app));
|
|
629
629
|
}
|
|
630
630
|
async hasSubscribedAppParent(app) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
return app.contextPath && this.appsGroupedByContextPath[app.contextPath]?.length === 2;
|
|
631
|
+
const appsGroupedByContextPath = await this.appsGroupedByContextPath$.pipe(take(1)).toPromise();
|
|
632
|
+
return app.contextPath && appsGroupedByContextPath[app.contextPath]?.length === 2;
|
|
635
633
|
}
|
|
636
634
|
/**
|
|
637
635
|
* @deprecated
|