@c8y/ngx-components 1023.52.0 → 1023.55.5
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/alarms/index.d.ts +2 -1
- package/alarms/index.d.ts.map +1 -1
- package/application-access/list/index.d.ts +36 -0
- package/application-access/list/index.d.ts.map +1 -0
- package/application-access/user/application-access-user-details-wrapper/index.d.ts +33 -0
- package/application-access/user/application-access-user-details-wrapper/index.d.ts.map +1 -0
- package/application-access/user/index.d.ts +6 -0
- package/application-access/user/index.d.ts.map +1 -0
- package/asset-properties/index.d.ts +247 -28
- package/asset-properties/index.d.ts.map +1 -1
- package/context-dashboard/index.d.ts +1 -1
- package/datapoints-export-selector/index.d.ts +2 -2
- package/device-enrolment/index.d.ts +6 -0
- package/device-enrolment/index.d.ts.map +1 -0
- package/device-enrolment/modal/index.d.ts +88 -0
- package/device-enrolment/modal/index.d.ts.map +1 -0
- package/device-grid/index.d.ts +1 -1
- package/device-list/index.d.ts +1 -1
- package/device-shell/index.d.ts +1 -1
- package/echart/index.d.ts +1 -1
- package/echart/models/index.d.ts +2 -2
- package/fesm2022/c8y-ngx-components-alarms-cockpit.mjs +1 -1
- package/fesm2022/c8y-ngx-components-alarms-devicemanagement.mjs +1 -1
- package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-application-access-list.mjs +180 -0
- package/fesm2022/c8y-ngx-components-application-access-list.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-application-access-user-application-access-user-details-wrapper.mjs +113 -0
- package/fesm2022/c8y-ngx-components-application-access-user-application-access-user-details-wrapper.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-application-access-user.mjs +20 -0
- package/fesm2022/c8y-ngx-components-application-access-user.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-asset-properties.mjs +640 -119
- package/fesm2022/c8y-ngx-components-asset-properties.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-branding-shared.mjs +1 -1
- package/fesm2022/c8y-ngx-components-child-devices.mjs +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard-asset-add.mjs +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard-device-add.mjs +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard-devicemanagement.mjs +1 -1
- package/fesm2022/{c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-D0C7SH6L.mjs → c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-DvKsV_Fs.mjs} +14 -12
- package/fesm2022/c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-DvKsV_Fs.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-dashboard-details-advanced-tab.mjs +2 -2
- package/fesm2022/c8y-ngx-components-datapoint-explorer-devicemanagement.mjs +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-explorer.mjs +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-library.mjs +1 -1
- package/fesm2022/c8y-ngx-components-device-enrolment-modal.mjs +570 -0
- package/fesm2022/c8y-ngx-components-device-enrolment-modal.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-device-enrolment.mjs +147 -0
- package/fesm2022/c8y-ngx-components-device-enrolment.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-ecosystem.mjs +2 -2
- package/fesm2022/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-exports.mjs +1 -1
- package/fesm2022/c8y-ngx-components-feature-toggles.mjs +1 -1
- package/fesm2022/c8y-ngx-components-register-device.mjs +1 -1
- package/fesm2022/c8y-ngx-components-remote-access-ssh.mjs +1 -1
- package/fesm2022/c8y-ngx-components-remote-access-telnet.mjs +1 -1
- package/fesm2022/c8y-ngx-components-remote-access-vnc.mjs +1 -1
- package/fesm2022/c8y-ngx-components-report-dashboard.mjs +1 -1
- package/fesm2022/c8y-ngx-components-repository-firmware.mjs +1 -1
- package/fesm2022/c8y-ngx-components-repository-shared.mjs +3 -5
- package/fesm2022/c8y-ngx-components-repository-shared.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-sub-assets.mjs +132 -55
- package/fesm2022/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-tenants.mjs +71 -32
- package/fesm2022/c8y-ngx-components-tenants.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-upgrade.mjs +7 -1
- package/fesm2022/c8y-ngx-components-upgrade.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-cockpit-welcome.mjs +4 -4
- package/fesm2022/c8y-ngx-components-widgets-implementations-cockpit-welcome.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +454 -225
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/index.d.ts +109 -39
- package/index.d.ts.map +1 -1
- package/locales/de.po +190 -13
- package/locales/es.po +189 -13
- package/locales/fr.po +189 -13
- package/locales/ja_JP.po +168 -13
- package/locales/ko.po +190 -13
- package/locales/locales.pot +169 -8
- package/locales/nl.po +189 -13
- package/locales/pl.po +189 -13
- package/locales/pt_BR.po +189 -13
- package/locales/zh_CN.po +190 -13
- package/locales/zh_TW.po +189 -13
- package/map/index.d.ts +1 -0
- package/map/index.d.ts.map +1 -1
- package/operations/bulk-operations-service/index.d.ts +1 -1
- package/package.json +1 -1
- package/protocol-opcua/mappings/index.d.ts +1 -1
- package/register-device/index.d.ts +1 -1
- package/remote-access/data/index.d.ts +1 -0
- package/remote-access/data/index.d.ts.map +1 -1
- package/repository/shared/index.d.ts.map +1 -1
- package/sub-assets/index.d.ts +9 -3
- package/sub-assets/index.d.ts.map +1 -1
- package/tenants/index.d.ts +1 -0
- package/tenants/index.d.ts.map +1 -1
- package/upgrade/index.d.ts.map +1 -1
- package/widgets/implementations/asset-table/index.d.ts +1 -1
- package/widgets/implementations/datapoints-table/index.d.ts +2 -2
- package/widgets/implementations/kpi/index.d.ts +1 -1
- package/fesm2022/c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-D0C7SH6L.mjs.map +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, input, output, Component, signal, computed, inject, forwardRef } from '@angular/core';
|
|
3
|
+
import { ApplicationAvailability, ApplicationService } from '@c8y/client';
|
|
4
|
+
import { ListGroupComponent, ListItemComponent, ListItemBodyComponent, AppIconComponent, IconDirective, C8yTranslatePipe, HumanizeAppNamePipe, C8yTranslateDirective, AppStateService } from '@c8y/ngx-components';
|
|
5
|
+
import { AsyncPipe } from '@angular/common';
|
|
6
|
+
import { PopoverDirective } from 'ngx-bootstrap/popover';
|
|
7
|
+
import { gettext } from '@c8y/ngx-components/gettext';
|
|
8
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
|
|
10
|
+
class AlreadyInArrayPipe {
|
|
11
|
+
transform(application, appIdsOfGlobalRoles) {
|
|
12
|
+
if (!application || !appIdsOfGlobalRoles || Array.isArray(appIdsOfGlobalRoles) === false) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return appIdsOfGlobalRoles.includes(application.id);
|
|
16
|
+
}
|
|
17
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AlreadyInArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
18
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AlreadyInArrayPipe, isStandalone: true, name: "alreadyInArray" }); }
|
|
19
|
+
}
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AlreadyInArrayPipe, decorators: [{
|
|
21
|
+
type: Pipe,
|
|
22
|
+
args: [{
|
|
23
|
+
name: 'alreadyInArray'
|
|
24
|
+
}]
|
|
25
|
+
}] });
|
|
26
|
+
|
|
27
|
+
class NotAvailableInOwnerPipe {
|
|
28
|
+
transform(application, ownerUser) {
|
|
29
|
+
const ownerApps = ownerUser?.applications;
|
|
30
|
+
if (!ownerApps) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const isAvailable = ownerApps.some(app => app.id === application.id);
|
|
34
|
+
return !isAvailable;
|
|
35
|
+
}
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NotAvailableInOwnerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
37
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: NotAvailableInOwnerPipe, isStandalone: true, name: "notAvailableInOwner" }); }
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NotAvailableInOwnerPipe, decorators: [{
|
|
40
|
+
type: Pipe,
|
|
41
|
+
args: [{
|
|
42
|
+
name: 'notAvailableInOwner'
|
|
43
|
+
}]
|
|
44
|
+
}] });
|
|
45
|
+
|
|
46
|
+
class ApplicationAccessSubListComponent {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.applications = input(...(ngDevMode ? [undefined, { debugName: "applications" }] : []));
|
|
49
|
+
this.legend = input('', ...(ngDevMode ? [{ debugName: "legend" }] : []));
|
|
50
|
+
this.legendHelpText = input('', ...(ngDevMode ? [{ debugName: "legendHelpText" }] : []));
|
|
51
|
+
this.noOwnerAvailable = input(false, ...(ngDevMode ? [{ debugName: "noOwnerAvailable" }] : []));
|
|
52
|
+
this.appIdsOfGlobalRoles = input([], ...(ngDevMode ? [{ debugName: "appIdsOfGlobalRoles" }] : []));
|
|
53
|
+
this.disabledEdit = input(false, ...(ngDevMode ? [{ debugName: "disabledEdit" }] : []));
|
|
54
|
+
this.userWithOwner = input(null, ...(ngDevMode ? [{ debugName: "userWithOwner" }] : []));
|
|
55
|
+
this.selectedAppIds = input([], ...(ngDevMode ? [{ debugName: "selectedAppIds" }] : []));
|
|
56
|
+
this.allSelected = input(false, ...(ngDevMode ? [{ debugName: "allSelected" }] : []));
|
|
57
|
+
this.accessToggled = output();
|
|
58
|
+
this.noOwnerMessage = gettext(`You don't have the permission required to manage application access for {{ user.userName }}.`);
|
|
59
|
+
}
|
|
60
|
+
toggleAccess(application) {
|
|
61
|
+
this.accessToggled.emit(application);
|
|
62
|
+
}
|
|
63
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessSubListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
64
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ApplicationAccessSubListComponent, isStandalone: true, selector: "c8y-application-access-sub-list", inputs: { applications: { classPropertyName: "applications", publicName: "applications", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null }, legendHelpText: { classPropertyName: "legendHelpText", publicName: "legendHelpText", isSignal: true, isRequired: false, transformFunction: null }, noOwnerAvailable: { classPropertyName: "noOwnerAvailable", publicName: "noOwnerAvailable", isSignal: true, isRequired: false, transformFunction: null }, appIdsOfGlobalRoles: { classPropertyName: "appIdsOfGlobalRoles", publicName: "appIdsOfGlobalRoles", isSignal: true, isRequired: false, transformFunction: null }, disabledEdit: { classPropertyName: "disabledEdit", publicName: "disabledEdit", isSignal: true, isRequired: false, transformFunction: null }, userWithOwner: { classPropertyName: "userWithOwner", publicName: "userWithOwner", isSignal: true, isRequired: false, transformFunction: null }, selectedAppIds: { classPropertyName: "selectedAppIds", publicName: "selectedAppIds", isSignal: true, isRequired: false, transformFunction: null }, allSelected: { classPropertyName: "allSelected", publicName: "allSelected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { accessToggled: "accessToggled" }, ngImport: i0, template: "@if (applications().length) {\n <div class=\"legend form-block\">\n {{ legend() | translate }}\n @if (legendHelpText()) {\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"legendHelpText() | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n </div>\n\n @if (disabledEdit() && noOwnerAvailable()) {\n <div class=\"alert alert-info\">\n {{ noOwnerMessage | translate: { 'user.userName': userWithOwner()?.user.userName } }}\n </div>\n }\n\n <c8y-list-group>\n @for (application of applications(); track application.id) {\n @let applicationAlreadyInappIdsOfGlobalRoles =\n application | alreadyInArray: appIdsOfGlobalRoles();\n @let applicationName = application | humanizeAppName | async;\n <c8y-list-item>\n <c8y-list-item-body>\n <div class=\"d-flex\">\n <label class=\"c8y-checkbox a-i-center\">\n <input\n [attr.aria-label]=\"applicationName\"\n type=\"checkbox\"\n [checked]=\"\n allSelected() ||\n (application | alreadyInArray: selectedAppIds()) ||\n applicationAlreadyInappIdsOfGlobalRoles\n \"\n (click)=\"toggleAccess(application)\"\n [disabled]=\"disabledEdit() || applicationAlreadyInappIdsOfGlobalRoles\"\n />\n <span></span>\n <span class=\"icon-36 l-h-1 p-l-8\">\n <c8y-app-icon [app]=\"application\"></c8y-app-icon>\n </span>\n <span\n class=\"m-l-8 text-normal l-h-1\"\n [title]=\"applicationName\"\n >\n {{ applicationName }}\n <br />\n <small class=\"text-muted\">{{ application.contextPath }}</small>\n </span>\n </label>\n <span class=\"m-l-auto\"></span>\n @if (applicationAlreadyInappIdsOfGlobalRoles) {\n <button\n class=\"btn-help\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'This application is already made available in a global role' | translate\n \"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n\n @if (\n (application | notAvailableInOwner: userWithOwner()?.owner) &&\n !applicationAlreadyInappIdsOfGlobalRoles\n ) {\n <button\n class=\"btn-dot\"\n [attr.aria-label]=\"'This application is not accessible by the owner.' | translate\"\n [popover]=\"'This application is not accessible by the owner.' | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n >\n <i\n class=\"text-warning\"\n [c8yIcon]=\"'warning'\"\n ></i>\n </button>\n }\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n }\n </c8y-list-group>\n}\n", dependencies: [{ kind: "directive", type: PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "component", type: ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: ListItemBodyComponent, selector: "c8y-list-item-body, c8y-li-body", inputs: ["body"] }, { kind: "component", type: AppIconComponent, selector: "c8y-app-icon", inputs: ["contextPath", "name", "app"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: HumanizeAppNamePipe, name: "humanizeAppName" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AlreadyInArrayPipe, name: "alreadyInArray" }, { kind: "pipe", type: NotAvailableInOwnerPipe, name: "notAvailableInOwner" }] }); }
|
|
65
|
+
}
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessSubListComponent, decorators: [{
|
|
67
|
+
type: Component,
|
|
68
|
+
args: [{ selector: 'c8y-application-access-sub-list', imports: [
|
|
69
|
+
C8yTranslateDirective,
|
|
70
|
+
C8yTranslatePipe,
|
|
71
|
+
HumanizeAppNamePipe,
|
|
72
|
+
PopoverDirective,
|
|
73
|
+
ListGroupComponent,
|
|
74
|
+
ListItemComponent,
|
|
75
|
+
ListItemBodyComponent,
|
|
76
|
+
AppIconComponent,
|
|
77
|
+
AsyncPipe,
|
|
78
|
+
AlreadyInArrayPipe,
|
|
79
|
+
NotAvailableInOwnerPipe,
|
|
80
|
+
IconDirective
|
|
81
|
+
], template: "@if (applications().length) {\n <div class=\"legend form-block\">\n {{ legend() | translate }}\n @if (legendHelpText()) {\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"legendHelpText() | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n </div>\n\n @if (disabledEdit() && noOwnerAvailable()) {\n <div class=\"alert alert-info\">\n {{ noOwnerMessage | translate: { 'user.userName': userWithOwner()?.user.userName } }}\n </div>\n }\n\n <c8y-list-group>\n @for (application of applications(); track application.id) {\n @let applicationAlreadyInappIdsOfGlobalRoles =\n application | alreadyInArray: appIdsOfGlobalRoles();\n @let applicationName = application | humanizeAppName | async;\n <c8y-list-item>\n <c8y-list-item-body>\n <div class=\"d-flex\">\n <label class=\"c8y-checkbox a-i-center\">\n <input\n [attr.aria-label]=\"applicationName\"\n type=\"checkbox\"\n [checked]=\"\n allSelected() ||\n (application | alreadyInArray: selectedAppIds()) ||\n applicationAlreadyInappIdsOfGlobalRoles\n \"\n (click)=\"toggleAccess(application)\"\n [disabled]=\"disabledEdit() || applicationAlreadyInappIdsOfGlobalRoles\"\n />\n <span></span>\n <span class=\"icon-36 l-h-1 p-l-8\">\n <c8y-app-icon [app]=\"application\"></c8y-app-icon>\n </span>\n <span\n class=\"m-l-8 text-normal l-h-1\"\n [title]=\"applicationName\"\n >\n {{ applicationName }}\n <br />\n <small class=\"text-muted\">{{ application.contextPath }}</small>\n </span>\n </label>\n <span class=\"m-l-auto\"></span>\n @if (applicationAlreadyInappIdsOfGlobalRoles) {\n <button\n class=\"btn-help\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'This application is already made available in a global role' | translate\n \"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n\n @if (\n (application | notAvailableInOwner: userWithOwner()?.owner) &&\n !applicationAlreadyInappIdsOfGlobalRoles\n ) {\n <button\n class=\"btn-dot\"\n [attr.aria-label]=\"'This application is not accessible by the owner.' | translate\"\n [popover]=\"'This application is not accessible by the owner.' | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n >\n <i\n class=\"text-warning\"\n [c8yIcon]=\"'warning'\"\n ></i>\n </button>\n }\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n }\n </c8y-list-group>\n}\n" }]
|
|
82
|
+
}], propDecorators: { applications: [{ type: i0.Input, args: [{ isSignal: true, alias: "applications", required: false }] }], legend: [{ type: i0.Input, args: [{ isSignal: true, alias: "legend", required: false }] }], legendHelpText: [{ type: i0.Input, args: [{ isSignal: true, alias: "legendHelpText", required: false }] }], noOwnerAvailable: [{ type: i0.Input, args: [{ isSignal: true, alias: "noOwnerAvailable", required: false }] }], appIdsOfGlobalRoles: [{ type: i0.Input, args: [{ isSignal: true, alias: "appIdsOfGlobalRoles", required: false }] }], disabledEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledEdit", required: false }] }], userWithOwner: [{ type: i0.Input, args: [{ isSignal: true, alias: "userWithOwner", required: false }] }], selectedAppIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedAppIds", required: false }] }], allSelected: [{ type: i0.Input, args: [{ isSignal: true, alias: "allSelected", required: false }] }], accessToggled: [{ type: i0.Output, args: ["accessToggled"] }] } });
|
|
83
|
+
|
|
84
|
+
class ApplicationAccessListComponent {
|
|
85
|
+
constructor() {
|
|
86
|
+
this.allApps = signal([], ...(ngDevMode ? [{ debugName: "allApps" }] : []));
|
|
87
|
+
this.nonMicroserviceApps = computed(() => {
|
|
88
|
+
return this.allApps().filter(app => app.type !== 'MICROSERVICE');
|
|
89
|
+
}, ...(ngDevMode ? [{ debugName: "nonMicroserviceApps" }] : []));
|
|
90
|
+
this.marketApps = computed(() => {
|
|
91
|
+
return this.nonMicroserviceApps().filter(app => app.availability === ApplicationAvailability.MARKET);
|
|
92
|
+
}, ...(ngDevMode ? [{ debugName: "marketApps" }] : []));
|
|
93
|
+
this.privateApps = computed(() => {
|
|
94
|
+
return this.nonMicroserviceApps().filter(app => app.availability === ApplicationAvailability.PRIVATE);
|
|
95
|
+
}, ...(ngDevMode ? [{ debugName: "privateApps" }] : []));
|
|
96
|
+
this.userWithOwner = input(null, ...(ngDevMode ? [{ debugName: "userWithOwner" }] : []));
|
|
97
|
+
this.appIdsOfGlobalRoles = computed(() => {
|
|
98
|
+
const userWithOwner = this.userWithOwner();
|
|
99
|
+
if (!userWithOwner || !userWithOwner.user?.groups) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
const allApps = userWithOwner.user.groups.references
|
|
103
|
+
.map(groupReference => groupReference.group.applications || [])
|
|
104
|
+
.flat();
|
|
105
|
+
return Array.from(new Set(allApps.map(app => app.id)));
|
|
106
|
+
}, ...(ngDevMode ? [{ debugName: "appIdsOfGlobalRoles" }] : []));
|
|
107
|
+
this.disabledEdit = signal(false, ...(ngDevMode ? [{ debugName: "disabledEdit" }] : []));
|
|
108
|
+
this.userOwnerAvailable = computed(() => {
|
|
109
|
+
const userWithOwner = this.userWithOwner();
|
|
110
|
+
if (userWithOwner?.owner) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}, ...(ngDevMode ? [{ debugName: "userOwnerAvailable" }] : []));
|
|
115
|
+
this.selectedApps = signal([], ...(ngDevMode ? [{ debugName: "selectedApps" }] : []));
|
|
116
|
+
this.selectedAppIds = computed(() => {
|
|
117
|
+
return this.selectedApps().map(app => app.id);
|
|
118
|
+
}, ...(ngDevMode ? [{ debugName: "selectedAppIds" }] : []));
|
|
119
|
+
this.allSelected = input(false, ...(ngDevMode ? [{ debugName: "allSelected" }] : []));
|
|
120
|
+
this.applicationService = inject(ApplicationService);
|
|
121
|
+
this.appState = inject(AppStateService);
|
|
122
|
+
}
|
|
123
|
+
async ngOnInit() {
|
|
124
|
+
const { data: apps } = await this.applicationService.listByUser(this.appState.currentUser.value, { dropOverwrittenApps: true, noPaging: true });
|
|
125
|
+
const sortedApps = apps.sort((a, b) => a.name.localeCompare(b.name));
|
|
126
|
+
this.allApps.set(sortedApps);
|
|
127
|
+
}
|
|
128
|
+
toggleAccess(app) {
|
|
129
|
+
const selectedAppIds = this.selectedAppIds();
|
|
130
|
+
if (selectedAppIds.includes(app.id)) {
|
|
131
|
+
this.selectedApps.set(this.selectedApps().filter(selectedApp => selectedApp.id !== app.id));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.selectedApps.set([...this.selectedApps(), app]);
|
|
135
|
+
}
|
|
136
|
+
if (this.onChange) {
|
|
137
|
+
this.onChange(this.selectedApps());
|
|
138
|
+
}
|
|
139
|
+
if (this.onTouched) {
|
|
140
|
+
this.onTouched();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
writeValue(selectedApps) {
|
|
144
|
+
this.selectedApps.set(selectedApps);
|
|
145
|
+
}
|
|
146
|
+
registerOnChange(fn) {
|
|
147
|
+
this.onChange = fn;
|
|
148
|
+
}
|
|
149
|
+
registerOnTouched(fn) {
|
|
150
|
+
this.onTouched = fn;
|
|
151
|
+
}
|
|
152
|
+
setDisabledState(isDisabled) {
|
|
153
|
+
this.disabledEdit.set(isDisabled);
|
|
154
|
+
}
|
|
155
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
156
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: ApplicationAccessListComponent, isStandalone: true, selector: "c8y-application-access-list", inputs: { userWithOwner: { classPropertyName: "userWithOwner", publicName: "userWithOwner", isSignal: true, isRequired: false, transformFunction: null }, allSelected: { classPropertyName: "allSelected", publicName: "allSelected", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
157
|
+
{
|
|
158
|
+
provide: NG_VALUE_ACCESSOR,
|
|
159
|
+
multi: true,
|
|
160
|
+
useExisting: forwardRef(() => ApplicationAccessListComponent)
|
|
161
|
+
}
|
|
162
|
+
], ngImport: i0, template: "<c8y-application-access-sub-list\n [applications]=\"marketApps()\"\n [legend]=\"'Subscribed applications' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n\n<c8y-application-access-sub-list\n [applications]=\"privateApps()\"\n [legend]=\"'Custom applications' | translate\"\n [legendHelpText]=\"'Applications owned by your tenant' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n", dependencies: [{ kind: "component", type: ApplicationAccessSubListComponent, selector: "c8y-application-access-sub-list", inputs: ["applications", "legend", "legendHelpText", "noOwnerAvailable", "appIdsOfGlobalRoles", "disabledEdit", "userWithOwner", "selectedAppIds", "allSelected"], outputs: ["accessToggled"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
|
|
163
|
+
}
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessListComponent, decorators: [{
|
|
165
|
+
type: Component,
|
|
166
|
+
args: [{ selector: 'c8y-application-access-list', imports: [C8yTranslatePipe, ApplicationAccessSubListComponent], providers: [
|
|
167
|
+
{
|
|
168
|
+
provide: NG_VALUE_ACCESSOR,
|
|
169
|
+
multi: true,
|
|
170
|
+
useExisting: forwardRef(() => ApplicationAccessListComponent)
|
|
171
|
+
}
|
|
172
|
+
], template: "<c8y-application-access-sub-list\n [applications]=\"marketApps()\"\n [legend]=\"'Subscribed applications' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n\n<c8y-application-access-sub-list\n [applications]=\"privateApps()\"\n [legend]=\"'Custom applications' | translate\"\n [legendHelpText]=\"'Applications owned by your tenant' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n" }]
|
|
173
|
+
}], propDecorators: { userWithOwner: [{ type: i0.Input, args: [{ isSignal: true, alias: "userWithOwner", required: false }] }], allSelected: [{ type: i0.Input, args: [{ isSignal: true, alias: "allSelected", required: false }] }] } });
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Generated bundle index. Do not edit.
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
export { ApplicationAccessListComponent };
|
|
180
|
+
//# sourceMappingURL=c8y-ngx-components-application-access-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-application-access-list.mjs","sources":["../../application-access/list/already-in-global-role.pipe.ts","../../application-access/list/not-available-in-owner.pipe.ts","../../application-access/list/application-access-sub-list/application-access-sub-list.component.ts","../../application-access/list/application-access-sub-list/application-access-sub-list.component.html","../../application-access/list/application-access-list/application-access-list.component.ts","../../application-access/list/application-access-list/application-access-list.component.html","../../application-access/list/c8y-ngx-components-application-access-list.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { IApplication } from '@c8y/client';\n\n@Pipe({\n name: 'alreadyInArray'\n})\nexport class AlreadyInArrayPipe implements PipeTransform {\n transform(application: IApplication, appIdsOfGlobalRoles: (string | number)[]): boolean {\n if (!application || !appIdsOfGlobalRoles || Array.isArray(appIdsOfGlobalRoles) === false) {\n return false;\n }\n\n return appIdsOfGlobalRoles.includes(application.id);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { IApplication, IUser } from '@c8y/client';\n\n@Pipe({\n name: 'notAvailableInOwner'\n})\nexport class NotAvailableInOwnerPipe implements PipeTransform {\n transform(application: IApplication, ownerUser: IUser | null): boolean {\n const ownerApps = ownerUser?.applications;\n if (!ownerApps) {\n return false;\n }\n const isAvailable = ownerApps.some(app => app.id === application.id);\n return !isAvailable;\n }\n}\n","import { AsyncPipe } from '@angular/common';\nimport { Component, input, output } from '@angular/core';\nimport { IApplication, IUser } from '@c8y/client';\nimport {\n C8yTranslateDirective,\n ListGroupComponent,\n ListItemComponent,\n ListItemBodyComponent,\n C8yTranslatePipe,\n HumanizeAppNamePipe,\n AppIconComponent,\n IconDirective\n} from '@c8y/ngx-components';\nimport { PopoverDirective } from 'ngx-bootstrap/popover';\nimport { AlreadyInArrayPipe } from '../already-in-global-role.pipe';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { NotAvailableInOwnerPipe } from '../not-available-in-owner.pipe';\n\n@Component({\n selector: 'c8y-application-access-sub-list',\n templateUrl: './application-access-sub-list.component.html',\n imports: [\n C8yTranslateDirective,\n C8yTranslatePipe,\n HumanizeAppNamePipe,\n PopoverDirective,\n ListGroupComponent,\n ListItemComponent,\n ListItemBodyComponent,\n AppIconComponent,\n AsyncPipe,\n AlreadyInArrayPipe,\n NotAvailableInOwnerPipe,\n IconDirective\n ]\n})\nexport class ApplicationAccessSubListComponent {\n applications = input<IApplication[]>();\n legend = input<string>('');\n legendHelpText = input<string>('');\n noOwnerAvailable = input<boolean>(false);\n appIdsOfGlobalRoles = input<(string | number)[]>([]);\n disabledEdit = input<boolean>(false);\n userWithOwner = input<{ user: IUser; owner: IUser | null } | null>(null);\n selectedAppIds = input<(string | number)[]>([]);\n allSelected = input<boolean>(false);\n\n accessToggled = output<IApplication>();\n\n noOwnerMessage = gettext(\n `You don't have the permission required to manage application access for {{ user.userName }}.`\n );\n\n toggleAccess(application: IApplication): void {\n this.accessToggled.emit(application);\n }\n}\n","@if (applications().length) {\n <div class=\"legend form-block\">\n {{ legend() | translate }}\n @if (legendHelpText()) {\n <button\n class=\"btn-help btn-help--sm\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"legendHelpText() | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n </div>\n\n @if (disabledEdit() && noOwnerAvailable()) {\n <div class=\"alert alert-info\">\n {{ noOwnerMessage | translate: { 'user.userName': userWithOwner()?.user.userName } }}\n </div>\n }\n\n <c8y-list-group>\n @for (application of applications(); track application.id) {\n @let applicationAlreadyInappIdsOfGlobalRoles =\n application | alreadyInArray: appIdsOfGlobalRoles();\n @let applicationName = application | humanizeAppName | async;\n <c8y-list-item>\n <c8y-list-item-body>\n <div class=\"d-flex\">\n <label class=\"c8y-checkbox a-i-center\">\n <input\n [attr.aria-label]=\"applicationName\"\n type=\"checkbox\"\n [checked]=\"\n allSelected() ||\n (application | alreadyInArray: selectedAppIds()) ||\n applicationAlreadyInappIdsOfGlobalRoles\n \"\n (click)=\"toggleAccess(application)\"\n [disabled]=\"disabledEdit() || applicationAlreadyInappIdsOfGlobalRoles\"\n />\n <span></span>\n <span class=\"icon-36 l-h-1 p-l-8\">\n <c8y-app-icon [app]=\"application\"></c8y-app-icon>\n </span>\n <span\n class=\"m-l-8 text-normal l-h-1\"\n [title]=\"applicationName\"\n >\n {{ applicationName }}\n <br />\n <small class=\"text-muted\">{{ application.contextPath }}</small>\n </span>\n </label>\n <span class=\"m-l-auto\"></span>\n @if (applicationAlreadyInappIdsOfGlobalRoles) {\n <button\n class=\"btn-help\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"\n 'This application is already made available in a global role' | translate\n \"\n type=\"button\"\n [triggers]=\"'focus'\"\n ></button>\n }\n\n @if (\n (application | notAvailableInOwner: userWithOwner()?.owner) &&\n !applicationAlreadyInappIdsOfGlobalRoles\n ) {\n <button\n class=\"btn-dot\"\n [attr.aria-label]=\"'This application is not accessible by the owner.' | translate\"\n [popover]=\"'This application is not accessible by the owner.' | translate\"\n type=\"button\"\n [triggers]=\"'focus'\"\n >\n <i\n class=\"text-warning\"\n [c8yIcon]=\"'warning'\"\n ></i>\n </button>\n }\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n }\n </c8y-list-group>\n}\n","import { Component, computed, forwardRef, inject, input, OnInit, signal } from '@angular/core';\nimport { ApplicationAvailability, ApplicationService, IApplication, IUser } from '@c8y/client';\nimport { C8yTranslatePipe, AppStateService } from '@c8y/ngx-components';\nimport { ApplicationAccessSubListComponent } from '../application-access-sub-list/application-access-sub-list.component';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n@Component({\n selector: 'c8y-application-access-list',\n templateUrl: './application-access-list.component.html',\n imports: [C8yTranslatePipe, ApplicationAccessSubListComponent],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n multi: true,\n useExisting: forwardRef(() => ApplicationAccessListComponent)\n }\n ]\n})\nexport class ApplicationAccessListComponent implements OnInit, ControlValueAccessor {\n allApps = signal<IApplication[]>([]);\n nonMicroserviceApps = computed(() => {\n return this.allApps().filter(app => app.type !== 'MICROSERVICE');\n });\n marketApps = computed(() => {\n return this.nonMicroserviceApps().filter(\n app => app.availability === ApplicationAvailability.MARKET\n );\n });\n privateApps = computed(() => {\n return this.nonMicroserviceApps().filter(\n app => app.availability === ApplicationAvailability.PRIVATE\n );\n });\n userWithOwner = input<{ user: IUser; owner: IUser | null } | null>(null);\n appIdsOfGlobalRoles = computed(() => {\n const userWithOwner = this.userWithOwner();\n if (!userWithOwner || !userWithOwner.user?.groups) {\n return [];\n }\n const allApps = userWithOwner.user.groups.references\n .map(groupReference => groupReference.group.applications || [])\n .flat();\n\n return Array.from(new Set(allApps.map(app => app.id)));\n });\n disabledEdit = signal<boolean>(false);\n userOwnerAvailable = computed(() => {\n const userWithOwner = this.userWithOwner();\n if (userWithOwner?.owner) {\n return true;\n }\n return false;\n });\n selectedApps = signal<IApplication[]>([]);\n selectedAppIds = computed<(string | number)[]>(() => {\n return this.selectedApps().map(app => app.id);\n });\n allSelected = input<boolean>(false);\n\n private applicationService = inject(ApplicationService);\n private appState = inject(AppStateService);\n\n private onChange: (selectedApps: Partial<IApplication>[]) => void;\n private onTouched: () => void;\n\n async ngOnInit() {\n const { data: apps } = await this.applicationService.listByUser(\n this.appState.currentUser.value,\n { dropOverwrittenApps: true, noPaging: true }\n );\n\n const sortedApps = apps.sort((a, b) => a.name.localeCompare(b.name));\n\n this.allApps.set(sortedApps);\n }\n\n toggleAccess(app: IApplication): void {\n const selectedAppIds = this.selectedAppIds();\n if (selectedAppIds.includes(app.id)) {\n this.selectedApps.set(this.selectedApps().filter(selectedApp => selectedApp.id !== app.id));\n } else {\n this.selectedApps.set([...this.selectedApps(), app]);\n }\n if (this.onChange) {\n this.onChange(this.selectedApps());\n }\n if (this.onTouched) {\n this.onTouched();\n }\n }\n\n writeValue(selectedApps: Partial<IApplication>[]): void {\n this.selectedApps.set(selectedApps);\n }\n\n registerOnChange(fn: (selectedApps: Partial<IApplication>[]) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabledEdit.set(isDisabled);\n }\n}\n","<c8y-application-access-sub-list\n [applications]=\"marketApps()\"\n [legend]=\"'Subscribed applications' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n\n<c8y-application-access-sub-list\n [applications]=\"privateApps()\"\n [legend]=\"'Custom applications' | translate\"\n [legendHelpText]=\"'Applications owned by your tenant' | translate\"\n [noOwnerAvailable]=\"!userOwnerAvailable()\"\n [appIdsOfGlobalRoles]=\"appIdsOfGlobalRoles()\"\n [userWithOwner]=\"userWithOwner()\"\n [disabledEdit]=\"disabledEdit()\"\n (accessToggled)=\"toggleAccess($event)\"\n [selectedAppIds]=\"selectedAppIds()\"\n [allSelected]=\"allSelected()\"\n></c8y-application-access-sub-list>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAMa,kBAAkB,CAAA;IAC7B,SAAS,CAAC,WAAyB,EAAE,mBAAwC,EAAA;AAC3E,QAAA,IAAI,CAAC,WAAW,IAAI,CAAC,mBAAmB,IAAI,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,KAAK,EAAE;AACxF,YAAA,OAAO,KAAK;QACd;QAEA,OAAO,mBAAmB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;IACrD;+GAPW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;6GAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,gBAAA,EAAA,CAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH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
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, computed, inject, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
6
|
+
import { UserService } from '@c8y/client';
|
|
7
|
+
import { ContextRouteService, AlertService, Permissions, C8yTranslateDirective, LoadingComponent, BreadcrumbComponent, BreadcrumbItemComponent, C8yTranslatePipe } from '@c8y/ngx-components';
|
|
8
|
+
import { ApplicationAccessListComponent } from '@c8y/ngx-components/application-access/list';
|
|
9
|
+
import { gettext } from '@c8y/ngx-components/gettext';
|
|
10
|
+
|
|
11
|
+
class ApplicationAccessUserDetailsWrapperComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.userWithOwner = signal(null, ...(ngDevMode ? [{ debugName: "userWithOwner" }] : []));
|
|
14
|
+
this.hasAppManagement = computed(() => {
|
|
15
|
+
const userWithOwner = this.userWithOwner();
|
|
16
|
+
if (!userWithOwner) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return this.hasApplicationManagementRoles(userWithOwner.user);
|
|
20
|
+
}, ...(ngDevMode ? [{ debugName: "hasAppManagement" }] : []));
|
|
21
|
+
this.contextService = inject(ContextRouteService);
|
|
22
|
+
this.activatedRoute = inject(ActivatedRoute);
|
|
23
|
+
this.userService = inject(UserService);
|
|
24
|
+
this.formBuilder = inject(FormBuilder);
|
|
25
|
+
this.alertService = inject(AlertService);
|
|
26
|
+
this.router = inject(Router);
|
|
27
|
+
}
|
|
28
|
+
async ngOnInit() {
|
|
29
|
+
const data = this.contextService.getContextData(this.activatedRoute);
|
|
30
|
+
let user = data.contextData;
|
|
31
|
+
const { data: refreshedUser } = await this.userService.detail(user.id);
|
|
32
|
+
user = refreshedUser;
|
|
33
|
+
let owner = null;
|
|
34
|
+
if (user.owner) {
|
|
35
|
+
try {
|
|
36
|
+
const ownerResponse = await this.userService.detail(user.owner);
|
|
37
|
+
owner = ownerResponse.data;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
// proceed without owner
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.userWithOwner.set({ user, owner });
|
|
44
|
+
this.formGroup = this.initForm(user);
|
|
45
|
+
}
|
|
46
|
+
initForm(user) {
|
|
47
|
+
const currentApplicationOfUser = user.applications || [];
|
|
48
|
+
const form = this.formBuilder.group({
|
|
49
|
+
applications: [currentApplicationOfUser]
|
|
50
|
+
});
|
|
51
|
+
const hasApplicationManagementRoles = this.hasApplicationManagementRoles(user);
|
|
52
|
+
const isExternalUser = this.userService.isExternalUser(user);
|
|
53
|
+
if (hasApplicationManagementRoles || isExternalUser) {
|
|
54
|
+
form.controls.applications.disable();
|
|
55
|
+
}
|
|
56
|
+
if (isExternalUser) {
|
|
57
|
+
this.alertService.warning(gettext('You cannot edit the user since it is managed via your authorization server.'));
|
|
58
|
+
}
|
|
59
|
+
return form;
|
|
60
|
+
}
|
|
61
|
+
async save() {
|
|
62
|
+
const user = this.userWithOwner().user;
|
|
63
|
+
const applications = this.formGroup.value.applications.map(app => ({
|
|
64
|
+
id: app.id,
|
|
65
|
+
type: app.type
|
|
66
|
+
}));
|
|
67
|
+
try {
|
|
68
|
+
await this.userService.update({
|
|
69
|
+
id: user.id,
|
|
70
|
+
applications: applications
|
|
71
|
+
});
|
|
72
|
+
this.alertService.success(gettext("User's application access changed."));
|
|
73
|
+
this.formGroup.markAsPristine();
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
this.alertService.danger(gettext("Failed to update user's application access."), e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
cancel() {
|
|
80
|
+
this.router.navigate(['users']);
|
|
81
|
+
}
|
|
82
|
+
ngOnDestroy() {
|
|
83
|
+
// remove SSO related alert once navigating away
|
|
84
|
+
this.alertService.clearAll();
|
|
85
|
+
}
|
|
86
|
+
hasApplicationManagementRoles(user) {
|
|
87
|
+
return this.userService.hasAnyRole(user, [
|
|
88
|
+
Permissions.ROLE_APPLICATION_MANAGEMENT_ADMIN,
|
|
89
|
+
Permissions.ROLE_APPLICATION_MANAGEMENT_READ
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessUserDetailsWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
93
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ApplicationAccessUserDetailsWrapperComponent, isStandalone: true, selector: "c8y-application-access-user-details-wrapper", ngImport: i0, template: "<c8y-breadcrumb>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n [label]=\"'Accounts' | translate\"\n ></c8y-breadcrumb-item>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n path=\"#users\"\n [label]=\"'Users' | translate\"\n ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<div class=\"row\">\n <div class=\"col-md-8\">\n <div class=\"card card--fullpage\">\n <div class=\"card-header separator\">\n <div class=\"card-title\">\n {{ 'Application access' | translate }}\n </div>\n </div>\n <div class=\"inner-scroll\">\n <div class=\"card-block\">\n @if (formGroup) {\n <form [formGroup]=\"formGroup\">\n @if (hasAppManagement()) {\n <div\n class=\"alert alert-info\"\n translate\n >\n This user is assigned a global role with \"Application management\" permission.\n Therefore all applications are accessible.\n </div>\n }\n <c8y-application-access-list\n formControlName=\"applications\"\n [userWithOwner]=\"userWithOwner()\"\n [allSelected]=\"hasAppManagement()\"\n ></c8y-application-access-list>\n </form>\n } @else {\n <c8y-loading></c8y-loading>\n }\n </div>\n </div>\n <div class=\"card-footer separator\">\n <button\n class=\"btn btn-default\"\n [title]=\"'Cancel' | translate\"\n type=\"button\"\n (click)=\"cancel()\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n class=\"btn btn-primary\"\n [title]=\"'Save' | translate\"\n type=\"button\"\n (click)=\"save()\"\n [disabled]=\"hasAppManagement() || formGroup?.invalid || formGroup?.pristine\"\n >\n {{ 'Save' | translate }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: ApplicationAccessListComponent, selector: "c8y-application-access-list", inputs: ["userWithOwner", "allSelected"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "message"] }, { kind: "component", type: BreadcrumbComponent, selector: "c8y-breadcrumb" }, { kind: "component", type: BreadcrumbItemComponent, selector: "c8y-breadcrumb-item", inputs: ["icon", "translate", "label", "path", "injector"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
|
|
94
|
+
}
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ApplicationAccessUserDetailsWrapperComponent, decorators: [{
|
|
96
|
+
type: Component,
|
|
97
|
+
args: [{ selector: 'c8y-application-access-user-details-wrapper', imports: [
|
|
98
|
+
C8yTranslatePipe,
|
|
99
|
+
C8yTranslateDirective,
|
|
100
|
+
ApplicationAccessListComponent,
|
|
101
|
+
ReactiveFormsModule,
|
|
102
|
+
LoadingComponent,
|
|
103
|
+
BreadcrumbComponent,
|
|
104
|
+
BreadcrumbItemComponent
|
|
105
|
+
], template: "<c8y-breadcrumb>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n [label]=\"'Accounts' | translate\"\n ></c8y-breadcrumb-item>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n path=\"#users\"\n [label]=\"'Users' | translate\"\n ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<div class=\"row\">\n <div class=\"col-md-8\">\n <div class=\"card card--fullpage\">\n <div class=\"card-header separator\">\n <div class=\"card-title\">\n {{ 'Application access' | translate }}\n </div>\n </div>\n <div class=\"inner-scroll\">\n <div class=\"card-block\">\n @if (formGroup) {\n <form [formGroup]=\"formGroup\">\n @if (hasAppManagement()) {\n <div\n class=\"alert alert-info\"\n translate\n >\n This user is assigned a global role with \"Application management\" permission.\n Therefore all applications are accessible.\n </div>\n }\n <c8y-application-access-list\n formControlName=\"applications\"\n [userWithOwner]=\"userWithOwner()\"\n [allSelected]=\"hasAppManagement()\"\n ></c8y-application-access-list>\n </form>\n } @else {\n <c8y-loading></c8y-loading>\n }\n </div>\n </div>\n <div class=\"card-footer separator\">\n <button\n class=\"btn btn-default\"\n [title]=\"'Cancel' | translate\"\n type=\"button\"\n (click)=\"cancel()\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n class=\"btn btn-primary\"\n [title]=\"'Save' | translate\"\n type=\"button\"\n (click)=\"save()\"\n [disabled]=\"hasAppManagement() || formGroup?.invalid || formGroup?.pristine\"\n >\n {{ 'Save' | translate }}\n </button>\n </div>\n </div>\n </div>\n</div>\n" }]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Generated bundle index. Do not edit.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
export { ApplicationAccessUserDetailsWrapperComponent };
|
|
113
|
+
//# sourceMappingURL=c8y-ngx-components-application-access-user-application-access-user-details-wrapper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-application-access-user-application-access-user-details-wrapper.mjs","sources":["../../application-access/user/application-access-user-details-wrapper/application-access-user-details-wrapper.component.ts","../../application-access/user/application-access-user-details-wrapper/application-access-user-details-wrapper.component.html","../../application-access/user/application-access-user-details-wrapper/c8y-ngx-components-application-access-user-application-access-user-details-wrapper.ts"],"sourcesContent":["import { Component, computed, inject, OnDestroy, OnInit, signal } from '@angular/core';\nimport { FormBuilder, ReactiveFormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { IUser, UserService } from '@c8y/client';\nimport {\n C8yTranslateDirective,\n C8yTranslatePipe,\n ContextRouteService,\n Permissions,\n LoadingComponent,\n AlertService,\n BreadcrumbComponent,\n BreadcrumbItemComponent\n} from '@c8y/ngx-components';\nimport { ApplicationAccessListComponent } from '@c8y/ngx-components/application-access/list';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\n@Component({\n selector: 'c8y-application-access-user-details-wrapper',\n templateUrl: './application-access-user-details-wrapper.component.html',\n imports: [\n C8yTranslatePipe,\n C8yTranslateDirective,\n ApplicationAccessListComponent,\n ReactiveFormsModule,\n LoadingComponent,\n BreadcrumbComponent,\n BreadcrumbItemComponent\n ]\n})\nexport class ApplicationAccessUserDetailsWrapperComponent implements OnInit, OnDestroy {\n userWithOwner = signal<{ user: IUser; owner: IUser | null } | null>(null);\n hasAppManagement = computed(() => {\n const userWithOwner = this.userWithOwner();\n if (!userWithOwner) {\n return false;\n }\n return this.hasApplicationManagementRoles(userWithOwner.user);\n });\n formGroup: ReturnType<typeof this.initForm>;\n private contextService = inject(ContextRouteService);\n private activatedRoute = inject(ActivatedRoute);\n private userService = inject(UserService);\n private formBuilder = inject(FormBuilder);\n private alertService = inject(AlertService);\n private router = inject(Router);\n\n async ngOnInit(): Promise<void> {\n const data = this.contextService.getContextData(this.activatedRoute);\n let user = data.contextData as IUser;\n\n const { data: refreshedUser } = await this.userService.detail(user.id);\n user = refreshedUser;\n let owner: IUser | null = null;\n if (user.owner) {\n try {\n const ownerResponse = await this.userService.detail(user.owner);\n owner = ownerResponse.data;\n } catch (e) {\n // proceed without owner\n }\n }\n\n this.userWithOwner.set({ user, owner });\n\n this.formGroup = this.initForm(user);\n }\n\n initForm(user: IUser) {\n const currentApplicationOfUser = user.applications || [];\n const form = this.formBuilder.group({\n applications: [currentApplicationOfUser]\n });\n\n const hasApplicationManagementRoles = this.hasApplicationManagementRoles(user);\n const isExternalUser = this.userService.isExternalUser(user);\n if (hasApplicationManagementRoles || isExternalUser) {\n form.controls.applications.disable();\n }\n if (isExternalUser) {\n this.alertService.warning(\n gettext('You cannot edit the user since it is managed via your authorization server.')\n );\n }\n\n return form;\n }\n\n async save() {\n const user = this.userWithOwner().user;\n const applications = this.formGroup.value.applications.map(app => ({\n id: app.id,\n type: app.type\n }));\n try {\n await this.userService.update({\n id: user.id,\n applications: applications\n });\n this.alertService.success(gettext(\"User's application access changed.\"));\n this.formGroup.markAsPristine();\n } catch (e) {\n this.alertService.danger(gettext(\"Failed to update user's application access.\"), e);\n }\n }\n\n cancel() {\n this.router.navigate(['users']);\n }\n\n ngOnDestroy(): void {\n // remove SSO related alert once navigating away\n this.alertService.clearAll();\n }\n\n private hasApplicationManagementRoles(user: IUser): boolean {\n return this.userService.hasAnyRole(user, [\n Permissions.ROLE_APPLICATION_MANAGEMENT_ADMIN,\n Permissions.ROLE_APPLICATION_MANAGEMENT_READ\n ]);\n }\n}\n","<c8y-breadcrumb>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n [label]=\"'Accounts' | translate\"\n ></c8y-breadcrumb-item>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-accounts'\"\n path=\"#users\"\n [label]=\"'Users' | translate\"\n ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<div class=\"row\">\n <div class=\"col-md-8\">\n <div class=\"card card--fullpage\">\n <div class=\"card-header separator\">\n <div class=\"card-title\">\n {{ 'Application access' | translate }}\n </div>\n </div>\n <div class=\"inner-scroll\">\n <div class=\"card-block\">\n @if (formGroup) {\n <form [formGroup]=\"formGroup\">\n @if (hasAppManagement()) {\n <div\n class=\"alert alert-info\"\n translate\n >\n This user is assigned a global role with \"Application management\" permission.\n Therefore all applications are accessible.\n </div>\n }\n <c8y-application-access-list\n formControlName=\"applications\"\n [userWithOwner]=\"userWithOwner()\"\n [allSelected]=\"hasAppManagement()\"\n ></c8y-application-access-list>\n </form>\n } @else {\n <c8y-loading></c8y-loading>\n }\n </div>\n </div>\n <div class=\"card-footer separator\">\n <button\n class=\"btn btn-default\"\n [title]=\"'Cancel' | translate\"\n type=\"button\"\n (click)=\"cancel()\"\n >\n {{ 'Cancel' | translate }}\n </button>\n <button\n class=\"btn btn-primary\"\n [title]=\"'Save' | translate\"\n type=\"button\"\n (click)=\"save()\"\n [disabled]=\"hasAppManagement() || formGroup?.invalid || formGroup?.pristine\"\n >\n {{ 'Save' | translate }}\n </button>\n </div>\n </div>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MA8Ba,4CAA4C,CAAA;AAbzD,IAAA,WAAA,GAAA;AAcE,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAA8C,IAAI,yDAAC;AACzE,QAAA,IAAA,CAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAK;AAC/B,YAAA,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE;YAC1C,IAAI,CAAC,aAAa,EAAE;AAClB,gBAAA,OAAO,KAAK;YACd;YACA,OAAO,IAAI,CAAC,6BAA6B,CAAC,aAAa,CAAC,IAAI,CAAC;AAC/D,QAAA,CAAC,4DAAC;AAEM,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAC5C,QAAA,IAAA,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AAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,iBAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,gBAAgB,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAChB,mBAAmB,EAAA,QAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,uBAAuB,uHANvB,gBAAgB,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FASP,4CAA4C,EAAA,UAAA,EAAA,CAAA;kBAbxD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,6CAA6C,EAAA,OAAA,EAE9C;wBACP,gBAAgB;wBAChB,qBAAqB;wBACrB,8BAA8B;wBAC9B,mBAAmB;wBACnB,gBAAgB;wBAChB,mBAAmB;wBACnB;AACD,qBAAA,EAAA,QAAA,EAAA,0gEAAA,EAAA;;;AE5BH;;AAEG;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { hookRoute, ViewContext } from '@c8y/ngx-components';
|
|
2
|
+
import { gettext } from '@c8y/ngx-components/gettext';
|
|
3
|
+
|
|
4
|
+
const userApplicationAccessProviders = [
|
|
5
|
+
hookRoute({
|
|
6
|
+
context: ViewContext.User,
|
|
7
|
+
path: 'application_access',
|
|
8
|
+
label: gettext('Application access'),
|
|
9
|
+
icon: 'c8y-atom',
|
|
10
|
+
priority: -1000,
|
|
11
|
+
loadComponent: () => import('@c8y/ngx-components/application-access/user/application-access-user-details-wrapper').then(m => m.ApplicationAccessUserDetailsWrapperComponent)
|
|
12
|
+
})
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generated bundle index. Do not edit.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { userApplicationAccessProviders };
|
|
20
|
+
//# sourceMappingURL=c8y-ngx-components-application-access-user.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-application-access-user.mjs","sources":["../../application-access/user/index.ts","../../application-access/user/c8y-ngx-components-application-access-user.ts"],"sourcesContent":["import { hookRoute, ViewContext } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const userApplicationAccessProviders = [\n hookRoute({\n context: ViewContext.User,\n path: 'application_access',\n label: gettext('Application access'),\n icon: 'c8y-atom',\n priority: -1000,\n loadComponent: () =>\n import(\n '@c8y/ngx-components/application-access/user/application-access-user-details-wrapper'\n ).then(m => m.ApplicationAccessUserDetailsWrapperComponent)\n })\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGO,MAAM,8BAA8B,GAAG;AAC5C,IAAA,SAAS,CAAC;QACR,OAAO,EAAE,WAAW,CAAC,IAAI;AACzB,QAAA,IAAI,EAAE,oBAAoB;AAC1B,QAAA,KAAK,EAAE,OAAO,CAAC,oBAAoB,CAAC;AACpC,QAAA,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,IAAI;AACf,QAAA,aAAa,EAAE,MACb,OACE,qFAAqF,CACtF,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,4CAA4C;KAC7D;;;ACdH;;AAEG;;;;"}
|