@masterteam/users-groups 0.0.39 → 0.0.40
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.
|
@@ -10,18 +10,21 @@ import { TranslocoService, TranslocoDirective, TranslocoPipe } from '@jsverse/tr
|
|
|
10
10
|
import { Page } from '@masterteam/components/page';
|
|
11
11
|
import { Button } from '@masterteam/components/button';
|
|
12
12
|
import { Table } from '@masterteam/components/table';
|
|
13
|
+
import { TruncateTooltip } from '@masterteam/components/tooltip';
|
|
13
14
|
import * as i1 from 'primeng/skeleton';
|
|
14
15
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
15
16
|
import { Icon } from '@masterteam/icons';
|
|
16
17
|
import { ModalService } from '@masterteam/components/modal';
|
|
17
18
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
18
|
-
import * as
|
|
19
|
+
import * as i1$1 from '@angular/forms';
|
|
19
20
|
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
20
21
|
import { DynamicForm } from '@masterteam/forms/dynamic-form';
|
|
21
22
|
import { ModalRef, DialogService } from '@masterteam/components/dialog';
|
|
22
23
|
import { Tabs } from '@masterteam/components/tabs';
|
|
23
24
|
import { finalize } from 'rxjs';
|
|
24
25
|
import { Avatar } from '@masterteam/components/avatar';
|
|
26
|
+
import { EmptyState } from '@masterteam/components/empty-state';
|
|
27
|
+
import { TextField } from '@masterteam/components/text-field';
|
|
25
28
|
import { Tree } from '@masterteam/components/tree';
|
|
26
29
|
import { SecureImagePipe } from '@masterteam/components/upload-field';
|
|
27
30
|
|
|
@@ -79,6 +82,13 @@ class GetUserSummary {
|
|
|
79
82
|
this.userName = userName;
|
|
80
83
|
}
|
|
81
84
|
}
|
|
85
|
+
class GetGroupSummary {
|
|
86
|
+
groupId;
|
|
87
|
+
static type = '[UsersGroups] Get Group Summary';
|
|
88
|
+
constructor(groupId) {
|
|
89
|
+
this.groupId = groupId;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
82
92
|
class ResetUserPassword {
|
|
83
93
|
id;
|
|
84
94
|
payload;
|
|
@@ -141,6 +151,7 @@ var UsersGroupsActionKey;
|
|
|
141
151
|
UsersGroupsActionKey["DeleteUser"] = "deleteUser";
|
|
142
152
|
UsersGroupsActionKey["LinkUserToApplication"] = "linkUserToApplication";
|
|
143
153
|
UsersGroupsActionKey["GetUserSummary"] = "getUserSummary";
|
|
154
|
+
UsersGroupsActionKey["GetGroupSummary"] = "getGroupSummary";
|
|
144
155
|
UsersGroupsActionKey["AddUserToGroup"] = "addUserToGroup";
|
|
145
156
|
UsersGroupsActionKey["DeleteUserFromGroup"] = "deleteUserFromGroup";
|
|
146
157
|
UsersGroupsActionKey["GetGroups"] = "getGroups";
|
|
@@ -177,6 +188,9 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
|
|
|
177
188
|
static getUserSummary(state) {
|
|
178
189
|
return state.userSummary;
|
|
179
190
|
}
|
|
191
|
+
static getGroupSummary(state) {
|
|
192
|
+
return state.groupSummary;
|
|
193
|
+
}
|
|
180
194
|
static getGroups(state) {
|
|
181
195
|
return state.groups;
|
|
182
196
|
}
|
|
@@ -326,6 +340,9 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
|
|
|
326
340
|
getUserSummary(ctx, { userName }) {
|
|
327
341
|
const encodedUserName = this.encodeUserName(userName);
|
|
328
342
|
const req$ = this.http.get(`identity/users/${encodedUserName}/summary`, { context: this.context });
|
|
343
|
+
// Drop the previous user's summary first: if this request fails, the
|
|
344
|
+
// drawer must show the error, not someone else's access.
|
|
345
|
+
ctx.patchState({ userSummary: null });
|
|
329
346
|
return handleApiRequest({
|
|
330
347
|
ctx,
|
|
331
348
|
key: UsersGroupsActionKey.GetUserSummary,
|
|
@@ -335,6 +352,19 @@ let UsersGroupsState = class UsersGroupsState extends CrudStateBase {
|
|
|
335
352
|
}),
|
|
336
353
|
});
|
|
337
354
|
}
|
|
355
|
+
getGroupSummary(ctx, { groupId }) {
|
|
356
|
+
const req$ = this.http.get(`identity/groups/${encodeURIComponent(String(groupId))}/summary`, { context: this.context });
|
|
357
|
+
// Same as the user summary: never leave another group's details on screen.
|
|
358
|
+
ctx.patchState({ groupSummary: null });
|
|
359
|
+
return handleApiRequest({
|
|
360
|
+
ctx,
|
|
361
|
+
key: UsersGroupsActionKey.GetGroupSummary,
|
|
362
|
+
request$: req$,
|
|
363
|
+
onSuccess: (response) => ({
|
|
364
|
+
groupSummary: response.data ?? null,
|
|
365
|
+
}),
|
|
366
|
+
});
|
|
367
|
+
}
|
|
338
368
|
resetUserPassword(ctx, { id, payload }) {
|
|
339
369
|
const encodedUserName = this.encodeUserName(id);
|
|
340
370
|
const req$ = this.http.put(`Identity/users/${encodedUserName}/password/reset`, payload, {
|
|
@@ -465,6 +495,9 @@ __decorate([
|
|
|
465
495
|
__decorate([
|
|
466
496
|
Action(GetUserSummary)
|
|
467
497
|
], UsersGroupsState.prototype, "getUserSummary", null);
|
|
498
|
+
__decorate([
|
|
499
|
+
Action(GetGroupSummary)
|
|
500
|
+
], UsersGroupsState.prototype, "getGroupSummary", null);
|
|
468
501
|
__decorate([
|
|
469
502
|
Action(ResetUserPassword)
|
|
470
503
|
], UsersGroupsState.prototype, "resetUserPassword", null);
|
|
@@ -498,6 +531,9 @@ __decorate([
|
|
|
498
531
|
__decorate([
|
|
499
532
|
Selector()
|
|
500
533
|
], UsersGroupsState, "getUserSummary", null);
|
|
534
|
+
__decorate([
|
|
535
|
+
Selector()
|
|
536
|
+
], UsersGroupsState, "getGroupSummary", null);
|
|
501
537
|
__decorate([
|
|
502
538
|
Selector()
|
|
503
539
|
], UsersGroupsState, "getGroups", null);
|
|
@@ -517,6 +553,7 @@ UsersGroupsState = __decorate([
|
|
|
517
553
|
users: [],
|
|
518
554
|
selectedUser: null,
|
|
519
555
|
userSummary: null,
|
|
556
|
+
groupSummary: null,
|
|
520
557
|
groups: [],
|
|
521
558
|
selectedGroup: null,
|
|
522
559
|
loadingActive: [],
|
|
@@ -526,7 +563,7 @@ UsersGroupsState = __decorate([
|
|
|
526
563
|
], UsersGroupsState);
|
|
527
564
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UsersGroupsState, decorators: [{
|
|
528
565
|
type: Injectable
|
|
529
|
-
}], propDecorators: { getUsers: [], getUser: [], createUser: [], addUserToGroup: [], updateUser: [], deleteUser: [], linkUserToApplication: [], getUserSummary: [], resetUserPassword: [], deleteUserFromGroup: [], getGroups: [], getGroup: [], createGroup: [], updateGroup: [], deleteGroup: [], clearSelectedGroup: [] } });
|
|
566
|
+
}], propDecorators: { getUsers: [], getUser: [], createUser: [], addUserToGroup: [], updateUser: [], deleteUser: [], linkUserToApplication: [], getUserSummary: [], getGroupSummary: [], resetUserPassword: [], deleteUserFromGroup: [], getGroups: [], getGroup: [], createGroup: [], updateGroup: [], deleteGroup: [], clearSelectedGroup: [] } });
|
|
530
567
|
|
|
531
568
|
class UsersGroupsFacade {
|
|
532
569
|
store = inject(Store);
|
|
@@ -536,12 +573,14 @@ class UsersGroupsFacade {
|
|
|
536
573
|
users = select(UsersGroupsState.getUsers);
|
|
537
574
|
selectedUser = select(UsersGroupsState.getSelectedUser);
|
|
538
575
|
userSummary = select(UsersGroupsState.getUserSummary);
|
|
576
|
+
groupSummary = select(UsersGroupsState.getGroupSummary);
|
|
539
577
|
groups = select(UsersGroupsState.getGroups);
|
|
540
578
|
selectedGroup = select(UsersGroupsState.getSelectedGroup);
|
|
541
579
|
// ============================================================================
|
|
542
580
|
// Loading/Error Slices - Memoized by NGXS
|
|
543
581
|
// ============================================================================
|
|
544
582
|
loadingActive = select(UsersGroupsState.getLoadingActive);
|
|
583
|
+
errors = select(UsersGroupsState.getErrors);
|
|
545
584
|
// ============================================================================
|
|
546
585
|
// Loading Signals - Computed from slice (minimal reactivity)
|
|
547
586
|
// ============================================================================
|
|
@@ -552,6 +591,9 @@ class UsersGroupsFacade {
|
|
|
552
591
|
isDeletingUser = computed(() => this.loadingActive().includes(UsersGroupsActionKey.DeleteUser), ...(ngDevMode ? [{ debugName: "isDeletingUser" }] : /* istanbul ignore next */ []));
|
|
553
592
|
isLinkingUserToApplication = computed(() => this.loadingActive().includes(UsersGroupsActionKey.LinkUserToApplication), ...(ngDevMode ? [{ debugName: "isLinkingUserToApplication" }] : /* istanbul ignore next */ []));
|
|
554
593
|
isLoadingUserSummary = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetUserSummary), ...(ngDevMode ? [{ debugName: "isLoadingUserSummary" }] : /* istanbul ignore next */ []));
|
|
594
|
+
userSummaryError = computed(() => this.errors()[UsersGroupsActionKey.GetUserSummary] ?? null, ...(ngDevMode ? [{ debugName: "userSummaryError" }] : /* istanbul ignore next */ []));
|
|
595
|
+
isLoadingGroupSummary = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroupSummary), ...(ngDevMode ? [{ debugName: "isLoadingGroupSummary" }] : /* istanbul ignore next */ []));
|
|
596
|
+
groupSummaryError = computed(() => this.errors()[UsersGroupsActionKey.GetGroupSummary] ?? null, ...(ngDevMode ? [{ debugName: "groupSummaryError" }] : /* istanbul ignore next */ []));
|
|
555
597
|
isLoadingGroups = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroups), ...(ngDevMode ? [{ debugName: "isLoadingGroups" }] : /* istanbul ignore next */ []));
|
|
556
598
|
isLoadingGroup = computed(() => this.loadingActive().includes(UsersGroupsActionKey.GetGroup), ...(ngDevMode ? [{ debugName: "isLoadingGroup" }] : /* istanbul ignore next */ []));
|
|
557
599
|
isSavingGroup = computed(() => this.loadingActive().includes(UsersGroupsActionKey.CreateGroup) ||
|
|
@@ -590,6 +632,9 @@ class UsersGroupsFacade {
|
|
|
590
632
|
getUserSummary(userName) {
|
|
591
633
|
return this.store.dispatch(new GetUserSummary(userName));
|
|
592
634
|
}
|
|
635
|
+
getGroupSummary(groupId) {
|
|
636
|
+
return this.store.dispatch(new GetGroupSummary(groupId));
|
|
637
|
+
}
|
|
593
638
|
resetUserPassword(id, payload) {
|
|
594
639
|
return this.store.dispatch(new ResetUserPassword(id, payload));
|
|
595
640
|
}
|
|
@@ -923,7 +968,7 @@ class UserForm {
|
|
|
923
968
|
}
|
|
924
969
|
}
|
|
925
970
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
926
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserForm, isStandalone: true, selector: "mt-user-form", inputs: { userForEdit: { classPropertyName: "userForEdit", publicName: "userForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getUserFormLoading()) {\r\n <div class=\"flex justify-center\">\r\n <div class=\"w-60\">\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList\"\r\n fluid\r\n size=\"small\"\r\n [disabled]=\"!!this.userForEdit()?.userName\"\r\n ></mt-tabs>\r\n </div>\r\n </div>\r\n\r\n <form class=\"col-span-1\">\r\n @if (selectedTab() === \"internal\") {\r\n <mt-dynamic-form\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n } @else {\r\n <mt-dynamic-form\r\n [formConfig]=\"externalUserFormConfig()\"\r\n [formControl]=\"externalUserFormControl\"\r\n />\r\n }\r\n </form>\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateUserLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedUser() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
971
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserForm, isStandalone: true, selector: "mt-user-form", inputs: { userForEdit: { classPropertyName: "userForEdit", publicName: "userForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getUserFormLoading()) {\r\n <div class=\"flex justify-center\">\r\n <div class=\"w-60\">\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList\"\r\n fluid\r\n size=\"small\"\r\n [disabled]=\"!!this.userForEdit()?.userName\"\r\n ></mt-tabs>\r\n </div>\r\n </div>\r\n\r\n <form class=\"col-span-1\">\r\n @if (selectedTab() === \"internal\") {\r\n <mt-dynamic-form\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n } @else {\r\n <mt-dynamic-form\r\n [formConfig]=\"externalUserFormConfig()\"\r\n [formControl]=\"externalUserFormControl\"\r\n />\r\n }\r\n </form>\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateUserLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedUser() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
927
972
|
}
|
|
928
973
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, decorators: [{
|
|
929
974
|
type: Component,
|
|
@@ -1011,7 +1056,7 @@ class ResetPasswordForm {
|
|
|
1011
1056
|
});
|
|
1012
1057
|
}
|
|
1013
1058
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1014
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: ResetPasswordForm, isStandalone: true, selector: "mt-reset-password-form", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
1059
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: ResetPasswordForm, isStandalone: true, selector: "mt-reset-password-form", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
1015
1060
|
}
|
|
1016
1061
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, decorators: [{
|
|
1017
1062
|
type: Component,
|
|
@@ -1026,238 +1071,454 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1026
1071
|
], providers: [DialogService], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <form class=\"p-4\" [class]=\"modal.contentClass\">\r\n <mt-dynamic-form\r\n [formConfig]=\"resetPasswordFormConfig()\"\r\n [formControl]=\"resetPasswordFormControl\"\r\n />\r\n </form>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"passwordResetLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"'save' | transloco\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"passwordResetLoading()\"\r\n [disabled]=\"!this.resetPasswordFormControl.valid\"\r\n />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
1027
1072
|
}], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
|
|
1028
1073
|
|
|
1029
|
-
|
|
1074
|
+
/**
|
|
1075
|
+
* Drawer size shared by the user and group summaries — wide enough for the
|
|
1076
|
+
* four tabs and the scope trees, full-bleed on narrow screens.
|
|
1077
|
+
*/
|
|
1078
|
+
const ACCESS_SUMMARY_DRAWER_CLASS = '!w-[90%] md:!w-[44rem] !absolute !shadow-none';
|
|
1079
|
+
/**
|
|
1080
|
+
* Resolves a `TranslatableDto`, or a string that is one serialized as JSON —
|
|
1081
|
+
* the summaries return workflow `sourceName` / `stepName` and some group
|
|
1082
|
+
* descriptions as `{"ar":"…","en":"…"}` text.
|
|
1083
|
+
*
|
|
1084
|
+
* The active language wins over `display`: `display` is resolved in the
|
|
1085
|
+
* language of the request, so it goes stale when the user switches language
|
|
1086
|
+
* with the drawer open.
|
|
1087
|
+
*/
|
|
1088
|
+
function resolveTranslated(value, lang) {
|
|
1089
|
+
if (!value)
|
|
1090
|
+
return '';
|
|
1091
|
+
if (typeof value === 'object') {
|
|
1092
|
+
const v = value;
|
|
1093
|
+
return v[lang] || v.display || v.en || v.ar || '';
|
|
1094
|
+
}
|
|
1095
|
+
if (typeof value === 'string') {
|
|
1096
|
+
const trimmed = value.trim();
|
|
1097
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
1098
|
+
try {
|
|
1099
|
+
const parsed = JSON.parse(trimmed);
|
|
1100
|
+
return parsed[lang] || parsed['en'] || parsed['ar'] || '';
|
|
1101
|
+
}
|
|
1102
|
+
catch {
|
|
1103
|
+
return value;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
return value;
|
|
1107
|
+
}
|
|
1108
|
+
return '';
|
|
1109
|
+
}
|
|
1110
|
+
/** Case-insensitive "any of these contains the term" for client-side search. */
|
|
1111
|
+
function matchesSearch(term, ...values) {
|
|
1112
|
+
const needle = term.trim().toLowerCase();
|
|
1113
|
+
if (!needle)
|
|
1114
|
+
return true;
|
|
1115
|
+
return values.some((value) => !!value && value.toLowerCase().includes(needle));
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Groups accessibilities by category. On the wire `name` carries the
|
|
1119
|
+
* category's label and `moduleName` the item itself, so a flat list repeats
|
|
1120
|
+
* the same subtitle on every row.
|
|
1121
|
+
*/
|
|
1122
|
+
function groupAccessibilities(accessibilities, lang) {
|
|
1123
|
+
const groups = new Map();
|
|
1124
|
+
for (const accessibility of accessibilities) {
|
|
1125
|
+
const key = accessibility.category || accessibility.moduleKey || '';
|
|
1126
|
+
let group = groups.get(key);
|
|
1127
|
+
if (!group) {
|
|
1128
|
+
group = {
|
|
1129
|
+
key,
|
|
1130
|
+
label: resolveTranslated(accessibility.name, lang) || key,
|
|
1131
|
+
items: [],
|
|
1132
|
+
};
|
|
1133
|
+
groups.set(key, group);
|
|
1134
|
+
}
|
|
1135
|
+
group.items.push({
|
|
1136
|
+
id: accessibility.id,
|
|
1137
|
+
name: resolveTranslated(accessibility.moduleName, lang) ||
|
|
1138
|
+
accessibility.moduleKey ||
|
|
1139
|
+
'',
|
|
1140
|
+
requiresMfa: !!accessibility.enableMFACheck,
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
return [...groups.values()];
|
|
1144
|
+
}
|
|
1145
|
+
// ============================================================================
|
|
1146
|
+
// Tree builders — group permissions/roles by Template → Level → Module so the
|
|
1147
|
+
// repeated scope context collapses into shared parent nodes instead of being
|
|
1148
|
+
// duplicated on every row.
|
|
1149
|
+
// ============================================================================
|
|
1150
|
+
function buildPermissionTree(permissions, lang, labels) {
|
|
1151
|
+
const roots = [];
|
|
1152
|
+
for (const permission of permissions) {
|
|
1153
|
+
const container = resolveScopeContainer(roots, 'perm', permission.scope, permission.templateName, lang, labels);
|
|
1154
|
+
container.push({
|
|
1155
|
+
key: `perm-${permission.id}`,
|
|
1156
|
+
label: resolveTranslated(permission.name, lang),
|
|
1157
|
+
icon: 'security.shield-tick',
|
|
1158
|
+
data: { type: 'permission' },
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
return finalizeTree(roots, 'permission');
|
|
1162
|
+
}
|
|
1163
|
+
function buildRoleTree(roles, lang, labels) {
|
|
1164
|
+
const roots = [];
|
|
1165
|
+
for (const role of roles) {
|
|
1166
|
+
const container = resolveScopeContainer(roots, 'role', role.scope, role.templateName, lang, labels);
|
|
1167
|
+
const assignments = (role.levelDataAssignments ?? [])
|
|
1168
|
+
.map((assignment, index) => {
|
|
1169
|
+
const parentPath = (assignment.parents ?? [])
|
|
1170
|
+
.map((parent) => parent.levelDataName)
|
|
1171
|
+
.filter(Boolean)
|
|
1172
|
+
.join(' / ');
|
|
1173
|
+
const name = assignment.levelDataName ?? '';
|
|
1174
|
+
return {
|
|
1175
|
+
key: `role-${role.id}-assign-${assignment.levelDataId ?? index}`,
|
|
1176
|
+
label: parentPath ? `${name} · ${parentPath}` : name,
|
|
1177
|
+
icon: 'map.marker-pin-01',
|
|
1178
|
+
data: { type: 'assignment' },
|
|
1179
|
+
};
|
|
1180
|
+
})
|
|
1181
|
+
.filter((node) => !!node.label);
|
|
1182
|
+
container.push({
|
|
1183
|
+
key: `role-${role.id}`,
|
|
1184
|
+
label: resolveTranslated(role.name, lang),
|
|
1185
|
+
icon: 'user.user-check-01',
|
|
1186
|
+
data: { type: 'role' },
|
|
1187
|
+
children: assignments.length ? assignments : undefined,
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
return finalizeTree(roots, 'role');
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Walks/creates the scope spine for a row and returns the children array the
|
|
1194
|
+
* leaf (permission/role) should be pushed into:
|
|
1195
|
+
* - level scope → Template → Level → (Module)
|
|
1196
|
+
* - module scope with no level → "Other modules" → Module
|
|
1197
|
+
* - no scope → "Unknown scope"
|
|
1198
|
+
*/
|
|
1199
|
+
function resolveScopeContainer(roots, prefix, scope, fallbackTemplateName, lang, labels) {
|
|
1200
|
+
const level = scope?.level;
|
|
1201
|
+
const moduleScope = scope?.module;
|
|
1202
|
+
if (!level) {
|
|
1203
|
+
if (!moduleScope) {
|
|
1204
|
+
return getOrCreateChild(roots, `${prefix}-unknown`, () => ({
|
|
1205
|
+
key: `${prefix}-unknown`,
|
|
1206
|
+
label: labels.unknownScope,
|
|
1207
|
+
icon: 'general.help-circle',
|
|
1208
|
+
data: { type: 'unknown', order: 2 },
|
|
1209
|
+
children: [],
|
|
1210
|
+
})).children;
|
|
1211
|
+
}
|
|
1212
|
+
const otherNode = getOrCreateChild(roots, `${prefix}-other`, () => ({
|
|
1213
|
+
key: `${prefix}-other`,
|
|
1214
|
+
label: labels.otherModules,
|
|
1215
|
+
icon: 'layout.layers-three-01',
|
|
1216
|
+
data: { type: 'other', order: 1 },
|
|
1217
|
+
children: [],
|
|
1218
|
+
}));
|
|
1219
|
+
return moduleContainer(otherNode, `${prefix}-other`, moduleScope, lang, labels);
|
|
1220
|
+
}
|
|
1221
|
+
const templateKey = `${prefix}-tpl-${level.templateId ?? 'na'}`;
|
|
1222
|
+
const templateNode = getOrCreateChild(roots, templateKey, () => ({
|
|
1223
|
+
key: templateKey,
|
|
1224
|
+
label: resolveTranslated(level.templateName ?? fallbackTemplateName, lang) ||
|
|
1225
|
+
labels.unknownScope,
|
|
1226
|
+
icon: 'custom.building',
|
|
1227
|
+
data: { type: 'template', order: 0 },
|
|
1228
|
+
children: [],
|
|
1229
|
+
}));
|
|
1230
|
+
const levelKey = `${templateKey}-lvl-${level.id ?? 'na'}`;
|
|
1231
|
+
const levelNode = getOrCreateChild(templateNode.children, levelKey, () => ({
|
|
1232
|
+
key: levelKey,
|
|
1233
|
+
label: resolveTranslated(level.name, lang) || labels.unknownScope,
|
|
1234
|
+
icon: 'custom.hierarchy-structure',
|
|
1235
|
+
data: { type: 'level', order: level.order ?? 0 },
|
|
1236
|
+
children: [],
|
|
1237
|
+
}));
|
|
1238
|
+
return moduleScope
|
|
1239
|
+
? moduleContainer(levelNode, levelKey, moduleScope, lang, labels)
|
|
1240
|
+
: levelNode.children;
|
|
1241
|
+
}
|
|
1242
|
+
function moduleContainer(parent, parentKey, moduleScope, lang, labels) {
|
|
1243
|
+
const moduleKey = `${parentKey}-mod-${moduleScope.id ?? moduleScope.levelModuleId ?? 'na'}`;
|
|
1244
|
+
return getOrCreateChild(parent.children, moduleKey, () => ({
|
|
1245
|
+
key: moduleKey,
|
|
1246
|
+
label: resolveTranslated(moduleScope.name, lang) || labels.unknownScope,
|
|
1247
|
+
icon: 'file.folder',
|
|
1248
|
+
data: { type: 'module', order: 0 },
|
|
1249
|
+
children: [],
|
|
1250
|
+
})).children;
|
|
1251
|
+
}
|
|
1252
|
+
function getOrCreateChild(children, key, factory) {
|
|
1253
|
+
const existing = children.find((node) => node.key === key);
|
|
1254
|
+
if (existing)
|
|
1255
|
+
return existing;
|
|
1256
|
+
const created = factory();
|
|
1257
|
+
children.push(created);
|
|
1258
|
+
return created;
|
|
1259
|
+
}
|
|
1260
|
+
const SCOPE_NODE_TYPES = new Set([
|
|
1261
|
+
'template',
|
|
1262
|
+
'level',
|
|
1263
|
+
'module',
|
|
1264
|
+
'other',
|
|
1265
|
+
'unknown',
|
|
1266
|
+
]);
|
|
1267
|
+
const isScopeNode = (node) => SCOPE_NODE_TYPES.has(node.data?.type ?? '');
|
|
1268
|
+
/**
|
|
1269
|
+
* Orders the scope nodes (templates and modules by name, levels by their
|
|
1270
|
+
* configured order, the "other"/"unknown" buckets last), keeps a node's own
|
|
1271
|
+
* permissions/roles above its sub-scopes, and appends a descendant-leaf count
|
|
1272
|
+
* to every scope node's label.
|
|
1273
|
+
*/
|
|
1274
|
+
function finalizeTree(nodes, leafType) {
|
|
1275
|
+
orderNodes(nodes);
|
|
1276
|
+
appendScopeCounts(nodes, leafType);
|
|
1277
|
+
return nodes;
|
|
1278
|
+
}
|
|
1279
|
+
function orderNodes(nodes) {
|
|
1280
|
+
const leaves = nodes.filter((node) => !isScopeNode(node));
|
|
1281
|
+
const scopes = nodes.filter(isScopeNode).sort(compareScopeNodes);
|
|
1282
|
+
nodes.splice(0, nodes.length, ...leaves, ...scopes);
|
|
1283
|
+
for (const node of scopes) {
|
|
1284
|
+
if (node.children?.length)
|
|
1285
|
+
orderNodes(node.children);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
function compareScopeNodes(a, b) {
|
|
1289
|
+
const rank = scopeRank(a) - scopeRank(b);
|
|
1290
|
+
if (rank !== 0)
|
|
1291
|
+
return rank;
|
|
1292
|
+
if (a.data?.type === 'level' && b.data?.type === 'level') {
|
|
1293
|
+
const byOrder = (a.data?.order ?? 0) - (b.data?.order ?? 0);
|
|
1294
|
+
if (byOrder !== 0)
|
|
1295
|
+
return byOrder;
|
|
1296
|
+
}
|
|
1297
|
+
return (a.label ?? '').localeCompare(b.label ?? '');
|
|
1298
|
+
}
|
|
1299
|
+
function scopeRank(node) {
|
|
1300
|
+
switch (node.data?.type) {
|
|
1301
|
+
case 'other':
|
|
1302
|
+
return 1;
|
|
1303
|
+
case 'unknown':
|
|
1304
|
+
return 2;
|
|
1305
|
+
default:
|
|
1306
|
+
return 0;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
function appendScopeCounts(nodes, leafType) {
|
|
1310
|
+
for (const node of nodes) {
|
|
1311
|
+
if (isScopeNode(node) && node.children?.length) {
|
|
1312
|
+
node.label = `${node.label} (${countLeaves(node, leafType)})`;
|
|
1313
|
+
appendScopeCounts(node.children, leafType);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function countLeaves(node, leafType) {
|
|
1318
|
+
if (node.data?.type === leafType)
|
|
1319
|
+
return 1;
|
|
1320
|
+
return (node.children ?? []).reduce((sum, child) => sum + countLeaves(child, leafType), 0);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
const TONE_CLASSES = {
|
|
1324
|
+
neutral: 'border-surface-200 bg-surface-50 text-surface-700 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-200',
|
|
1325
|
+
success: 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-200',
|
|
1326
|
+
warn: 'border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200',
|
|
1327
|
+
danger: 'border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-800 dark:bg-rose-900/30 dark:text-rose-200',
|
|
1328
|
+
info: 'border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-800 dark:bg-sky-900/30 dark:text-sky-200',
|
|
1329
|
+
primary: 'border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-200',
|
|
1330
|
+
};
|
|
1331
|
+
/** The status chip both access summaries use — one shape, six tones. */
|
|
1332
|
+
class SummaryPill {
|
|
1333
|
+
tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
1334
|
+
classes = computed(() => `inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap ${TONE_CLASSES[this.tone()]}`, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
1335
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryPill, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1336
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: SummaryPill, isStandalone: true, selector: "mt-summary-pill", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '<ng-content />', isInline: true });
|
|
1337
|
+
}
|
|
1338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryPill, decorators: [{
|
|
1339
|
+
type: Component,
|
|
1340
|
+
args: [{
|
|
1341
|
+
selector: 'mt-summary-pill',
|
|
1342
|
+
standalone: true,
|
|
1343
|
+
template: '<ng-content />',
|
|
1344
|
+
host: { '[class]': 'classes()' },
|
|
1345
|
+
}]
|
|
1346
|
+
}], propDecorators: { tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }] } });
|
|
1347
|
+
|
|
1348
|
+
/** Search appears once the list is long enough to need it. */
|
|
1349
|
+
const SEARCH_THRESHOLD$2 = 6;
|
|
1350
|
+
/**
|
|
1351
|
+
* The Accessibilities tab body, shared by the user and group summaries:
|
|
1352
|
+
* application accessibilities grouped under their category.
|
|
1353
|
+
*/
|
|
1354
|
+
class SummaryAccessibilities {
|
|
1355
|
+
translocoService = inject(TranslocoService);
|
|
1356
|
+
accessibilities = input([], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
|
|
1357
|
+
/** Empty-state copy, which names the subject ("this user" / "this group"). */
|
|
1358
|
+
emptyMessage = input('', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
1359
|
+
searchControl = new FormControl('', { nonNullable: true });
|
|
1360
|
+
searchTerm = toSignal(this.searchControl.valueChanges, {
|
|
1361
|
+
initialValue: '',
|
|
1362
|
+
});
|
|
1363
|
+
groups = computed(() => groupAccessibilities(this.accessibilities(), this.translocoService.getActiveLang()), ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
1364
|
+
showSearch = computed(() => this.accessibilities().length > SEARCH_THRESHOLD$2, ...(ngDevMode ? [{ debugName: "showSearch" }] : /* istanbul ignore next */ []));
|
|
1365
|
+
filteredGroups = computed(() => {
|
|
1366
|
+
const term = this.searchTerm();
|
|
1367
|
+
if (!term.trim())
|
|
1368
|
+
return this.groups();
|
|
1369
|
+
return this.groups()
|
|
1370
|
+
.map((group) => matchesSearch(term, group.label)
|
|
1371
|
+
? group
|
|
1372
|
+
: {
|
|
1373
|
+
...group,
|
|
1374
|
+
items: group.items.filter((item) => matchesSearch(term, item.name)),
|
|
1375
|
+
})
|
|
1376
|
+
.filter((group) => group.items.length > 0);
|
|
1377
|
+
}, ...(ngDevMode ? [{ debugName: "filteredGroups" }] : /* istanbul ignore next */ []));
|
|
1378
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryAccessibilities, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1379
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: SummaryAccessibilities, isStandalone: true, selector: "mt-summary-accessibilities", inputs: { accessibilities: { classPropertyName: "accessibilities", publicName: "accessibilities", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n @if (accessibilities().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"emptyMessage()\"\n [description]=\"t('accessibilities-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showSearch()) {\n <mt-text-field\n [formControl]=\"searchControl\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-accessibilities')\"\n />\n }\n\n @for (group of filteredGroups(); track group.key) {\n <section class=\"rounded-md border border-surface\">\n <header\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2\"\n >\n <span class=\"truncate text-sm font-semibold text-color\">\n {{ group.label }}\n </span>\n <span class=\"shrink-0 text-xs text-muted-color\">\n {{ group.items.length }}\n </span>\n </header>\n <ul>\n @for (item of group.items; track item.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-icon\n icon=\"security.lock-unlocked-01\"\n class=\"shrink-0 text-lg text-primary\"\n />\n <span\n class=\"min-w-0 flex-1 truncate text-sm text-color\"\n [title]=\"item.name\"\n >\n {{ item.name }}\n </span>\n @if (item.requiresMfa) {\n <mt-summary-pill tone=\"info\">{{ t(\"mfa\") }}</mt-summary-pill>\n }\n </li>\n }\n </ul>\n </section>\n } @empty {\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n }\n </div>\n }\n</ng-container>\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }] });
|
|
1380
|
+
}
|
|
1381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SummaryAccessibilities, decorators: [{
|
|
1382
|
+
type: Component,
|
|
1383
|
+
args: [{ selector: 'mt-summary-accessibilities', standalone: true, imports: [
|
|
1384
|
+
TranslocoDirective,
|
|
1385
|
+
ReactiveFormsModule,
|
|
1386
|
+
TextField,
|
|
1387
|
+
EmptyState,
|
|
1388
|
+
Icon,
|
|
1389
|
+
SummaryPill,
|
|
1390
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n @if (accessibilities().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"emptyMessage()\"\n [description]=\"t('accessibilities-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showSearch()) {\n <mt-text-field\n [formControl]=\"searchControl\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-accessibilities')\"\n />\n }\n\n @for (group of filteredGroups(); track group.key) {\n <section class=\"rounded-md border border-surface\">\n <header\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2\"\n >\n <span class=\"truncate text-sm font-semibold text-color\">\n {{ group.label }}\n </span>\n <span class=\"shrink-0 text-xs text-muted-color\">\n {{ group.items.length }}\n </span>\n </header>\n <ul>\n @for (item of group.items; track item.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-icon\n icon=\"security.lock-unlocked-01\"\n class=\"shrink-0 text-lg text-primary\"\n />\n <span\n class=\"min-w-0 flex-1 truncate text-sm text-color\"\n [title]=\"item.name\"\n >\n {{ item.name }}\n </span>\n @if (item.requiresMfa) {\n <mt-summary-pill tone=\"info\">{{ t(\"mfa\") }}</mt-summary-pill>\n }\n </li>\n }\n </ul>\n </section>\n } @empty {\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n }\n </div>\n }\n</ng-container>\n" }]
|
|
1391
|
+
}], propDecorators: { accessibilities: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibilities", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }] } });
|
|
1392
|
+
|
|
1393
|
+
/** Search appears once the list is long enough to need it. */
|
|
1394
|
+
const SEARCH_THRESHOLD$1 = 6;
|
|
1395
|
+
/**
|
|
1396
|
+
* One user's access, opened as a drawer from the users table: the groups the
|
|
1397
|
+
* user belongs to, the roles they hold (direct and from team membership), the
|
|
1398
|
+
* permissions those produce, and their application accessibilities.
|
|
1399
|
+
* `GET identity/users/{userName}/summary`.
|
|
1400
|
+
*/
|
|
1401
|
+
class UserAccessSummary {
|
|
1030
1402
|
facade = inject(UsersGroupsFacade);
|
|
1031
1403
|
translocoService = inject(TranslocoService);
|
|
1032
|
-
|
|
1404
|
+
/** The users-table row; renders the header before the summary arrives. */
|
|
1033
1405
|
user = input(null, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
1034
1406
|
context = new HttpContext().set(REQUEST_CONTEXT, {
|
|
1035
1407
|
useBaseUrl: true,
|
|
1036
1408
|
});
|
|
1037
1409
|
loading = this.facade.isLoadingUserSummary;
|
|
1410
|
+
error = this.facade.userSummaryError;
|
|
1038
1411
|
summary = this.facade.userSummary;
|
|
1412
|
+
lang = toSignal(this.translocoService.langChanges$, {
|
|
1413
|
+
initialValue: this.translocoService.getActiveLang(),
|
|
1414
|
+
});
|
|
1039
1415
|
activeTab = signal('groups', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
1416
|
+
groupSearch = new FormControl('', { nonNullable: true });
|
|
1417
|
+
groupSearchTerm = toSignal(this.groupSearch.valueChanges, {
|
|
1418
|
+
initialValue: '',
|
|
1419
|
+
});
|
|
1420
|
+
profile = computed(() => {
|
|
1421
|
+
const row = this.user();
|
|
1422
|
+
const fromSummary = this.summary()?.user;
|
|
1423
|
+
return {
|
|
1424
|
+
displayName: fromSummary?.displayName || row?.displayName || '',
|
|
1425
|
+
userName: fromSummary?.userName || row?.userName || '',
|
|
1426
|
+
image: fromSummary?.image || row?.image || '',
|
|
1427
|
+
isExternal: !!(fromSummary?.isExternal ?? row?.isExternal),
|
|
1428
|
+
};
|
|
1429
|
+
}, ...(ngDevMode ? [{ debugName: "profile" }] : /* istanbul ignore next */ []));
|
|
1040
1430
|
groups = computed(() => {
|
|
1041
1431
|
const lang = this.lang();
|
|
1042
1432
|
return (this.summary()?.groups ?? []).map((group) => ({
|
|
1043
1433
|
id: group.id,
|
|
1044
|
-
name:
|
|
1434
|
+
name: resolveTranslated(group.name, lang),
|
|
1435
|
+
description: resolveTranslated(group.description, lang),
|
|
1045
1436
|
isActivated: !!group.isActivated,
|
|
1046
1437
|
membersCount: group.membersCount ?? 0,
|
|
1047
1438
|
}));
|
|
1048
1439
|
}, ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1440
|
+
filteredGroups = computed(() => {
|
|
1441
|
+
const term = this.groupSearchTerm();
|
|
1442
|
+
return this.groups().filter((group) => matchesSearch(term, group.name, group.description));
|
|
1443
|
+
}, ...(ngDevMode ? [{ debugName: "filteredGroups" }] : /* istanbul ignore next */ []));
|
|
1444
|
+
showGroupSearch = computed(() => this.groups().length > SEARCH_THRESHOLD$1, ...(ngDevMode ? [{ debugName: "showGroupSearch" }] : /* istanbul ignore next */ []));
|
|
1445
|
+
accessibilities = computed(() => this.summary()?.accessibilities ?? [], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
|
|
1446
|
+
treeLabels = computed(() => {
|
|
1447
|
+
this.lang();
|
|
1448
|
+
return {
|
|
1449
|
+
otherModules: this.translocoService.translate('users-groups.other-modules'),
|
|
1450
|
+
unknownScope: this.translocoService.translate('users-groups.unknown-scope'),
|
|
1451
|
+
};
|
|
1452
|
+
}, ...(ngDevMode ? [{ debugName: "treeLabels" }] : /* istanbul ignore next */ []));
|
|
1453
|
+
permissionTree = computed(() => buildPermissionTree(this.summary()?.permissions ?? [], this.lang(), this.treeLabels()), ...(ngDevMode ? [{ debugName: "permissionTree" }] : /* istanbul ignore next */ []));
|
|
1454
|
+
roleTree = computed(() => buildRoleTree(this.summary()?.roles ?? [], this.lang(), this.treeLabels()), ...(ngDevMode ? [{ debugName: "roleTree" }] : /* istanbul ignore next */ []));
|
|
1455
|
+
tabs = computed(() => {
|
|
1456
|
+
this.lang();
|
|
1457
|
+
const summary = this.summary();
|
|
1458
|
+
const count = (value) => (summary ? value : null);
|
|
1459
|
+
return [
|
|
1460
|
+
{
|
|
1461
|
+
label: this.translocoService.translate('users-groups.groups'),
|
|
1462
|
+
value: 'groups',
|
|
1463
|
+
icon: 'user.users-01',
|
|
1464
|
+
badge: count(this.groups().length),
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
label: this.translocoService.translate('users-groups.roles'),
|
|
1468
|
+
value: 'roles',
|
|
1469
|
+
icon: 'user.user-check-01',
|
|
1470
|
+
badge: count(summary?.roles?.length ?? 0),
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
label: this.translocoService.translate('users-groups.permissions'),
|
|
1474
|
+
value: 'permissions',
|
|
1475
|
+
icon: 'security.shield-tick',
|
|
1476
|
+
badge: count(summary?.permissions?.length ?? 0),
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
label: this.translocoService.translate('users-groups.accessibilities'),
|
|
1480
|
+
value: 'accessibilities',
|
|
1481
|
+
icon: 'security.lock-unlocked-01',
|
|
1482
|
+
badge: count(this.accessibilities().length),
|
|
1483
|
+
},
|
|
1484
|
+
];
|
|
1485
|
+
}, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
1095
1486
|
ngOnInit() {
|
|
1487
|
+
this.load();
|
|
1488
|
+
}
|
|
1489
|
+
load() {
|
|
1096
1490
|
const userName = this.user()?.userName;
|
|
1097
1491
|
if (!userName)
|
|
1098
1492
|
return;
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
lang() {
|
|
1102
|
-
return this.translocoService.getActiveLang();
|
|
1103
|
-
}
|
|
1104
|
-
resolveTranslated(value, lang) {
|
|
1105
|
-
if (!value)
|
|
1106
|
-
return '';
|
|
1107
|
-
if (typeof value === 'object') {
|
|
1108
|
-
const v = value;
|
|
1109
|
-
return v['display'] || v[lang] || v['en'] || v['ar'] || '';
|
|
1110
|
-
}
|
|
1111
|
-
if (typeof value === 'string') {
|
|
1112
|
-
const trimmed = value.trim();
|
|
1113
|
-
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
1114
|
-
try {
|
|
1115
|
-
const parsed = JSON.parse(trimmed);
|
|
1116
|
-
return parsed[lang] || parsed['en'] || parsed['ar'] || '';
|
|
1117
|
-
}
|
|
1118
|
-
catch {
|
|
1119
|
-
return value;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
return value;
|
|
1123
|
-
}
|
|
1124
|
-
return '';
|
|
1493
|
+
// The failure is rendered from the store's error slice.
|
|
1494
|
+
this.facade.getUserSummary(userName).subscribe({ error: () => undefined });
|
|
1125
1495
|
}
|
|
1126
|
-
|
|
1127
|
-
// Tree builders — group permissions/roles by Template → Level → Module so the
|
|
1128
|
-
// repeated scope context collapses into shared parent nodes instead of being
|
|
1129
|
-
// duplicated on every row.
|
|
1130
|
-
// ============================================================================
|
|
1131
|
-
buildPermissionTree(permissions, lang) {
|
|
1132
|
-
const roots = [];
|
|
1133
|
-
for (const permission of permissions) {
|
|
1134
|
-
const container = this.resolveScopeContainer(roots, 'perm', permission.scope, permission.templateName, lang);
|
|
1135
|
-
container.push({
|
|
1136
|
-
key: `perm-${permission.id}`,
|
|
1137
|
-
label: this.resolveTranslated(permission.name, lang),
|
|
1138
|
-
icon: 'security.shield-tick',
|
|
1139
|
-
data: { type: 'permission' },
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
this.appendScopeCounts(roots, 'permission');
|
|
1143
|
-
return roots;
|
|
1144
|
-
}
|
|
1145
|
-
buildRoleTree(roles, lang) {
|
|
1146
|
-
const roots = [];
|
|
1147
|
-
for (const role of roles) {
|
|
1148
|
-
const container = this.resolveScopeContainer(roots, 'role', role.scope, role.templateName, lang);
|
|
1149
|
-
const assignments = (role.levelDataAssignments ?? [])
|
|
1150
|
-
.map((assignment, index) => {
|
|
1151
|
-
const parentPath = (assignment.parents ?? [])
|
|
1152
|
-
.map((parent) => parent.levelDataName)
|
|
1153
|
-
.filter(Boolean)
|
|
1154
|
-
.join(' / ');
|
|
1155
|
-
const name = assignment.levelDataName ?? '';
|
|
1156
|
-
return {
|
|
1157
|
-
key: `role-${role.id}-assign-${assignment.levelDataId ?? index}`,
|
|
1158
|
-
label: parentPath ? `${name} · ${parentPath}` : name,
|
|
1159
|
-
icon: 'map.marker-pin-01',
|
|
1160
|
-
data: { type: 'assignment' },
|
|
1161
|
-
};
|
|
1162
|
-
})
|
|
1163
|
-
.filter((node) => !!node.label);
|
|
1164
|
-
container.push({
|
|
1165
|
-
key: `role-${role.id}`,
|
|
1166
|
-
label: this.resolveTranslated(role.name, lang),
|
|
1167
|
-
icon: 'user.user-check-01',
|
|
1168
|
-
data: { type: 'role' },
|
|
1169
|
-
children: assignments.length ? assignments : undefined,
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
this.appendScopeCounts(roots, 'role');
|
|
1173
|
-
return roots;
|
|
1174
|
-
}
|
|
1175
|
-
/**
|
|
1176
|
-
* Walks/creates the Template → Level → Module spine for a scope and returns the
|
|
1177
|
-
* children array the leaf (permission/role) should be pushed into.
|
|
1178
|
-
*/
|
|
1179
|
-
resolveScopeContainer(roots, prefix, scope, fallbackTemplateName, lang) {
|
|
1180
|
-
const level = scope?.level;
|
|
1181
|
-
const templateKey = `${prefix}-tpl-${level?.templateId ?? 'na'}`;
|
|
1182
|
-
const templateNode = this.getOrCreateChild(roots, templateKey, () => ({
|
|
1183
|
-
key: templateKey,
|
|
1184
|
-
label: this.resolveTranslated(level?.templateName ?? fallbackTemplateName, lang) || this.unknownScopeLabel(),
|
|
1185
|
-
icon: 'custom.building',
|
|
1186
|
-
data: { type: 'template' },
|
|
1187
|
-
children: [],
|
|
1188
|
-
}));
|
|
1189
|
-
const levelKey = `${templateKey}-lvl-${level?.id ?? 'na'}`;
|
|
1190
|
-
const levelNode = this.getOrCreateChild(templateNode.children, levelKey, () => ({
|
|
1191
|
-
key: levelKey,
|
|
1192
|
-
label: this.resolveTranslated(level?.name, lang) || this.unknownScopeLabel(),
|
|
1193
|
-
icon: 'custom.hierarchy-structure',
|
|
1194
|
-
data: { type: 'level' },
|
|
1195
|
-
children: [],
|
|
1196
|
-
}));
|
|
1197
|
-
const moduleScope = scope?.module;
|
|
1198
|
-
if (!moduleScope) {
|
|
1199
|
-
return levelNode.children;
|
|
1200
|
-
}
|
|
1201
|
-
const moduleKey = `${levelKey}-mod-${moduleScope.id ?? moduleScope.levelModuleId ?? 'na'}`;
|
|
1202
|
-
const moduleNode = this.getOrCreateChild(levelNode.children, moduleKey, () => ({
|
|
1203
|
-
key: moduleKey,
|
|
1204
|
-
label: this.resolveTranslated(moduleScope.name, lang) ||
|
|
1205
|
-
this.unknownScopeLabel(),
|
|
1206
|
-
icon: 'file.folder',
|
|
1207
|
-
data: { type: 'module' },
|
|
1208
|
-
children: [],
|
|
1209
|
-
}));
|
|
1210
|
-
return moduleNode.children;
|
|
1211
|
-
}
|
|
1212
|
-
getOrCreateChild(children, key, factory) {
|
|
1213
|
-
const existing = children.find((node) => node.key === key);
|
|
1214
|
-
if (existing)
|
|
1215
|
-
return existing;
|
|
1216
|
-
const created = factory();
|
|
1217
|
-
children.push(created);
|
|
1218
|
-
return created;
|
|
1219
|
-
}
|
|
1220
|
-
/** Appends a descendant-leaf count to each grouping (template/level/module) node. */
|
|
1221
|
-
appendScopeCounts(nodes, leafType) {
|
|
1222
|
-
for (const node of nodes) {
|
|
1223
|
-
const type = node.data?.type;
|
|
1224
|
-
if ((type === 'template' || type === 'level' || type === 'module') &&
|
|
1225
|
-
node.children?.length) {
|
|
1226
|
-
node.label = `${node.label} (${this.countLeaves(node, leafType)})`;
|
|
1227
|
-
}
|
|
1228
|
-
if (node.children?.length) {
|
|
1229
|
-
this.appendScopeCounts(node.children, leafType);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
countLeaves(node, leafType) {
|
|
1234
|
-
if (node.data?.type === leafType)
|
|
1235
|
-
return 1;
|
|
1236
|
-
return (node.children ?? []).reduce((sum, child) => sum + this.countLeaves(child, leafType), 0);
|
|
1237
|
-
}
|
|
1238
|
-
unknownScopeLabel() {
|
|
1239
|
-
return this.translocoService.translate('users-groups.unknown-scope');
|
|
1240
|
-
}
|
|
1241
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserLinkedGroups, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1242
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserLinkedGroups, isStandalone: true, selector: "mt-user-linked-groups", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"flex flex-col gap-4 p-4 max-h-[75vh] overflow-auto\">\r\n <div class=\"flex items-center min-w-0\">\r\n <mt-tabs\r\n class=\"flex-1 min-w-0\"\r\n [options]=\"tabs()\"\r\n [(active)]=\"activeTab\"\r\n mode=\"underline\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n ></mt-tabs>\r\n <div\r\n class=\"flex items-center gap-2 pb-2 px-2 shrink-0 border-b border-slate-200 dark:border-slate-700\"\r\n >\r\n <mt-avatar\r\n [image]=\"\r\n userImage()\r\n ? $any(userImage() | secureImage: true : context : 'avatar/')\r\n : ''\r\n \"\r\n [icon]=\"'user.user-01'\"\r\n styleClass=\"w-8! h-8! text-lg! text-gray-600! bg-surface-300!\"\r\n ></mt-avatar>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-sm font-medium text-slate-600 dark:text-slate-100 truncate\"\r\n [title]=\"userDisplayName()\"\r\n >\r\n {{ userDisplayName() }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n <p-skeleton height=\"4rem\"></p-skeleton>\r\n </div>\r\n } @else if (isEmpty()) {\r\n <div\r\n class=\"flex flex-col items-center justify-center text-center py-10 gap-2 text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"general.link-broken-01\" class=\"text-2xl\" />\r\n <span class=\"text-sm font-medium\">\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n {{ t(\"no-linked-groups\") }}\r\n }\r\n @case (\"permissions\") {\r\n {{ t(\"no-permissions\") }}\r\n }\r\n @case (\"roles\") {\r\n {{ t(\"no-roles\") }}\r\n }\r\n @case (\"accessibilities\") {\r\n {{ t(\"no-accessibilities\") }}\r\n }\r\n }\r\n </span>\r\n </div>\r\n } @else {\r\n @switch (activeTab()) {\r\n @case (\"groups\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (group of groups(); track group.id) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3 hover:shadow-sm transition-shadow\"\r\n >\r\n <div class=\"flex items-start justify-between gap-2\">\r\n <div class=\"flex items-center gap-3 min-w-0\">\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-indigo-50 dark:bg-indigo-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-indigo-600 dark:text-indigo-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"group.name\"\r\n >\r\n {{ group.name }}\r\n </span>\r\n <span\r\n class=\"inline-flex items-center gap-1 text-xs text-slate-500 dark:text-slate-400\"\r\n >\r\n <mt-icon icon=\"user.users-01\" class=\"text-sm\" />\r\n {{ group.membersCount }} {{ t(\"users\") }}\r\n </span>\r\n </div>\r\n </div>\r\n\r\n @if (group.isActivated) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-emerald-500\"\r\n ></span>\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"active\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-100 dark:bg-slate-700 px-2 py-0.5 shrink-0\"\r\n >\r\n <span\r\n class=\"w-1.5 h-1.5 rounded-full bg-slate-400\"\r\n ></span>\r\n <span\r\n class=\"text-slate-600 dark:text-slate-200 text-xs font-medium\"\r\n >\r\n {{ t(\"inactive\") }}\r\n </span>\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @case (\"permissions\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"permissionTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-permissions')\"\r\n />\r\n }\r\n\r\n @case (\"roles\") {\r\n <mt-tree\r\n class=\"block pb-3\"\r\n [value]=\"roleTree()\"\r\n [filter]=\"true\"\r\n [filterPlaceholder]=\"t('search-roles')\"\r\n />\r\n }\r\n\r\n @case (\"accessibilities\") {\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3 pb-3\">\r\n @for (accessibility of accessibilities(); track accessibility.id) {\r\n <div\r\n class=\"flex items-center gap-3 rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 p-3\"\r\n >\r\n <span\r\n class=\"inline-flex items-center justify-center rounded-md bg-sky-50 dark:bg-sky-900/30 p-2 shrink-0\"\r\n >\r\n <mt-icon\r\n icon=\"security.lock-unlocked-01\"\r\n class=\"text-sky-600 dark:text-sky-300 text-xl\"\r\n />\r\n </span>\r\n <div class=\"flex flex-col min-w-0 flex-1\">\r\n <span\r\n class=\"text-md text-slate-800 dark:text-slate-100 truncate\"\r\n [title]=\"accessibility.name\"\r\n >\r\n {{ accessibility.name }}\r\n </span>\r\n @if (accessibility.category) {\r\n <span class=\"text-xs text-slate-500 dark:text-slate-400\">\r\n {{ accessibility.category }}\r\n </span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
|
|
1496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserAccessSummary, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1497
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserAccessSummary, isStandalone: true, selector: "mt-user-access-summary", inputs: { user: { classPropertyName: "user", publicName: "user", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex h-full min-h-0 flex-col" }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <!-- Who this is \u2014 rendered from the table row, so it never waits on the request. -->\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\n <mt-avatar\n [image]=\"\n profile().image\n ? $any(profile().image | secureImage: true : context : 'avatar/')\n : ''\n \"\n icon=\"user.user-01\"\n size=\"large\"\n styleClass=\"text-surface-600! bg-surface-200!\"\n />\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <h2\n class=\"min-w-0 truncate text-base font-semibold text-color\"\n [title]=\"profile().displayName\"\n >\n {{ profile().displayName }}\n </h2>\n @if (profile().isExternal) {\n <mt-summary-pill tone=\"neutral\">\n <mt-icon icon=\"general.link-external-02\" class=\"text-xs\" />\n {{ t(\"external\") }}\n </mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"success\">\n <mt-icon icon=\"user.users-01\" class=\"text-xs\" />\n {{ t(\"internal\") }}\n </mt-summary-pill>\n }\n </div>\n\n @if (profile().userName) {\n <span\n class=\"inline-flex min-w-0 items-center gap-1 text-sm text-muted-color\"\n >\n <mt-icon icon=\"user.user-01\" class=\"shrink-0 text-sm\" />\n <span class=\"truncate\">{{ profile().userName }}</span>\n </span>\n }\n </div>\n </section>\n\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\n </div>\n\n <div class=\"p-4\">\n @if (loading()) {\n <div class=\"flex flex-col gap-3\">\n @for (row of [1, 2, 3, 4]; track row) {\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\n }\n </div>\n } @else if (error()) {\n <div\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\n role=\"alert\"\n >\n <div class=\"flex flex-col gap-1\">\n <span\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\n >\n {{ t(\"summary-load-failed\") }}\n </span>\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\n {{ t(\"summary-load-failed-hint\") }}\n </span>\n </div>\n <mt-button\n icon=\"arrow.refresh-cw-02\"\n severity=\"danger\"\n variant=\"outlined\"\n size=\"small\"\n [label]=\"t('try-again')\"\n (onClick)=\"load()\"\n />\n </div>\n } @else {\n @switch (activeTab()) {\n @case (\"groups\") {\n @if (groups().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-linked-groups')\"\n [description]=\"t('user-groups-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showGroupSearch()) {\n <mt-text-field\n [formControl]=\"groupSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-groups')\"\n />\n }\n <ul class=\"rounded-md border border-surface\">\n @for (group of filteredGroups(); track group.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-avatar\n icon=\"user.users-01\"\n shape=\"square\"\n styleClass=\"bg-primary-50! text-primary!\"\n />\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"group.name\"\n >\n {{ group.name }}\n </span>\n @if (group.description) {\n <span\n class=\"truncate text-xs text-muted-color\"\n [title]=\"group.description\"\n >\n {{ group.description }}\n </span>\n }\n </div>\n <span\n class=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-color\"\n >\n <mt-icon icon=\"user.user-01\" class=\"text-sm\" />\n {{ group.membersCount }}\n </span>\n @if (group.isActivated) {\n <mt-summary-pill tone=\"success\">\n {{ t(\"active\") }}\n </mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"neutral\">\n {{ t(\"inactive\") }}\n </mt-summary-pill>\n }\n </li>\n } @empty {\n <li>\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n </li>\n }\n </ul>\n </div>\n }\n }\n\n @case (\"roles\") {\n @if (roleTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-roles')\"\n [description]=\"t('user-roles-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"roleTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-roles')\"\n />\n }\n }\n\n @case (\"permissions\") {\n @if (permissionTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-permissions')\"\n [description]=\"t('user-permissions-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"permissionTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-permissions')\"\n />\n }\n }\n\n @case (\"accessibilities\") {\n <mt-summary-accessibilities\n [accessibilities]=\"accessibilities()\"\n [emptyMessage]=\"t('no-accessibilities')\"\n />\n }\n }\n }\n </div>\n </div>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: SummaryAccessibilities, selector: "mt-summary-accessibilities", inputs: ["accessibilities", "emptyMessage"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
|
|
1243
1498
|
}
|
|
1244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type:
|
|
1499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserAccessSummary, decorators: [{
|
|
1245
1500
|
type: Component,
|
|
1246
|
-
args: [{ selector: 'mt-user-
|
|
1247
|
-
CommonModule,
|
|
1501
|
+
args: [{ selector: 'mt-user-access-summary', standalone: true, host: { class: 'flex h-full min-h-0 flex-col' }, imports: [
|
|
1248
1502
|
TranslocoDirective,
|
|
1503
|
+
ReactiveFormsModule,
|
|
1249
1504
|
SkeletonModule,
|
|
1250
1505
|
Icon,
|
|
1251
1506
|
Tabs,
|
|
1252
1507
|
Tree,
|
|
1253
1508
|
Avatar,
|
|
1509
|
+
Button,
|
|
1510
|
+
TextField,
|
|
1511
|
+
EmptyState,
|
|
1254
1512
|
SecureImagePipe,
|
|
1255
|
-
|
|
1513
|
+
SummaryAccessibilities,
|
|
1514
|
+
SummaryPill,
|
|
1515
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <!-- Who this is \u2014 rendered from the table row, so it never waits on the request. -->\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\n <mt-avatar\n [image]=\"\n profile().image\n ? $any(profile().image | secureImage: true : context : 'avatar/')\n : ''\n \"\n icon=\"user.user-01\"\n size=\"large\"\n styleClass=\"text-surface-600! bg-surface-200!\"\n />\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <h2\n class=\"min-w-0 truncate text-base font-semibold text-color\"\n [title]=\"profile().displayName\"\n >\n {{ profile().displayName }}\n </h2>\n @if (profile().isExternal) {\n <mt-summary-pill tone=\"neutral\">\n <mt-icon icon=\"general.link-external-02\" class=\"text-xs\" />\n {{ t(\"external\") }}\n </mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"success\">\n <mt-icon icon=\"user.users-01\" class=\"text-xs\" />\n {{ t(\"internal\") }}\n </mt-summary-pill>\n }\n </div>\n\n @if (profile().userName) {\n <span\n class=\"inline-flex min-w-0 items-center gap-1 text-sm text-muted-color\"\n >\n <mt-icon icon=\"user.user-01\" class=\"shrink-0 text-sm\" />\n <span class=\"truncate\">{{ profile().userName }}</span>\n </span>\n }\n </div>\n </section>\n\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\n </div>\n\n <div class=\"p-4\">\n @if (loading()) {\n <div class=\"flex flex-col gap-3\">\n @for (row of [1, 2, 3, 4]; track row) {\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\n }\n </div>\n } @else if (error()) {\n <div\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\n role=\"alert\"\n >\n <div class=\"flex flex-col gap-1\">\n <span\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\n >\n {{ t(\"summary-load-failed\") }}\n </span>\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\n {{ t(\"summary-load-failed-hint\") }}\n </span>\n </div>\n <mt-button\n icon=\"arrow.refresh-cw-02\"\n severity=\"danger\"\n variant=\"outlined\"\n size=\"small\"\n [label]=\"t('try-again')\"\n (onClick)=\"load()\"\n />\n </div>\n } @else {\n @switch (activeTab()) {\n @case (\"groups\") {\n @if (groups().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-linked-groups')\"\n [description]=\"t('user-groups-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showGroupSearch()) {\n <mt-text-field\n [formControl]=\"groupSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-groups')\"\n />\n }\n <ul class=\"rounded-md border border-surface\">\n @for (group of filteredGroups(); track group.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-avatar\n icon=\"user.users-01\"\n shape=\"square\"\n styleClass=\"bg-primary-50! text-primary!\"\n />\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"group.name\"\n >\n {{ group.name }}\n </span>\n @if (group.description) {\n <span\n class=\"truncate text-xs text-muted-color\"\n [title]=\"group.description\"\n >\n {{ group.description }}\n </span>\n }\n </div>\n <span\n class=\"inline-flex shrink-0 items-center gap-1 text-xs text-muted-color\"\n >\n <mt-icon icon=\"user.user-01\" class=\"text-sm\" />\n {{ group.membersCount }}\n </span>\n @if (group.isActivated) {\n <mt-summary-pill tone=\"success\">\n {{ t(\"active\") }}\n </mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"neutral\">\n {{ t(\"inactive\") }}\n </mt-summary-pill>\n }\n </li>\n } @empty {\n <li>\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n </li>\n }\n </ul>\n </div>\n }\n }\n\n @case (\"roles\") {\n @if (roleTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-roles')\"\n [description]=\"t('user-roles-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"roleTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-roles')\"\n />\n }\n }\n\n @case (\"permissions\") {\n @if (permissionTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-permissions')\"\n [description]=\"t('user-permissions-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"permissionTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-permissions')\"\n />\n }\n }\n\n @case (\"accessibilities\") {\n <mt-summary-accessibilities\n [accessibilities]=\"accessibilities()\"\n [emptyMessage]=\"t('no-accessibilities')\"\n />\n }\n }\n }\n </div>\n </div>\n</ng-container>\n" }]
|
|
1256
1516
|
}], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
|
|
1257
1517
|
|
|
1258
1518
|
class Users {
|
|
1259
1519
|
typeCol = viewChild.required('typeCol');
|
|
1260
1520
|
applicationLinkCol = viewChild.required('applicationLinkCol');
|
|
1521
|
+
emailCol = viewChild.required('emailCol');
|
|
1261
1522
|
facade = inject(UsersGroupsFacade);
|
|
1262
1523
|
modal = inject(ModalService);
|
|
1263
1524
|
translocoService = inject(TranslocoService);
|
|
@@ -1316,11 +1577,11 @@ class Users {
|
|
|
1316
1577
|
linkingRowIds = signal([], ...(ngDevMode ? [{ debugName: "linkingRowIds" }] : /* istanbul ignore next */ []));
|
|
1317
1578
|
rowActions = signal([
|
|
1318
1579
|
{
|
|
1319
|
-
icon: 'general.
|
|
1580
|
+
icon: 'general.eye',
|
|
1320
1581
|
tooltip: this.translocoService.translate('users-groups.access-summary'),
|
|
1321
1582
|
color: 'secondary',
|
|
1322
1583
|
action: (row) => {
|
|
1323
|
-
this.
|
|
1584
|
+
this.openAccessSummary(row);
|
|
1324
1585
|
},
|
|
1325
1586
|
hidden: (row) => !this.isLinkedToCurrentApplication(row),
|
|
1326
1587
|
},
|
|
@@ -1424,8 +1685,16 @@ class Users {
|
|
|
1424
1685
|
},
|
|
1425
1686
|
},
|
|
1426
1687
|
{
|
|
1688
|
+
// The table lays out as `auto`: a long address would set the column's
|
|
1689
|
+
// minimum width, and the widest content also takes the largest share of
|
|
1690
|
+
// the spare width. The cell truncates at 16rem and the column is pinned
|
|
1691
|
+
// to that plus the cell's 2rem padding, so other columns keep the room.
|
|
1427
1692
|
key: 'email',
|
|
1428
1693
|
label: this.translocoService.translate('users-groups.email'),
|
|
1694
|
+
type: 'custom',
|
|
1695
|
+
customCellTpl: this.emailCol(),
|
|
1696
|
+
width: '18rem',
|
|
1697
|
+
exportable: true,
|
|
1429
1698
|
filterConfig: {
|
|
1430
1699
|
type: 'text',
|
|
1431
1700
|
label: this.translocoService.translate('users-groups.email'),
|
|
@@ -1510,10 +1779,12 @@ class Users {
|
|
|
1510
1779
|
},
|
|
1511
1780
|
});
|
|
1512
1781
|
}
|
|
1513
|
-
|
|
1514
|
-
this.modal.openModal(
|
|
1515
|
-
header: this.translocoService.translate('users-groups.summary'),
|
|
1516
|
-
styleClass:
|
|
1782
|
+
openAccessSummary(user) {
|
|
1783
|
+
this.modal.openModal(UserAccessSummary, 'drawer', {
|
|
1784
|
+
header: this.translocoService.translate('users-groups.access-summary'),
|
|
1785
|
+
styleClass: ACCESS_SUMMARY_DRAWER_CLASS,
|
|
1786
|
+
position: 'end',
|
|
1787
|
+
appendTo: 'page-content',
|
|
1517
1788
|
dismissableMask: true,
|
|
1518
1789
|
dismissible: true,
|
|
1519
1790
|
inputValues: {
|
|
@@ -1522,12 +1793,49 @@ class Users {
|
|
|
1522
1793
|
});
|
|
1523
1794
|
}
|
|
1524
1795
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1525
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Users, isStandalone: true, selector: "mt-users", viewQueries: [{ propertyName: "typeCol", first: true, predicate: ["typeCol"], descendants: true, isSignal: true }, { propertyName: "applicationLinkCol", first: true, predicate: ["applicationLinkCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\
|
|
1796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Users, isStandalone: true, selector: "mt-users", viewQueries: [{ propertyName: "typeCol", first: true, predicate: ["typeCol"], descendants: true, isSignal: true }, { propertyName: "applicationLinkCol", first: true, predicate: ["applicationLinkCol"], descendants: true, isSignal: true }, { propertyName: "emailCol", first: true, predicate: ["emailCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <div class=\"mt-5\">\n <ng-template #typeCol let-row>\n @if (row.isExternal) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\n >\n <mt-icon\n icon=\"general.link-external-02\"\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\n />\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\n {{ t(\"external\") }}\n </span>\n </span>\n } @else {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\n >\n <mt-icon\n icon=\"user.users-01\"\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\n />\n <span\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\n >\n {{ t(\"internal\") }}\n </span>\n </span>\n }\n </ng-template>\n\n <ng-template #applicationLinkCol let-row>\n @if (isLinkedToCurrentApplication(row)) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\n >\n <mt-icon\n icon=\"user.user-check-01\"\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\n />\n <span\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\n >\n {{ t(\"linked\") }}\n </span>\n </span>\n } @else {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\n >\n <mt-icon\n icon=\"general.link-broken-01\"\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\n />\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\n {{ t(\"not-linked\") }}\n </span>\n </span>\n }\n </ng-template>\n\n <ng-template #emailCol let-row>\n <span\n class=\"block max-w-64 truncate\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >{{ row.email }}</span\n >\n </ng-template>\n\n <mt-table\n [tabs]=\"tabs()\"\n [(activeTab)]=\"activeTab\"\n [data]=\"users()\"\n [columns]=\"tableColumns()\"\n [actions]=\"tableActions()\"\n [rowActions]=\"rowActions()\"\n [generalSearch]=\"true\"\n [showFilters]=\"false\"\n [loading]=\"loading()\"\n storageKey=\"users-groups-users-table\"\n >\n </mt-table>\n </div>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }] });
|
|
1526
1797
|
}
|
|
1527
1798
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, decorators: [{
|
|
1528
1799
|
type: Component,
|
|
1529
|
-
args: [{ selector: 'mt-users', standalone: true, imports: [
|
|
1530
|
-
|
|
1800
|
+
args: [{ selector: 'mt-users', standalone: true, imports: [
|
|
1801
|
+
CommonModule,
|
|
1802
|
+
SkeletonModule,
|
|
1803
|
+
Table,
|
|
1804
|
+
Icon,
|
|
1805
|
+
TranslocoDirective,
|
|
1806
|
+
TruncateTooltip,
|
|
1807
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <div class=\"mt-5\">\n <ng-template #typeCol let-row>\n @if (row.isExternal) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\n >\n <mt-icon\n icon=\"general.link-external-02\"\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\n />\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\n {{ t(\"external\") }}\n </span>\n </span>\n } @else {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\n >\n <mt-icon\n icon=\"user.users-01\"\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\n />\n <span\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\n >\n {{ t(\"internal\") }}\n </span>\n </span>\n }\n </ng-template>\n\n <ng-template #applicationLinkCol let-row>\n @if (isLinkedToCurrentApplication(row)) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\n >\n <mt-icon\n icon=\"user.user-check-01\"\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\n />\n <span\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\n >\n {{ t(\"linked\") }}\n </span>\n </span>\n } @else {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\n >\n <mt-icon\n icon=\"general.link-broken-01\"\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\n />\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\n {{ t(\"not-linked\") }}\n </span>\n </span>\n }\n </ng-template>\n\n <ng-template #emailCol let-row>\n <span\n class=\"block max-w-64 truncate\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >{{ row.email }}</span\n >\n </ng-template>\n\n <mt-table\n [tabs]=\"tabs()\"\n [(activeTab)]=\"activeTab\"\n [data]=\"users()\"\n [columns]=\"tableColumns()\"\n [actions]=\"tableActions()\"\n [rowActions]=\"rowActions()\"\n [generalSearch]=\"true\"\n [showFilters]=\"false\"\n [loading]=\"loading()\"\n storageKey=\"users-groups-users-table\"\n >\n </mt-table>\n </div>\n</ng-container>\n" }]
|
|
1808
|
+
}], propDecorators: { typeCol: [{ type: i0.ViewChild, args: ['typeCol', { isSignal: true }] }], applicationLinkCol: [{ type: i0.ViewChild, args: ['applicationLinkCol', { isSignal: true }] }], emailCol: [{ type: i0.ViewChild, args: ['emailCol', { isSignal: true }] }] } });
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* A group's description is a single string on the wire: the backend changed it
|
|
1812
|
+
* from a translatable object to `string` (Pplus5.BE `4abe2647`, Jan 2026) and
|
|
1813
|
+
* returns it untouched. Both languages therefore travel JSON-encoded inside
|
|
1814
|
+
* that string — `{"ar":"…","en":"…"}`, the shape the seeded Administrators
|
|
1815
|
+
* group already uses. Groups saved before this hold plain text.
|
|
1816
|
+
*/
|
|
1817
|
+
function parseGroupDescription(value) {
|
|
1818
|
+
const text = value ?? '';
|
|
1819
|
+
const trimmed = text.trim();
|
|
1820
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
1821
|
+
try {
|
|
1822
|
+
const parsed = JSON.parse(trimmed);
|
|
1823
|
+
return { en: parsed.en ?? '', ar: parsed.ar ?? '' };
|
|
1824
|
+
}
|
|
1825
|
+
catch {
|
|
1826
|
+
// Plain text that happens to be wrapped in braces.
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
// Plain text has no language of its own; showing it in both fields keeps it
|
|
1830
|
+
// visible whichever language the user reads the group in.
|
|
1831
|
+
return { en: text, ar: text };
|
|
1832
|
+
}
|
|
1833
|
+
/** Both languages empty → `""`, the backend's own default for no description. */
|
|
1834
|
+
function serializeGroupDescription(description) {
|
|
1835
|
+
const en = description?.en?.trim() ?? '';
|
|
1836
|
+
const ar = description?.ar?.trim() ?? '';
|
|
1837
|
+
return en || ar ? JSON.stringify({ ar, en }) : '';
|
|
1838
|
+
}
|
|
1531
1839
|
|
|
1532
1840
|
class GroupForm {
|
|
1533
1841
|
modal = inject(ModalService);
|
|
@@ -1569,9 +1877,15 @@ class GroupForm {
|
|
|
1569
1877
|
order: 1,
|
|
1570
1878
|
},
|
|
1571
1879
|
new TextareaFieldConfig({
|
|
1572
|
-
key: 'description',
|
|
1573
|
-
label: this.translocoService.translate('users-groups.description'),
|
|
1574
|
-
placeholder: this.translocoService.translate('users-groups.description'),
|
|
1880
|
+
key: 'description.en',
|
|
1881
|
+
label: this.translocoService.translate('users-groups.description-en'),
|
|
1882
|
+
placeholder: this.translocoService.translate('users-groups.description-en'),
|
|
1883
|
+
order: 3,
|
|
1884
|
+
}),
|
|
1885
|
+
new TextareaFieldConfig({
|
|
1886
|
+
key: 'description.ar',
|
|
1887
|
+
label: this.translocoService.translate('users-groups.description-ar'),
|
|
1888
|
+
placeholder: this.translocoService.translate('users-groups.description-ar'),
|
|
1575
1889
|
order: 3,
|
|
1576
1890
|
}),
|
|
1577
1891
|
],
|
|
@@ -1642,8 +1956,12 @@ class GroupForm {
|
|
|
1642
1956
|
ngOnInit() {
|
|
1643
1957
|
if (this.groupForEdit()?.id) {
|
|
1644
1958
|
this.facade.getGroup(this.groupForEdit()?.id || null).subscribe((_) => {
|
|
1645
|
-
|
|
1646
|
-
|
|
1959
|
+
const group = this.selectedGroup();
|
|
1960
|
+
if (group) {
|
|
1961
|
+
this.groupFormControl.patchValue({
|
|
1962
|
+
...group,
|
|
1963
|
+
description: parseGroupDescription(group.description),
|
|
1964
|
+
});
|
|
1647
1965
|
}
|
|
1648
1966
|
});
|
|
1649
1967
|
}
|
|
@@ -1662,7 +1980,7 @@ class GroupForm {
|
|
|
1662
1980
|
const payload = {
|
|
1663
1981
|
name: this.groupFormControl.value?.name,
|
|
1664
1982
|
workspace: this.groupFormControl.value?.workspace,
|
|
1665
|
-
description: this.groupFormControl.value?.description,
|
|
1983
|
+
description: serializeGroupDescription(this.groupFormControl.value?.description),
|
|
1666
1984
|
};
|
|
1667
1985
|
this.facade.updateGroup(this.groupForEdit()?.id, payload).subscribe({
|
|
1668
1986
|
next: () => {
|
|
@@ -1677,7 +1995,7 @@ class GroupForm {
|
|
|
1677
1995
|
const payload = {
|
|
1678
1996
|
name: this.groupFormControl.value?.name,
|
|
1679
1997
|
workspace: this.groupFormControl.value?.workspace,
|
|
1680
|
-
description: this.groupFormControl.value?.description,
|
|
1998
|
+
description: serializeGroupDescription(this.groupFormControl.value?.description),
|
|
1681
1999
|
};
|
|
1682
2000
|
this.facade.createGroup(payload).subscribe({
|
|
1683
2001
|
next: () => {
|
|
@@ -1700,7 +2018,7 @@ class GroupForm {
|
|
|
1700
2018
|
}
|
|
1701
2019
|
}
|
|
1702
2020
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1703
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupForm, isStandalone: true, selector: "mt-group-form", inputs: { groupForEdit: { classPropertyName: "groupForEdit", publicName: "groupForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], viewQueries: [{ propertyName: "userCol", first: true, predicate: ["userCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
2021
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupForm, isStandalone: true, selector: "mt-group-form", inputs: { groupForEdit: { classPropertyName: "groupForEdit", publicName: "groupForEdit", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DialogService], viewQueries: [{ propertyName: "userCol", first: true, predicate: ["userCol"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "forcedDisabledFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys", "externalValues", "serverFieldErrors"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
1704
2022
|
}
|
|
1705
2023
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupForm, decorators: [{
|
|
1706
2024
|
type: Component,
|
|
@@ -1717,6 +2035,283 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1717
2035
|
], providers: [DialogService], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div [class]=\"'flex flex-col gap-1 p-4 ' + modal.contentClass\">\r\n @if (!getGroupFormLoading()) {\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"groupFormConfig()\"\r\n [formControl]=\"groupFormControl\"\r\n />\r\n </form>\r\n\r\n @if (groupForEdit()) {\r\n <div class=\"flex gap-3 items-end mt-6 pt-4 border-t-1 border-surface\">\r\n <mt-dynamic-form\r\n class=\"flex-1\"\r\n [formConfig]=\"internalUserFormConfig()\"\r\n [formControl]=\"internalUserFormControl\"\r\n />\r\n <mt-button\r\n icon=\"general.plus\"\r\n class=\"mb-1\"\r\n variant=\"outlined\"\r\n (click)=\"onAddUser()\"\r\n [disabled]=\"\r\n addUserToGroupLoading() ||\r\n isUserExistInMembers() ||\r\n !internalUserFormControl.value?.userField\r\n \"\r\n />\r\n </div>\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"selectedGroup()?.members || []\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n storageKey=\"users-groups-group-members-table\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [loading]=\"addUserToGroupLoading()\"\r\n >\r\n </mt-table>\r\n <ng-template #userCol let-row>\r\n <div class=\"flex items-center gap-2\">\r\n <mt-avatar [icon]=\"'custom.user-pp'\"> </mt-avatar>\r\n {{ row?.displayName }}\r\n </div>\r\n </ng-template>\r\n }\r\n } @else {\r\n <p-skeleton class=\"my-4 mt-7\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n <p-skeleton class=\"my-4\" height=\"3rem\" />\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n variant=\"outlined\"\r\n [disabled]=\"createUpdateGroupLoading()\"\r\n (click)=\"ref.close(false)\"\r\n />\r\n <mt-button\r\n [label]=\"selectedGroup() ? ('save' | transloco) : ('add' | transloco)\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateGroupLoading()\"\r\n [disabled]=\"!this.groupFormControl.valid || createUpdateGroupLoading()\"\r\n />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
1718
2036
|
}], ctorParameters: () => [], propDecorators: { groupForEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupForEdit", required: false }] }], userCol: [{ type: i0.ViewChild, args: ['userCol', { isSignal: true }] }] } });
|
|
1719
2037
|
|
|
2038
|
+
/** Search appears once the list is long enough to need it. */
|
|
2039
|
+
const SEARCH_THRESHOLD = 6;
|
|
2040
|
+
/**
|
|
2041
|
+
* Usage categories the backend emits today, in display order. Anything else
|
|
2042
|
+
* is rendered under its own humanized name after these — the contract says
|
|
2043
|
+
* new values arrive without notice.
|
|
2044
|
+
*/
|
|
2045
|
+
const USAGE_CATEGORIES = {
|
|
2046
|
+
Approval: { key: 'approval', icon: 'general.check-verified-01' },
|
|
2047
|
+
Escalation: { key: 'escalation', icon: 'arrow.chevron-up-double' },
|
|
2048
|
+
Notification: { key: 'notification', icon: 'alert.bell-01' },
|
|
2049
|
+
Visibility: { key: 'visibility', icon: 'general.eye' },
|
|
2050
|
+
Navigation: { key: 'navigation', icon: 'map.route' },
|
|
2051
|
+
Workspace: { key: 'workspace', icon: 'layout.layout-grid-01' },
|
|
2052
|
+
AccessControl: { key: 'access-control', icon: 'security.lock-01' },
|
|
2053
|
+
Uncategorized: { key: 'uncategorized', icon: 'layout.layers-three-01' },
|
|
2054
|
+
};
|
|
2055
|
+
const CATEGORY_ORDER = Object.keys(USAGE_CATEGORIES);
|
|
2056
|
+
const USAGE_SOURCES = {
|
|
2057
|
+
ProcessSchema: 'process-schema',
|
|
2058
|
+
EscalationSchema: 'escalation-schema',
|
|
2059
|
+
AlertDefinition: 'alert-definition',
|
|
2060
|
+
NotificationTemplate: 'notification-template',
|
|
2061
|
+
Category: 'category',
|
|
2062
|
+
NavigationItem: 'navigation-item',
|
|
2063
|
+
WorkspaceBuilder: 'workspace-builder',
|
|
2064
|
+
Accessibility: 'accessibility',
|
|
2065
|
+
};
|
|
2066
|
+
const NOTIFICATION_CHANNELS = new Set(['app', 'email', 'sms']);
|
|
2067
|
+
const WARNING_CODES = {
|
|
2068
|
+
NoEffectiveUsers: 'no-effective-users',
|
|
2069
|
+
ScopeUnresolved: 'scope-unresolved',
|
|
2070
|
+
NoNotificationChannels: 'no-notification-channels',
|
|
2071
|
+
};
|
|
2072
|
+
/**
|
|
2073
|
+
* Lifecycle flags carried in `metadata` as `"True"`/`"False"` strings. A
|
|
2074
|
+
* `"False"` value means the referencing definition is not live, which the row
|
|
2075
|
+
* shows instead of implying the reference is in effect.
|
|
2076
|
+
*/
|
|
2077
|
+
const INACTIVE_METADATA_FLAGS = {
|
|
2078
|
+
isPublished: 'unpublished',
|
|
2079
|
+
isEnabled: 'disabled',
|
|
2080
|
+
isActive: 'inactive',
|
|
2081
|
+
isVisible: 'hidden',
|
|
2082
|
+
};
|
|
2083
|
+
const IMPACT_KEYS = [
|
|
2084
|
+
'activeRequestsCount',
|
|
2085
|
+
'pendingStepsCount',
|
|
2086
|
+
'activeEscalationsCount',
|
|
2087
|
+
'pendingEscalationStepsCount',
|
|
2088
|
+
'activeAlertStatesCount',
|
|
2089
|
+
];
|
|
2090
|
+
/**
|
|
2091
|
+
* One group's access, opened as a drawer from the groups table: its members,
|
|
2092
|
+
* the permissions assigned to it, its application accessibilities, and the
|
|
2093
|
+
* configuration that references it. `GET identity/groups/{groupId}/summary`
|
|
2094
|
+
* (Pplus5.BE `Docs/Group-Access-Summary-Frontend-Contract.md`).
|
|
2095
|
+
*/
|
|
2096
|
+
class GroupAccessSummary {
|
|
2097
|
+
facade = inject(UsersGroupsFacade);
|
|
2098
|
+
translocoService = inject(TranslocoService);
|
|
2099
|
+
/** The groups-table row; renders the header before the summary arrives. */
|
|
2100
|
+
group = input(null, ...(ngDevMode ? [{ debugName: "group" }] : /* istanbul ignore next */ []));
|
|
2101
|
+
context = new HttpContext().set(REQUEST_CONTEXT, {
|
|
2102
|
+
useBaseUrl: true,
|
|
2103
|
+
});
|
|
2104
|
+
loading = this.facade.isLoadingGroupSummary;
|
|
2105
|
+
error = this.facade.groupSummaryError;
|
|
2106
|
+
summary = this.facade.groupSummary;
|
|
2107
|
+
lang = toSignal(this.translocoService.langChanges$, {
|
|
2108
|
+
initialValue: this.translocoService.getActiveLang(),
|
|
2109
|
+
});
|
|
2110
|
+
activeTab = signal('members', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
2111
|
+
memberSearch = new FormControl('', { nonNullable: true });
|
|
2112
|
+
memberSearchTerm = toSignal(this.memberSearch.valueChanges, {
|
|
2113
|
+
initialValue: '',
|
|
2114
|
+
});
|
|
2115
|
+
usageSearch = new FormControl('', { nonNullable: true });
|
|
2116
|
+
usageSearchTerm = toSignal(this.usageSearch.valueChanges, {
|
|
2117
|
+
initialValue: '',
|
|
2118
|
+
});
|
|
2119
|
+
header = computed(() => {
|
|
2120
|
+
const lang = this.lang();
|
|
2121
|
+
const group = this.summary()?.group ?? this.group();
|
|
2122
|
+
return {
|
|
2123
|
+
name: resolveTranslated(group?.name, lang),
|
|
2124
|
+
description: resolveTranslated(group?.description, lang),
|
|
2125
|
+
isActivated: !!group?.isActivated,
|
|
2126
|
+
};
|
|
2127
|
+
}, ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
|
|
2128
|
+
members = computed(() => {
|
|
2129
|
+
this.lang();
|
|
2130
|
+
return (this.summary()?.members ?? []).map((member) => {
|
|
2131
|
+
const flags = [];
|
|
2132
|
+
if (member.isDeleted) {
|
|
2133
|
+
flags.push({ label: this.t('member-deleted'), tone: 'danger' });
|
|
2134
|
+
}
|
|
2135
|
+
else if (member.isActive === false) {
|
|
2136
|
+
flags.push({ label: this.t('inactive'), tone: 'neutral' });
|
|
2137
|
+
}
|
|
2138
|
+
if (!member.isLinkedToCurrentApplication) {
|
|
2139
|
+
flags.push({ label: this.t('not-linked'), tone: 'warn' });
|
|
2140
|
+
}
|
|
2141
|
+
return {
|
|
2142
|
+
id: member.id,
|
|
2143
|
+
displayName: member.displayName || member.fullName || member.userName || '',
|
|
2144
|
+
userName: member.userName ?? '',
|
|
2145
|
+
email: member.email ?? '',
|
|
2146
|
+
photo: member.photoUrl ?? '',
|
|
2147
|
+
flags,
|
|
2148
|
+
};
|
|
2149
|
+
});
|
|
2150
|
+
}, ...(ngDevMode ? [{ debugName: "members" }] : /* istanbul ignore next */ []));
|
|
2151
|
+
filteredMembers = computed(() => {
|
|
2152
|
+
const term = this.memberSearchTerm();
|
|
2153
|
+
return this.members().filter((member) => matchesSearch(term, member.displayName, member.userName, member.email));
|
|
2154
|
+
}, ...(ngDevMode ? [{ debugName: "filteredMembers" }] : /* istanbul ignore next */ []));
|
|
2155
|
+
showMemberSearch = computed(() => this.members().length > SEARCH_THRESHOLD, ...(ngDevMode ? [{ debugName: "showMemberSearch" }] : /* istanbul ignore next */ []));
|
|
2156
|
+
permissionTree = computed(() => buildPermissionTree(this.summary()?.permissions ?? [], this.lang(), {
|
|
2157
|
+
otherModules: this.t('other-modules'),
|
|
2158
|
+
unknownScope: this.t('unknown-scope'),
|
|
2159
|
+
}), ...(ngDevMode ? [{ debugName: "permissionTree" }] : /* istanbul ignore next */ []));
|
|
2160
|
+
accessibilities = computed(() => this.summary()?.accessibilities ?? [], ...(ngDevMode ? [{ debugName: "accessibilities" }] : /* istanbul ignore next */ []));
|
|
2161
|
+
usageCategories = computed(() => {
|
|
2162
|
+
const lang = this.lang();
|
|
2163
|
+
const categories = new Map();
|
|
2164
|
+
(this.summary()?.usageSummary?.items ?? []).forEach((usage, index) => {
|
|
2165
|
+
const key = usage.usageCategory || 'Uncategorized';
|
|
2166
|
+
let category = categories.get(key);
|
|
2167
|
+
if (!category) {
|
|
2168
|
+
const known = USAGE_CATEGORIES[key];
|
|
2169
|
+
category = {
|
|
2170
|
+
key,
|
|
2171
|
+
label: known ? this.t(`usage-category.${known.key}`) : humanize(key),
|
|
2172
|
+
icon: known?.icon ?? 'layout.layers-three-01',
|
|
2173
|
+
items: [],
|
|
2174
|
+
};
|
|
2175
|
+
categories.set(key, category);
|
|
2176
|
+
}
|
|
2177
|
+
category.items.push(this.toUsageView(usage, index, lang));
|
|
2178
|
+
});
|
|
2179
|
+
return [...categories.values()].sort((a, b) => categoryRank(a.key) - categoryRank(b.key));
|
|
2180
|
+
}, ...(ngDevMode ? [{ debugName: "usageCategories" }] : /* istanbul ignore next */ []));
|
|
2181
|
+
filteredUsageCategories = computed(() => {
|
|
2182
|
+
const term = this.usageSearchTerm();
|
|
2183
|
+
if (!term.trim())
|
|
2184
|
+
return this.usageCategories();
|
|
2185
|
+
return this.usageCategories()
|
|
2186
|
+
.map((category) => ({
|
|
2187
|
+
...category,
|
|
2188
|
+
items: category.items.filter((usage) => matchesSearch(term, usage.title, usage.stepName, usage.scopeLabel, usage.sourceLabel, category.label)),
|
|
2189
|
+
}))
|
|
2190
|
+
.filter((category) => category.items.length > 0);
|
|
2191
|
+
}, ...(ngDevMode ? [{ debugName: "filteredUsageCategories" }] : /* istanbul ignore next */ []));
|
|
2192
|
+
usageCount = computed(() => this.summary()?.usageSummary?.items?.length ?? 0, ...(ngDevMode ? [{ debugName: "usageCount" }] : /* istanbul ignore next */ []));
|
|
2193
|
+
showUsageSearch = computed(() => this.usageCount() > SEARCH_THRESHOLD, ...(ngDevMode ? [{ debugName: "showUsageSearch" }] : /* istanbul ignore next */ []));
|
|
2194
|
+
/** Configuration references that make deleting/disabling the group risky. */
|
|
2195
|
+
blockingCount = computed(() => this.summary()?.usageSummary?.blockingUsagesCount ?? 0, ...(ngDevMode ? [{ debugName: "blockingCount" }] : /* istanbul ignore next */ []));
|
|
2196
|
+
impactTiles = computed(() => {
|
|
2197
|
+
this.lang();
|
|
2198
|
+
const impact = this.summary()?.usageSummary?.runtimeImpact;
|
|
2199
|
+
if (!impact)
|
|
2200
|
+
return [];
|
|
2201
|
+
const tiles = IMPACT_KEYS.map((key) => ({
|
|
2202
|
+
key,
|
|
2203
|
+
label: this.t(`impact.${key}`),
|
|
2204
|
+
value: impact[key],
|
|
2205
|
+
}));
|
|
2206
|
+
return tiles.some((tile) => tile.value > 0) ? tiles : [];
|
|
2207
|
+
}, ...(ngDevMode ? [{ debugName: "impactTiles" }] : /* istanbul ignore next */ []));
|
|
2208
|
+
tabs = computed(() => {
|
|
2209
|
+
this.lang();
|
|
2210
|
+
const summary = this.summary();
|
|
2211
|
+
const count = (value) => (summary ? value : null);
|
|
2212
|
+
return [
|
|
2213
|
+
{
|
|
2214
|
+
label: this.t('members'),
|
|
2215
|
+
value: 'members',
|
|
2216
|
+
icon: 'user.users-01',
|
|
2217
|
+
badge: count(this.members().length),
|
|
2218
|
+
},
|
|
2219
|
+
{
|
|
2220
|
+
label: this.t('permissions'),
|
|
2221
|
+
value: 'permissions',
|
|
2222
|
+
icon: 'security.shield-tick',
|
|
2223
|
+
badge: count(summary?.permissions?.length ?? 0),
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
label: this.t('accessibilities'),
|
|
2227
|
+
value: 'accessibilities',
|
|
2228
|
+
icon: 'security.lock-unlocked-01',
|
|
2229
|
+
badge: count(this.accessibilities().length),
|
|
2230
|
+
},
|
|
2231
|
+
{
|
|
2232
|
+
label: this.t('usages'),
|
|
2233
|
+
value: 'usages',
|
|
2234
|
+
icon: 'layout.layers-three-01',
|
|
2235
|
+
badge: count(this.usageCount()),
|
|
2236
|
+
},
|
|
2237
|
+
];
|
|
2238
|
+
}, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
2239
|
+
ngOnInit() {
|
|
2240
|
+
this.load();
|
|
2241
|
+
}
|
|
2242
|
+
load() {
|
|
2243
|
+
const groupId = this.group()?.id;
|
|
2244
|
+
if (groupId === undefined || groupId === null)
|
|
2245
|
+
return;
|
|
2246
|
+
// The failure is rendered from the store's error slice.
|
|
2247
|
+
this.facade.getGroupSummary(groupId).subscribe({ error: () => undefined });
|
|
2248
|
+
}
|
|
2249
|
+
toUsageView(usage, index, lang) {
|
|
2250
|
+
const sourceKey = USAGE_SOURCES[usage.source];
|
|
2251
|
+
const scopes = [usage.scope, ...(usage.relatedScopes ?? [])].filter((scope) => !!scope);
|
|
2252
|
+
return {
|
|
2253
|
+
id: `${usage.source}-${usage.usageType}-${usage.sourceId}-${usage.stepId}-${index}`,
|
|
2254
|
+
title: resolveTranslated(usage.sourceName, lang) ||
|
|
2255
|
+
(usage.sourceId !== null ? `#${usage.sourceId}` : ''),
|
|
2256
|
+
sourceLabel: sourceKey
|
|
2257
|
+
? this.t(`usage-source.${sourceKey}`)
|
|
2258
|
+
: humanize(usage.source),
|
|
2259
|
+
stepName: resolveTranslated(usage.stepName, lang),
|
|
2260
|
+
scopeLabel: [...new Set(scopes.map((scope) => scopeLabel(scope, lang)))]
|
|
2261
|
+
.filter(Boolean)
|
|
2262
|
+
.join(', '),
|
|
2263
|
+
channels: (usage.channels ?? []).map((channel) => NOTIFICATION_CHANNELS.has(channel)
|
|
2264
|
+
? this.t(`channel.${channel}`)
|
|
2265
|
+
: channel),
|
|
2266
|
+
states: Object.entries(INACTIVE_METADATA_FLAGS)
|
|
2267
|
+
.filter(([flag]) => usage.metadata?.[flag]?.toLowerCase() === 'false')
|
|
2268
|
+
.map(([, key]) => this.t(`usage-state.${key}`)),
|
|
2269
|
+
warnings: (usage.warnings ?? []).map((warning) => WARNING_CODES[warning.code]
|
|
2270
|
+
? this.t(`usage-warning.${WARNING_CODES[warning.code]}`)
|
|
2271
|
+
: warning.message),
|
|
2272
|
+
impact: IMPACT_KEYS.filter((key) => (usage.runtimeImpact?.[key] ?? 0) > 0).map((key) => `${usage.runtimeImpact[key]} ${this.t(`impact.${key}`)}`),
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
t(key) {
|
|
2276
|
+
return this.translocoService.translate(`users-groups.${key}`);
|
|
2277
|
+
}
|
|
2278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupAccessSummary, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2279
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: GroupAccessSummary, isStandalone: true, selector: "mt-group-access-summary", inputs: { group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex h-full min-h-0 flex-col" }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <!-- Which group \u2014 rendered from the table row, so it never waits on the request. -->\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\n <mt-avatar\n icon=\"user.users-01\"\n size=\"large\"\n shape=\"square\"\n styleClass=\"bg-primary-50! text-primary!\"\n />\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <h2\n class=\"min-w-0 truncate text-base font-semibold text-color\"\n [title]=\"header().name\"\n >\n {{ header().name }}\n </h2>\n @if (header().isActivated) {\n <mt-summary-pill tone=\"success\">{{ t(\"active\") }}</mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"neutral\">{{\n t(\"inactive\")\n }}</mt-summary-pill>\n }\n </div>\n\n @if (header().description) {\n <p\n class=\"line-clamp-2 text-sm text-muted-color\"\n [title]=\"header().description\"\n >\n {{ header().description }}\n </p>\n }\n </div>\n </section>\n\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\n </div>\n\n <div class=\"p-4\">\n @if (loading()) {\n <div class=\"flex flex-col gap-3\">\n @for (row of [1, 2, 3, 4]; track row) {\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\n }\n </div>\n } @else if (error()) {\n <div\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\n role=\"alert\"\n >\n <div class=\"flex flex-col gap-1\">\n <span\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\n >\n {{ t(\"summary-load-failed\") }}\n </span>\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\n {{ t(\"summary-load-failed-hint\") }}\n </span>\n </div>\n <mt-button\n icon=\"arrow.refresh-cw-02\"\n severity=\"danger\"\n variant=\"outlined\"\n size=\"small\"\n [label]=\"t('try-again')\"\n (onClick)=\"load()\"\n />\n </div>\n } @else {\n @switch (activeTab()) {\n @case (\"members\") {\n @if (members().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-members')\"\n [description]=\"t('group-members-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showMemberSearch()) {\n <mt-text-field\n [formControl]=\"memberSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-members')\"\n />\n }\n <ul class=\"rounded-md border border-surface\">\n @for (member of filteredMembers(); track member.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-avatar\n [image]=\"\n member.photo\n ? $any(\n member.photo\n | secureImage: true : context : 'avatar/'\n )\n : ''\n \"\n icon=\"user.user-01\"\n styleClass=\"text-surface-600! bg-surface-200!\"\n />\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"member.displayName\"\n >\n {{ member.displayName }}\n </span>\n @if (member.email || member.userName) {\n <span\n class=\"truncate text-xs text-muted-color\"\n [title]=\"member.email || member.userName\"\n >\n {{ member.email || member.userName }}\n </span>\n }\n </div>\n @for (flag of member.flags; track flag.label) {\n <mt-summary-pill [tone]=\"flag.tone\">\n {{ flag.label }}\n </mt-summary-pill>\n }\n </li>\n } @empty {\n <li>\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n </li>\n }\n </ul>\n </div>\n }\n }\n\n @case (\"permissions\") {\n @if (permissionTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('group-no-permissions')\"\n [description]=\"t('group-permissions-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"permissionTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-permissions')\"\n />\n }\n }\n\n @case (\"accessibilities\") {\n <mt-summary-accessibilities\n [accessibilities]=\"accessibilities()\"\n [emptyMessage]=\"t('group-no-accessibilities')\"\n />\n }\n\n @case (\"usages\") {\n @if (usageCount() === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-usages')\"\n [description]=\"t('usages-coverage')\"\n />\n } @else {\n <div class=\"flex flex-col gap-4\">\n @if (blockingCount() > 0) {\n <div\n class=\"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200\"\n role=\"status\"\n >\n <mt-icon\n icon=\"alert.alert-triangle\"\n class=\"mt-0.5 shrink-0 text-base\"\n />\n <span>\n {{\n t(\"usages-blocking-note\", { count: blockingCount() })\n }}\n </span>\n </div>\n }\n\n @if (impactTiles().length) {\n <section class=\"flex flex-col gap-2\">\n <div class=\"flex flex-col\">\n <span class=\"text-sm font-semibold text-color\">\n {{ t(\"runtime-impact\") }}\n </span>\n <span class=\"text-xs text-muted-color\">\n {{ t(\"runtime-impact-hint\") }}\n </span>\n </div>\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\n @for (tile of impactTiles(); track tile.key) {\n <div\n class=\"flex flex-col gap-0.5 rounded-md border border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\n >\n <span\n class=\"text-lg font-semibold text-color tabular-nums\"\n >\n {{ tile.value }}\n </span>\n <span class=\"text-xs text-muted-color\">\n {{ tile.label }}\n </span>\n </div>\n }\n </div>\n </section>\n }\n\n @if (showUsageSearch()) {\n <mt-text-field\n [formControl]=\"usageSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-usages')\"\n />\n }\n\n @for (\n category of filteredUsageCategories();\n track category.key\n ) {\n <section class=\"rounded-md border border-surface\">\n <header\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\n >\n <span\n class=\"inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-color\"\n >\n <mt-icon\n [icon]=\"category.icon\"\n class=\"shrink-0 text-base text-primary\"\n />\n <span class=\"truncate\">{{ category.label }}</span>\n </span>\n <span class=\"shrink-0 text-xs text-muted-color\">\n {{ category.items.length }}\n </span>\n </header>\n\n <ul>\n @for (usage of category.items; track usage.id) {\n <li\n class=\"flex flex-col gap-1.5 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <div class=\"flex min-w-0 items-start gap-2\">\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"usage.title\"\n >\n {{ usage.title }}\n </span>\n <span class=\"truncate text-xs text-muted-color\">\n {{ usage.sourceLabel }}\n @if (usage.stepName) {\n \u00B7 {{ t(\"step\") }}: {{ usage.stepName }}\n }\n </span>\n </div>\n @for (state of usage.states; track state) {\n <mt-summary-pill tone=\"warn\">\n {{ state }}\n </mt-summary-pill>\n }\n </div>\n\n @if (usage.scopeLabel || usage.channels.length) {\n <div class=\"flex flex-wrap items-center gap-1.5\">\n @if (usage.scopeLabel) {\n <span\n class=\"inline-flex min-w-0 items-center gap-1 text-xs text-muted-color\"\n >\n <mt-icon\n icon=\"custom.hierarchy-structure\"\n class=\"shrink-0 text-sm\"\n />\n <span\n class=\"truncate\"\n [title]=\"usage.scopeLabel\"\n >\n {{ usage.scopeLabel }}\n </span>\n </span>\n }\n @for (channel of usage.channels; track channel) {\n <mt-summary-pill tone=\"info\">\n {{ channel }}\n </mt-summary-pill>\n }\n </div>\n }\n\n @if (usage.impact.length) {\n <span class=\"text-xs text-muted-color\">\n {{ usage.impact.join(\" \u00B7 \") }}\n </span>\n }\n\n @for (warning of usage.warnings; track $index) {\n <span\n class=\"inline-flex items-start gap-1 text-xs text-amber-700 dark:text-amber-300\"\n >\n <mt-icon\n icon=\"alert.alert-triangle\"\n class=\"mt-px shrink-0 text-sm\"\n />\n {{ warning }}\n </span>\n }\n </li>\n }\n </ul>\n </section>\n } @empty {\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n }\n </div>\n }\n }\n }\n }\n </div>\n </div>\n</ng-container>\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: Tree, selector: "mt-tree", inputs: ["value", "selection", "selectionMode", "nodeIcon", "propagateSelectionUp", "propagateSelectionDown", "checkAllChildren", "loading", "emptyMessage", "checkAllLabel", "filterPlaceholder", "dataKey", "filter", "filterMode", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "styleClass", "style", "pInputs", "nodeActions", "nodeContextmenuActions", "contextMenuSelection"], outputs: ["selectionChange", "contextMenuSelectionChange", "action"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: SummaryAccessibilities, selector: "mt-summary-accessibilities", inputs: ["accessibilities", "emptyMessage"] }, { kind: "component", type: SummaryPill, selector: "mt-summary-pill", inputs: ["tone"] }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }] });
|
|
2280
|
+
}
|
|
2281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: GroupAccessSummary, decorators: [{
|
|
2282
|
+
type: Component,
|
|
2283
|
+
args: [{ selector: 'mt-group-access-summary', standalone: true, host: { class: 'flex h-full min-h-0 flex-col' }, imports: [
|
|
2284
|
+
TranslocoDirective,
|
|
2285
|
+
ReactiveFormsModule,
|
|
2286
|
+
SkeletonModule,
|
|
2287
|
+
Icon,
|
|
2288
|
+
Tabs,
|
|
2289
|
+
Tree,
|
|
2290
|
+
Avatar,
|
|
2291
|
+
Button,
|
|
2292
|
+
TextField,
|
|
2293
|
+
EmptyState,
|
|
2294
|
+
SecureImagePipe,
|
|
2295
|
+
SummaryAccessibilities,
|
|
2296
|
+
SummaryPill,
|
|
2297
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\n <!-- Which group \u2014 rendered from the table row, so it never waits on the request. -->\n <div class=\"min-h-0 flex-1 overflow-y-auto\">\n <section class=\"flex items-center gap-3 border-b border-surface p-4\">\n <mt-avatar\n icon=\"user.users-01\"\n size=\"large\"\n shape=\"square\"\n styleClass=\"bg-primary-50! text-primary!\"\n />\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <h2\n class=\"min-w-0 truncate text-base font-semibold text-color\"\n [title]=\"header().name\"\n >\n {{ header().name }}\n </h2>\n @if (header().isActivated) {\n <mt-summary-pill tone=\"success\">{{ t(\"active\") }}</mt-summary-pill>\n } @else {\n <mt-summary-pill tone=\"neutral\">{{\n t(\"inactive\")\n }}</mt-summary-pill>\n }\n </div>\n\n @if (header().description) {\n <p\n class=\"line-clamp-2 text-sm text-muted-color\"\n [title]=\"header().description\"\n >\n {{ header().description }}\n </p>\n }\n </div>\n </section>\n\n <div class=\"sticky top-0 z-10 bg-content px-4 pt-2\">\n <mt-tabs [options]=\"tabs()\" [(active)]=\"activeTab\" mode=\"underline\" />\n </div>\n\n <div class=\"p-4\">\n @if (loading()) {\n <div class=\"flex flex-col gap-3\">\n @for (row of [1, 2, 3, 4]; track row) {\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\n }\n </div>\n } @else if (error()) {\n <div\n class=\"flex flex-col items-start gap-3 rounded-md border border-rose-200 bg-rose-50 p-4 dark:border-rose-800 dark:bg-rose-900/30\"\n role=\"alert\"\n >\n <div class=\"flex flex-col gap-1\">\n <span\n class=\"text-sm font-semibold text-rose-700 dark:text-rose-200\"\n >\n {{ t(\"summary-load-failed\") }}\n </span>\n <span class=\"text-sm text-rose-600 dark:text-rose-300\">\n {{ t(\"summary-load-failed-hint\") }}\n </span>\n </div>\n <mt-button\n icon=\"arrow.refresh-cw-02\"\n severity=\"danger\"\n variant=\"outlined\"\n size=\"small\"\n [label]=\"t('try-again')\"\n (onClick)=\"load()\"\n />\n </div>\n } @else {\n @switch (activeTab()) {\n @case (\"members\") {\n @if (members().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-members')\"\n [description]=\"t('group-members-hint')\"\n />\n } @else {\n <div class=\"flex flex-col gap-3\">\n @if (showMemberSearch()) {\n <mt-text-field\n [formControl]=\"memberSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-members')\"\n />\n }\n <ul class=\"rounded-md border border-surface\">\n @for (member of filteredMembers(); track member.id) {\n <li\n class=\"flex items-center gap-3 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <mt-avatar\n [image]=\"\n member.photo\n ? $any(\n member.photo\n | secureImage: true : context : 'avatar/'\n )\n : ''\n \"\n icon=\"user.user-01\"\n styleClass=\"text-surface-600! bg-surface-200!\"\n />\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"member.displayName\"\n >\n {{ member.displayName }}\n </span>\n @if (member.email || member.userName) {\n <span\n class=\"truncate text-xs text-muted-color\"\n [title]=\"member.email || member.userName\"\n >\n {{ member.email || member.userName }}\n </span>\n }\n </div>\n @for (flag of member.flags; track flag.label) {\n <mt-summary-pill [tone]=\"flag.tone\">\n {{ flag.label }}\n </mt-summary-pill>\n }\n </li>\n } @empty {\n <li>\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n </li>\n }\n </ul>\n </div>\n }\n }\n\n @case (\"permissions\") {\n @if (permissionTree().length === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('group-no-permissions')\"\n [description]=\"t('group-permissions-hint')\"\n />\n } @else {\n <mt-tree\n class=\"block\"\n [value]=\"permissionTree()\"\n [filter]=\"true\"\n [filterPlaceholder]=\"t('search-permissions')\"\n />\n }\n }\n\n @case (\"accessibilities\") {\n <mt-summary-accessibilities\n [accessibilities]=\"accessibilities()\"\n [emptyMessage]=\"t('group-no-accessibilities')\"\n />\n }\n\n @case (\"usages\") {\n @if (usageCount() === 0) {\n <mt-empty-state\n illustration=\"none\"\n [title]=\"t('no-usages')\"\n [description]=\"t('usages-coverage')\"\n />\n } @else {\n <div class=\"flex flex-col gap-4\">\n @if (blockingCount() > 0) {\n <div\n class=\"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-200\"\n role=\"status\"\n >\n <mt-icon\n icon=\"alert.alert-triangle\"\n class=\"mt-0.5 shrink-0 text-base\"\n />\n <span>\n {{\n t(\"usages-blocking-note\", { count: blockingCount() })\n }}\n </span>\n </div>\n }\n\n @if (impactTiles().length) {\n <section class=\"flex flex-col gap-2\">\n <div class=\"flex flex-col\">\n <span class=\"text-sm font-semibold text-color\">\n {{ t(\"runtime-impact\") }}\n </span>\n <span class=\"text-xs text-muted-color\">\n {{ t(\"runtime-impact-hint\") }}\n </span>\n </div>\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\n @for (tile of impactTiles(); track tile.key) {\n <div\n class=\"flex flex-col gap-0.5 rounded-md border border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\n >\n <span\n class=\"text-lg font-semibold text-color tabular-nums\"\n >\n {{ tile.value }}\n </span>\n <span class=\"text-xs text-muted-color\">\n {{ tile.label }}\n </span>\n </div>\n }\n </div>\n </section>\n }\n\n @if (showUsageSearch()) {\n <mt-text-field\n [formControl]=\"usageSearch\"\n icon=\"general.search-lg\"\n [placeholder]=\"t('search-usages')\"\n />\n }\n\n @for (\n category of filteredUsageCategories();\n track category.key\n ) {\n <section class=\"rounded-md border border-surface\">\n <header\n class=\"flex items-center justify-between gap-2 rounded-t-md border-b border-surface bg-surface-50 px-3 py-2 dark:bg-surface-800\"\n >\n <span\n class=\"inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-color\"\n >\n <mt-icon\n [icon]=\"category.icon\"\n class=\"shrink-0 text-base text-primary\"\n />\n <span class=\"truncate\">{{ category.label }}</span>\n </span>\n <span class=\"shrink-0 text-xs text-muted-color\">\n {{ category.items.length }}\n </span>\n </header>\n\n <ul>\n @for (usage of category.items; track usage.id) {\n <li\n class=\"flex flex-col gap-1.5 border-b border-surface px-3 py-2.5 last:border-b-0\"\n >\n <div class=\"flex min-w-0 items-start gap-2\">\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <span\n class=\"truncate text-sm font-medium text-color\"\n [title]=\"usage.title\"\n >\n {{ usage.title }}\n </span>\n <span class=\"truncate text-xs text-muted-color\">\n {{ usage.sourceLabel }}\n @if (usage.stepName) {\n \u00B7 {{ t(\"step\") }}: {{ usage.stepName }}\n }\n </span>\n </div>\n @for (state of usage.states; track state) {\n <mt-summary-pill tone=\"warn\">\n {{ state }}\n </mt-summary-pill>\n }\n </div>\n\n @if (usage.scopeLabel || usage.channels.length) {\n <div class=\"flex flex-wrap items-center gap-1.5\">\n @if (usage.scopeLabel) {\n <span\n class=\"inline-flex min-w-0 items-center gap-1 text-xs text-muted-color\"\n >\n <mt-icon\n icon=\"custom.hierarchy-structure\"\n class=\"shrink-0 text-sm\"\n />\n <span\n class=\"truncate\"\n [title]=\"usage.scopeLabel\"\n >\n {{ usage.scopeLabel }}\n </span>\n </span>\n }\n @for (channel of usage.channels; track channel) {\n <mt-summary-pill tone=\"info\">\n {{ channel }}\n </mt-summary-pill>\n }\n </div>\n }\n\n @if (usage.impact.length) {\n <span class=\"text-xs text-muted-color\">\n {{ usage.impact.join(\" \u00B7 \") }}\n </span>\n }\n\n @for (warning of usage.warnings; track $index) {\n <span\n class=\"inline-flex items-start gap-1 text-xs text-amber-700 dark:text-amber-300\"\n >\n <mt-icon\n icon=\"alert.alert-triangle\"\n class=\"mt-px shrink-0 text-sm\"\n />\n {{ warning }}\n </span>\n }\n </li>\n }\n </ul>\n </section>\n } @empty {\n <mt-empty-state\n variant=\"filtered\"\n illustration=\"none\"\n [title]=\"t('no-search-results')\"\n />\n }\n </div>\n }\n }\n }\n }\n </div>\n </div>\n</ng-container>\n" }]
|
|
2298
|
+
}], propDecorators: { group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: false }] }] } });
|
|
2299
|
+
function scopeLabel(scope, lang) {
|
|
2300
|
+
const template = resolveTranslated(scope.level?.templateName, lang);
|
|
2301
|
+
const name = resolveTranslated(scope.displayName, lang);
|
|
2302
|
+
return template && template !== name
|
|
2303
|
+
? `${template} › ${name}`
|
|
2304
|
+
: name || template;
|
|
2305
|
+
}
|
|
2306
|
+
function categoryRank(key) {
|
|
2307
|
+
const index = CATEGORY_ORDER.indexOf(key);
|
|
2308
|
+
return index === -1 ? CATEGORY_ORDER.length : index;
|
|
2309
|
+
}
|
|
2310
|
+
/** `NotificationTemplate` → `Notification Template`, for values we do not know yet. */
|
|
2311
|
+
function humanize(value) {
|
|
2312
|
+
return value.replace(/([a-z])([A-Z])/g, '$1 $2').trim();
|
|
2313
|
+
}
|
|
2314
|
+
|
|
1720
2315
|
class Groups {
|
|
1721
2316
|
facade = inject(UsersGroupsFacade);
|
|
1722
2317
|
modal = inject(ModalService);
|
|
@@ -1734,6 +2329,14 @@ class Groups {
|
|
|
1734
2329
|
], ...(ngDevMode ? [{ debugName: "tableActions" }] : /* istanbul ignore next */ []));
|
|
1735
2330
|
deletingRowIds = signal([], ...(ngDevMode ? [{ debugName: "deletingRowIds" }] : /* istanbul ignore next */ []));
|
|
1736
2331
|
rowActions = signal([
|
|
2332
|
+
{
|
|
2333
|
+
icon: 'general.eye',
|
|
2334
|
+
tooltip: this.translocoService.translate('users-groups.group-summary'),
|
|
2335
|
+
color: 'secondary',
|
|
2336
|
+
action: (row) => {
|
|
2337
|
+
this.openAccessSummary(row);
|
|
2338
|
+
},
|
|
2339
|
+
},
|
|
1737
2340
|
{
|
|
1738
2341
|
icon: 'custom.pencil',
|
|
1739
2342
|
tooltip: this.translocoService.translate('edit'),
|
|
@@ -1800,8 +2403,21 @@ class Groups {
|
|
|
1800
2403
|
},
|
|
1801
2404
|
});
|
|
1802
2405
|
}
|
|
2406
|
+
openAccessSummary(group) {
|
|
2407
|
+
this.modal.openModal(GroupAccessSummary, 'drawer', {
|
|
2408
|
+
header: this.translocoService.translate('users-groups.group-summary'),
|
|
2409
|
+
styleClass: ACCESS_SUMMARY_DRAWER_CLASS,
|
|
2410
|
+
position: 'end',
|
|
2411
|
+
appendTo: 'page-content',
|
|
2412
|
+
dismissableMask: true,
|
|
2413
|
+
dismissible: true,
|
|
2414
|
+
inputValues: {
|
|
2415
|
+
group,
|
|
2416
|
+
},
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
1803
2419
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1804
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: Groups, isStandalone: true, selector: "mt-groups", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <mt-table\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"allGroups()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-groups-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [".groups{padding:2rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
|
|
2420
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.8", type: Groups, isStandalone: true, selector: "mt-groups", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <div class=\"mt-5\">\r\n <mt-table\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"allGroups()\"\r\n [columns]=\"tableColumns()\"\r\n [actions]=\"tableActions()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"false\"\r\n [loading]=\"loading()\"\r\n storageKey=\"users-groups-groups-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [".groups{padding:2rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
|
|
1805
2421
|
}
|
|
1806
2422
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, decorators: [{
|
|
1807
2423
|
type: Component,
|
|
@@ -1814,5 +2430,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1814
2430
|
* Generated bundle index. Do not edit.
|
|
1815
2431
|
*/
|
|
1816
2432
|
|
|
1817
|
-
export { AddUserToGroup, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, GetGroup, GetGroups, GetUser, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, ResetUserPassword, UpdateGroup, UpdateUser, UserForm, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState };
|
|
2433
|
+
export { AddUserToGroup, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, GetGroup, GetGroupSummary, GetGroups, GetUser, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, ResetUserPassword, UpdateGroup, UpdateUser, UserForm, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState };
|
|
1818
2434
|
//# sourceMappingURL=masterteam-users-groups.mjs.map
|