@masterteam/users-groups 0.0.47 → 0.0.49
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.
|
@@ -3,15 +3,16 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { inject, Injectable, computed, DestroyRef, signal, Component, input, effect, untracked, linkedSignal, viewChild } from '@angular/core';
|
|
4
4
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { Breadcrumb } from '@masterteam/components/breadcrumb';
|
|
6
|
-
import { CrudStateBase, REQUEST_CONTEXT, handleApiRequest, UserSearchFieldConfig, ValidatorConfig, UploadFileFieldConfig, SelectFieldConfig, TextareaFieldConfig
|
|
6
|
+
import { CrudStateBase, REQUEST_CONTEXT, handleApiRequest, MTDateFormatPipe, UserSearchFieldConfig, ValidatorConfig, UploadFileFieldConfig, SelectFieldConfig, TextareaFieldConfig } from '@masterteam/components';
|
|
7
7
|
import { Action, Selector, State, Store, select } from '@ngxs/store';
|
|
8
8
|
import { HttpClient, HttpContext } from '@angular/common/http';
|
|
9
|
-
import { of, from, concatMap, map, toArray, catchError, shareReplay, filter,
|
|
9
|
+
import { of, from, concatMap, map, toArray, catchError, shareReplay, filter, switchMap, Observable, finalize, firstValueFrom, take, distinctUntilChanged } from 'rxjs';
|
|
10
10
|
import { ActivatedRoute, Router, NavigationEnd, RouterOutlet } from '@angular/router';
|
|
11
11
|
import { TranslocoService, TranslocoDirective, TranslocoPipe } from '@jsverse/transloco';
|
|
12
12
|
import { Page } from '@masterteam/components/page';
|
|
13
13
|
import { Button } from '@masterteam/components/button';
|
|
14
|
-
import { Table } from '@masterteam/components/table';
|
|
14
|
+
import { TableExportService, TableActionsMenu, Table } from '@masterteam/components/table';
|
|
15
|
+
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
15
16
|
import { TruncateTooltip } from '@masterteam/components/tooltip';
|
|
16
17
|
import * as i1 from 'primeng/skeleton';
|
|
17
18
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
@@ -28,7 +29,6 @@ import { EmptyState } from '@masterteam/components/empty-state';
|
|
|
28
29
|
import { TextField } from '@masterteam/components/text-field';
|
|
29
30
|
import { Tree } from '@masterteam/components/tree';
|
|
30
31
|
import { SecureImagePipe } from '@masterteam/components/upload-field';
|
|
31
|
-
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
32
32
|
import * as i2 from 'primeng/progressbar';
|
|
33
33
|
import { ProgressBarModule } from 'primeng/progressbar';
|
|
34
34
|
|
|
@@ -998,419 +998,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
998
998
|
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <mt-page\r\n [title]=\"t('users-groups')\"\r\n [avatarIcon]=\"'user.user-circle'\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-sky-100)',\r\n '--p-avatar-color': 'var(--p-sky-700)',\r\n }\"\r\n [tabs]=\"tabsList()\"\r\n [activeTab]=\"activeTab()\"\r\n (tabChange)=\"onTabChange($event)\"\r\n (backButtonClick)=\"goBack()\"\r\n backButton\r\n >\r\n <div class=\"flex justify-between items-end\">\r\n <div>\r\n <h3 class=\"font-bold text-lg\">{{ t(\"users-groups\") }}</h3>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems\"\r\n [styleClass]=\"'flex justify-start mx-1'\"\r\n ></mt-breadcrumb>\r\n </div>\r\n @if (selectedTab() === \"users\") {\r\n <mt-button\r\n [icon]=\"'arrow.refresh-cw-02'\"\r\n [label]=\"\r\n translocoService.translate('users-groups.sync-users-information')\r\n \"\r\n [severity]=\"'primary'\"\r\n [variant]=\"'outlined'\"\r\n [size]=\"'small'\"\r\n (click)=\"getUsers()\"\r\n class=\"mx-4\"\r\n >\r\n </mt-button>\r\n }\r\n </div>\r\n <router-outlet />\r\n </mt-page>\r\n</ng-container>\r\n" }]
|
|
999
999
|
}] });
|
|
1000
1000
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
internalFormEvents = toSignal(this.internalUserFormControl.events, { initialValue: null });
|
|
1023
|
-
externalFormEvents = toSignal(this.externalUserFormControl.events, { initialValue: null });
|
|
1024
|
-
getUserFormLoading = this.facade.isLoadingUser;
|
|
1025
|
-
createUpdateUserLoading = this.facade.isSavingUser;
|
|
1026
|
-
isEditMode = computed(() => !!this.userForEdit()?.userName, ...(ngDevMode ? [{ debugName: "isEditMode" }] : /* istanbul ignore next */ []));
|
|
1027
|
-
isSubmitDisabled = computed(() => {
|
|
1028
|
-
if (this.createUpdateUserLoading()) {
|
|
1029
|
-
return true;
|
|
1030
|
-
}
|
|
1031
|
-
if (this.isEditMode()) {
|
|
1032
|
-
this.externalFormEvents();
|
|
1033
|
-
return (this.externalUserFormControl.pristine ||
|
|
1034
|
-
!this.externalUserFormControl.valid);
|
|
1035
|
-
}
|
|
1036
|
-
if (this.selectedTab() === 'internal') {
|
|
1037
|
-
this.internalFormEvents();
|
|
1038
|
-
return !this.internalUserFormControl.valid;
|
|
1039
|
-
}
|
|
1040
|
-
this.externalFormEvents();
|
|
1041
|
-
return !this.externalUserFormControl.valid;
|
|
1042
|
-
}, ...(ngDevMode ? [{ debugName: "isSubmitDisabled" }] : /* istanbul ignore next */ []));
|
|
1043
|
-
context = new HttpContext().set(REQUEST_CONTEXT, {
|
|
1044
|
-
useBaseUrl: false,
|
|
1045
|
-
});
|
|
1046
|
-
contextGatway = new HttpContext().set(REQUEST_CONTEXT, {
|
|
1047
|
-
useBaseUrl: true,
|
|
1048
|
-
});
|
|
1049
|
-
internalUserFormConfig = signal({
|
|
1050
|
-
sections: [
|
|
1051
|
-
{
|
|
1052
|
-
key: 'internalUserFormConfig',
|
|
1053
|
-
type: 'header',
|
|
1054
|
-
order: 1,
|
|
1055
|
-
fields: [
|
|
1056
|
-
new UserSearchFieldConfig({
|
|
1057
|
-
key: 'userField',
|
|
1058
|
-
label: this.translocoService.translate('users-groups.user-name'),
|
|
1059
|
-
apiUrl: 'Identity/users/external/ad',
|
|
1060
|
-
context: this.context,
|
|
1061
|
-
hideUnlinkedHint: true,
|
|
1062
|
-
validators: [ValidatorConfig.required()],
|
|
1063
|
-
order: 1,
|
|
1064
|
-
}),
|
|
1065
|
-
],
|
|
1066
|
-
},
|
|
1067
|
-
],
|
|
1068
|
-
}, ...(ngDevMode ? [{ debugName: "internalUserFormConfig" }] : /* istanbul ignore next */ []));
|
|
1069
|
-
fieldColSpan = computed(() => (this.userForEdit()?.userName ? 12 : 6), ...(ngDevMode ? [{ debugName: "fieldColSpan" }] : /* istanbul ignore next */ []));
|
|
1070
|
-
externalUserFormConfig = computed(() => ({
|
|
1071
|
-
sections: [
|
|
1072
|
-
{
|
|
1073
|
-
key: 'externalUserFormConfig',
|
|
1074
|
-
type: 'header',
|
|
1075
|
-
order: 1,
|
|
1076
|
-
fields: [
|
|
1077
|
-
new UploadFileFieldConfig({
|
|
1078
|
-
key: 'image',
|
|
1079
|
-
label: this.translocoService.translate('users-groups.avatar'),
|
|
1080
|
-
shape: 'circle',
|
|
1081
|
-
endPoint: 'avatar',
|
|
1082
|
-
context: this.contextGatway,
|
|
1083
|
-
colSpan: 12,
|
|
1084
|
-
order: 1,
|
|
1085
|
-
}),
|
|
1086
|
-
{
|
|
1087
|
-
key: 'displayName',
|
|
1088
|
-
label: this.translocoService.translate('users-groups.display-name'),
|
|
1089
|
-
placeholder: this.translocoService.translate('users-groups.display-name'),
|
|
1090
|
-
validators: [ValidatorConfig.required()],
|
|
1091
|
-
colSpan: this.fieldColSpan(),
|
|
1092
|
-
order: 2,
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
key: 'email',
|
|
1096
|
-
label: this.translocoService.translate('users-groups.email'),
|
|
1097
|
-
placeholder: this.translocoService.translate('users-groups.email'),
|
|
1098
|
-
inputType: 'email',
|
|
1099
|
-
required: true,
|
|
1100
|
-
hint: this.translocoService.translate('users-groups.email-hint'),
|
|
1101
|
-
validators: [
|
|
1102
|
-
// No hardcoded message: the generic translated "required" copy
|
|
1103
|
-
// covers this field fine, and a literal English string here
|
|
1104
|
-
// was overriding it in every non-English locale.
|
|
1105
|
-
ValidatorConfig.required(),
|
|
1106
|
-
ValidatorConfig.pattern('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z]{2,}$', this.translocoService.translate('users-groups.email-invalid')),
|
|
1107
|
-
],
|
|
1108
|
-
colSpan: this.fieldColSpan(),
|
|
1109
|
-
order: 3,
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
key: 'mobile',
|
|
1113
|
-
label: this.translocoService.translate('users-groups.mobile'),
|
|
1114
|
-
placeholder: this.translocoService.translate('users-groups.mobile'),
|
|
1115
|
-
hint: this.translocoService.translate('users-groups.mobile-hint'),
|
|
1116
|
-
validators: [
|
|
1117
|
-
ValidatorConfig.required(),
|
|
1118
|
-
ValidatorConfig.pattern('^\\+?[0-9]{7,15}$', this.translocoService.translate('users-groups.mobile-invalid')),
|
|
1119
|
-
],
|
|
1120
|
-
colSpan: this.fieldColSpan(),
|
|
1121
|
-
order: 4,
|
|
1122
|
-
},
|
|
1123
|
-
],
|
|
1124
|
-
},
|
|
1125
|
-
],
|
|
1126
|
-
}), ...(ngDevMode ? [{ debugName: "externalUserFormConfig" }] : /* istanbul ignore next */ []));
|
|
1127
|
-
constructor() {
|
|
1128
|
-
effect(() => {
|
|
1129
|
-
const userName = this.userForEdit()?.userName;
|
|
1130
|
-
const selectedUser = this.selectedUser();
|
|
1131
|
-
if (selectedUser && userName) {
|
|
1132
|
-
untracked(() => {
|
|
1133
|
-
this.selectedTab.set('external');
|
|
1134
|
-
const data = {
|
|
1135
|
-
...selectedUser,
|
|
1136
|
-
image: selectedUser.image,
|
|
1137
|
-
};
|
|
1138
|
-
this.externalUserFormControl.patchValue(data, { emitEvent: false });
|
|
1139
|
-
this.externalUserFormControl.markAsPristine({ emitEvent: false });
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1001
|
+
/**
|
|
1002
|
+
* Drawer size shared by the user and group summaries — wide enough for the
|
|
1003
|
+
* four tabs and the scope trees. The cap keeps it inside the page area on
|
|
1004
|
+
* laptops, where a fixed width would run under the side menu.
|
|
1005
|
+
*/
|
|
1006
|
+
const ACCESS_SUMMARY_DRAWER_CLASS = '!w-[90%] !max-w-[56rem] !absolute !shadow-none';
|
|
1007
|
+
/**
|
|
1008
|
+
* Resolves a `TranslatableDto`, or a string that is one serialized as JSON —
|
|
1009
|
+
* the summaries return workflow `sourceName` / `stepName` and some group
|
|
1010
|
+
* descriptions as `{"ar":"…","en":"…"}` text.
|
|
1011
|
+
*
|
|
1012
|
+
* The active language wins over `display`: `display` is resolved in the
|
|
1013
|
+
* language of the request, so it goes stale when the user switches language
|
|
1014
|
+
* with the drawer open.
|
|
1015
|
+
*/
|
|
1016
|
+
function resolveTranslated(value, lang) {
|
|
1017
|
+
if (!value)
|
|
1018
|
+
return '';
|
|
1019
|
+
if (typeof value === 'object') {
|
|
1020
|
+
const v = value;
|
|
1021
|
+
return v[lang] || v.display || v.en || v.ar || '';
|
|
1143
1022
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1023
|
+
if (typeof value === 'string') {
|
|
1024
|
+
const trimmed = value.trim();
|
|
1025
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
1026
|
+
try {
|
|
1027
|
+
const parsed = JSON.parse(trimmed);
|
|
1028
|
+
return parsed[lang] || parsed['en'] || parsed['ar'] || '';
|
|
1029
|
+
}
|
|
1030
|
+
catch {
|
|
1031
|
+
return value;
|
|
1032
|
+
}
|
|
1147
1033
|
}
|
|
1148
|
-
|
|
1034
|
+
return value;
|
|
1149
1035
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1036
|
+
return '';
|
|
1037
|
+
}
|
|
1038
|
+
/** Case-insensitive "any of these contains the term" for client-side search. */
|
|
1039
|
+
function matchesSearch(term, ...values) {
|
|
1040
|
+
const needle = term.trim().toLowerCase();
|
|
1041
|
+
if (!needle)
|
|
1042
|
+
return true;
|
|
1043
|
+
return values.some((value) => !!value && value.toLowerCase().includes(needle));
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Groups accessibilities by category. On the wire `name` carries the
|
|
1047
|
+
* category's label and `moduleName` the item itself, so a flat list repeats
|
|
1048
|
+
* the same subtitle on every row.
|
|
1049
|
+
*/
|
|
1050
|
+
function groupAccessibilities(accessibilities, lang) {
|
|
1051
|
+
const groups = new Map();
|
|
1052
|
+
for (const accessibility of accessibilities) {
|
|
1053
|
+
const key = accessibility.category || accessibility.moduleKey || '';
|
|
1054
|
+
let group = groups.get(key);
|
|
1055
|
+
if (!group) {
|
|
1056
|
+
group = {
|
|
1057
|
+
key,
|
|
1058
|
+
label: resolveTranslated(accessibility.name, lang) || key,
|
|
1059
|
+
items: [],
|
|
1157
1060
|
};
|
|
1158
|
-
|
|
1159
|
-
next: () => {
|
|
1160
|
-
this.ref.close(true);
|
|
1161
|
-
},
|
|
1162
|
-
error: () => { },
|
|
1163
|
-
});
|
|
1164
|
-
}
|
|
1165
|
-
else {
|
|
1166
|
-
let payload = {};
|
|
1167
|
-
if (this.selectedTab() === 'internal') {
|
|
1168
|
-
payload = {
|
|
1169
|
-
userName: this.internalUserFormControl.value?.userField?.userName,
|
|
1170
|
-
isExternal: false,
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
else {
|
|
1174
|
-
payload = {
|
|
1175
|
-
id: '',
|
|
1176
|
-
userName: this.externalUserFormControl.value?.userName,
|
|
1177
|
-
displayName: this.externalUserFormControl.value?.displayName,
|
|
1178
|
-
email: this.externalUserFormControl.value?.email,
|
|
1179
|
-
mobile: this.externalUserFormControl.value?.mobile,
|
|
1180
|
-
password: this.externalUserFormControl.value?.password,
|
|
1181
|
-
isExternal: true,
|
|
1182
|
-
image: this.externalUserFormControl.value?.image?.fileName,
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
this.facade.createUser(payload).subscribe({
|
|
1186
|
-
next: () => {
|
|
1187
|
-
this.ref.close(true);
|
|
1188
|
-
},
|
|
1189
|
-
error: () => { },
|
|
1190
|
-
});
|
|
1061
|
+
groups.set(key, group);
|
|
1191
1062
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
placeholder: this.translocoService.translate('users-groups.user-name'),
|
|
1200
|
-
hint: this.translocoService.translate('users-groups.user-name-hint'),
|
|
1201
|
-
validators: [
|
|
1202
|
-
ValidatorConfig.required(),
|
|
1203
|
-
ValidatorConfig.pattern('^[a-zA-Z0-9]+$', this.translocoService.translate('users-groups.user-name-invalid')),
|
|
1204
|
-
],
|
|
1205
|
-
colSpan: 6,
|
|
1206
|
-
order: 5,
|
|
1207
|
-
hidden: !!this.userForEdit()?.userName,
|
|
1208
|
-
}, {
|
|
1209
|
-
key: 'password',
|
|
1210
|
-
label: this.translocoService.translate('users-groups.password'),
|
|
1211
|
-
placeholder: this.translocoService.translate('users-groups.password'),
|
|
1212
|
-
hint: passwordRules,
|
|
1213
|
-
validators: [
|
|
1214
|
-
ValidatorConfig.required(),
|
|
1215
|
-
ValidatorConfig.pattern(this.passwordPattern, passwordRules),
|
|
1216
|
-
],
|
|
1217
|
-
inputType: 'password',
|
|
1218
|
-
colSpan: 6,
|
|
1219
|
-
order: 6,
|
|
1220
|
-
hidden: !!this.userForEdit()?.userName,
|
|
1221
|
-
}, {
|
|
1222
|
-
key: 'confirmPassword',
|
|
1223
|
-
label: this.translocoService.translate('users-groups.confirm-password'),
|
|
1224
|
-
placeholder: this.translocoService.translate('users-groups.confirm-password'),
|
|
1225
|
-
hint: passwordRules,
|
|
1226
|
-
validators: [
|
|
1227
|
-
ValidatorConfig.required(),
|
|
1228
|
-
ValidatorConfig.pattern(this.passwordPattern, passwordRules),
|
|
1229
|
-
ValidatorConfig.custom((value, control) => {
|
|
1230
|
-
const password = control?.parent?.get('password')?.value;
|
|
1231
|
-
return !value || !password || value === password;
|
|
1232
|
-
}, this.translocoService.translate('users-groups.passwords-must-match')),
|
|
1233
|
-
],
|
|
1234
|
-
inputType: 'password',
|
|
1235
|
-
colSpan: 6,
|
|
1236
|
-
order: 6,
|
|
1237
|
-
hidden: !!this.userForEdit()?.userName,
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1242
|
-
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() ? t('save') : t('add')\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"], 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"] }] });
|
|
1243
|
-
}
|
|
1244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, decorators: [{
|
|
1245
|
-
type: Component,
|
|
1246
|
-
args: [{ selector: 'mt-user-form', standalone: true, imports: [
|
|
1247
|
-
CommonModule,
|
|
1248
|
-
Button,
|
|
1249
|
-
TranslocoDirective,
|
|
1250
|
-
SkeletonModule,
|
|
1251
|
-
DynamicForm,
|
|
1252
|
-
ReactiveFormsModule,
|
|
1253
|
-
Tabs,
|
|
1254
|
-
TranslocoPipe,
|
|
1255
|
-
], 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 (!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() ? t('save') : t('add')\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"] }]
|
|
1256
|
-
}], ctorParameters: () => [], propDecorators: { userForEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "userForEdit", required: false }] }] } });
|
|
1257
|
-
|
|
1258
|
-
class ResetPasswordForm {
|
|
1259
|
-
passwordPattern = '^(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?=.*[a-z])(?=.*\\d).{6,}$';
|
|
1260
|
-
modal = inject(ModalService);
|
|
1261
|
-
ref = inject(ModalRef);
|
|
1262
|
-
translocoService = inject(TranslocoService);
|
|
1263
|
-
facade = inject(UsersGroupsFacade);
|
|
1264
|
-
user = input(null, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
1265
|
-
passwordResetLoading = this.facade.isResettingPassword;
|
|
1266
|
-
resetPasswordFormControl = new FormControl();
|
|
1267
|
-
resetPasswordFormConfig = computed(() => ({
|
|
1268
|
-
sections: [
|
|
1269
|
-
{
|
|
1270
|
-
key: 'resetPasswordFormConfig',
|
|
1271
|
-
type: 'header',
|
|
1272
|
-
order: 1,
|
|
1273
|
-
fields: [
|
|
1274
|
-
{
|
|
1275
|
-
key: 'displayName',
|
|
1276
|
-
inputType: 'text',
|
|
1277
|
-
disabled: true,
|
|
1278
|
-
label: this.translocoService.translate('users-groups.user'),
|
|
1279
|
-
value: this.user()?.displayName || '',
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
key: 'newPassword',
|
|
1283
|
-
inputType: 'password',
|
|
1284
|
-
label: this.translocoService.translate('users-groups.new-password'),
|
|
1285
|
-
hint: this.translocoService.translate('users-groups.password-rules'),
|
|
1286
|
-
validators: [
|
|
1287
|
-
ValidatorConfig.required(),
|
|
1288
|
-
ValidatorConfig.pattern(this.passwordPattern, this.translocoService.translate('users-groups.password-rules')),
|
|
1289
|
-
],
|
|
1290
|
-
},
|
|
1291
|
-
{
|
|
1292
|
-
key: 'confirmPassword',
|
|
1293
|
-
inputType: 'password',
|
|
1294
|
-
label: this.translocoService.translate('users-groups.confirm-password'),
|
|
1295
|
-
placeholder: this.translocoService.translate('users-groups.confirm-password'),
|
|
1296
|
-
hint: this.translocoService.translate('users-groups.password-rules'),
|
|
1297
|
-
validators: [
|
|
1298
|
-
ValidatorConfig.required(),
|
|
1299
|
-
ValidatorConfig.pattern(this.passwordPattern, this.translocoService.translate('users-groups.password-rules')),
|
|
1300
|
-
ValidatorConfig.custom((value, control) => {
|
|
1301
|
-
const newPassword = control?.parent?.get('newPassword')?.value;
|
|
1302
|
-
return !value || !newPassword || value === newPassword;
|
|
1303
|
-
}, this.translocoService.translate('users-groups.passwords-must-match')),
|
|
1304
|
-
],
|
|
1305
|
-
},
|
|
1306
|
-
],
|
|
1307
|
-
},
|
|
1308
|
-
],
|
|
1309
|
-
}), ...(ngDevMode ? [{ debugName: "resetPasswordFormConfig" }] : /* istanbul ignore next */ []));
|
|
1310
|
-
ngOnInit() {
|
|
1311
|
-
this.resetPasswordFormControl.setValue({
|
|
1312
|
-
displayName: this.user()?.displayName || '',
|
|
1313
|
-
newPassword: '',
|
|
1314
|
-
confirmPassword: '',
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
onSubmit() {
|
|
1318
|
-
const payload = {
|
|
1319
|
-
userName: this.user()?.userName,
|
|
1320
|
-
newPassword: this.resetPasswordFormControl.value?.newPassword,
|
|
1321
|
-
};
|
|
1322
|
-
this.facade.resetUserPassword(this.user()?.userName, payload).subscribe({
|
|
1323
|
-
next: () => {
|
|
1324
|
-
this.ref.close(true);
|
|
1325
|
-
},
|
|
1326
|
-
error: () => { },
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1330
|
-
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" }] });
|
|
1331
|
-
}
|
|
1332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, decorators: [{
|
|
1333
|
-
type: Component,
|
|
1334
|
-
args: [{ selector: 'mt-reset-password-form', standalone: true, imports: [
|
|
1335
|
-
CommonModule,
|
|
1336
|
-
Button,
|
|
1337
|
-
TranslocoDirective,
|
|
1338
|
-
SkeletonModule,
|
|
1339
|
-
DynamicForm,
|
|
1340
|
-
ReactiveFormsModule,
|
|
1341
|
-
TranslocoPipe,
|
|
1342
|
-
], 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" }]
|
|
1343
|
-
}], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Drawer size shared by the user and group summaries — wide enough for the
|
|
1347
|
-
* four tabs and the scope trees. The cap keeps it inside the page area on
|
|
1348
|
-
* laptops, where a fixed width would run under the side menu.
|
|
1349
|
-
*/
|
|
1350
|
-
const ACCESS_SUMMARY_DRAWER_CLASS = '!w-[90%] !max-w-[56rem] !absolute !shadow-none';
|
|
1351
|
-
/**
|
|
1352
|
-
* Resolves a `TranslatableDto`, or a string that is one serialized as JSON —
|
|
1353
|
-
* the summaries return workflow `sourceName` / `stepName` and some group
|
|
1354
|
-
* descriptions as `{"ar":"…","en":"…"}` text.
|
|
1355
|
-
*
|
|
1356
|
-
* The active language wins over `display`: `display` is resolved in the
|
|
1357
|
-
* language of the request, so it goes stale when the user switches language
|
|
1358
|
-
* with the drawer open.
|
|
1359
|
-
*/
|
|
1360
|
-
function resolveTranslated(value, lang) {
|
|
1361
|
-
if (!value)
|
|
1362
|
-
return '';
|
|
1363
|
-
if (typeof value === 'object') {
|
|
1364
|
-
const v = value;
|
|
1365
|
-
return v[lang] || v.display || v.en || v.ar || '';
|
|
1366
|
-
}
|
|
1367
|
-
if (typeof value === 'string') {
|
|
1368
|
-
const trimmed = value.trim();
|
|
1369
|
-
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
1370
|
-
try {
|
|
1371
|
-
const parsed = JSON.parse(trimmed);
|
|
1372
|
-
return parsed[lang] || parsed['en'] || parsed['ar'] || '';
|
|
1373
|
-
}
|
|
1374
|
-
catch {
|
|
1375
|
-
return value;
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
return value;
|
|
1379
|
-
}
|
|
1380
|
-
return '';
|
|
1381
|
-
}
|
|
1382
|
-
/** Case-insensitive "any of these contains the term" for client-side search. */
|
|
1383
|
-
function matchesSearch(term, ...values) {
|
|
1384
|
-
const needle = term.trim().toLowerCase();
|
|
1385
|
-
if (!needle)
|
|
1386
|
-
return true;
|
|
1387
|
-
return values.some((value) => !!value && value.toLowerCase().includes(needle));
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Groups accessibilities by category. On the wire `name` carries the
|
|
1391
|
-
* category's label and `moduleName` the item itself, so a flat list repeats
|
|
1392
|
-
* the same subtitle on every row.
|
|
1393
|
-
*/
|
|
1394
|
-
function groupAccessibilities(accessibilities, lang) {
|
|
1395
|
-
const groups = new Map();
|
|
1396
|
-
for (const accessibility of accessibilities) {
|
|
1397
|
-
const key = accessibility.category || accessibility.moduleKey || '';
|
|
1398
|
-
let group = groups.get(key);
|
|
1399
|
-
if (!group) {
|
|
1400
|
-
group = {
|
|
1401
|
-
key,
|
|
1402
|
-
label: resolveTranslated(accessibility.name, lang) || key,
|
|
1403
|
-
items: [],
|
|
1404
|
-
};
|
|
1405
|
-
groups.set(key, group);
|
|
1406
|
-
}
|
|
1407
|
-
group.items.push({
|
|
1408
|
-
id: accessibility.id,
|
|
1409
|
-
name: resolveTranslated(accessibility.moduleName, lang) ||
|
|
1410
|
-
accessibility.moduleKey ||
|
|
1411
|
-
'',
|
|
1412
|
-
requiresMfa: !!accessibility.enableMFACheck,
|
|
1413
|
-
});
|
|
1063
|
+
group.items.push({
|
|
1064
|
+
id: accessibility.id,
|
|
1065
|
+
name: resolveTranslated(accessibility.moduleName, lang) ||
|
|
1066
|
+
accessibility.moduleKey ||
|
|
1067
|
+
'',
|
|
1068
|
+
requiresMfa: !!accessibility.enableMFACheck,
|
|
1069
|
+
});
|
|
1414
1070
|
}
|
|
1415
1071
|
return [...groups.values()];
|
|
1416
1072
|
}
|
|
@@ -1582,31 +1238,863 @@ function compareScopeNodes(a, b) {
|
|
|
1582
1238
|
if (byOrder !== 0)
|
|
1583
1239
|
return byOrder;
|
|
1584
1240
|
}
|
|
1585
|
-
return (a.label ?? '').localeCompare(b.label ?? '');
|
|
1586
|
-
}
|
|
1587
|
-
function scopeRank(node) {
|
|
1588
|
-
switch (node.data?.type) {
|
|
1589
|
-
case 'other':
|
|
1590
|
-
return 1;
|
|
1591
|
-
case 'unknown':
|
|
1592
|
-
return 2;
|
|
1593
|
-
default:
|
|
1594
|
-
return 0;
|
|
1241
|
+
return (a.label ?? '').localeCompare(b.label ?? '');
|
|
1242
|
+
}
|
|
1243
|
+
function scopeRank(node) {
|
|
1244
|
+
switch (node.data?.type) {
|
|
1245
|
+
case 'other':
|
|
1246
|
+
return 1;
|
|
1247
|
+
case 'unknown':
|
|
1248
|
+
return 2;
|
|
1249
|
+
default:
|
|
1250
|
+
return 0;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
function appendScopeCounts(nodes, leafType) {
|
|
1254
|
+
for (const node of nodes) {
|
|
1255
|
+
if (isScopeNode(node) && node.children?.length) {
|
|
1256
|
+
node.label = `${node.label} (${countLeaves(node, leafType)})`;
|
|
1257
|
+
appendScopeCounts(node.children, leafType);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
function countLeaves(node, leafType) {
|
|
1262
|
+
if (node.data?.type === leafType)
|
|
1263
|
+
return 1;
|
|
1264
|
+
return (node.children ?? []).reduce((sum, child) => sum + countLeaves(child, leafType), 0);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/** Excel rejects a cell longer than this; a longer one corrupts the file. */
|
|
1268
|
+
const EXCEL_CELL_LIMIT = 32767;
|
|
1269
|
+
const USER_COLUMNS = [
|
|
1270
|
+
['userName', 'user-name'],
|
|
1271
|
+
['displayName', 'display-name'],
|
|
1272
|
+
['email', 'email'],
|
|
1273
|
+
['mobile', 'mobile'],
|
|
1274
|
+
['type', 'type'],
|
|
1275
|
+
['lastSeen', 'last-seen'],
|
|
1276
|
+
['groups', 'groups'],
|
|
1277
|
+
['roles', 'roles'],
|
|
1278
|
+
['permissions', 'permissions'],
|
|
1279
|
+
['accessibilities', 'accessibilities'],
|
|
1280
|
+
];
|
|
1281
|
+
const GROUP_COLUMNS = [
|
|
1282
|
+
['group', 'group'],
|
|
1283
|
+
['description', 'description'],
|
|
1284
|
+
['membersCount', 'members-count'],
|
|
1285
|
+
['members', 'members'],
|
|
1286
|
+
['permissions', 'permissions'],
|
|
1287
|
+
['accessibilities', 'accessibilities'],
|
|
1288
|
+
['usages', 'usages'],
|
|
1289
|
+
];
|
|
1290
|
+
/** Several values in one cell, cut to what Excel accepts. */
|
|
1291
|
+
function exportCell(values) {
|
|
1292
|
+
const cell = values.filter(Boolean).join(', ');
|
|
1293
|
+
return cell.length > EXCEL_CELL_LIMIT
|
|
1294
|
+
? `${cell.slice(0, EXCEL_CELL_LIMIT - 1)}…`
|
|
1295
|
+
: cell;
|
|
1296
|
+
}
|
|
1297
|
+
function buildUserExport(items, lang, t, formatDateTime) {
|
|
1298
|
+
return {
|
|
1299
|
+
columns: columnsOf(USER_COLUMNS, t),
|
|
1300
|
+
rows: items.map(({ user, groups, roles, permissions, accessibilities }) => ({
|
|
1301
|
+
userName: user.userName ?? '',
|
|
1302
|
+
displayName: user.displayName ?? '',
|
|
1303
|
+
email: user.email ?? '',
|
|
1304
|
+
mobile: user.mobile ?? '',
|
|
1305
|
+
type: t(user.isExternal ? 'users-groups.external' : 'users-groups.internal'),
|
|
1306
|
+
// `displayValue` is formatted in UTC by the backend; the screen shows
|
|
1307
|
+
// local time, so the file does too.
|
|
1308
|
+
lastSeen: user.lastLoginTime?.actualValue
|
|
1309
|
+
? formatDateTime(user.lastLoginTime.actualValue)
|
|
1310
|
+
: '',
|
|
1311
|
+
groups: exportCell(groups.map((group) => resolveTranslated(group.name, lang))),
|
|
1312
|
+
roles: exportCell(roles.map((role) => scopedLabel(role, lang))),
|
|
1313
|
+
permissions: exportCell(permissions.map((permission) => scopedLabel(permission, lang))),
|
|
1314
|
+
accessibilities: exportCell(accessibilities.map((item) => accessibilityLabel(item, lang))),
|
|
1315
|
+
})),
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
function buildGroupExport(items, lang, t) {
|
|
1319
|
+
return {
|
|
1320
|
+
columns: columnsOf(GROUP_COLUMNS, t),
|
|
1321
|
+
rows: items.map(({ group, members, permissions, accessibilities, usagesCount }) => ({
|
|
1322
|
+
group: resolveTranslated(group.name, lang),
|
|
1323
|
+
description: exportCell([resolveTranslated(group.description, lang)]),
|
|
1324
|
+
membersCount: members.length,
|
|
1325
|
+
members: exportCell(members.map((member) => memberLabel(member, t))),
|
|
1326
|
+
permissions: exportCell(permissions.map((permission) => scopedLabel(permission, lang))),
|
|
1327
|
+
accessibilities: exportCell(accessibilities.map((item) => accessibilityLabel(item, lang))),
|
|
1328
|
+
usages: usagesCount,
|
|
1329
|
+
})),
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
function columnsOf(columns, t) {
|
|
1333
|
+
return columns.map(([key, labelKey]) => ({
|
|
1334
|
+
key,
|
|
1335
|
+
label: t(`users-groups.${labelKey}`),
|
|
1336
|
+
type: 'text',
|
|
1337
|
+
}));
|
|
1338
|
+
}
|
|
1339
|
+
/** The scope label of a permission or role, `''` when it has none. */
|
|
1340
|
+
function scopeOf(item, lang) {
|
|
1341
|
+
return (resolveTranslated(item.scope?.displayName, lang) ||
|
|
1342
|
+
resolveTranslated(item.scope?.module?.name, lang));
|
|
1343
|
+
}
|
|
1344
|
+
/** `Name (scope)` — the scope tells apart same-named permissions of two modules. */
|
|
1345
|
+
function scopedLabel(item, lang) {
|
|
1346
|
+
const name = resolveTranslated(item.name, lang);
|
|
1347
|
+
const scope = scopeOf(item, lang);
|
|
1348
|
+
return scope ? `${name} (${scope})` : name;
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* `Name (Deleted, Not linked)` — the same flags the group drawer shows, so an
|
|
1352
|
+
* auditor does not read a deleted member as one who still holds the access.
|
|
1353
|
+
*/
|
|
1354
|
+
function memberLabel(member, t) {
|
|
1355
|
+
const name = member.displayName || member.fullName || member.userName || '';
|
|
1356
|
+
const flags = [];
|
|
1357
|
+
if (member.isDeleted)
|
|
1358
|
+
flags.push(t('users-groups.member-deleted'));
|
|
1359
|
+
else if (member.isActive === false)
|
|
1360
|
+
flags.push(t('users-groups.inactive'));
|
|
1361
|
+
if (!member.isLinkedToCurrentApplication) {
|
|
1362
|
+
flags.push(t('users-groups.not-linked'));
|
|
1363
|
+
}
|
|
1364
|
+
return flags.length ? `${name} (${flags.join(', ')})` : name;
|
|
1365
|
+
}
|
|
1366
|
+
/** On the wire `moduleName` is the item and `name` its category. */
|
|
1367
|
+
function accessibilityParts(item, lang) {
|
|
1368
|
+
return {
|
|
1369
|
+
item: resolveTranslated(item.moduleName, lang) || item.moduleKey || '',
|
|
1370
|
+
category: resolveTranslated(item.name, lang) || item.category || '',
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
function accessibilityLabel(item, lang) {
|
|
1374
|
+
const { item: label, category } = accessibilityParts(item, lang);
|
|
1375
|
+
return category ? `${label} (${category})` : label;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* Above this many users / groups the PDF asks first: the browser lays out
|
|
1380
|
+
* every page before its print preview opens, which gets slow — Excel suits a
|
|
1381
|
+
* list that long better.
|
|
1382
|
+
*/
|
|
1383
|
+
const PDF_CONFIRM_THRESHOLD = 200;
|
|
1384
|
+
const SEPARATOR = ' · ';
|
|
1385
|
+
function buildUserPrintPages(items, lang, t, formatDateTime) {
|
|
1386
|
+
return items.map(({ user, groups, roles, permissions, accessibilities }) => ({
|
|
1387
|
+
title: user.displayName || user.userName || '',
|
|
1388
|
+
facts: [
|
|
1389
|
+
[t('users-groups.user-name'), user.userName ?? ''],
|
|
1390
|
+
[t('users-groups.email'), user.email ?? ''],
|
|
1391
|
+
[t('users-groups.mobile'), user.mobile ?? ''],
|
|
1392
|
+
[
|
|
1393
|
+
t('users-groups.type'),
|
|
1394
|
+
t(user.isExternal ? 'users-groups.external' : 'users-groups.internal'),
|
|
1395
|
+
],
|
|
1396
|
+
[
|
|
1397
|
+
t('users-groups.last-seen'),
|
|
1398
|
+
user.lastLoginTime?.actualValue
|
|
1399
|
+
? formatDateTime(user.lastLoginTime.actualValue)
|
|
1400
|
+
: '',
|
|
1401
|
+
],
|
|
1402
|
+
],
|
|
1403
|
+
sections: [
|
|
1404
|
+
{
|
|
1405
|
+
title: t('users-groups.groups'),
|
|
1406
|
+
count: groups.length,
|
|
1407
|
+
inline: groups
|
|
1408
|
+
.map((group) => resolveTranslated(group.name, lang))
|
|
1409
|
+
.join(SEPARATOR),
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
title: t('users-groups.roles'),
|
|
1413
|
+
count: roles.length,
|
|
1414
|
+
table: {
|
|
1415
|
+
headers: [t('users-groups.role'), t('users-groups.scope')],
|
|
1416
|
+
rows: roles.map((role) => [
|
|
1417
|
+
resolveTranslated(role.name, lang),
|
|
1418
|
+
scopeOf(role, lang),
|
|
1419
|
+
]),
|
|
1420
|
+
},
|
|
1421
|
+
},
|
|
1422
|
+
permissionSection(permissions, lang, t),
|
|
1423
|
+
accessibilitySection(accessibilities, lang, t),
|
|
1424
|
+
],
|
|
1425
|
+
}));
|
|
1426
|
+
}
|
|
1427
|
+
function buildGroupPrintPages(items, lang, t) {
|
|
1428
|
+
return items.map(({ group, members, permissions, accessibilities, usagesCount }) => ({
|
|
1429
|
+
title: resolveTranslated(group.name, lang),
|
|
1430
|
+
facts: [
|
|
1431
|
+
[
|
|
1432
|
+
t('users-groups.description'),
|
|
1433
|
+
resolveTranslated(group.description, lang),
|
|
1434
|
+
],
|
|
1435
|
+
[t('users-groups.members-count'), String(members.length)],
|
|
1436
|
+
[t('users-groups.usages'), String(usagesCount)],
|
|
1437
|
+
],
|
|
1438
|
+
sections: [
|
|
1439
|
+
{
|
|
1440
|
+
title: t('users-groups.members'),
|
|
1441
|
+
count: members.length,
|
|
1442
|
+
inline: members
|
|
1443
|
+
.map((member) => memberLabel(member, t))
|
|
1444
|
+
.join(SEPARATOR),
|
|
1445
|
+
},
|
|
1446
|
+
permissionSection(permissions, lang, t),
|
|
1447
|
+
accessibilitySection(accessibilities, lang, t),
|
|
1448
|
+
],
|
|
1449
|
+
}));
|
|
1450
|
+
}
|
|
1451
|
+
/** One row per module, not per permission: 200 permissions stay ~15 rows. */
|
|
1452
|
+
function permissionSection(permissions, lang, t) {
|
|
1453
|
+
return {
|
|
1454
|
+
title: t('users-groups.permissions'),
|
|
1455
|
+
count: permissions.length,
|
|
1456
|
+
table: {
|
|
1457
|
+
headers: [t('users-groups.module'), t('users-groups.permissions')],
|
|
1458
|
+
rows: groupedRows(permissions.map((permission) => [
|
|
1459
|
+
scopeOf(permission, lang) || t('users-groups.unknown-scope'),
|
|
1460
|
+
resolveTranslated(permission.name, lang),
|
|
1461
|
+
]), lang),
|
|
1462
|
+
},
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
/** One row per category. */
|
|
1466
|
+
function accessibilitySection(accessibilities, lang, t) {
|
|
1467
|
+
return {
|
|
1468
|
+
title: t('users-groups.accessibilities'),
|
|
1469
|
+
count: accessibilities.length,
|
|
1470
|
+
table: {
|
|
1471
|
+
headers: [t('users-groups.category'), t('users-groups.items')],
|
|
1472
|
+
rows: groupedRows(accessibilities.map((accessibility) => {
|
|
1473
|
+
const { item, category } = accessibilityParts(accessibility, lang);
|
|
1474
|
+
return [category || t('users-groups.unknown-scope'), item];
|
|
1475
|
+
}), lang),
|
|
1476
|
+
},
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
/** `[group, item]` pairs → one sorted row per group, its items sorted and joined. */
|
|
1480
|
+
function groupedRows(pairs, lang) {
|
|
1481
|
+
const byGroup = new Map();
|
|
1482
|
+
for (const [group, item] of pairs) {
|
|
1483
|
+
byGroup.set(group, [...(byGroup.get(group) ?? []), item]);
|
|
1484
|
+
}
|
|
1485
|
+
const compare = (a, b) => a.localeCompare(b, lang);
|
|
1486
|
+
return [...byGroup.entries()]
|
|
1487
|
+
.sort(([a], [b]) => compare(a, b))
|
|
1488
|
+
.map(([group, names]) => [group, names.sort(compare).join(SEPARATOR)]);
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Text-only print layout — no images, fills or web fonts keeps the saved PDF
|
|
1492
|
+
* small. One plain section per person, starting a new page. Long grids
|
|
1493
|
+
* split across pages like any table; their header repeats, and its first
|
|
1494
|
+
* row names the person, so a continuation page still says whose access it is.
|
|
1495
|
+
*/
|
|
1496
|
+
function renderPrintPages(pages, rtl, emptyText) {
|
|
1497
|
+
const region = element('div', 'mt-access-print');
|
|
1498
|
+
region.dir = rtl ? 'rtl' : 'ltr';
|
|
1499
|
+
for (const page of pages) {
|
|
1500
|
+
const section = region.appendChild(element('section', 'mt-access-page'));
|
|
1501
|
+
section.appendChild(element('h1', '', page.title));
|
|
1502
|
+
const facts = section.appendChild(element('table', 'mt-access-facts'));
|
|
1503
|
+
for (const [label, value] of page.facts) {
|
|
1504
|
+
const row = facts.insertRow();
|
|
1505
|
+
row.appendChild(element('th', '', label));
|
|
1506
|
+
row.appendChild(element('td', '', value || emptyText));
|
|
1507
|
+
}
|
|
1508
|
+
for (const part of page.sections) {
|
|
1509
|
+
section.appendChild(element('h2', '', `${part.title} (${part.count})`));
|
|
1510
|
+
if (!part.count) {
|
|
1511
|
+
section.appendChild(element('p', 'mt-access-empty', emptyText));
|
|
1512
|
+
}
|
|
1513
|
+
else if (part.table) {
|
|
1514
|
+
section.appendChild(gridTable(part.table, page.title));
|
|
1515
|
+
}
|
|
1516
|
+
else {
|
|
1517
|
+
section.appendChild(element('p', '', part.inline ?? ''));
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
return region;
|
|
1522
|
+
}
|
|
1523
|
+
function gridTable(table, owner) {
|
|
1524
|
+
const grid = element('table', 'mt-access-grid');
|
|
1525
|
+
const head = grid.createTHead();
|
|
1526
|
+
const ownerCell = head
|
|
1527
|
+
.insertRow()
|
|
1528
|
+
.appendChild(element('th', 'mt-access-owner', owner));
|
|
1529
|
+
ownerCell.colSpan = table.headers.length;
|
|
1530
|
+
const columns = head.insertRow();
|
|
1531
|
+
for (const header of table.headers)
|
|
1532
|
+
columns.appendChild(element('th', '', header));
|
|
1533
|
+
const body = grid.createTBody();
|
|
1534
|
+
for (const cells of table.rows) {
|
|
1535
|
+
const row = body.insertRow();
|
|
1536
|
+
for (const cell of cells)
|
|
1537
|
+
row.appendChild(element('td', '', cell));
|
|
1538
|
+
}
|
|
1539
|
+
return grid;
|
|
1540
|
+
}
|
|
1541
|
+
function element(tag, className = '', text) {
|
|
1542
|
+
const node = document.createElement(tag);
|
|
1543
|
+
if (className)
|
|
1544
|
+
node.className = className;
|
|
1545
|
+
if (text !== undefined)
|
|
1546
|
+
node.textContent = text;
|
|
1547
|
+
return node;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
const PRINTING_CLASS = 'mt-access-printing';
|
|
1551
|
+
const STYLE_ID = 'mt-access-print-style';
|
|
1552
|
+
/**
|
|
1553
|
+
* Print-only, text-only styles: no fills, images or web fonts, so a saved PDF
|
|
1554
|
+
* stays small. Every person starts a new page. Added for one print and
|
|
1555
|
+
* removed after it — `@page` cannot be scoped, so leaving it would change the
|
|
1556
|
+
* margins of every later print in the app.
|
|
1557
|
+
*/
|
|
1558
|
+
const PRINT_CSS = `
|
|
1559
|
+
.mt-access-print { display: none; }
|
|
1560
|
+
@media print {
|
|
1561
|
+
@page { margin: 12mm; }
|
|
1562
|
+
html.${PRINTING_CLASS} body > *:not(.mt-access-print) { display: none !important; }
|
|
1563
|
+
html.${PRINTING_CLASS}, html.${PRINTING_CLASS} body { height: auto !important;
|
|
1564
|
+
overflow: visible !important; background: #fff !important; }
|
|
1565
|
+
html.${PRINTING_CLASS} .mt-access-print { display: block !important;
|
|
1566
|
+
--mt-access-accent: var(--p-primary-700, #4b2a9b);
|
|
1567
|
+
--mt-access-tint: var(--p-primary-50, #f3f0fa);
|
|
1568
|
+
--mt-access-line: var(--p-primary-200, #d6cdee);
|
|
1569
|
+
color: #1f2937; font: 10pt Arial, 'Segoe UI', Tahoma, sans-serif;
|
|
1570
|
+
-webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
1571
|
+
/* Inner padding too: the print dialog's margins may be set to None. */
|
|
1572
|
+
.mt-access-page { padding: 6mm 8mm; }
|
|
1573
|
+
.mt-access-page + .mt-access-page { break-before: page; }
|
|
1574
|
+
.mt-access-print h1 { font-size: 15pt; font-weight: 700; margin: 0 0 8pt;
|
|
1575
|
+
padding-bottom: 5pt; color: var(--mt-access-accent);
|
|
1576
|
+
border-bottom: 2pt solid var(--mt-access-accent); }
|
|
1577
|
+
.mt-access-print h2 { font-size: 11pt; font-weight: 700; margin: 12pt 0 5pt;
|
|
1578
|
+
color: var(--mt-access-accent); }
|
|
1579
|
+
.mt-access-print p { margin: 0; }
|
|
1580
|
+
.mt-access-facts, .mt-access-grid { width: 100%; border-collapse: collapse; }
|
|
1581
|
+
.mt-access-facts th, .mt-access-facts td, .mt-access-grid th, .mt-access-grid td {
|
|
1582
|
+
border: 0.5pt solid var(--mt-access-line); padding: 4pt 6pt; text-align: start;
|
|
1583
|
+
vertical-align: top; overflow-wrap: anywhere; }
|
|
1584
|
+
.mt-access-facts th, .mt-access-grid td:first-child { width: 28%; }
|
|
1585
|
+
.mt-access-facts th, .mt-access-grid th { font-weight: 600; }
|
|
1586
|
+
.mt-access-facts th { background: var(--mt-access-tint); color: var(--mt-access-accent); }
|
|
1587
|
+
.mt-access-grid thead tr:last-child th { background: var(--mt-access-accent); color: #fff; }
|
|
1588
|
+
.mt-access-grid th.mt-access-owner { font-weight: 400; font-size: 8pt;
|
|
1589
|
+
color: #6b7280; background: #fff; border-color: transparent; padding: 0 0 2pt; }
|
|
1590
|
+
.mt-access-grid tbody tr:nth-child(even) td { background: #f9fafb; }
|
|
1591
|
+
.mt-access-grid tr { break-inside: avoid; }
|
|
1592
|
+
.mt-access-empty { color: #6b7280; }
|
|
1593
|
+
}
|
|
1594
|
+
`;
|
|
1595
|
+
/**
|
|
1596
|
+
* The cleanup of a print whose `afterprint` never came (some mobile browsers
|
|
1597
|
+
* and webviews do not send it). Run before the next print, so a stale region
|
|
1598
|
+
* is not printed twice and the page title is restored.
|
|
1599
|
+
*/
|
|
1600
|
+
let pendingPrintCleanup = null;
|
|
1601
|
+
/**
|
|
1602
|
+
* Downloads the open Users & Groups tab for an auditor — Excel (one row per
|
|
1603
|
+
* user / group) or PDF (one page each, printed through the browser). The
|
|
1604
|
+
* backend returns the whole list with each row's access in one call
|
|
1605
|
+
* (`.github/instructions/users-groups/Users-Groups-Export-Backend-Contract.md`).
|
|
1606
|
+
* A failed request writes nothing — the host's message/error interceptors
|
|
1607
|
+
* show the error, as for every other call.
|
|
1608
|
+
*
|
|
1609
|
+
* Provided by the component that triggers it, with `MTDateFormatPipe`.
|
|
1610
|
+
*/
|
|
1611
|
+
class AccessExportService {
|
|
1612
|
+
http = inject(HttpClient);
|
|
1613
|
+
transloco = inject(TranslocoService);
|
|
1614
|
+
exporter = inject(TableExportService);
|
|
1615
|
+
confirmation = inject(ConfirmationService);
|
|
1616
|
+
dateFormat = inject(MTDateFormatPipe);
|
|
1617
|
+
formatDateTime = (value) => this.dateFormat.transform(value, 'dateTime');
|
|
1618
|
+
users() {
|
|
1619
|
+
return this.http
|
|
1620
|
+
.get('identity/users/access-export')
|
|
1621
|
+
.pipe(map((response) => response.data));
|
|
1622
|
+
}
|
|
1623
|
+
groups() {
|
|
1624
|
+
return this.http
|
|
1625
|
+
.get('identity/groups/access-export')
|
|
1626
|
+
.pipe(map((response) => response.data));
|
|
1627
|
+
}
|
|
1628
|
+
download(tab) {
|
|
1629
|
+
const { lang, t } = this.language();
|
|
1630
|
+
const sheet$ = tab === 'users'
|
|
1631
|
+
? this.users().pipe(map((items) => buildUserExport(items, lang, t, this.formatDateTime)))
|
|
1632
|
+
: this.groups().pipe(map((items) => buildGroupExport(items, lang, t)));
|
|
1633
|
+
return sheet$.pipe(map(({ columns, rows }) => this.exporter.exportToExcel({
|
|
1634
|
+
columns,
|
|
1635
|
+
rows,
|
|
1636
|
+
filename: fileName(tab),
|
|
1637
|
+
resolveValue: (row, column) => row[column.key] ?? '',
|
|
1638
|
+
})));
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Opens the browser's print dialog (Save as PDF) with one page per user or
|
|
1642
|
+
* group. Above `PDF_CONFIRM_THRESHOLD` it asks first and suggests Excel.
|
|
1643
|
+
*/
|
|
1644
|
+
print(tab) {
|
|
1645
|
+
const { lang, t } = this.language();
|
|
1646
|
+
const pages$ = tab === 'users'
|
|
1647
|
+
? this.users().pipe(map((items) => buildUserPrintPages(items, lang, t, this.formatDateTime)))
|
|
1648
|
+
: this.groups().pipe(map((items) => buildGroupPrintPages(items, lang, t)));
|
|
1649
|
+
return pages$.pipe(switchMap((pages) => pages.length > PDF_CONFIRM_THRESHOLD
|
|
1650
|
+
? this.confirmLargePrint(pages.length).pipe(map((accepted) => (accepted ? pages : null)))
|
|
1651
|
+
: of(pages)), map((pages) => {
|
|
1652
|
+
if (pages)
|
|
1653
|
+
this.printPages(pages, fileName(tab), lang === 'ar');
|
|
1654
|
+
}));
|
|
1655
|
+
}
|
|
1656
|
+
/** Emits once: true on Continue, false on Cancel / close / Escape. */
|
|
1657
|
+
confirmLargePrint(count) {
|
|
1658
|
+
const t = (key, params) => this.transloco.translate(key, params);
|
|
1659
|
+
return new Observable((subscriber) => {
|
|
1660
|
+
const answer = (accepted) => {
|
|
1661
|
+
subscriber.next(accepted);
|
|
1662
|
+
subscriber.complete();
|
|
1663
|
+
};
|
|
1664
|
+
this.confirmation.confirm({
|
|
1665
|
+
type: 'dialog',
|
|
1666
|
+
header: t('users-groups.large-export-header'),
|
|
1667
|
+
message: t('users-groups.large-export-message', { count }),
|
|
1668
|
+
icon: 'alert.alert-triangle',
|
|
1669
|
+
acceptLabel: t('users-groups.continue'),
|
|
1670
|
+
rejectLabel: t('users-groups.cancel'),
|
|
1671
|
+
accept: () => answer(true),
|
|
1672
|
+
reject: () => answer(false),
|
|
1673
|
+
});
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
printPages(pages, title, rtl) {
|
|
1677
|
+
pendingPrintCleanup?.();
|
|
1678
|
+
const isRtl = rtl || document.documentElement.dir.toLowerCase() === 'rtl';
|
|
1679
|
+
const region = renderPrintPages(pages, isRtl, '—');
|
|
1680
|
+
const style = document.createElement('style');
|
|
1681
|
+
style.id = STYLE_ID;
|
|
1682
|
+
style.textContent = PRINT_CSS;
|
|
1683
|
+
document.head.appendChild(style);
|
|
1684
|
+
document.body.appendChild(region);
|
|
1685
|
+
document.documentElement.classList.add(PRINTING_CLASS);
|
|
1686
|
+
// Chrome names the saved PDF after the document title.
|
|
1687
|
+
const previousTitle = document.title;
|
|
1688
|
+
document.title = title;
|
|
1689
|
+
const cleanup = () => {
|
|
1690
|
+
document.documentElement.classList.remove(PRINTING_CLASS);
|
|
1691
|
+
region.remove();
|
|
1692
|
+
style.remove();
|
|
1693
|
+
document.title = previousTitle;
|
|
1694
|
+
window.removeEventListener('afterprint', cleanup);
|
|
1695
|
+
pendingPrintCleanup = null;
|
|
1696
|
+
};
|
|
1697
|
+
pendingPrintCleanup = cleanup;
|
|
1698
|
+
window.addEventListener('afterprint', cleanup);
|
|
1699
|
+
window.print();
|
|
1700
|
+
}
|
|
1701
|
+
language() {
|
|
1702
|
+
return {
|
|
1703
|
+
lang: this.transloco.getActiveLang().startsWith('ar') ? 'ar' : 'en',
|
|
1704
|
+
t: (key) => this.transloco.translate(key),
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: AccessExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1708
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: AccessExportService });
|
|
1709
|
+
}
|
|
1710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: AccessExportService, decorators: [{
|
|
1711
|
+
type: Injectable
|
|
1712
|
+
}] });
|
|
1713
|
+
/** `users-access-YYYY-MM-DD` — the day they exported, in their time zone. */
|
|
1714
|
+
function fileName(tab) {
|
|
1715
|
+
const now = new Date();
|
|
1716
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
1717
|
+
return `${tab}-access-${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Excel and PDF buttons for the Users / Groups table, placed in its
|
|
1722
|
+
* `#captionEnd` slot next to Add. Opt-in per host: shown only when a route on
|
|
1723
|
+
* the path sets `data: { exportable: true }` — a backend without the
|
|
1724
|
+
* access-export endpoints would answer every click with a 404.
|
|
1725
|
+
*/
|
|
1726
|
+
class AccessExportActions {
|
|
1727
|
+
tab = input.required(...(ngDevMode ? [{ debugName: "tab" }] : /* istanbul ignore next */ []));
|
|
1728
|
+
service = inject(AccessExportService);
|
|
1729
|
+
destroyRef = inject(DestroyRef);
|
|
1730
|
+
enabled = inject(ActivatedRoute).pathFromRoot.some((route) => route.snapshot.data['exportable'] === true);
|
|
1731
|
+
busy = signal(false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1732
|
+
exportExcel() {
|
|
1733
|
+
this.run(() => this.service.download(this.tab()));
|
|
1734
|
+
}
|
|
1735
|
+
exportPdf() {
|
|
1736
|
+
this.run(() => this.service.print(this.tab()));
|
|
1737
|
+
}
|
|
1738
|
+
/** One export at a time; the host's interceptors show a failed request. */
|
|
1739
|
+
run(job) {
|
|
1740
|
+
if (this.busy())
|
|
1741
|
+
return;
|
|
1742
|
+
this.busy.set(true);
|
|
1743
|
+
job()
|
|
1744
|
+
.pipe(finalize(() => this.busy.set(false)), takeUntilDestroyed(this.destroyRef))
|
|
1745
|
+
.subscribe({ error: () => undefined });
|
|
1746
|
+
}
|
|
1747
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: AccessExportActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1748
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: AccessExportActions, isStandalone: true, selector: "mt-access-export-actions", inputs: { tab: { classPropertyName: "tab", publicName: "tab", isSignal: true, isRequired: true, transformFunction: null } }, providers: [AccessExportService, MTDateFormatPipe], ngImport: i0, template: "@if (enabled) {\r\n <mt-table-actions-menu\r\n [exportable]=\"true\"\r\n [printable]=\"true\"\r\n (exportRequested)=\"exportExcel()\"\r\n (printRequested)=\"exportPdf()\"\r\n />\r\n}\r\n", dependencies: [{ kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }] });
|
|
1749
|
+
}
|
|
1750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: AccessExportActions, decorators: [{
|
|
1751
|
+
type: Component,
|
|
1752
|
+
args: [{ selector: 'mt-access-export-actions', standalone: true, imports: [TableActionsMenu], providers: [AccessExportService, MTDateFormatPipe], template: "@if (enabled) {\r\n <mt-table-actions-menu\r\n [exportable]=\"true\"\r\n [printable]=\"true\"\r\n (exportRequested)=\"exportExcel()\"\r\n (printRequested)=\"exportPdf()\"\r\n />\r\n}\r\n" }]
|
|
1753
|
+
}], propDecorators: { tab: [{ type: i0.Input, args: [{ isSignal: true, alias: "tab", required: true }] }] } });
|
|
1754
|
+
|
|
1755
|
+
class UserForm {
|
|
1756
|
+
passwordPattern = '^(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?=.*[a-z])(?=.*\\d).{6,}$';
|
|
1757
|
+
modal = inject(ModalService);
|
|
1758
|
+
ref = inject(ModalRef);
|
|
1759
|
+
userForEdit = input(null, ...(ngDevMode ? [{ debugName: "userForEdit" }] : /* istanbul ignore next */ []));
|
|
1760
|
+
selectedTab = signal('internal', ...(ngDevMode ? [{ debugName: "selectedTab" }] : /* istanbul ignore next */ []));
|
|
1761
|
+
translocoService = inject(TranslocoService);
|
|
1762
|
+
tabsList = [
|
|
1763
|
+
{
|
|
1764
|
+
label: this.translocoService.translate('users-groups.internal'),
|
|
1765
|
+
value: 'internal',
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
label: this.translocoService.translate('users-groups.external'),
|
|
1769
|
+
value: 'external',
|
|
1770
|
+
},
|
|
1771
|
+
];
|
|
1772
|
+
facade = inject(UsersGroupsFacade);
|
|
1773
|
+
selectedUser = this.facade.selectedUser;
|
|
1774
|
+
internalUserFormControl = new FormControl();
|
|
1775
|
+
externalUserFormControl = new FormControl();
|
|
1776
|
+
internalFormEvents = toSignal(this.internalUserFormControl.events, { initialValue: null });
|
|
1777
|
+
externalFormEvents = toSignal(this.externalUserFormControl.events, { initialValue: null });
|
|
1778
|
+
getUserFormLoading = this.facade.isLoadingUser;
|
|
1779
|
+
createUpdateUserLoading = this.facade.isSavingUser;
|
|
1780
|
+
isEditMode = computed(() => !!this.userForEdit()?.userName, ...(ngDevMode ? [{ debugName: "isEditMode" }] : /* istanbul ignore next */ []));
|
|
1781
|
+
isSubmitDisabled = computed(() => {
|
|
1782
|
+
if (this.createUpdateUserLoading()) {
|
|
1783
|
+
return true;
|
|
1784
|
+
}
|
|
1785
|
+
if (this.isEditMode()) {
|
|
1786
|
+
this.externalFormEvents();
|
|
1787
|
+
return (this.externalUserFormControl.pristine ||
|
|
1788
|
+
!this.externalUserFormControl.valid);
|
|
1789
|
+
}
|
|
1790
|
+
if (this.selectedTab() === 'internal') {
|
|
1791
|
+
this.internalFormEvents();
|
|
1792
|
+
return !this.internalUserFormControl.valid;
|
|
1793
|
+
}
|
|
1794
|
+
this.externalFormEvents();
|
|
1795
|
+
return !this.externalUserFormControl.valid;
|
|
1796
|
+
}, ...(ngDevMode ? [{ debugName: "isSubmitDisabled" }] : /* istanbul ignore next */ []));
|
|
1797
|
+
context = new HttpContext().set(REQUEST_CONTEXT, {
|
|
1798
|
+
useBaseUrl: false,
|
|
1799
|
+
});
|
|
1800
|
+
contextGatway = new HttpContext().set(REQUEST_CONTEXT, {
|
|
1801
|
+
useBaseUrl: true,
|
|
1802
|
+
});
|
|
1803
|
+
internalUserFormConfig = signal({
|
|
1804
|
+
sections: [
|
|
1805
|
+
{
|
|
1806
|
+
key: 'internalUserFormConfig',
|
|
1807
|
+
type: 'header',
|
|
1808
|
+
order: 1,
|
|
1809
|
+
fields: [
|
|
1810
|
+
new UserSearchFieldConfig({
|
|
1811
|
+
key: 'userField',
|
|
1812
|
+
label: this.translocoService.translate('users-groups.user-name'),
|
|
1813
|
+
apiUrl: 'Identity/users/external/ad',
|
|
1814
|
+
context: this.context,
|
|
1815
|
+
hideUnlinkedHint: true,
|
|
1816
|
+
validators: [ValidatorConfig.required()],
|
|
1817
|
+
order: 1,
|
|
1818
|
+
}),
|
|
1819
|
+
],
|
|
1820
|
+
},
|
|
1821
|
+
],
|
|
1822
|
+
}, ...(ngDevMode ? [{ debugName: "internalUserFormConfig" }] : /* istanbul ignore next */ []));
|
|
1823
|
+
fieldColSpan = computed(() => (this.userForEdit()?.userName ? 12 : 6), ...(ngDevMode ? [{ debugName: "fieldColSpan" }] : /* istanbul ignore next */ []));
|
|
1824
|
+
externalUserFormConfig = computed(() => ({
|
|
1825
|
+
sections: [
|
|
1826
|
+
{
|
|
1827
|
+
key: 'externalUserFormConfig',
|
|
1828
|
+
type: 'header',
|
|
1829
|
+
order: 1,
|
|
1830
|
+
fields: [
|
|
1831
|
+
new UploadFileFieldConfig({
|
|
1832
|
+
key: 'image',
|
|
1833
|
+
label: this.translocoService.translate('users-groups.avatar'),
|
|
1834
|
+
shape: 'circle',
|
|
1835
|
+
endPoint: 'avatar',
|
|
1836
|
+
context: this.contextGatway,
|
|
1837
|
+
colSpan: 12,
|
|
1838
|
+
order: 1,
|
|
1839
|
+
}),
|
|
1840
|
+
{
|
|
1841
|
+
key: 'displayName',
|
|
1842
|
+
label: this.translocoService.translate('users-groups.display-name'),
|
|
1843
|
+
placeholder: this.translocoService.translate('users-groups.display-name'),
|
|
1844
|
+
validators: [ValidatorConfig.required()],
|
|
1845
|
+
colSpan: this.fieldColSpan(),
|
|
1846
|
+
order: 2,
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
key: 'email',
|
|
1850
|
+
label: this.translocoService.translate('users-groups.email'),
|
|
1851
|
+
placeholder: this.translocoService.translate('users-groups.email'),
|
|
1852
|
+
inputType: 'email',
|
|
1853
|
+
required: true,
|
|
1854
|
+
hint: this.translocoService.translate('users-groups.email-hint'),
|
|
1855
|
+
validators: [
|
|
1856
|
+
// No hardcoded message: the generic translated "required" copy
|
|
1857
|
+
// covers this field fine, and a literal English string here
|
|
1858
|
+
// was overriding it in every non-English locale.
|
|
1859
|
+
ValidatorConfig.required(),
|
|
1860
|
+
ValidatorConfig.pattern('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z]{2,}$', this.translocoService.translate('users-groups.email-invalid')),
|
|
1861
|
+
],
|
|
1862
|
+
colSpan: this.fieldColSpan(),
|
|
1863
|
+
order: 3,
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
key: 'mobile',
|
|
1867
|
+
label: this.translocoService.translate('users-groups.mobile'),
|
|
1868
|
+
placeholder: this.translocoService.translate('users-groups.mobile'),
|
|
1869
|
+
hint: this.translocoService.translate('users-groups.mobile-hint'),
|
|
1870
|
+
validators: [
|
|
1871
|
+
ValidatorConfig.required(),
|
|
1872
|
+
ValidatorConfig.pattern('^\\+?[0-9]{7,15}$', this.translocoService.translate('users-groups.mobile-invalid')),
|
|
1873
|
+
],
|
|
1874
|
+
colSpan: this.fieldColSpan(),
|
|
1875
|
+
order: 4,
|
|
1876
|
+
},
|
|
1877
|
+
],
|
|
1878
|
+
},
|
|
1879
|
+
],
|
|
1880
|
+
}), ...(ngDevMode ? [{ debugName: "externalUserFormConfig" }] : /* istanbul ignore next */ []));
|
|
1881
|
+
constructor() {
|
|
1882
|
+
effect(() => {
|
|
1883
|
+
const userName = this.userForEdit()?.userName;
|
|
1884
|
+
const selectedUser = this.selectedUser();
|
|
1885
|
+
if (selectedUser && userName) {
|
|
1886
|
+
untracked(() => {
|
|
1887
|
+
this.selectedTab.set('external');
|
|
1888
|
+
const data = {
|
|
1889
|
+
...selectedUser,
|
|
1890
|
+
image: selectedUser.image,
|
|
1891
|
+
};
|
|
1892
|
+
this.externalUserFormControl.patchValue(data, { emitEvent: false });
|
|
1893
|
+
this.externalUserFormControl.markAsPristine({ emitEvent: false });
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
ngOnInit() {
|
|
1899
|
+
if (this.userForEdit()?.userName) {
|
|
1900
|
+
this.facade.getUser(this.userForEdit()?.userName || null);
|
|
1901
|
+
}
|
|
1902
|
+
this.updateFormFields();
|
|
1595
1903
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1904
|
+
onSubmit() {
|
|
1905
|
+
if (this.userForEdit()?.userName) {
|
|
1906
|
+
const payload = {
|
|
1907
|
+
displayName: this.externalUserFormControl.value?.displayName,
|
|
1908
|
+
email: this.externalUserFormControl.value?.email,
|
|
1909
|
+
mobile: this.externalUserFormControl.value?.mobile,
|
|
1910
|
+
image: this.externalUserFormControl.value?.image?.fileName,
|
|
1911
|
+
};
|
|
1912
|
+
this.facade.updateUser(this.userForEdit()?.userName, payload).subscribe({
|
|
1913
|
+
next: () => {
|
|
1914
|
+
this.ref.close(true);
|
|
1915
|
+
},
|
|
1916
|
+
error: () => { },
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
let payload = {};
|
|
1921
|
+
if (this.selectedTab() === 'internal') {
|
|
1922
|
+
payload = {
|
|
1923
|
+
userName: this.internalUserFormControl.value?.userField?.userName,
|
|
1924
|
+
isExternal: false,
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
else {
|
|
1928
|
+
payload = {
|
|
1929
|
+
id: '',
|
|
1930
|
+
userName: this.externalUserFormControl.value?.userName,
|
|
1931
|
+
displayName: this.externalUserFormControl.value?.displayName,
|
|
1932
|
+
email: this.externalUserFormControl.value?.email,
|
|
1933
|
+
mobile: this.externalUserFormControl.value?.mobile,
|
|
1934
|
+
password: this.externalUserFormControl.value?.password,
|
|
1935
|
+
isExternal: true,
|
|
1936
|
+
image: this.externalUserFormControl.value?.image?.fileName,
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
this.facade.createUser(payload).subscribe({
|
|
1940
|
+
next: () => {
|
|
1941
|
+
this.ref.close(true);
|
|
1942
|
+
},
|
|
1943
|
+
error: () => { },
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
updateFormFields() {
|
|
1948
|
+
if (!this.userForEdit()?.userName) {
|
|
1949
|
+
const passwordRules = this.translocoService.translate('users-groups.password-rules');
|
|
1950
|
+
this.externalUserFormConfig().sections[0].fields.push({
|
|
1951
|
+
key: 'userName',
|
|
1952
|
+
label: this.translocoService.translate('users-groups.user-name'),
|
|
1953
|
+
placeholder: this.translocoService.translate('users-groups.user-name'),
|
|
1954
|
+
hint: this.translocoService.translate('users-groups.user-name-hint'),
|
|
1955
|
+
validators: [
|
|
1956
|
+
ValidatorConfig.required(),
|
|
1957
|
+
ValidatorConfig.pattern('^[a-zA-Z0-9]+$', this.translocoService.translate('users-groups.user-name-invalid')),
|
|
1958
|
+
],
|
|
1959
|
+
colSpan: 6,
|
|
1960
|
+
order: 5,
|
|
1961
|
+
hidden: !!this.userForEdit()?.userName,
|
|
1962
|
+
}, {
|
|
1963
|
+
key: 'password',
|
|
1964
|
+
label: this.translocoService.translate('users-groups.password'),
|
|
1965
|
+
placeholder: this.translocoService.translate('users-groups.password'),
|
|
1966
|
+
hint: passwordRules,
|
|
1967
|
+
validators: [
|
|
1968
|
+
ValidatorConfig.required(),
|
|
1969
|
+
ValidatorConfig.pattern(this.passwordPattern, passwordRules),
|
|
1970
|
+
],
|
|
1971
|
+
inputType: 'password',
|
|
1972
|
+
colSpan: 6,
|
|
1973
|
+
order: 6,
|
|
1974
|
+
hidden: !!this.userForEdit()?.userName,
|
|
1975
|
+
}, {
|
|
1976
|
+
key: 'confirmPassword',
|
|
1977
|
+
label: this.translocoService.translate('users-groups.confirm-password'),
|
|
1978
|
+
placeholder: this.translocoService.translate('users-groups.confirm-password'),
|
|
1979
|
+
hint: passwordRules,
|
|
1980
|
+
validators: [
|
|
1981
|
+
ValidatorConfig.required(),
|
|
1982
|
+
ValidatorConfig.pattern(this.passwordPattern, passwordRules),
|
|
1983
|
+
ValidatorConfig.custom((value, control) => {
|
|
1984
|
+
const password = control?.parent?.get('password')?.value;
|
|
1985
|
+
return !value || !password || value === password;
|
|
1986
|
+
}, this.translocoService.translate('users-groups.passwords-must-match')),
|
|
1987
|
+
],
|
|
1988
|
+
inputType: 'password',
|
|
1989
|
+
colSpan: 6,
|
|
1990
|
+
order: 6,
|
|
1991
|
+
hidden: !!this.userForEdit()?.userName,
|
|
1992
|
+
});
|
|
1602
1993
|
}
|
|
1603
1994
|
}
|
|
1995
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1996
|
+
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() ? t('save') : t('add')\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"], 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"] }] });
|
|
1604
1997
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1998
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserForm, decorators: [{
|
|
1999
|
+
type: Component,
|
|
2000
|
+
args: [{ selector: 'mt-user-form', standalone: true, imports: [
|
|
2001
|
+
CommonModule,
|
|
2002
|
+
Button,
|
|
2003
|
+
TranslocoDirective,
|
|
2004
|
+
SkeletonModule,
|
|
2005
|
+
DynamicForm,
|
|
2006
|
+
ReactiveFormsModule,
|
|
2007
|
+
Tabs,
|
|
2008
|
+
TranslocoPipe,
|
|
2009
|
+
], 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 (!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() ? t('save') : t('add')\"\r\n (click)=\"onSubmit()\"\r\n [loading]=\"createUpdateUserLoading()\"\r\n [disabled]=\"isSubmitDisabled()\"\r\n />\r\n </div>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"] }]
|
|
2010
|
+
}], ctorParameters: () => [], propDecorators: { userForEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "userForEdit", required: false }] }] } });
|
|
2011
|
+
|
|
2012
|
+
class ResetPasswordForm {
|
|
2013
|
+
passwordPattern = '^(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?=.*[a-z])(?=.*\\d).{6,}$';
|
|
2014
|
+
modal = inject(ModalService);
|
|
2015
|
+
ref = inject(ModalRef);
|
|
2016
|
+
translocoService = inject(TranslocoService);
|
|
2017
|
+
facade = inject(UsersGroupsFacade);
|
|
2018
|
+
user = input(null, ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
|
|
2019
|
+
passwordResetLoading = this.facade.isResettingPassword;
|
|
2020
|
+
resetPasswordFormControl = new FormControl();
|
|
2021
|
+
resetPasswordFormConfig = computed(() => ({
|
|
2022
|
+
sections: [
|
|
2023
|
+
{
|
|
2024
|
+
key: 'resetPasswordFormConfig',
|
|
2025
|
+
type: 'header',
|
|
2026
|
+
order: 1,
|
|
2027
|
+
fields: [
|
|
2028
|
+
{
|
|
2029
|
+
key: 'displayName',
|
|
2030
|
+
inputType: 'text',
|
|
2031
|
+
disabled: true,
|
|
2032
|
+
label: this.translocoService.translate('users-groups.user'),
|
|
2033
|
+
value: this.user()?.displayName || '',
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
key: 'newPassword',
|
|
2037
|
+
inputType: 'password',
|
|
2038
|
+
label: this.translocoService.translate('users-groups.new-password'),
|
|
2039
|
+
hint: this.translocoService.translate('users-groups.password-rules'),
|
|
2040
|
+
validators: [
|
|
2041
|
+
ValidatorConfig.required(),
|
|
2042
|
+
ValidatorConfig.pattern(this.passwordPattern, this.translocoService.translate('users-groups.password-rules')),
|
|
2043
|
+
],
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
key: 'confirmPassword',
|
|
2047
|
+
inputType: 'password',
|
|
2048
|
+
label: this.translocoService.translate('users-groups.confirm-password'),
|
|
2049
|
+
placeholder: this.translocoService.translate('users-groups.confirm-password'),
|
|
2050
|
+
hint: this.translocoService.translate('users-groups.password-rules'),
|
|
2051
|
+
validators: [
|
|
2052
|
+
ValidatorConfig.required(),
|
|
2053
|
+
ValidatorConfig.pattern(this.passwordPattern, this.translocoService.translate('users-groups.password-rules')),
|
|
2054
|
+
ValidatorConfig.custom((value, control) => {
|
|
2055
|
+
const newPassword = control?.parent?.get('newPassword')?.value;
|
|
2056
|
+
return !value || !newPassword || value === newPassword;
|
|
2057
|
+
}, this.translocoService.translate('users-groups.passwords-must-match')),
|
|
2058
|
+
],
|
|
2059
|
+
},
|
|
2060
|
+
],
|
|
2061
|
+
},
|
|
2062
|
+
],
|
|
2063
|
+
}), ...(ngDevMode ? [{ debugName: "resetPasswordFormConfig" }] : /* istanbul ignore next */ []));
|
|
2064
|
+
ngOnInit() {
|
|
2065
|
+
this.resetPasswordFormControl.setValue({
|
|
2066
|
+
displayName: this.user()?.displayName || '',
|
|
2067
|
+
newPassword: '',
|
|
2068
|
+
confirmPassword: '',
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
onSubmit() {
|
|
2072
|
+
const payload = {
|
|
2073
|
+
userName: this.user()?.userName,
|
|
2074
|
+
newPassword: this.resetPasswordFormControl.value?.newPassword,
|
|
2075
|
+
};
|
|
2076
|
+
this.facade.resetUserPassword(this.user()?.userName, payload).subscribe({
|
|
2077
|
+
next: () => {
|
|
2078
|
+
this.ref.close(true);
|
|
2079
|
+
},
|
|
2080
|
+
error: () => { },
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2084
|
+
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" }] });
|
|
1609
2085
|
}
|
|
2086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ResetPasswordForm, decorators: [{
|
|
2087
|
+
type: Component,
|
|
2088
|
+
args: [{ selector: 'mt-reset-password-form', standalone: true, imports: [
|
|
2089
|
+
CommonModule,
|
|
2090
|
+
Button,
|
|
2091
|
+
TranslocoDirective,
|
|
2092
|
+
SkeletonModule,
|
|
2093
|
+
DynamicForm,
|
|
2094
|
+
ReactiveFormsModule,
|
|
2095
|
+
TranslocoPipe,
|
|
2096
|
+
], 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" }]
|
|
2097
|
+
}], propDecorators: { user: [{ type: i0.Input, args: [{ isSignal: true, alias: "user", required: false }] }] } });
|
|
1610
2098
|
|
|
1611
2099
|
const TONE_CLASSES = {
|
|
1612
2100
|
neutral: 'border-surface-200 bg-surface-50 text-surface-700 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-200',
|
|
@@ -2608,18 +3096,19 @@ class Users {
|
|
|
2608
3096
|
});
|
|
2609
3097
|
}
|
|
2610
3098
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2611
|
-
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'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\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-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\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", "searchScope", "showFilters", "filterMode", "filterCloseOnOutsideClick", "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]" }] });
|
|
3099
|
+
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'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\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-users-table\"\r\n >\r\n <ng-template #captionEnd>\r\n <mt-access-export-actions tab=\"users\" />\r\n </ng-template>\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [""], dependencies: [{ kind: "component", type: AccessExportActions, selector: "mt-access-export-actions", inputs: ["tab"] }, { 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", "searchScope", "showFilters", "filterMode", "filterCloseOnOutsideClick", "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]" }] });
|
|
2612
3100
|
}
|
|
2613
3101
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Users, decorators: [{
|
|
2614
3102
|
type: Component,
|
|
2615
3103
|
args: [{ selector: 'mt-users', standalone: true, imports: [
|
|
3104
|
+
AccessExportActions,
|
|
2616
3105
|
CommonModule,
|
|
2617
3106
|
SkeletonModule,
|
|
2618
3107
|
Table,
|
|
2619
3108
|
Icon,
|
|
2620
3109
|
TranslocoDirective,
|
|
2621
3110
|
TruncateTooltip,
|
|
2622
|
-
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\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-users-table\"\r\n >\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n" }]
|
|
3111
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups'\">\r\n <!-- mt-table wraps row actions; a locked row has five, so keep them on one line. -->\r\n <div class=\"mt-5 [&_.mt-actions-column>div]:flex-nowrap\">\r\n <ng-template #typeCol let-row>\r\n @if (row.isExternal) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-slate-50 dark:bg-slate-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-external-02\"\r\n class=\"text-slate-600 dark:text-slate-300 text-sm\"\r\n />\r\n <span class=\"text-slate-700 dark:text-slate-200 text-xs font-medium\">\r\n {{ t(\"external\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.users-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"internal\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #applicationLinkCol let-row>\r\n @if (isLinkedToCurrentApplication(row)) {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-emerald-50 dark:bg-emerald-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"user.user-check-01\"\r\n class=\"text-emerald-600 dark:text-emerald-300 text-sm\"\r\n />\r\n <span\r\n class=\"text-emerald-700 dark:text-emerald-200 text-xs font-medium\"\r\n >\r\n {{ t(\"linked\") }}\r\n </span>\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center gap-1 rounded-md bg-amber-50 dark:bg-amber-900/30 p-2\"\r\n >\r\n <mt-icon\r\n icon=\"general.link-broken-01\"\r\n class=\"text-amber-600 dark:text-amber-300 text-sm\"\r\n />\r\n <span class=\"text-amber-700 dark:text-amber-200 text-xs font-medium\">\r\n {{ t(\"not-linked\") }}\r\n </span>\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n <ng-template #emailCol let-row>\r\n <span\r\n class=\"block max-w-64 truncate\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >{{ row.email }}</span\r\n >\r\n </ng-template>\r\n\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n [data]=\"users()\"\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-users-table\"\r\n >\r\n <ng-template #captionEnd>\r\n <mt-access-export-actions tab=\"users\" />\r\n </ng-template>\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n" }]
|
|
2623
3112
|
}], 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 }] }] } });
|
|
2624
3113
|
|
|
2625
3114
|
/**
|
|
@@ -3253,11 +3742,17 @@ class Groups {
|
|
|
3253
3742
|
});
|
|
3254
3743
|
}
|
|
3255
3744
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3256
|
-
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", "searchScope", "showFilters", "filterMode", "filterCloseOnOutsideClick", "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"] }] });
|
|
3745
|
+
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 <ng-template #captionEnd>\r\n <mt-access-export-actions tab=\"groups\" />\r\n </ng-template>\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", "searchScope", "showFilters", "filterMode", "filterCloseOnOutsideClick", "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"] }, { kind: "component", type: AccessExportActions, selector: "mt-access-export-actions", inputs: ["tab"] }] });
|
|
3257
3746
|
}
|
|
3258
3747
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Groups, decorators: [{
|
|
3259
3748
|
type: Component,
|
|
3260
|
-
args: [{ selector: 'mt-groups', standalone: true, imports: [
|
|
3749
|
+
args: [{ selector: 'mt-groups', standalone: true, imports: [
|
|
3750
|
+
CommonModule,
|
|
3751
|
+
SkeletonModule,
|
|
3752
|
+
Table,
|
|
3753
|
+
TranslocoDirective,
|
|
3754
|
+
AccessExportActions,
|
|
3755
|
+
], 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 <ng-template #captionEnd>\r\n <mt-access-export-actions tab=\"groups\" />\r\n </ng-template>\r\n </mt-table>\r\n </div>\r\n</ng-container>\r\n", styles: [".groups{padding:2rem}\n"] }]
|
|
3261
3756
|
}] });
|
|
3262
3757
|
|
|
3263
3758
|
// store/index.ts
|
|
@@ -3338,6 +3833,11 @@ const STATUS_TONE = {
|
|
|
3338
3833
|
AwaitingRestart: 'warning',
|
|
3339
3834
|
};
|
|
3340
3835
|
|
|
3836
|
+
/** The place could not be read, so the item was not checked. */
|
|
3837
|
+
function isNotChecked(item) {
|
|
3838
|
+
return (item.resultStatus === 'NotChecked' ||
|
|
3839
|
+
item.resultCode === 'PlaceCouldNotBeRead');
|
|
3840
|
+
}
|
|
3341
3841
|
/** Finished results: moved, already with the successor, or kept as history. */
|
|
3342
3842
|
const DONE_RESULTS = [
|
|
3343
3843
|
'Applied',
|
|
@@ -3373,6 +3873,8 @@ function describeResult(item, text, names) {
|
|
|
3373
3873
|
technical,
|
|
3374
3874
|
foldable: item.display?.subjectKind === 'TeamRole' &&
|
|
3375
3875
|
DONE_RESULTS.includes(item.resultStatus ?? ''),
|
|
3876
|
+
untouched: !!item.display && !item.display.subjectKind && !item.resultStatus,
|
|
3877
|
+
unchecked: !!item.display && !item.display.subjectKind && isNotChecked(item),
|
|
3376
3878
|
};
|
|
3377
3879
|
}
|
|
3378
3880
|
function placeOf(item, text) {
|
|
@@ -3388,6 +3890,8 @@ function placeOf(item, text) {
|
|
|
3388
3890
|
};
|
|
3389
3891
|
}
|
|
3390
3892
|
const kind = display.placeKind;
|
|
3893
|
+
if (kind === 'Unknown')
|
|
3894
|
+
return otherPlaceOf(item, text);
|
|
3391
3895
|
const id = display.moduleDataId ??
|
|
3392
3896
|
display.requestId ??
|
|
3393
3897
|
display.escalationInstanceId ??
|
|
@@ -3432,6 +3936,23 @@ function placeOf(item, text) {
|
|
|
3432
3936
|
: null,
|
|
3433
3937
|
};
|
|
3434
3938
|
}
|
|
3939
|
+
/**
|
|
3940
|
+
* A place the backend cannot name as a record: workspace or application
|
|
3941
|
+
* settings and the like. It is never a hidden record (those keep their kind),
|
|
3942
|
+
* so it is named by its scope, without a lock and without a link.
|
|
3943
|
+
*/
|
|
3944
|
+
function otherPlaceOf(item, text) {
|
|
3945
|
+
const display = item.display;
|
|
3946
|
+
return {
|
|
3947
|
+
key: `Unknown:${item.scope}:${item.scopeId}`,
|
|
3948
|
+
icon: 'general.settings-01',
|
|
3949
|
+
title: text.code('place.settings', item.scope, '') ||
|
|
3950
|
+
text.code('scopes', item.scope, '') ||
|
|
3951
|
+
text.code('place.kinds', 'Unknown'),
|
|
3952
|
+
context: display?.workspaceName?.trim() ?? '',
|
|
3953
|
+
openUrl: null,
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3435
3956
|
function headlineOf(item, text) {
|
|
3436
3957
|
const display = item.display;
|
|
3437
3958
|
const subject = display?.subject?.trim() || null;
|
|
@@ -3483,21 +4004,82 @@ function sentenceOf(item, text, names) {
|
|
|
3483
4004
|
? text.code('reasons', item.reason, '')
|
|
3484
4005
|
: '';
|
|
3485
4006
|
}
|
|
3486
|
-
function groupByPlace(rows) {
|
|
4007
|
+
function groupByPlace(rows, options = {}) {
|
|
4008
|
+
const count = (kinds, kind) => kinds.set(kind, (kinds.get(kind) ?? 0) + 1);
|
|
4009
|
+
const listOf = (kinds) => [...kinds].map(([kind, n]) => `${kind} (${n})`).join(' · ');
|
|
3487
4010
|
const groups = new Map();
|
|
3488
4011
|
for (const row of rows) {
|
|
3489
4012
|
const key = row.words.place.key;
|
|
3490
4013
|
let group = groups.get(key);
|
|
3491
4014
|
if (!group) {
|
|
3492
|
-
group = {
|
|
4015
|
+
group = {
|
|
4016
|
+
place: row.words.place,
|
|
4017
|
+
rows: [],
|
|
4018
|
+
foldedTeamRoles: 0,
|
|
4019
|
+
untouched: '',
|
|
4020
|
+
unchecked: '',
|
|
4021
|
+
untouchedKinds: new Map(),
|
|
4022
|
+
uncheckedKinds: new Map(),
|
|
4023
|
+
};
|
|
3493
4024
|
groups.set(key, group);
|
|
3494
4025
|
}
|
|
3495
|
-
if (
|
|
4026
|
+
if (options.unfold)
|
|
4027
|
+
group.rows.push(row);
|
|
4028
|
+
else if (row.words.foldable)
|
|
3496
4029
|
group.foldedTeamRoles++;
|
|
4030
|
+
// A place it could not read is a final result: folded at any status.
|
|
4031
|
+
else if (row.words.unchecked)
|
|
4032
|
+
count(group.uncheckedKinds, row.words.headline);
|
|
4033
|
+
else if (options.settled && row.words.untouched)
|
|
4034
|
+
count(group.untouchedKinds, row.words.headline);
|
|
3497
4035
|
else
|
|
3498
4036
|
group.rows.push(row);
|
|
3499
4037
|
}
|
|
3500
|
-
return [...groups.values()]
|
|
4038
|
+
return [...groups.values()].map(({ untouchedKinds, uncheckedKinds, ...group }) => ({
|
|
4039
|
+
...group,
|
|
4040
|
+
untouched: listOf(untouchedKinds),
|
|
4041
|
+
unchecked: listOf(uncheckedKinds),
|
|
4042
|
+
}));
|
|
4043
|
+
}
|
|
4044
|
+
/** What a group draws: its rows, plus one line per note. */
|
|
4045
|
+
function linesOf(group) {
|
|
4046
|
+
return (group.rows.length +
|
|
4047
|
+
(group.foldedTeamRoles ? 1 : 0) +
|
|
4048
|
+
(group.untouched ? 1 : 0) +
|
|
4049
|
+
(group.unchecked ? 1 : 0));
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* The first `limit` lines (rows and notes) of the groups, and how many are
|
|
4053
|
+
* left for "Show more". A group cut short keeps its notes for the next batch.
|
|
4054
|
+
*/
|
|
4055
|
+
function limitGroups(groups, limit) {
|
|
4056
|
+
const total = groups.reduce((sum, group) => sum + linesOf(group), 0);
|
|
4057
|
+
const shown = [];
|
|
4058
|
+
let left = limit;
|
|
4059
|
+
for (const group of groups) {
|
|
4060
|
+
if (left <= 0)
|
|
4061
|
+
break;
|
|
4062
|
+
const lines = linesOf(group);
|
|
4063
|
+
if (lines <= left) {
|
|
4064
|
+
shown.push(group);
|
|
4065
|
+
left -= lines;
|
|
4066
|
+
}
|
|
4067
|
+
else {
|
|
4068
|
+
// Cut short: the rows that fit; the notes come with the next batch.
|
|
4069
|
+
const rows = group.rows.slice(0, left);
|
|
4070
|
+
if (rows.length)
|
|
4071
|
+
shown.push({
|
|
4072
|
+
...group,
|
|
4073
|
+
rows,
|
|
4074
|
+
foldedTeamRoles: 0,
|
|
4075
|
+
untouched: '',
|
|
4076
|
+
unchecked: '',
|
|
4077
|
+
});
|
|
4078
|
+
left = 0;
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
const drawn = shown.reduce((sum, group) => sum + linesOf(group), 0);
|
|
4082
|
+
return { groups: shown, hidden: total - drawn };
|
|
3501
4083
|
}
|
|
3502
4084
|
|
|
3503
4085
|
/** The server works in the background; the drawer only re-reads it. */
|
|
@@ -3526,8 +4108,8 @@ function contractMajor(version) {
|
|
|
3526
4108
|
* work in the background; the drawer shows a generic "processing" card while
|
|
3527
4109
|
* it does, then the results (what needs an admin first). Its footer holds
|
|
3528
4110
|
* Close and, while `canCancel` allows, Stop / Close replacement; nothing else
|
|
3529
|
-
* (starting again lives on the Users page). It never shows
|
|
3530
|
-
*
|
|
4111
|
+
* (starting again lives on the Users page). It never shows scan counts: the
|
|
4112
|
+
* backend asks screens not to.
|
|
3531
4113
|
*
|
|
3532
4114
|
* Opened through `ModalService`, so it gets the root injector: it never
|
|
3533
4115
|
* navigates; the opener clears `?id=` when it closes.
|
|
@@ -3562,6 +4144,11 @@ class UserReplacementDetails {
|
|
|
3562
4144
|
actionError = signal(null, ...(ngDevMode ? [{ debugName: "actionError" }] : /* istanbul ignore next */ []));
|
|
3563
4145
|
items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
3564
4146
|
itemsLoading = signal(false, ...(ngDevMode ? [{ debugName: "itemsLoading" }] : /* istanbul ignore next */ []));
|
|
4147
|
+
/**
|
|
4148
|
+
* A first load drew its first page and more pages are still coming (a
|
|
4149
|
+
* large replacement can have thousands of items).
|
|
4150
|
+
*/
|
|
4151
|
+
loadingMore = signal(false, ...(ngDevMode ? [{ debugName: "loadingMore" }] : /* istanbul ignore next */ []));
|
|
3565
4152
|
itemsError = signal(null, ...(ngDevMode ? [{ debugName: "itemsError" }] : /* istanbul ignore next */ []));
|
|
3566
4153
|
showDetails = signal(false, ...(ngDevMode ? [{ debugName: "showDetails" }] : /* istanbul ignore next */ []));
|
|
3567
4154
|
selectedTab = signal(null, ...(ngDevMode ? [{ debugName: "selectedTab" }] : /* istanbul ignore next */ []));
|
|
@@ -3681,8 +4268,7 @@ class UserReplacementDetails {
|
|
|
3681
4268
|
const active = this.isActive();
|
|
3682
4269
|
const names = { name: this.sourceName(), successor: this.successorName() };
|
|
3683
4270
|
return this.items().map((item) => {
|
|
3684
|
-
const notChecked = item
|
|
3685
|
-
item.resultCode === 'PlaceCouldNotBeRead';
|
|
4271
|
+
const notChecked = isNotChecked(item);
|
|
3686
4272
|
const [status, tone] = item.resultStatus
|
|
3687
4273
|
? [
|
|
3688
4274
|
this.text.code('results', item.resultStatus),
|
|
@@ -3720,18 +4306,24 @@ class UserReplacementDetails {
|
|
|
3720
4306
|
this.language();
|
|
3721
4307
|
const rows = this.rows();
|
|
3722
4308
|
const checked = rows.filter((row) => !row.notChecked);
|
|
4309
|
+
// While pages still arrive, the summary's totals keep the tabs (and so
|
|
4310
|
+
// the tab opened first) from changing under the admin's eyes.
|
|
4311
|
+
const summary = this.loadingMore() ? this.summary() : null;
|
|
4312
|
+
const byResult = summary?.itemsByResult ?? {};
|
|
4313
|
+
const total = (keys) => keys.reduce((sum, key) => sum + (byResult[key] ?? 0), 0);
|
|
4314
|
+
const withResult = Object.values(byResult).reduce((a, b) => a + b, 0);
|
|
3723
4315
|
const tabs = [];
|
|
3724
|
-
const add = (value, label, match) => {
|
|
3725
|
-
const badge = checked.filter(match).length;
|
|
4316
|
+
const add = (value, label, match, expected) => {
|
|
4317
|
+
const badge = Math.max(checked.filter(match).length, expected);
|
|
3726
4318
|
if (badge)
|
|
3727
4319
|
tabs.push({ value, label, badge });
|
|
3728
4320
|
};
|
|
3729
|
-
add('manual', this.text.t('tabs.manual'), (row) => MANUAL_RESULTS.includes(row.resultKey ?? ''));
|
|
3730
|
-
add('done', this.text.t('tabs.done'), (row) => DONE_RESULTS.includes(row.resultKey ?? ''));
|
|
4321
|
+
add('manual', this.text.t('tabs.manual'), (row) => MANUAL_RESULTS.includes(row.resultKey ?? ''), total(MANUAL_RESULTS));
|
|
4322
|
+
add('done', this.text.t('tabs.done'), (row) => DONE_RESULTS.includes(row.resultKey ?? ''), total(DONE_RESULTS));
|
|
3731
4323
|
add('waiting', this.isActive()
|
|
3732
4324
|
? this.text.t('tabs.waiting')
|
|
3733
|
-
: this.text.t('tabs.not-done'), (row) => !row.resultKey);
|
|
3734
|
-
const notChecked = rows.length - checked.length;
|
|
4325
|
+
: this.text.t('tabs.not-done'), (row) => !row.resultKey, summary ? Math.max(0, summary.itemCount - withResult) : 0);
|
|
4326
|
+
const notChecked = Math.max(rows.length - checked.length, total([NOT_CHECKED]));
|
|
3735
4327
|
if (notChecked)
|
|
3736
4328
|
tabs.push({
|
|
3737
4329
|
value: 'notChecked',
|
|
@@ -3742,7 +4334,7 @@ class UserReplacementDetails {
|
|
|
3742
4334
|
tabs.push({
|
|
3743
4335
|
value: 'all',
|
|
3744
4336
|
label: this.text.t('tabs.all'),
|
|
3745
|
-
badge: rows.length,
|
|
4337
|
+
badge: Math.max(rows.length, summary?.itemCount ?? 0),
|
|
3746
4338
|
});
|
|
3747
4339
|
return tabs;
|
|
3748
4340
|
}, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
@@ -3772,10 +4364,21 @@ class UserReplacementDetails {
|
|
|
3772
4364
|
})();
|
|
3773
4365
|
return query ? inTab.filter((row) => row.search.includes(query)) : inTab;
|
|
3774
4366
|
}, ...(ngDevMode ? [{ debugName: "filteredRows" }] : /* istanbul ignore next */ []));
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
4367
|
+
/**
|
|
4368
|
+
* The rows under their place (project, record, request, escalation).
|
|
4369
|
+
* Handed-over team roles, and once nothing more will happen the references
|
|
4370
|
+
* it never acts on, are notes; "Technical details" draws every row.
|
|
4371
|
+
*/
|
|
4372
|
+
groups = computed(() => {
|
|
4373
|
+
const status = this.status() ?? '';
|
|
4374
|
+
return groupByPlace(this.filteredRows(), {
|
|
4375
|
+
settled: FINISHED_STATUSES.includes(status) || CLOSED_STATUSES.includes(status),
|
|
4376
|
+
unfold: this.showDetails(),
|
|
4377
|
+
});
|
|
4378
|
+
}, ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
4379
|
+
drawn = computed(() => limitGroups(this.groups(), this.rowLimit()), ...(ngDevMode ? [{ debugName: "drawn" }] : /* istanbul ignore next */ []));
|
|
4380
|
+
visibleGroups = computed(() => this.drawn().groups, ...(ngDevMode ? [{ debugName: "visibleGroups" }] : /* istanbul ignore next */ []));
|
|
4381
|
+
hiddenRowCount = computed(() => this.drawn().hidden, ...(ngDevMode ? [{ debugName: "hiddenRowCount" }] : /* istanbul ignore next */ []));
|
|
3779
4382
|
ngOnInit() {
|
|
3780
4383
|
this.destroyRef.onDestroy(() => (this.destroyed = true));
|
|
3781
4384
|
if (!this.users().length)
|
|
@@ -3824,13 +4427,19 @@ class UserReplacementDetails {
|
|
|
3824
4427
|
// The old summary stays visible; the caller already shows the failure.
|
|
3825
4428
|
}
|
|
3826
4429
|
}
|
|
3827
|
-
/**
|
|
4430
|
+
/**
|
|
4431
|
+
* All result pages; skipped while the server is still preparing. A first
|
|
4432
|
+
* load draws each page as it arrives, so a large replacement shows its
|
|
4433
|
+
* results after one page instead of after all of them. A reload keeps the
|
|
4434
|
+
* current list until the new one is complete, so it never shrinks.
|
|
4435
|
+
*/
|
|
3828
4436
|
async loadResults() {
|
|
3829
4437
|
if (this.status() === 'Preparing')
|
|
3830
4438
|
return;
|
|
3831
4439
|
const operationId = this.operationId();
|
|
3832
4440
|
const request = ++this.resultsRequest;
|
|
3833
4441
|
const isLatest = () => !this.destroyed && request === this.resultsRequest;
|
|
4442
|
+
const progressive = !this.items().length;
|
|
3834
4443
|
this.itemsLoading.set(true);
|
|
3835
4444
|
this.itemsError.set(null);
|
|
3836
4445
|
const items = [];
|
|
@@ -3845,6 +4454,10 @@ class UserReplacementDetails {
|
|
|
3845
4454
|
if (page.nextAfterItemId == null || !page.items.length)
|
|
3846
4455
|
break;
|
|
3847
4456
|
afterItemId = page.nextAfterItemId;
|
|
4457
|
+
if (progressive) {
|
|
4458
|
+
this.items.set([...items]);
|
|
4459
|
+
this.loadingMore.set(true);
|
|
4460
|
+
}
|
|
3848
4461
|
}
|
|
3849
4462
|
this.items.set(items);
|
|
3850
4463
|
this.resultsLoadedAt = Date.now();
|
|
@@ -3854,8 +4467,10 @@ class UserReplacementDetails {
|
|
|
3854
4467
|
this.itemsError.set(this.text.error(replacementErrorKey(error)));
|
|
3855
4468
|
}
|
|
3856
4469
|
finally {
|
|
3857
|
-
if (isLatest())
|
|
4470
|
+
if (isLatest()) {
|
|
3858
4471
|
this.itemsLoading.set(false);
|
|
4472
|
+
this.loadingMore.set(false);
|
|
4473
|
+
}
|
|
3859
4474
|
}
|
|
3860
4475
|
}
|
|
3861
4476
|
// ---------------------------------------------------------------------------
|
|
@@ -3976,7 +4591,7 @@ class UserReplacementDetails {
|
|
|
3976
4591
|
return user?.displayName || user?.userName || userId;
|
|
3977
4592
|
}
|
|
3978
4593
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserReplacementDetails, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3979
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserReplacementDetails, isStandalone: true, selector: "mt-user-replacement-details", inputs: { operationId: { classPropertyName: "operationId", publicName: "operationId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups.replacement'\">\r\n <div class=\"flex flex-col gap-4 p-4\" [class]=\"modal.contentClass\">\r\n @if (loading()) {\r\n <p-skeleton height=\"7rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"6rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"12rem\" borderRadius=\"0.375rem\" />\r\n } @else if (loadError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ loadError() }}</span>\r\n </div>\r\n } @else if (contractOutdated()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200\"\r\n >\r\n {{ t(\"contract-outdated\") }}\r\n </div>\r\n } @else if (summary(); as replacement) {\r\n <!-- Who \u2192 who, the status, and when -->\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border border-surface bg-content p-4\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"sourceInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-surface-100! text-color! dark:bg-surface-800!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"from\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"sourceName()\">\r\n {{ sourceName() }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-icon\r\n icon=\"arrow.arrow-right\"\r\n class=\"shrink-0 text-lg text-muted-color rtl:rotate-180\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"successorInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-primary-50! text-primary-700! dark:bg-primary-950! dark:text-primary-200!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"to\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"successorName()\">\r\n {{ successorName() }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-surface pt-3 text-xs text-muted-color\"\r\n >\r\n <span\r\n class=\"rounded-md border px-2 py-0.5 font-semibold\"\r\n [class]=\"statusClass()\"\r\n >{{ text.code(\"statuses\", replacement.status) }}</span\r\n >\r\n @if (createdAt(); as created) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.calendar\" />\r\n {{ t(\"started\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n created | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n @if (updatedAt(); as updated) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.clock\" />\r\n {{ t(\"updated\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n updated | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Where it is, in one sentence -->\r\n @if (card(); as status) {\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border p-4\"\r\n [class]=\"cardBoxClass()\"\r\n role=\"status\"\r\n >\r\n <div class=\"flex items-start gap-3\">\r\n <mt-icon\r\n [icon]=\"status.icon\"\r\n class=\"mt-0.5 shrink-0 text-xl\"\r\n [class]=\"cardIconClass()\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"font-semibold\">{{ status.title }}</div>\r\n @if (status.body) {\r\n <div class=\"text-sm\">{{ status.body }}</div>\r\n }\r\n @if (isFinished() && notCheckedCount() > 0) {\r\n <div class=\"text-sm opacity-80\">\r\n {{ t(\"not-checked-note\", { count: notCheckedCount() }) }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (status.progress) {\r\n <p-progressbar mode=\"indeterminate\" [style]=\"{ height: '4px' }\" />\r\n }\r\n\r\n @if (actionError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ actionError() }}</span>\r\n </div>\r\n }\r\n </section>\r\n }\r\n\r\n <!-- The results: outcomes after Start, what needs an admin first -->\r\n @if (showResults()) {\r\n <section class=\"flex flex-col gap-3\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"results-title\") }}</h3>\r\n\r\n @if (tabs().length > 1) {\r\n <mt-tabs\r\n [options]=\"tabs()\"\r\n [active]=\"activeTab()\"\r\n (activeChange)=\"selectTab($event)\"\r\n mode=\"underline\"\r\n size=\"small\"\r\n />\r\n }\r\n @if (rows().length > 8) {\r\n <mt-text-field\r\n [formControl]=\"search\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-results')\"\r\n />\r\n }\r\n\r\n @if (itemsError()) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n {{ itemsError() }}\r\n </div>\r\n } @else if (itemsLoading() && !items().length) {\r\n <div class=\"flex flex-col gap-2\">\r\n @for (row of [1, 2, 3]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (!filteredRows().length) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface p-4 text-center text-sm text-muted-color\"\r\n >\r\n {{ t(\"no-matching-results\") }}\r\n </div>\r\n } @else {\r\n <ul class=\"rounded-md border border-surface bg-content\">\r\n @for (group of visibleGroups(); track group.place.key) {\r\n <li class=\"border-t border-surface first:border-t-0\">\r\n <!-- The place: project, record, request or escalation -->\r\n <div\r\n class=\"flex items-center gap-3 bg-surface-50 px-3 py-2 dark:bg-surface-900\"\r\n >\r\n <mt-icon\r\n [icon]=\"group.place.icon\"\r\n class=\"shrink-0 text-muted-color\"\r\n />\r\n <div class=\"min-w-0 flex-1\">\r\n <div\r\n class=\"truncate text-sm font-semibold\"\r\n [title]=\"group.place.title\"\r\n >\r\n {{ group.place.title }}\r\n </div>\r\n @if (group.place.context) {\r\n <div\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.place.context\"\r\n >\r\n {{ group.place.context }}\r\n </div>\r\n }\r\n </div>\r\n @if (group.place.openUrl) {\r\n <a\r\n class=\"flex shrink-0 items-center gap-1 text-xs text-primary hover:underline\"\r\n [href]=\"group.place.openUrl\"\r\n target=\"_blank\"\r\n rel=\"noopener\"\r\n >\r\n {{ t(\"open-project\") }}\r\n <mt-icon\r\n icon=\"general.link-external-01\"\r\n class=\"rtl:-scale-x-100\"\r\n />\r\n </a>\r\n }\r\n </div>\r\n <ul>\r\n @for (row of group.rows; track row.itemId) {\r\n <li\r\n class=\"flex items-start gap-3 border-t border-surface p-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\r\n <span class=\"text-sm font-medium\">{{\r\n row.words.headline\r\n }}</span>\r\n @if (row.statusDetail) {\r\n <span class=\"text-xs text-muted-color\">{{\r\n row.statusDetail\r\n }}</span>\r\n }\r\n @if (showDetails() && row.words.technical) {\r\n <span\r\n class=\"truncate font-mono text-[11px] text-muted-color\"\r\n [title]=\"row.words.technical\"\r\n >{{ row.words.technical }}</span\r\n >\r\n }\r\n </div>\r\n <span\r\n class=\"shrink-0 whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\r\n [class]=\"row.statusClass\"\r\n >{{ row.status }}</span\r\n >\r\n </li>\r\n }\r\n @if (group.foldedTeamRoles) {\r\n <li\r\n class=\"flex items-center gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"general.check-circle\" class=\"shrink-0\" />\r\n {{ t(\"team-note\", { count: group.foldedTeamRoles }) }}\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n </ul>\r\n @if (hiddenRowCount() > 0) {\r\n <mt-button\r\n class=\"self-center\"\r\n [label]=\"t('show-more', { count: hiddenRowCount() })\"\r\n icon=\"arrow.chevron-down\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"showMore()\"\r\n />\r\n }\r\n }\r\n </section>\r\n }\r\n\r\n <!-- One general limit, with every backend code behind a toggle -->\r\n <div class=\"flex flex-col gap-1 text-xs text-muted-color\">\r\n <div class=\"flex items-start gap-1.5\">\r\n <mt-icon icon=\"general.info-circle\" class=\"mt-px shrink-0\" />\r\n <span>{{ t(\"notices.supported-only\") }}</span>\r\n </div>\r\n @if (technicalDetails().length) {\r\n <button\r\n type=\"button\"\r\n class=\"ms-5 flex items-center gap-1 self-start text-primary hover:underline\"\r\n [attr.aria-expanded]=\"showDetails()\"\r\n (click)=\"showDetails.set(!showDetails())\"\r\n >\r\n <mt-icon\r\n [icon]=\"showDetails() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\r\n />\r\n {{ showDetails() ? t(\"hide-details\") : t(\"show-details\") }}\r\n </button>\r\n @if (showDetails()) {\r\n <ul class=\"ms-5 flex list-disc flex-col gap-0.5 ps-4\">\r\n @for (detail of technicalDetails(); track $index) {\r\n <li>{{ detail }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Close, and Stop / Close replacement while the backend allows it -->\r\n <div [class]=\"modal.footerClass\">\r\n @if (canCancel()) {\r\n <mt-button\r\n [label]=\"cancelIsStop() ? t('stop') : t('close')\"\r\n icon=\"general.x-circle\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n [loading]=\"cancelling()\"\r\n (click)=\"cancel()\"\r\n />\r\n }\r\n <mt-button [label]=\"t('dismiss')\" (click)=\"close()\" />\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ 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: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: 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: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i2.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "unit", "mode", "color"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }] });
|
|
4594
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: UserReplacementDetails, isStandalone: true, selector: "mt-user-replacement-details", inputs: { operationId: { classPropertyName: "operationId", publicName: "operationId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'users-groups.replacement'\">\r\n <div class=\"flex flex-col gap-4 p-4\" [class]=\"modal.contentClass\">\r\n @if (loading()) {\r\n <p-skeleton height=\"7rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"6rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"12rem\" borderRadius=\"0.375rem\" />\r\n } @else if (loadError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ loadError() }}</span>\r\n </div>\r\n } @else if (contractOutdated()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200\"\r\n >\r\n {{ t(\"contract-outdated\") }}\r\n </div>\r\n } @else if (summary(); as replacement) {\r\n <!-- Who \u2192 who, the status, and when -->\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border border-surface bg-content p-4\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"sourceInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-surface-100! text-color! dark:bg-surface-800!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"from\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"sourceName()\">\r\n {{ sourceName() }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-icon\r\n icon=\"arrow.arrow-right\"\r\n class=\"shrink-0 text-lg text-muted-color rtl:rotate-180\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"successorInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-primary-50! text-primary-700! dark:bg-primary-950! dark:text-primary-200!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"to\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"successorName()\">\r\n {{ successorName() }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-surface pt-3 text-xs text-muted-color\"\r\n >\r\n <span\r\n class=\"rounded-md border px-2 py-0.5 font-semibold\"\r\n [class]=\"statusClass()\"\r\n >{{ text.code(\"statuses\", replacement.status) }}</span\r\n >\r\n @if (createdAt(); as created) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.calendar\" />\r\n {{ t(\"started\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n created | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n @if (updatedAt(); as updated) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.clock\" />\r\n {{ t(\"updated\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n updated | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Where it is, in one sentence -->\r\n @if (card(); as status) {\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border p-4\"\r\n [class]=\"cardBoxClass()\"\r\n role=\"status\"\r\n >\r\n <div class=\"flex items-start gap-3\">\r\n <mt-icon\r\n [icon]=\"status.icon\"\r\n class=\"mt-0.5 shrink-0 text-xl\"\r\n [class]=\"cardIconClass()\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"font-semibold\">{{ status.title }}</div>\r\n @if (status.body) {\r\n <div class=\"text-sm\">{{ status.body }}</div>\r\n }\r\n @if (isFinished() && notCheckedCount() > 0) {\r\n <div class=\"text-sm opacity-80\">\r\n {{ t(\"not-checked-note\", { count: notCheckedCount() }) }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (status.progress) {\r\n <p-progressbar mode=\"indeterminate\" [style]=\"{ height: '4px' }\" />\r\n }\r\n\r\n @if (actionError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ actionError() }}</span>\r\n </div>\r\n }\r\n </section>\r\n }\r\n\r\n <!-- The results: outcomes after Start, what needs an admin first -->\r\n @if (showResults()) {\r\n <section class=\"flex flex-col gap-3\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"results-title\") }}</h3>\r\n\r\n @if (tabs().length > 1) {\r\n <mt-tabs\r\n [options]=\"tabs()\"\r\n [active]=\"activeTab()\"\r\n (activeChange)=\"selectTab($event)\"\r\n mode=\"underline\"\r\n size=\"small\"\r\n />\r\n }\r\n @if (rows().length > 8) {\r\n <mt-text-field\r\n [formControl]=\"search\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-results')\"\r\n />\r\n }\r\n\r\n @if (itemsError()) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n {{ itemsError() }}\r\n </div>\r\n } @else if (itemsLoading() && !filteredRows().length) {\r\n <div class=\"flex flex-col gap-2\">\r\n @for (row of [1, 2, 3]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (!filteredRows().length) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface p-4 text-center text-sm text-muted-color\"\r\n >\r\n {{ t(\"no-matching-results\") }}\r\n </div>\r\n } @else {\r\n <ul class=\"rounded-md border border-surface bg-content\">\r\n @for (group of visibleGroups(); track group.place.key) {\r\n <li class=\"border-t border-surface first:border-t-0\">\r\n <!-- The place: project, record, request or escalation -->\r\n <div\r\n class=\"flex items-center gap-3 bg-surface-50 px-3 py-2 dark:bg-surface-900\"\r\n >\r\n <mt-icon\r\n [icon]=\"group.place.icon\"\r\n class=\"shrink-0 text-muted-color\"\r\n />\r\n <div class=\"min-w-0 flex-1\">\r\n <div\r\n class=\"truncate text-sm font-semibold\"\r\n [title]=\"group.place.title\"\r\n >\r\n {{ group.place.title }}\r\n </div>\r\n @if (group.place.context) {\r\n <div\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.place.context\"\r\n >\r\n {{ group.place.context }}\r\n </div>\r\n }\r\n </div>\r\n @if (group.place.openUrl) {\r\n <a\r\n class=\"flex shrink-0 items-center gap-1 text-xs text-primary hover:underline\"\r\n [href]=\"group.place.openUrl\"\r\n target=\"_blank\"\r\n rel=\"noopener\"\r\n >\r\n {{ t(\"open-project\") }}\r\n <mt-icon\r\n icon=\"general.link-external-01\"\r\n class=\"rtl:-scale-x-100\"\r\n />\r\n </a>\r\n }\r\n </div>\r\n <ul>\r\n @for (row of group.rows; track row.itemId) {\r\n <li\r\n class=\"flex items-start gap-3 border-t border-surface p-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\r\n <span class=\"text-sm font-medium\">{{\r\n row.words.headline\r\n }}</span>\r\n @if (row.statusDetail) {\r\n <span class=\"text-xs text-muted-color\">{{\r\n row.statusDetail\r\n }}</span>\r\n }\r\n @if (showDetails() && row.words.technical) {\r\n <span\r\n class=\"truncate font-mono text-[11px] text-muted-color\"\r\n [title]=\"row.words.technical\"\r\n >{{ row.words.technical }}</span\r\n >\r\n }\r\n </div>\r\n <span\r\n class=\"shrink-0 whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\r\n [class]=\"row.statusClass\"\r\n >{{ row.status }}</span\r\n >\r\n </li>\r\n }\r\n @if (group.foldedTeamRoles) {\r\n <li\r\n class=\"flex items-center gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"general.check-circle\" class=\"shrink-0\" />\r\n {{ t(\"team-note\", { count: group.foldedTeamRoles }) }}\r\n </li>\r\n }\r\n @if (group.untouched) {\r\n <li\r\n class=\"flex items-start gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"mt-0.5 shrink-0\"\r\n />\r\n {{ t(\"untouched-note\", { list: group.untouched }) }}\r\n </li>\r\n }\r\n @if (group.unchecked) {\r\n <li\r\n class=\"flex items-start gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-circle\"\r\n class=\"mt-0.5 shrink-0\"\r\n />\r\n {{ t(\"unchecked-note\", { list: group.unchecked }) }}\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n </ul>\r\n @if (hiddenRowCount() > 0) {\r\n <mt-button\r\n class=\"self-center\"\r\n [label]=\"t('show-more', { count: hiddenRowCount() })\"\r\n icon=\"arrow.chevron-down\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"showMore()\"\r\n />\r\n }\r\n @if (loadingMore()) {\r\n <div\r\n class=\"flex items-center justify-center gap-2 text-xs text-muted-color\"\r\n role=\"status\"\r\n >\r\n <mt-icon icon=\"arrow.refresh-cw-02\" class=\"animate-spin\" />\r\n {{\r\n t(\"loading-more\", {\r\n loaded: items().length,\r\n total: summary()?.itemCount ?? items().length,\r\n })\r\n }}\r\n </div>\r\n }\r\n }\r\n </section>\r\n }\r\n\r\n <!-- One general limit, with every backend code behind a toggle -->\r\n <div class=\"flex flex-col gap-1 text-xs text-muted-color\">\r\n <div class=\"flex items-start gap-1.5\">\r\n <mt-icon icon=\"general.info-circle\" class=\"mt-px shrink-0\" />\r\n <span>{{ t(\"notices.supported-only\") }}</span>\r\n </div>\r\n @if (technicalDetails().length) {\r\n <button\r\n type=\"button\"\r\n class=\"ms-5 flex items-center gap-1 self-start text-primary hover:underline\"\r\n [attr.aria-expanded]=\"showDetails()\"\r\n (click)=\"showDetails.set(!showDetails())\"\r\n >\r\n <mt-icon\r\n [icon]=\"showDetails() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\r\n />\r\n {{ showDetails() ? t(\"hide-details\") : t(\"show-details\") }}\r\n </button>\r\n @if (showDetails()) {\r\n <ul class=\"ms-5 flex list-disc flex-col gap-0.5 ps-4\">\r\n @for (detail of technicalDetails(); track $index) {\r\n <li>{{ detail }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Close, and Stop / Close replacement while the backend allows it -->\r\n <div [class]=\"modal.footerClass\">\r\n @if (canCancel()) {\r\n <mt-button\r\n [label]=\"cancelIsStop() ? t('stop') : t('close')\"\r\n icon=\"general.x-circle\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n [loading]=\"cancelling()\"\r\n (click)=\"cancel()\"\r\n />\r\n }\r\n <mt-button [label]=\"t('dismiss')\" (click)=\"close()\" />\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ 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: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: 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: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i2.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "unit", "mode", "color"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }] });
|
|
3980
4595
|
}
|
|
3981
4596
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UserReplacementDetails, decorators: [{
|
|
3982
4597
|
type: Component,
|
|
@@ -3991,7 +4606,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3991
4606
|
ProgressBarModule,
|
|
3992
4607
|
SkeletonModule,
|
|
3993
4608
|
MTDateFormatPipe,
|
|
3994
|
-
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups.replacement'\">\r\n <div class=\"flex flex-col gap-4 p-4\" [class]=\"modal.contentClass\">\r\n @if (loading()) {\r\n <p-skeleton height=\"7rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"6rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"12rem\" borderRadius=\"0.375rem\" />\r\n } @else if (loadError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ loadError() }}</span>\r\n </div>\r\n } @else if (contractOutdated()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200\"\r\n >\r\n {{ t(\"contract-outdated\") }}\r\n </div>\r\n } @else if (summary(); as replacement) {\r\n <!-- Who \u2192 who, the status, and when -->\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border border-surface bg-content p-4\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"sourceInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-surface-100! text-color! dark:bg-surface-800!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"from\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"sourceName()\">\r\n {{ sourceName() }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-icon\r\n icon=\"arrow.arrow-right\"\r\n class=\"shrink-0 text-lg text-muted-color rtl:rotate-180\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"successorInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-primary-50! text-primary-700! dark:bg-primary-950! dark:text-primary-200!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"to\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"successorName()\">\r\n {{ successorName() }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-surface pt-3 text-xs text-muted-color\"\r\n >\r\n <span\r\n class=\"rounded-md border px-2 py-0.5 font-semibold\"\r\n [class]=\"statusClass()\"\r\n >{{ text.code(\"statuses\", replacement.status) }}</span\r\n >\r\n @if (createdAt(); as created) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.calendar\" />\r\n {{ t(\"started\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n created | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n @if (updatedAt(); as updated) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.clock\" />\r\n {{ t(\"updated\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n updated | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Where it is, in one sentence -->\r\n @if (card(); as status) {\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border p-4\"\r\n [class]=\"cardBoxClass()\"\r\n role=\"status\"\r\n >\r\n <div class=\"flex items-start gap-3\">\r\n <mt-icon\r\n [icon]=\"status.icon\"\r\n class=\"mt-0.5 shrink-0 text-xl\"\r\n [class]=\"cardIconClass()\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"font-semibold\">{{ status.title }}</div>\r\n @if (status.body) {\r\n <div class=\"text-sm\">{{ status.body }}</div>\r\n }\r\n @if (isFinished() && notCheckedCount() > 0) {\r\n <div class=\"text-sm opacity-80\">\r\n {{ t(\"not-checked-note\", { count: notCheckedCount() }) }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (status.progress) {\r\n <p-progressbar mode=\"indeterminate\" [style]=\"{ height: '4px' }\" />\r\n }\r\n\r\n @if (actionError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ actionError() }}</span>\r\n </div>\r\n }\r\n </section>\r\n }\r\n\r\n <!-- The results: outcomes after Start, what needs an admin first -->\r\n @if (showResults()) {\r\n <section class=\"flex flex-col gap-3\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"results-title\") }}</h3>\r\n\r\n @if (tabs().length > 1) {\r\n <mt-tabs\r\n [options]=\"tabs()\"\r\n [active]=\"activeTab()\"\r\n (activeChange)=\"selectTab($event)\"\r\n mode=\"underline\"\r\n size=\"small\"\r\n />\r\n }\r\n @if (rows().length > 8) {\r\n <mt-text-field\r\n [formControl]=\"search\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-results')\"\r\n />\r\n }\r\n\r\n @if (itemsError()) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n {{ itemsError() }}\r\n </div>\r\n } @else if (itemsLoading() && !items().length) {\r\n <div class=\"flex flex-col gap-2\">\r\n @for (row of [1, 2, 3]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (!filteredRows().length) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface p-4 text-center text-sm text-muted-color\"\r\n >\r\n {{ t(\"no-matching-results\") }}\r\n </div>\r\n } @else {\r\n <ul class=\"rounded-md border border-surface bg-content\">\r\n @for (group of visibleGroups(); track group.place.key) {\r\n <li class=\"border-t border-surface first:border-t-0\">\r\n <!-- The place: project, record, request or escalation -->\r\n <div\r\n class=\"flex items-center gap-3 bg-surface-50 px-3 py-2 dark:bg-surface-900\"\r\n >\r\n <mt-icon\r\n [icon]=\"group.place.icon\"\r\n class=\"shrink-0 text-muted-color\"\r\n />\r\n <div class=\"min-w-0 flex-1\">\r\n <div\r\n class=\"truncate text-sm font-semibold\"\r\n [title]=\"group.place.title\"\r\n >\r\n {{ group.place.title }}\r\n </div>\r\n @if (group.place.context) {\r\n <div\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.place.context\"\r\n >\r\n {{ group.place.context }}\r\n </div>\r\n }\r\n </div>\r\n @if (group.place.openUrl) {\r\n <a\r\n class=\"flex shrink-0 items-center gap-1 text-xs text-primary hover:underline\"\r\n [href]=\"group.place.openUrl\"\r\n target=\"_blank\"\r\n rel=\"noopener\"\r\n >\r\n {{ t(\"open-project\") }}\r\n <mt-icon\r\n icon=\"general.link-external-01\"\r\n class=\"rtl:-scale-x-100\"\r\n />\r\n </a>\r\n }\r\n </div>\r\n <ul>\r\n @for (row of group.rows; track row.itemId) {\r\n <li\r\n class=\"flex items-start gap-3 border-t border-surface p-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\r\n <span class=\"text-sm font-medium\">{{\r\n row.words.headline\r\n }}</span>\r\n @if (row.statusDetail) {\r\n <span class=\"text-xs text-muted-color\">{{\r\n row.statusDetail\r\n }}</span>\r\n }\r\n @if (showDetails() && row.words.technical) {\r\n <span\r\n class=\"truncate font-mono text-[11px] text-muted-color\"\r\n [title]=\"row.words.technical\"\r\n >{{ row.words.technical }}</span\r\n >\r\n }\r\n </div>\r\n <span\r\n class=\"shrink-0 whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\r\n [class]=\"row.statusClass\"\r\n >{{ row.status }}</span\r\n >\r\n </li>\r\n }\r\n @if (group.foldedTeamRoles) {\r\n <li\r\n class=\"flex items-center gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"general.check-circle\" class=\"shrink-0\" />\r\n {{ t(\"team-note\", { count: group.foldedTeamRoles }) }}\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n </ul>\r\n @if (hiddenRowCount() > 0) {\r\n <mt-button\r\n class=\"self-center\"\r\n [label]=\"t('show-more', { count: hiddenRowCount() })\"\r\n icon=\"arrow.chevron-down\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"showMore()\"\r\n />\r\n }\r\n }\r\n </section>\r\n }\r\n\r\n <!-- One general limit, with every backend code behind a toggle -->\r\n <div class=\"flex flex-col gap-1 text-xs text-muted-color\">\r\n <div class=\"flex items-start gap-1.5\">\r\n <mt-icon icon=\"general.info-circle\" class=\"mt-px shrink-0\" />\r\n <span>{{ t(\"notices.supported-only\") }}</span>\r\n </div>\r\n @if (technicalDetails().length) {\r\n <button\r\n type=\"button\"\r\n class=\"ms-5 flex items-center gap-1 self-start text-primary hover:underline\"\r\n [attr.aria-expanded]=\"showDetails()\"\r\n (click)=\"showDetails.set(!showDetails())\"\r\n >\r\n <mt-icon\r\n [icon]=\"showDetails() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\r\n />\r\n {{ showDetails() ? t(\"hide-details\") : t(\"show-details\") }}\r\n </button>\r\n @if (showDetails()) {\r\n <ul class=\"ms-5 flex list-disc flex-col gap-0.5 ps-4\">\r\n @for (detail of technicalDetails(); track $index) {\r\n <li>{{ detail }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Close, and Stop / Close replacement while the backend allows it -->\r\n <div [class]=\"modal.footerClass\">\r\n @if (canCancel()) {\r\n <mt-button\r\n [label]=\"cancelIsStop() ? t('stop') : t('close')\"\r\n icon=\"general.x-circle\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n [loading]=\"cancelling()\"\r\n (click)=\"cancel()\"\r\n />\r\n }\r\n <mt-button [label]=\"t('dismiss')\" (click)=\"close()\" />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
4609
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'users-groups.replacement'\">\r\n <div class=\"flex flex-col gap-4 p-4\" [class]=\"modal.contentClass\">\r\n @if (loading()) {\r\n <p-skeleton height=\"7rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"6rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton height=\"12rem\" borderRadius=\"0.375rem\" />\r\n } @else if (loadError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ loadError() }}</span>\r\n </div>\r\n } @else if (contractOutdated()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200\"\r\n >\r\n {{ t(\"contract-outdated\") }}\r\n </div>\r\n } @else if (summary(); as replacement) {\r\n <!-- Who \u2192 who, the status, and when -->\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border border-surface bg-content p-4\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"sourceInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-surface-100! text-color! dark:bg-surface-800!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"from\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"sourceName()\">\r\n {{ sourceName() }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-icon\r\n icon=\"arrow.arrow-right\"\r\n class=\"shrink-0 text-lg text-muted-color rtl:rotate-180\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 items-center gap-3\">\r\n <mt-avatar\r\n [label]=\"successorInitials()\"\r\n shape=\"circle\"\r\n styleClass=\"bg-primary-50! text-primary-700! dark:bg-primary-950! dark:text-primary-200!\"\r\n />\r\n <div class=\"min-w-0\">\r\n <div class=\"text-xs text-muted-color\">{{ t(\"to\") }}</div>\r\n <div class=\"truncate font-semibold\" [title]=\"successorName()\">\r\n {{ successorName() }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-surface pt-3 text-xs text-muted-color\"\r\n >\r\n <span\r\n class=\"rounded-md border px-2 py-0.5 font-semibold\"\r\n [class]=\"statusClass()\"\r\n >{{ text.code(\"statuses\", replacement.status) }}</span\r\n >\r\n @if (createdAt(); as created) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.calendar\" />\r\n {{ t(\"started\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n created | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n @if (updatedAt(); as updated) {\r\n <span class=\"flex items-center gap-1\">\r\n <mt-icon icon=\"time.clock\" />\r\n {{ t(\"updated\") }}\r\n <span class=\"tabular-nums text-color\">{{\r\n updated | mtDateFormat: \"dateTime\"\r\n }}</span>\r\n </span>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Where it is, in one sentence -->\r\n @if (card(); as status) {\r\n <section\r\n class=\"flex flex-col gap-3 rounded-md border p-4\"\r\n [class]=\"cardBoxClass()\"\r\n role=\"status\"\r\n >\r\n <div class=\"flex items-start gap-3\">\r\n <mt-icon\r\n [icon]=\"status.icon\"\r\n class=\"mt-0.5 shrink-0 text-xl\"\r\n [class]=\"cardIconClass()\"\r\n />\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n <div class=\"font-semibold\">{{ status.title }}</div>\r\n @if (status.body) {\r\n <div class=\"text-sm\">{{ status.body }}</div>\r\n }\r\n @if (isFinished() && notCheckedCount() > 0) {\r\n <div class=\"text-sm opacity-80\">\r\n {{ t(\"not-checked-note\", { count: notCheckedCount() }) }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (status.progress) {\r\n <p-progressbar mode=\"indeterminate\" [style]=\"{ height: '4px' }\" />\r\n }\r\n\r\n @if (actionError()) {\r\n <div\r\n class=\"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n <mt-icon icon=\"alert.alert-circle\" class=\"mt-0.5 shrink-0\" />\r\n <span>{{ actionError() }}</span>\r\n </div>\r\n }\r\n </section>\r\n }\r\n\r\n <!-- The results: outcomes after Start, what needs an admin first -->\r\n @if (showResults()) {\r\n <section class=\"flex flex-col gap-3\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"results-title\") }}</h3>\r\n\r\n @if (tabs().length > 1) {\r\n <mt-tabs\r\n [options]=\"tabs()\"\r\n [active]=\"activeTab()\"\r\n (activeChange)=\"selectTab($event)\"\r\n mode=\"underline\"\r\n size=\"small\"\r\n />\r\n }\r\n @if (rows().length > 8) {\r\n <mt-text-field\r\n [formControl]=\"search\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"t('search-results')\"\r\n />\r\n }\r\n\r\n @if (itemsError()) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200\"\r\n role=\"alert\"\r\n >\r\n {{ itemsError() }}\r\n </div>\r\n } @else if (itemsLoading() && !filteredRows().length) {\r\n <div class=\"flex flex-col gap-2\">\r\n @for (row of [1, 2, 3]; track row) {\r\n <p-skeleton height=\"3.5rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n } @else if (!filteredRows().length) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface p-4 text-center text-sm text-muted-color\"\r\n >\r\n {{ t(\"no-matching-results\") }}\r\n </div>\r\n } @else {\r\n <ul class=\"rounded-md border border-surface bg-content\">\r\n @for (group of visibleGroups(); track group.place.key) {\r\n <li class=\"border-t border-surface first:border-t-0\">\r\n <!-- The place: project, record, request or escalation -->\r\n <div\r\n class=\"flex items-center gap-3 bg-surface-50 px-3 py-2 dark:bg-surface-900\"\r\n >\r\n <mt-icon\r\n [icon]=\"group.place.icon\"\r\n class=\"shrink-0 text-muted-color\"\r\n />\r\n <div class=\"min-w-0 flex-1\">\r\n <div\r\n class=\"truncate text-sm font-semibold\"\r\n [title]=\"group.place.title\"\r\n >\r\n {{ group.place.title }}\r\n </div>\r\n @if (group.place.context) {\r\n <div\r\n class=\"truncate text-xs text-muted-color\"\r\n [title]=\"group.place.context\"\r\n >\r\n {{ group.place.context }}\r\n </div>\r\n }\r\n </div>\r\n @if (group.place.openUrl) {\r\n <a\r\n class=\"flex shrink-0 items-center gap-1 text-xs text-primary hover:underline\"\r\n [href]=\"group.place.openUrl\"\r\n target=\"_blank\"\r\n rel=\"noopener\"\r\n >\r\n {{ t(\"open-project\") }}\r\n <mt-icon\r\n icon=\"general.link-external-01\"\r\n class=\"rtl:-scale-x-100\"\r\n />\r\n </a>\r\n }\r\n </div>\r\n <ul>\r\n @for (row of group.rows; track row.itemId) {\r\n <li\r\n class=\"flex items-start gap-3 border-t border-surface p-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\r\n <span class=\"text-sm font-medium\">{{\r\n row.words.headline\r\n }}</span>\r\n @if (row.statusDetail) {\r\n <span class=\"text-xs text-muted-color\">{{\r\n row.statusDetail\r\n }}</span>\r\n }\r\n @if (showDetails() && row.words.technical) {\r\n <span\r\n class=\"truncate font-mono text-[11px] text-muted-color\"\r\n [title]=\"row.words.technical\"\r\n >{{ row.words.technical }}</span\r\n >\r\n }\r\n </div>\r\n <span\r\n class=\"shrink-0 whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\r\n [class]=\"row.statusClass\"\r\n >{{ row.status }}</span\r\n >\r\n </li>\r\n }\r\n @if (group.foldedTeamRoles) {\r\n <li\r\n class=\"flex items-center gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon icon=\"general.check-circle\" class=\"shrink-0\" />\r\n {{ t(\"team-note\", { count: group.foldedTeamRoles }) }}\r\n </li>\r\n }\r\n @if (group.untouched) {\r\n <li\r\n class=\"flex items-start gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"mt-0.5 shrink-0\"\r\n />\r\n {{ t(\"untouched-note\", { list: group.untouched }) }}\r\n </li>\r\n }\r\n @if (group.unchecked) {\r\n <li\r\n class=\"flex items-start gap-2 border-t border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <mt-icon\r\n icon=\"alert.alert-circle\"\r\n class=\"mt-0.5 shrink-0\"\r\n />\r\n {{ t(\"unchecked-note\", { list: group.unchecked }) }}\r\n </li>\r\n }\r\n </ul>\r\n </li>\r\n }\r\n </ul>\r\n @if (hiddenRowCount() > 0) {\r\n <mt-button\r\n class=\"self-center\"\r\n [label]=\"t('show-more', { count: hiddenRowCount() })\"\r\n icon=\"arrow.chevron-down\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"showMore()\"\r\n />\r\n }\r\n @if (loadingMore()) {\r\n <div\r\n class=\"flex items-center justify-center gap-2 text-xs text-muted-color\"\r\n role=\"status\"\r\n >\r\n <mt-icon icon=\"arrow.refresh-cw-02\" class=\"animate-spin\" />\r\n {{\r\n t(\"loading-more\", {\r\n loaded: items().length,\r\n total: summary()?.itemCount ?? items().length,\r\n })\r\n }}\r\n </div>\r\n }\r\n }\r\n </section>\r\n }\r\n\r\n <!-- One general limit, with every backend code behind a toggle -->\r\n <div class=\"flex flex-col gap-1 text-xs text-muted-color\">\r\n <div class=\"flex items-start gap-1.5\">\r\n <mt-icon icon=\"general.info-circle\" class=\"mt-px shrink-0\" />\r\n <span>{{ t(\"notices.supported-only\") }}</span>\r\n </div>\r\n @if (technicalDetails().length) {\r\n <button\r\n type=\"button\"\r\n class=\"ms-5 flex items-center gap-1 self-start text-primary hover:underline\"\r\n [attr.aria-expanded]=\"showDetails()\"\r\n (click)=\"showDetails.set(!showDetails())\"\r\n >\r\n <mt-icon\r\n [icon]=\"showDetails() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\r\n />\r\n {{ showDetails() ? t(\"hide-details\") : t(\"show-details\") }}\r\n </button>\r\n @if (showDetails()) {\r\n <ul class=\"ms-5 flex list-disc flex-col gap-0.5 ps-4\">\r\n @for (detail of technicalDetails(); track $index) {\r\n <li>{{ detail }}</li>\r\n }\r\n </ul>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n <!-- Close, and Stop / Close replacement while the backend allows it -->\r\n <div [class]=\"modal.footerClass\">\r\n @if (canCancel()) {\r\n <mt-button\r\n [label]=\"cancelIsStop() ? t('stop') : t('close')\"\r\n icon=\"general.x-circle\"\r\n severity=\"danger\"\r\n variant=\"outlined\"\r\n [loading]=\"cancelling()\"\r\n (click)=\"cancel()\"\r\n />\r\n }\r\n <mt-button [label]=\"t('dismiss')\" (click)=\"close()\" />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
3995
4610
|
}], propDecorators: { operationId: [{ type: i0.Input, args: [{ isSignal: true, alias: "operationId", required: true }] }] } });
|
|
3996
4611
|
|
|
3997
4612
|
const PAGE_SIZE = 25;
|