@masterteam/permissions 0.0.1 → 0.0.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, input, output, signal, effect, Component, DestroyRef, linkedSignal
|
|
2
|
+
import { inject, Injectable, computed, input, output, signal, effect, Component, DestroyRef, linkedSignal } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
@@ -14,13 +14,26 @@ import * as i2 from '@jsverse/transloco';
|
|
|
14
14
|
import { TranslocoModule, TranslocoService } from '@jsverse/transloco';
|
|
15
15
|
import * as i2$1 from 'primeng/skeleton';
|
|
16
16
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
17
|
-
import { Action, Selector, State, Store } from '@ngxs/store';
|
|
17
|
+
import { Action, Selector, State, Store, select } from '@ngxs/store';
|
|
18
18
|
import { HttpClient } from '@angular/common/http';
|
|
19
|
-
import { map
|
|
19
|
+
import { map } from 'rxjs';
|
|
20
|
+
import { CrudStateBase, handleApiRequest } from '@masterteam/components';
|
|
20
21
|
import { ModalRef } from '@masterteam/components/dialog';
|
|
21
22
|
import { Tabs } from '@masterteam/components/tabs';
|
|
22
23
|
import { AccessibilitiesFacade } from '@masterteam/accessibilities';
|
|
23
24
|
|
|
25
|
+
var PermissionsActionKey;
|
|
26
|
+
(function (PermissionsActionKey) {
|
|
27
|
+
PermissionsActionKey["LoadRoles"] = "loadRoles";
|
|
28
|
+
PermissionsActionKey["SelectRole"] = "selectRole";
|
|
29
|
+
PermissionsActionKey["SelectGroup"] = "selectGroup";
|
|
30
|
+
PermissionsActionKey["LoadPermissions"] = "loadPermissions";
|
|
31
|
+
PermissionsActionKey["LoadGroupPermissions"] = "loadGroupPermissions";
|
|
32
|
+
PermissionsActionKey["UpdatePermission"] = "updatePermission";
|
|
33
|
+
PermissionsActionKey["UpdateGroupPermission"] = "updateGroupPermission";
|
|
34
|
+
PermissionsActionKey["ToggleAllLevelPermissions"] = "toggleAllLevelPermissions";
|
|
35
|
+
PermissionsActionKey["ToggleAllGroupPermissions"] = "toggleAllGroupPermissions";
|
|
36
|
+
})(PermissionsActionKey || (PermissionsActionKey = {}));
|
|
24
37
|
var ModuleType;
|
|
25
38
|
(function (ModuleType) {
|
|
26
39
|
ModuleType["LEVEL"] = "level";
|
|
@@ -32,20 +45,6 @@ class LoadRoles {
|
|
|
32
45
|
static type = '[Permissions] Load Roles';
|
|
33
46
|
constructor() { }
|
|
34
47
|
}
|
|
35
|
-
class LoadRolesSuccess {
|
|
36
|
-
roles;
|
|
37
|
-
static type = '[Permissions] Load Roles Success';
|
|
38
|
-
constructor(roles) {
|
|
39
|
-
this.roles = roles;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
class LoadRolesFail {
|
|
43
|
-
error;
|
|
44
|
-
static type = '[Permissions] Load Roles Fail';
|
|
45
|
-
constructor(error) {
|
|
46
|
-
this.error = error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
48
|
class SelectRole {
|
|
50
49
|
roleValue;
|
|
51
50
|
static type = '[Permissions] Select Role';
|
|
@@ -78,27 +77,6 @@ class LoadGroupPermissions {
|
|
|
78
77
|
this.levelId = levelId;
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
class LoadPermissionsSuccess {
|
|
82
|
-
permissions;
|
|
83
|
-
static type = '[Permissions] Load Permissions Success';
|
|
84
|
-
constructor(permissions) {
|
|
85
|
-
this.permissions = permissions;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
class LoadGroupPermissionsSuccess {
|
|
89
|
-
permissions;
|
|
90
|
-
static type = '[Permissions] Load Group Permissions Success';
|
|
91
|
-
constructor(permissions) {
|
|
92
|
-
this.permissions = permissions;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
class LoadPermissionsFail {
|
|
96
|
-
error;
|
|
97
|
-
static type = '[Permissions] Load Permissions Fail';
|
|
98
|
-
constructor(error) {
|
|
99
|
-
this.error = error;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
80
|
class UpdatePermissionLocally {
|
|
103
81
|
roleValue;
|
|
104
82
|
levelId;
|
|
@@ -145,16 +123,6 @@ class UpdateGroupPermission {
|
|
|
145
123
|
this.levelId = levelId;
|
|
146
124
|
}
|
|
147
125
|
}
|
|
148
|
-
class UpdatePermissionSuccess {
|
|
149
|
-
static type = '[Permissions] Update Permission Success';
|
|
150
|
-
}
|
|
151
|
-
class UpdatePermissionFail {
|
|
152
|
-
error;
|
|
153
|
-
static type = '[Permissions] Update Permission Fail';
|
|
154
|
-
constructor(error) {
|
|
155
|
-
this.error = error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
126
|
class ToggleAllLevelPermissions {
|
|
159
127
|
roleValue;
|
|
160
128
|
levelId;
|
|
@@ -205,78 +173,74 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
205
173
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
206
174
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
207
175
|
};
|
|
208
|
-
let PermissionsState = class PermissionsState {
|
|
176
|
+
let PermissionsState = class PermissionsState extends CrudStateBase {
|
|
209
177
|
http = inject(HttpClient);
|
|
210
|
-
|
|
178
|
+
// ============================================================================
|
|
179
|
+
// Data Selectors - Individual for fine-grained reactivity
|
|
180
|
+
// ============================================================================
|
|
181
|
+
static getRoles(state) {
|
|
211
182
|
return state.roles;
|
|
212
183
|
}
|
|
213
|
-
static
|
|
184
|
+
static getSelectedRoleValue(state) {
|
|
214
185
|
return state.selectedRoleValue;
|
|
215
186
|
}
|
|
216
|
-
static
|
|
187
|
+
static getSelectedGroupValue(state) {
|
|
217
188
|
return state.selectedGroupValue;
|
|
218
189
|
}
|
|
219
|
-
static
|
|
190
|
+
static getPermissions(state) {
|
|
220
191
|
return state.permissions;
|
|
221
192
|
}
|
|
222
|
-
static
|
|
193
|
+
static getGroupPermissions(state) {
|
|
223
194
|
return state.groupPermissions;
|
|
224
195
|
}
|
|
225
|
-
static
|
|
226
|
-
return state.loading;
|
|
227
|
-
}
|
|
228
|
-
static permissionsLoading(state) {
|
|
229
|
-
return state.permissionsLoading;
|
|
230
|
-
}
|
|
231
|
-
static addPermissionsLoading(state) {
|
|
232
|
-
return state.addPermissionsLoading;
|
|
233
|
-
}
|
|
234
|
-
static moduleType(state) {
|
|
196
|
+
static getModuleType(state) {
|
|
235
197
|
return state.moduleType;
|
|
236
198
|
}
|
|
237
|
-
static
|
|
199
|
+
static getModuleId(state) {
|
|
238
200
|
return state.moduleId;
|
|
239
201
|
}
|
|
240
|
-
static
|
|
202
|
+
static getLevelId(state) {
|
|
241
203
|
return state.moduleType === 'module'
|
|
242
204
|
? state.parentModuleId.toString()
|
|
243
205
|
: state.moduleId.toString();
|
|
244
206
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
207
|
+
// ============================================================================
|
|
208
|
+
// Loading/Error Slice Selectors - REQUIRED for optimal performance
|
|
209
|
+
// ============================================================================
|
|
210
|
+
static getLoadingActive(state) {
|
|
211
|
+
return state.loadingActive;
|
|
212
|
+
}
|
|
213
|
+
static getErrors(state) {
|
|
214
|
+
return state.errors;
|
|
215
|
+
}
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// CRUD Actions
|
|
218
|
+
// ============================================================================
|
|
219
|
+
// ============================================================================
|
|
220
|
+
// CRUD Actions
|
|
221
|
+
// ============================================================================
|
|
248
222
|
loadRoles(ctx) {
|
|
249
|
-
ctx.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}));
|
|
262
|
-
}
|
|
263
|
-
loadRolesSuccess(ctx, action) {
|
|
264
|
-
ctx.patchState({
|
|
265
|
-
roles: action.roles,
|
|
266
|
-
loading: false,
|
|
267
|
-
error: null,
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
loadRolesFail(ctx, action) {
|
|
271
|
-
ctx.patchState({
|
|
272
|
-
loading: false,
|
|
273
|
-
error: action.error,
|
|
223
|
+
const { moduleType, moduleId } = ctx.getState();
|
|
224
|
+
const req$ = this.http
|
|
225
|
+
.get(`identity/roles/scopes/${moduleType}/${moduleId}?inherited=true`)
|
|
226
|
+
.pipe(map((response) => response.data));
|
|
227
|
+
return handleApiRequest({
|
|
228
|
+
ctx,
|
|
229
|
+
key: PermissionsActionKey.LoadRoles,
|
|
230
|
+
request$: req$,
|
|
231
|
+
onSuccess: (roles) => ({
|
|
232
|
+
roles,
|
|
233
|
+
currentLevelId: moduleId.toString() || '',
|
|
234
|
+
}),
|
|
274
235
|
});
|
|
275
236
|
}
|
|
237
|
+
// ============================================================================
|
|
238
|
+
// Simple State Updates (No HTTP)
|
|
239
|
+
// ============================================================================
|
|
276
240
|
selectRole(ctx, action) {
|
|
277
241
|
const state = ctx.getState();
|
|
278
242
|
ctx.patchState({ selectedRoleValue: action.roleValue });
|
|
279
|
-
if (state.currentLevelId) {
|
|
243
|
+
if (state.currentLevelId && action.roleValue) {
|
|
280
244
|
ctx.dispatch(new LoadPermissions(action.roleValue, state.currentLevelId));
|
|
281
245
|
}
|
|
282
246
|
}
|
|
@@ -288,61 +252,40 @@ let PermissionsState = class PermissionsState {
|
|
|
288
252
|
}
|
|
289
253
|
}
|
|
290
254
|
loadPermissions(ctx, action) {
|
|
291
|
-
ctx.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
: ctx.getState().moduleId}/${ctx.getState().moduleType === 'module' ? 'module/' : ''}${ctx.getState().moduleType === 'module'
|
|
297
|
-
? `${ctx.getState().moduleId}/`
|
|
298
|
-
: ''}${action.roleValue}/permissions`, {
|
|
255
|
+
const state = ctx.getState();
|
|
256
|
+
const modulePath = state.moduleType === 'module' ? `module/${state.moduleId}/` : '';
|
|
257
|
+
const levelId = state.moduleType === 'module' ? state.parentModuleId : state.moduleId;
|
|
258
|
+
const req$ = this.http
|
|
259
|
+
.get(`identity/roles/level/${levelId}/${modulePath}${action.roleValue}/permissions`, {
|
|
299
260
|
params: {
|
|
300
|
-
scopeId:
|
|
301
|
-
? ctx.getState().parentModuleId
|
|
302
|
-
: ctx.getState().moduleId,
|
|
261
|
+
scopeId: levelId,
|
|
303
262
|
scopeType: ModuleType.LEVEL,
|
|
304
263
|
},
|
|
305
264
|
})
|
|
306
|
-
.pipe(map((response) => response.data.permissions)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
ctx.patchState({ permissionsLoading: true, error: null });
|
|
315
|
-
return this.http
|
|
316
|
-
.get(`identity/groups/level/${ctx.getState().moduleType === 'module'
|
|
317
|
-
? ctx.getState().parentModuleId
|
|
318
|
-
: ctx.getState().moduleId}/${ctx.getState().moduleType === 'module' ? 'module/' : ''}${ctx.getState().moduleType === 'module'
|
|
319
|
-
? `${ctx.getState().moduleId}/`
|
|
320
|
-
: ''}${action.groupId}/permissions`)
|
|
321
|
-
.pipe(map((response) => response.data), tap((permissions) => {
|
|
322
|
-
ctx.dispatch(new LoadGroupPermissionsSuccess(permissions));
|
|
323
|
-
}), catchError((error) => {
|
|
324
|
-
ctx.dispatch(new LoadPermissionsFail(error.message || 'Failed to load permissions'));
|
|
325
|
-
throw error;
|
|
326
|
-
}));
|
|
327
|
-
}
|
|
328
|
-
loadPermissionsSuccess(ctx, action) {
|
|
329
|
-
ctx.patchState({
|
|
330
|
-
permissions: action.permissions,
|
|
331
|
-
permissionsLoading: false,
|
|
332
|
-
error: null,
|
|
265
|
+
.pipe(map((response) => response.data.permissions));
|
|
266
|
+
return handleApiRequest({
|
|
267
|
+
ctx,
|
|
268
|
+
key: PermissionsActionKey.LoadPermissions,
|
|
269
|
+
request$: req$,
|
|
270
|
+
onSuccess: (permissions) => ({
|
|
271
|
+
permissions,
|
|
272
|
+
}),
|
|
333
273
|
});
|
|
334
274
|
}
|
|
335
|
-
|
|
336
|
-
ctx.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
275
|
+
loadGroupPermissions(ctx, action) {
|
|
276
|
+
const state = ctx.getState();
|
|
277
|
+
const modulePath = state.moduleType === 'module' ? `module/${state.moduleId}/` : '';
|
|
278
|
+
const levelId = state.moduleType === 'module' ? state.parentModuleId : state.moduleId;
|
|
279
|
+
const req$ = this.http
|
|
280
|
+
.get(`identity/groups/level/${levelId}/${modulePath}${action.groupId}/permissions`)
|
|
281
|
+
.pipe(map((response) => response.data));
|
|
282
|
+
return handleApiRequest({
|
|
283
|
+
ctx,
|
|
284
|
+
key: PermissionsActionKey.LoadGroupPermissions,
|
|
285
|
+
request$: req$,
|
|
286
|
+
onSuccess: (permissions) => ({
|
|
287
|
+
groupPermissions: permissions,
|
|
288
|
+
}),
|
|
346
289
|
});
|
|
347
290
|
}
|
|
348
291
|
updatePermissionLocally(ctx, action) {
|
|
@@ -368,54 +311,46 @@ let PermissionsState = class PermissionsState {
|
|
|
368
311
|
}));
|
|
369
312
|
ctx.patchState({ groupPermissions: updatedPermissions });
|
|
370
313
|
}
|
|
314
|
+
// ============================================================================
|
|
315
|
+
// Complex Operations - use handleApiRequest for transformations
|
|
316
|
+
// ============================================================================
|
|
371
317
|
updatePermission(ctx, action) {
|
|
372
318
|
const state = ctx.getState();
|
|
373
|
-
ctx.patchState({ addPermissionsLoading: true, error: null });
|
|
374
319
|
const updatedPermissions = state.permissions;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
.put(`identity/roles/${action.roleValue}/setAllPermissions`, { permissions: updatedPermissions }, {
|
|
320
|
+
const scopeId = state.moduleType === 'module' ? state.parentModuleId : state.moduleId;
|
|
321
|
+
const req$ = this.http.put(`identity/roles/${action.roleValue}/setAllPermissions`, { permissions: updatedPermissions }, {
|
|
378
322
|
params: {
|
|
379
|
-
scopeId
|
|
380
|
-
? ctx.getState().parentModuleId
|
|
381
|
-
: ctx.getState().moduleId,
|
|
323
|
+
scopeId,
|
|
382
324
|
scopeType: ModuleType.LEVEL,
|
|
383
325
|
},
|
|
384
|
-
})
|
|
385
|
-
|
|
386
|
-
ctx
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
permissions:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
throw error;
|
|
397
|
-
}));
|
|
326
|
+
});
|
|
327
|
+
return handleApiRequest({
|
|
328
|
+
ctx,
|
|
329
|
+
key: PermissionsActionKey.UpdatePermission,
|
|
330
|
+
request$: req$,
|
|
331
|
+
onSuccess: () => ({}),
|
|
332
|
+
onError: (error, currentState) => {
|
|
333
|
+
// Rollback on error
|
|
334
|
+
return { permissions: currentState.permissions };
|
|
335
|
+
},
|
|
336
|
+
errorMessage: 'Failed to update permission',
|
|
337
|
+
});
|
|
398
338
|
}
|
|
399
339
|
updateGroupPermission(ctx, action) {
|
|
400
340
|
const state = ctx.getState();
|
|
401
|
-
ctx.patchState({ addPermissionsLoading: true, error: null });
|
|
402
341
|
const updatedPermissions = state.groupPermissions;
|
|
403
|
-
|
|
404
|
-
return
|
|
405
|
-
|
|
406
|
-
.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
});
|
|
416
|
-
ctx.dispatch(new UpdatePermissionFail(error.message || 'Failed to update permission'));
|
|
417
|
-
throw error;
|
|
418
|
-
}));
|
|
342
|
+
const req$ = this.http.put(`identity/groups/${action.groupId}/setAllPermissions`, { permissions: updatedPermissions[0].logs || [] });
|
|
343
|
+
return handleApiRequest({
|
|
344
|
+
ctx,
|
|
345
|
+
key: PermissionsActionKey.UpdateGroupPermission,
|
|
346
|
+
request$: req$,
|
|
347
|
+
onSuccess: () => ({}),
|
|
348
|
+
onError: (error, currentState) => {
|
|
349
|
+
// Rollback on error
|
|
350
|
+
return { groupPermissions: currentState.groupPermissions };
|
|
351
|
+
},
|
|
352
|
+
errorMessage: 'Failed to update permission',
|
|
353
|
+
});
|
|
419
354
|
}
|
|
420
355
|
toggleAllLevelPermissions(ctx, action) {
|
|
421
356
|
const state = ctx.getState();
|
|
@@ -426,23 +361,25 @@ let PermissionsState = class PermissionsState {
|
|
|
426
361
|
isSelected: action.enabled,
|
|
427
362
|
})),
|
|
428
363
|
}));
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
.put(`identity/roles/${action.roleValue}/setAllPermissions`, { permissions: updatedPermissions }, {
|
|
364
|
+
const scopeId = state.moduleType === 'module' ? state.parentModuleId : state.moduleId;
|
|
365
|
+
const req$ = this.http.put(`identity/roles/${action.roleValue}/setAllPermissions`, { permissions: updatedPermissions }, {
|
|
432
366
|
params: {
|
|
433
|
-
scopeId
|
|
434
|
-
? ctx.getState().parentModuleId
|
|
435
|
-
: ctx.getState().moduleId,
|
|
367
|
+
scopeId,
|
|
436
368
|
scopeType: ModuleType.LEVEL,
|
|
437
369
|
},
|
|
438
|
-
})
|
|
439
|
-
|
|
440
|
-
ctx
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
370
|
+
});
|
|
371
|
+
return handleApiRequest({
|
|
372
|
+
ctx,
|
|
373
|
+
key: PermissionsActionKey.ToggleAllLevelPermissions,
|
|
374
|
+
request$: req$,
|
|
375
|
+
onSuccess: () => ({
|
|
376
|
+
permissions: updatedPermissions,
|
|
377
|
+
}),
|
|
378
|
+
onError: () => ({
|
|
379
|
+
permissions: state.permissions,
|
|
380
|
+
}),
|
|
381
|
+
errorMessage: 'Failed to toggle all permissions',
|
|
382
|
+
});
|
|
446
383
|
}
|
|
447
384
|
toggleAllGroupPermissions(ctx, action) {
|
|
448
385
|
const state = ctx.getState();
|
|
@@ -456,16 +393,19 @@ let PermissionsState = class PermissionsState {
|
|
|
456
393
|
})),
|
|
457
394
|
})),
|
|
458
395
|
}));
|
|
459
|
-
|
|
460
|
-
return
|
|
461
|
-
|
|
462
|
-
.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
396
|
+
const req$ = this.http.put(`identity/groups/${action.groupId}/setAllPermissions`, { permissions: updatedPermissions[0].logs || [] });
|
|
397
|
+
return handleApiRequest({
|
|
398
|
+
ctx,
|
|
399
|
+
key: PermissionsActionKey.ToggleAllGroupPermissions,
|
|
400
|
+
request$: req$,
|
|
401
|
+
onSuccess: () => ({
|
|
402
|
+
groupPermissions: updatedPermissions,
|
|
403
|
+
}),
|
|
404
|
+
onError: () => ({
|
|
405
|
+
groupPermissions: state.groupPermissions,
|
|
406
|
+
}),
|
|
407
|
+
errorMessage: 'Failed to toggle all permissions',
|
|
408
|
+
});
|
|
469
409
|
}
|
|
470
410
|
setModuleInfo(ctx, action) {
|
|
471
411
|
let parentPath = '';
|
|
@@ -497,18 +437,12 @@ let PermissionsState = class PermissionsState {
|
|
|
497
437
|
groupPermissions: [],
|
|
498
438
|
});
|
|
499
439
|
}
|
|
500
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsState, deps:
|
|
440
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsState, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
501
441
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsState });
|
|
502
442
|
};
|
|
503
443
|
__decorate([
|
|
504
444
|
Action(LoadRoles)
|
|
505
445
|
], PermissionsState.prototype, "loadRoles", null);
|
|
506
|
-
__decorate([
|
|
507
|
-
Action(LoadRolesSuccess)
|
|
508
|
-
], PermissionsState.prototype, "loadRolesSuccess", null);
|
|
509
|
-
__decorate([
|
|
510
|
-
Action(LoadRolesFail)
|
|
511
|
-
], PermissionsState.prototype, "loadRolesFail", null);
|
|
512
446
|
__decorate([
|
|
513
447
|
Action(SelectRole)
|
|
514
448
|
], PermissionsState.prototype, "selectRole", null);
|
|
@@ -521,15 +455,6 @@ __decorate([
|
|
|
521
455
|
__decorate([
|
|
522
456
|
Action(LoadGroupPermissions)
|
|
523
457
|
], PermissionsState.prototype, "loadGroupPermissions", null);
|
|
524
|
-
__decorate([
|
|
525
|
-
Action(LoadPermissionsSuccess)
|
|
526
|
-
], PermissionsState.prototype, "loadPermissionsSuccess", null);
|
|
527
|
-
__decorate([
|
|
528
|
-
Action(LoadGroupPermissionsSuccess)
|
|
529
|
-
], PermissionsState.prototype, "loadGroupPermissionsSuccess", null);
|
|
530
|
-
__decorate([
|
|
531
|
-
Action(LoadPermissionsFail)
|
|
532
|
-
], PermissionsState.prototype, "loadPermissionsFail", null);
|
|
533
458
|
__decorate([
|
|
534
459
|
Action(UpdatePermissionLocally)
|
|
535
460
|
], PermissionsState.prototype, "updatePermissionLocally", null);
|
|
@@ -556,40 +481,34 @@ __decorate([
|
|
|
556
481
|
], PermissionsState.prototype, "reset", null);
|
|
557
482
|
__decorate([
|
|
558
483
|
Selector()
|
|
559
|
-
], PermissionsState, "
|
|
560
|
-
__decorate([
|
|
561
|
-
Selector()
|
|
562
|
-
], PermissionsState, "selectedRoleValue", null);
|
|
484
|
+
], PermissionsState, "getRoles", null);
|
|
563
485
|
__decorate([
|
|
564
486
|
Selector()
|
|
565
|
-
], PermissionsState, "
|
|
487
|
+
], PermissionsState, "getSelectedRoleValue", null);
|
|
566
488
|
__decorate([
|
|
567
489
|
Selector()
|
|
568
|
-
], PermissionsState, "
|
|
490
|
+
], PermissionsState, "getSelectedGroupValue", null);
|
|
569
491
|
__decorate([
|
|
570
492
|
Selector()
|
|
571
|
-
], PermissionsState, "
|
|
493
|
+
], PermissionsState, "getPermissions", null);
|
|
572
494
|
__decorate([
|
|
573
495
|
Selector()
|
|
574
|
-
], PermissionsState, "
|
|
496
|
+
], PermissionsState, "getGroupPermissions", null);
|
|
575
497
|
__decorate([
|
|
576
498
|
Selector()
|
|
577
|
-
], PermissionsState, "
|
|
499
|
+
], PermissionsState, "getModuleType", null);
|
|
578
500
|
__decorate([
|
|
579
501
|
Selector()
|
|
580
|
-
], PermissionsState, "
|
|
502
|
+
], PermissionsState, "getModuleId", null);
|
|
581
503
|
__decorate([
|
|
582
504
|
Selector()
|
|
583
|
-
], PermissionsState, "
|
|
505
|
+
], PermissionsState, "getLevelId", null);
|
|
584
506
|
__decorate([
|
|
585
507
|
Selector()
|
|
586
|
-
], PermissionsState, "
|
|
508
|
+
], PermissionsState, "getLoadingActive", null);
|
|
587
509
|
__decorate([
|
|
588
510
|
Selector()
|
|
589
|
-
], PermissionsState, "
|
|
590
|
-
__decorate([
|
|
591
|
-
Selector()
|
|
592
|
-
], PermissionsState, "error", null);
|
|
511
|
+
], PermissionsState, "getErrors", null);
|
|
593
512
|
PermissionsState = __decorate([
|
|
594
513
|
State({
|
|
595
514
|
name: 'permissions',
|
|
@@ -600,36 +519,59 @@ PermissionsState = __decorate([
|
|
|
600
519
|
permissions: [],
|
|
601
520
|
groupPermissions: [],
|
|
602
521
|
currentLevelId: null,
|
|
603
|
-
loading: false,
|
|
604
|
-
permissionsLoading: false,
|
|
605
|
-
addPermissionsLoading: false,
|
|
606
|
-
error: null,
|
|
607
522
|
moduleType: '',
|
|
608
523
|
moduleId: '',
|
|
609
|
-
parentModuleType:
|
|
610
|
-
parentModuleId:
|
|
524
|
+
parentModuleType: null,
|
|
525
|
+
parentModuleId: null,
|
|
611
526
|
parentPath: '',
|
|
527
|
+
loadingActive: [], // Required by LoadingStateShape
|
|
528
|
+
errors: {}, // Required by LoadingStateShape
|
|
612
529
|
},
|
|
613
530
|
})
|
|
614
531
|
], PermissionsState);
|
|
615
532
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsState, decorators: [{
|
|
616
533
|
type: Injectable
|
|
617
|
-
}], propDecorators: { loadRoles: [],
|
|
534
|
+
}], propDecorators: { loadRoles: [], selectRole: [], selectGroup: [], loadPermissions: [], loadGroupPermissions: [], updatePermissionLocally: [], updateGroupPermissionLocally: [], updatePermission: [], updateGroupPermission: [], toggleAllLevelPermissions: [], toggleAllGroupPermissions: [], setModuleInfo: [], reset: [] } });
|
|
618
535
|
|
|
619
536
|
class PermissionsFacade {
|
|
620
537
|
store = inject(Store);
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
538
|
+
// ============================================================================
|
|
539
|
+
// Data Selectors - Memoized by NGXS (fine-grained reactivity)
|
|
540
|
+
// ============================================================================
|
|
541
|
+
roles = select(PermissionsState.getRoles);
|
|
542
|
+
selectedRoleValue = select(PermissionsState.getSelectedRoleValue);
|
|
543
|
+
selectedGroupValue = select(PermissionsState.getSelectedGroupValue);
|
|
544
|
+
permissions = select(PermissionsState.getPermissions);
|
|
545
|
+
groupPermissions = select(PermissionsState.getGroupPermissions);
|
|
546
|
+
moduleType = select(PermissionsState.getModuleType);
|
|
547
|
+
moduleId = select(PermissionsState.getModuleId);
|
|
548
|
+
levelId = select(PermissionsState.getLevelId);
|
|
549
|
+
// ============================================================================
|
|
550
|
+
// Loading/Error Slices - Memoized by NGXS
|
|
551
|
+
// ============================================================================
|
|
552
|
+
loadingActive = select(PermissionsState.getLoadingActive);
|
|
553
|
+
errors = select(PermissionsState.getErrors);
|
|
554
|
+
// ============================================================================
|
|
555
|
+
// Loading Signals - Computed from slice (minimal reactivity)
|
|
556
|
+
// ============================================================================
|
|
557
|
+
isLoadingRoles = computed(() => this.loadingActive().includes(PermissionsActionKey.LoadRoles), ...(ngDevMode ? [{ debugName: "isLoadingRoles" }] : []));
|
|
558
|
+
isLoadingPermissions = computed(() => this.loadingActive().includes(PermissionsActionKey.LoadPermissions), ...(ngDevMode ? [{ debugName: "isLoadingPermissions" }] : []));
|
|
559
|
+
isLoadingGroupPermissions = computed(() => this.loadingActive().includes(PermissionsActionKey.LoadGroupPermissions), ...(ngDevMode ? [{ debugName: "isLoadingGroupPermissions" }] : []));
|
|
560
|
+
isUpdatingPermission = computed(() => this.loadingActive().includes(PermissionsActionKey.UpdatePermission), ...(ngDevMode ? [{ debugName: "isUpdatingPermission" }] : []));
|
|
561
|
+
isUpdatingGroupPermission = computed(() => this.loadingActive().includes(PermissionsActionKey.UpdateGroupPermission), ...(ngDevMode ? [{ debugName: "isUpdatingGroupPermission" }] : []));
|
|
562
|
+
isTogglingLevelPermissions = computed(() => this.loadingActive().includes(PermissionsActionKey.ToggleAllLevelPermissions), ...(ngDevMode ? [{ debugName: "isTogglingLevelPermissions" }] : []));
|
|
563
|
+
isTogglingGroupPermissions = computed(() => this.loadingActive().includes(PermissionsActionKey.ToggleAllGroupPermissions), ...(ngDevMode ? [{ debugName: "isTogglingGroupPermissions" }] : []));
|
|
564
|
+
// ============================================================================
|
|
565
|
+
// Error Signals - Computed from slice (minimal reactivity)
|
|
566
|
+
// ============================================================================
|
|
567
|
+
rolesError = computed(() => this.errors()[PermissionsActionKey.LoadRoles] ?? null, ...(ngDevMode ? [{ debugName: "rolesError" }] : []));
|
|
568
|
+
permissionsError = computed(() => this.errors()[PermissionsActionKey.LoadPermissions] ?? null, ...(ngDevMode ? [{ debugName: "permissionsError" }] : []));
|
|
569
|
+
groupPermissionsError = computed(() => this.errors()[PermissionsActionKey.LoadGroupPermissions] ?? null, ...(ngDevMode ? [{ debugName: "groupPermissionsError" }] : []));
|
|
570
|
+
updatePermissionError = computed(() => this.errors()[PermissionsActionKey.UpdatePermission] ?? null, ...(ngDevMode ? [{ debugName: "updatePermissionError" }] : []));
|
|
571
|
+
updateGroupPermissionError = computed(() => this.errors()[PermissionsActionKey.UpdateGroupPermission] ?? null, ...(ngDevMode ? [{ debugName: "updateGroupPermissionError" }] : []));
|
|
572
|
+
// ============================================================================
|
|
573
|
+
// Action Dispatchers
|
|
574
|
+
// ============================================================================
|
|
633
575
|
loadRoles() {
|
|
634
576
|
return this.store.dispatch(new LoadRoles());
|
|
635
577
|
}
|
|
@@ -689,8 +631,9 @@ class PermissionsEditDialog {
|
|
|
689
631
|
ref = inject(ModalRef);
|
|
690
632
|
// permissionGroup = input.required<PermissionLog | null>();
|
|
691
633
|
permissionGroup = input(null, ...(ngDevMode ? [{ debugName: "permissionGroup" }] : []));
|
|
692
|
-
|
|
693
|
-
|
|
634
|
+
// Use new facade pattern
|
|
635
|
+
addPermissionsLoading = this.permissionsFacade.isUpdatingPermission;
|
|
636
|
+
addPermissionsError = this.permissionsFacade.updatePermissionError;
|
|
694
637
|
levelId = input.required(...(ngDevMode ? [{ debugName: "levelId" }] : []));
|
|
695
638
|
roleValue = input.required(...(ngDevMode ? [{ debugName: "roleValue" }] : []));
|
|
696
639
|
isGroup = input.required(...(ngDevMode ? [{ debugName: "isGroup" }] : []));
|
|
@@ -791,16 +734,17 @@ class PermissionsPage {
|
|
|
791
734
|
modal = inject(ModalService);
|
|
792
735
|
destroyRef = inject(DestroyRef);
|
|
793
736
|
defaultLevelName = 'Project';
|
|
794
|
-
|
|
795
|
-
|
|
737
|
+
// Use new facade pattern
|
|
738
|
+
levelRoles = this.permissionsFacade.roles;
|
|
739
|
+
selectedRoleValue = this.permissionsFacade.selectedRoleValue;
|
|
796
740
|
selectedRole = linkedSignal(this.selectedRoleValue, ...(ngDevMode ? [{ debugName: "selectedRole" }] : []));
|
|
797
|
-
selectedGroupValue = this.permissionsFacade.
|
|
741
|
+
selectedGroupValue = this.permissionsFacade.selectedGroupValue;
|
|
798
742
|
selectedGroup = linkedSignal(this.selectedGroupValue, ...(ngDevMode ? [{ debugName: "selectedGroup" }] : []));
|
|
799
|
-
permissions = this.permissionsFacade.
|
|
800
|
-
groupPermissions = this.permissionsFacade.
|
|
801
|
-
loading = this.permissionsFacade.
|
|
802
|
-
permissionsLoading = this.permissionsFacade.
|
|
803
|
-
levelId = this.permissionsFacade.
|
|
743
|
+
permissions = this.permissionsFacade.permissions;
|
|
744
|
+
groupPermissions = this.permissionsFacade.groupPermissions;
|
|
745
|
+
loading = this.permissionsFacade.isLoadingRoles;
|
|
746
|
+
permissionsLoading = this.permissionsFacade.isLoadingPermissions;
|
|
747
|
+
levelId = this.permissionsFacade.levelId;
|
|
804
748
|
groups = this.accessibilitiesFacade.groups;
|
|
805
749
|
allPermissionsToggle = new FormControl(false);
|
|
806
750
|
groupOrRoleId = computed(() => {
|
|
@@ -944,7 +888,7 @@ class PermissionsPage {
|
|
|
944
888
|
this.permissionsFacade.reset();
|
|
945
889
|
}
|
|
946
890
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
947
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PermissionsPage, isStandalone: true, selector: "mt-permissions-page", ngImport: i0, template: "<div id=\"permissions-page-card\" class=\"flex gap-4 p-1\">\r\n <div class=\"w-1/5 flex-shrink-0\">\r\n <mt-card class=\"h-full flex flex-col\">\r\n <ng-template #headless>\r\n <div class=\"flex flex-col h-full\">\r\n <div\r\n class=\"p-4 pb-0 bg-surface-50 rounded-t-2xl border-b border-surface\"\r\n >\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{ \"permissions.rolesAndGroups\" | transloco }}\r\n </h2>\r\n\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList()\"\r\n size=\"large\"\r\n (onChange)=\"onTabChange($event)\"\r\n />\r\n </div>\r\n\r\n <div class=\"flex-1 overflow-y-auto p-4\">\r\n @if (loading()) {\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n } @else {\r\n @if (selectedTab() === \"roles\") {\r\n @for (level of levelRoles(); track level.levelKey) {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n <h2 class=\"font-semibold\">{{ level.level }}</h2>\r\n @for (role of level.roles; track role.value) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedRole() === role.value\"\r\n [class.hover:bg-surface]=\"selectedRole() !== role.value\"\r\n [class.border-primary-400]=\"\r\n selectedRole() === role.value\r\n \"\r\n [style.--p-avatar-background]=\"\r\n selectedRole() === role.value\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedRole() === role.value ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectRole(role.value)\"\r\n >\r\n <mt-avatar [icon]=\"'user.user-check-01'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ role.name }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noRolesFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noLevelRolesFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n @for (group of groups(); track group.name) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedGroup() === group.id\"\r\n [class.hover:bg-surface]=\"selectedGroup() !== group.id\"\r\n [class.border-primary-400]=\"selectedGroup() === group.id\"\r\n [style.--p-avatar-background]=\"\r\n selectedGroup() === group.id\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedGroup() === group.id ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectGroup(group.id)\"\r\n >\r\n <mt-avatar [icon]=\"'user.users-check'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">{{ group.name }}</div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noGroupsFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n </div>\r\n\r\n <div class=\"min-w-0 w-1/2\">\r\n @if (!selectedRole() && !selectedGroup()) {\r\n <mt-card class=\"h-full\">\r\n <ng-template #headless>\r\n <div class=\"flex items-center justify-center h-full text-muted-color\">\r\n {{ \"permissions.selectRoleToViewPermissions\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n } @else {\r\n <mt-card class=\"h-full\">\r\n <div class=\"flex flex-col h-full\">\r\n <ng-template #headless>\r\n <div class=\"p-4 pb-2 mb-5 border-b border-surface\">\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.levelPermissions\"\r\n : \"permissions.groupsPermissions\"\r\n ) | transloco\r\n }}\r\n </h2>\r\n </div>\r\n @if (permissionsLoading()) {\r\n <div class=\"mx-4\">\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"mb-5 p-3 mx-4 rounded-lg border-1 border-surface flex items-center justify-between\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'security.lock-unlocked-01'\"\r\n shape=\"square\"\r\n size=\"large\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + 'primary' + '-600)'\"\r\n >\r\n </mt-avatar>\r\n <div>\r\n <div class=\"text-sm font-semibold\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.setAllProjectPermissions\"\r\n : \"permissions.setAllGroupPermissions\"\r\n ) | transloco\r\n }}\r\n </div>\r\n <div class=\"text-xs text-muted-color\">\r\n {{ \"permissions.recommendedForSimpleForms\" | transloco }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-toggle-field\r\n [formControl]=\"allPermissionsToggle\"\r\n ></mt-toggle-field>\r\n </div>\r\n\r\n <div class=\"flex-1 px-4 overflow-y-auto border-t border-surface\">\r\n <div class=\"space-y-3 my-5\">\r\n @if (selectedTab() === \"roles\") {\r\n @for (group of permissions(); track group.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ group.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(group)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n @for (group of groupPermissions(); track group.levelName) {\r\n <div class=\"flex flex-col justify-between gap-3\">\r\n @for (log of group.logs; track log.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ log.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(log)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{\r\n \"permissions.noPermissionsFoundForSelectedGroup\"\r\n | transloco\r\n }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n }\r\n </ng-template>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { 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"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
891
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PermissionsPage, isStandalone: true, selector: "mt-permissions-page", ngImport: i0, template: "<div id=\"permissions-page-card\" class=\"flex gap-4 p-1\">\r\n <div class=\"w-1/5 flex-shrink-0\">\r\n <mt-card class=\"h-full flex flex-col\">\r\n <ng-template #headless>\r\n <div class=\"flex flex-col h-full\">\r\n <div\r\n class=\"p-4 pb-0 bg-surface-50 rounded-t-2xl border-b border-surface\"\r\n >\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{ \"permissions.rolesAndGroups\" | transloco }}\r\n </h2>\r\n\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList()\"\r\n size=\"large\"\r\n (onChange)=\"onTabChange($event)\"\r\n />\r\n </div>\r\n\r\n <div class=\"flex-1 overflow-y-auto p-4\">\r\n @if (loading()) {\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n } @else {\r\n @if (selectedTab() === \"roles\") {\r\n @for (level of levelRoles(); track level.levelKey) {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n <h2 class=\"font-semibold\">{{ level.level }}</h2>\r\n @for (role of level.roles; track role.value) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedRole() === role.value\"\r\n [class.hover:bg-surface]=\"selectedRole() !== role.value\"\r\n [class.border-primary-400]=\"\r\n selectedRole() === role.value\r\n \"\r\n [style.--p-avatar-background]=\"\r\n selectedRole() === role.value\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedRole() === role.value ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectRole(role.value)\"\r\n >\r\n <mt-avatar [icon]=\"'user.user-check-01'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ role.name }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noRolesFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noLevelRolesFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n @for (group of groups(); track group.name) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedGroup() === group.id\"\r\n [class.hover:bg-surface]=\"selectedGroup() !== group.id\"\r\n [class.border-primary-400]=\"selectedGroup() === group.id\"\r\n [style.--p-avatar-background]=\"\r\n selectedGroup() === group.id\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedGroup() === group.id ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectGroup(group.id)\"\r\n >\r\n <mt-avatar [icon]=\"'user.users-check'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ group.name?.display }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noGroupsFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n </div>\r\n\r\n <div class=\"min-w-0 w-1/2\">\r\n @if (!selectedRole() && !selectedGroup()) {\r\n <mt-card class=\"h-full\">\r\n <ng-template #headless>\r\n <div class=\"flex items-center justify-center h-full text-muted-color\">\r\n {{ \"permissions.selectRoleToViewPermissions\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n } @else {\r\n <mt-card class=\"h-full\">\r\n <div class=\"flex flex-col h-full\">\r\n <ng-template #headless>\r\n <div class=\"p-4 pb-2 mb-5 border-b border-surface\">\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.levelPermissions\"\r\n : \"permissions.groupsPermissions\"\r\n ) | transloco\r\n }}\r\n </h2>\r\n </div>\r\n @if (permissionsLoading()) {\r\n <div class=\"mx-4\">\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"mb-5 p-3 mx-4 rounded-lg border-1 border-surface flex items-center justify-between\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'security.lock-unlocked-01'\"\r\n shape=\"square\"\r\n size=\"large\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + 'primary' + '-600)'\"\r\n >\r\n </mt-avatar>\r\n <div>\r\n <div class=\"text-sm font-semibold\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.setAllProjectPermissions\"\r\n : \"permissions.setAllGroupPermissions\"\r\n ) | transloco\r\n }}\r\n </div>\r\n <div class=\"text-xs text-muted-color\">\r\n {{ \"permissions.recommendedForSimpleForms\" | transloco }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-toggle-field\r\n [formControl]=\"allPermissionsToggle\"\r\n ></mt-toggle-field>\r\n </div>\r\n\r\n <div class=\"flex-1 px-4 overflow-y-auto border-t border-surface\">\r\n <div class=\"space-y-3 my-5\">\r\n @if (selectedTab() === \"roles\") {\r\n @for (group of permissions(); track group.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ group.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(group)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n @for (group of groupPermissions(); track group.levelName) {\r\n <div class=\"flex flex-col justify-between gap-3\">\r\n @for (log of group.logs; track log.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ log.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(log)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{\r\n \"permissions.noPermissionsFoundForSelectedGroup\"\r\n | transloco\r\n }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n }\r\n </ng-template>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { 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"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
948
892
|
}
|
|
949
893
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PermissionsPage, decorators: [{
|
|
950
894
|
type: Component,
|
|
@@ -958,7 +902,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
958
902
|
Avatar,
|
|
959
903
|
SkeletonModule,
|
|
960
904
|
Tabs,
|
|
961
|
-
], template: "<div id=\"permissions-page-card\" class=\"flex gap-4 p-1\">\r\n <div class=\"w-1/5 flex-shrink-0\">\r\n <mt-card class=\"h-full flex flex-col\">\r\n <ng-template #headless>\r\n <div class=\"flex flex-col h-full\">\r\n <div\r\n class=\"p-4 pb-0 bg-surface-50 rounded-t-2xl border-b border-surface\"\r\n >\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{ \"permissions.rolesAndGroups\" | transloco }}\r\n </h2>\r\n\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList()\"\r\n size=\"large\"\r\n (onChange)=\"onTabChange($event)\"\r\n />\r\n </div>\r\n\r\n <div class=\"flex-1 overflow-y-auto p-4\">\r\n @if (loading()) {\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n } @else {\r\n @if (selectedTab() === \"roles\") {\r\n @for (level of levelRoles(); track level.levelKey) {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n <h2 class=\"font-semibold\">{{ level.level }}</h2>\r\n @for (role of level.roles; track role.value) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedRole() === role.value\"\r\n [class.hover:bg-surface]=\"selectedRole() !== role.value\"\r\n [class.border-primary-400]=\"\r\n selectedRole() === role.value\r\n \"\r\n [style.--p-avatar-background]=\"\r\n selectedRole() === role.value\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedRole() === role.value ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectRole(role.value)\"\r\n >\r\n <mt-avatar [icon]=\"'user.user-check-01'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ role.name }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noRolesFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noLevelRolesFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n @for (group of groups(); track group.name) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedGroup() === group.id\"\r\n [class.hover:bg-surface]=\"selectedGroup() !== group.id\"\r\n [class.border-primary-400]=\"selectedGroup() === group.id\"\r\n [style.--p-avatar-background]=\"\r\n selectedGroup() === group.id\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedGroup() === group.id ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectGroup(group.id)\"\r\n >\r\n <mt-avatar [icon]=\"'user.users-check'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">{{ group.name }}</div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noGroupsFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n </div>\r\n\r\n <div class=\"min-w-0 w-1/2\">\r\n @if (!selectedRole() && !selectedGroup()) {\r\n <mt-card class=\"h-full\">\r\n <ng-template #headless>\r\n <div class=\"flex items-center justify-center h-full text-muted-color\">\r\n {{ \"permissions.selectRoleToViewPermissions\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n } @else {\r\n <mt-card class=\"h-full\">\r\n <div class=\"flex flex-col h-full\">\r\n <ng-template #headless>\r\n <div class=\"p-4 pb-2 mb-5 border-b border-surface\">\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.levelPermissions\"\r\n : \"permissions.groupsPermissions\"\r\n ) | transloco\r\n }}\r\n </h2>\r\n </div>\r\n @if (permissionsLoading()) {\r\n <div class=\"mx-4\">\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"mb-5 p-3 mx-4 rounded-lg border-1 border-surface flex items-center justify-between\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'security.lock-unlocked-01'\"\r\n shape=\"square\"\r\n size=\"large\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + 'primary' + '-600)'\"\r\n >\r\n </mt-avatar>\r\n <div>\r\n <div class=\"text-sm font-semibold\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.setAllProjectPermissions\"\r\n : \"permissions.setAllGroupPermissions\"\r\n ) | transloco\r\n }}\r\n </div>\r\n <div class=\"text-xs text-muted-color\">\r\n {{ \"permissions.recommendedForSimpleForms\" | transloco }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-toggle-field\r\n [formControl]=\"allPermissionsToggle\"\r\n ></mt-toggle-field>\r\n </div>\r\n\r\n <div class=\"flex-1 px-4 overflow-y-auto border-t border-surface\">\r\n <div class=\"space-y-3 my-5\">\r\n @if (selectedTab() === \"roles\") {\r\n @for (group of permissions(); track group.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ group.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(group)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n @for (group of groupPermissions(); track group.levelName) {\r\n <div class=\"flex flex-col justify-between gap-3\">\r\n @for (log of group.logs; track log.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ log.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(log)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{\r\n \"permissions.noPermissionsFoundForSelectedGroup\"\r\n | transloco\r\n }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n }\r\n </ng-template>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n</div>\r\n" }]
|
|
905
|
+
], template: "<div id=\"permissions-page-card\" class=\"flex gap-4 p-1\">\r\n <div class=\"w-1/5 flex-shrink-0\">\r\n <mt-card class=\"h-full flex flex-col\">\r\n <ng-template #headless>\r\n <div class=\"flex flex-col h-full\">\r\n <div\r\n class=\"p-4 pb-0 bg-surface-50 rounded-t-2xl border-b border-surface\"\r\n >\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{ \"permissions.rolesAndGroups\" | transloco }}\r\n </h2>\r\n\r\n <mt-tabs\r\n [(active)]=\"selectedTab\"\r\n [options]=\"tabsList()\"\r\n size=\"large\"\r\n (onChange)=\"onTabChange($event)\"\r\n />\r\n </div>\r\n\r\n <div class=\"flex-1 overflow-y-auto p-4\">\r\n @if (loading()) {\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n } @else {\r\n @if (selectedTab() === \"roles\") {\r\n @for (level of levelRoles(); track level.levelKey) {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n <h2 class=\"font-semibold\">{{ level.level }}</h2>\r\n @for (role of level.roles; track role.value) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedRole() === role.value\"\r\n [class.hover:bg-surface]=\"selectedRole() !== role.value\"\r\n [class.border-primary-400]=\"\r\n selectedRole() === role.value\r\n \"\r\n [style.--p-avatar-background]=\"\r\n selectedRole() === role.value\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedRole() === role.value ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectRole(role.value)\"\r\n >\r\n <mt-avatar [icon]=\"'user.user-check-01'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ role.name }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noRolesFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noLevelRolesFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n <div class=\"flex flex-col gap-2 mb-4\">\r\n @for (group of groups(); track group.name) {\r\n <div\r\n class=\"p-3 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer transition-colors flex items-center gap-3\"\r\n [class.bg-primary-50]=\"selectedGroup() === group.id\"\r\n [class.hover:bg-surface]=\"selectedGroup() !== group.id\"\r\n [class.border-primary-400]=\"selectedGroup() === group.id\"\r\n [style.--p-avatar-background]=\"\r\n selectedGroup() === group.id\r\n ? 'var(--p-primary-color)'\r\n : 'var(--p-surface-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n selectedGroup() === group.id ? '#ffffff' : ''\r\n \"\r\n (click)=\"selectGroup(group.id)\"\r\n >\r\n <mt-avatar [icon]=\"'user.users-check'\" shape=\"square\">\r\n </mt-avatar>\r\n <div class=\"flex-1 min-w-0\">\r\n <div class=\"font-medium truncate\">\r\n {{ group.name?.display }}\r\n </div>\r\n </div>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noGroupsFound\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n </div>\r\n\r\n <div class=\"min-w-0 w-1/2\">\r\n @if (!selectedRole() && !selectedGroup()) {\r\n <mt-card class=\"h-full\">\r\n <ng-template #headless>\r\n <div class=\"flex items-center justify-center h-full text-muted-color\">\r\n {{ \"permissions.selectRoleToViewPermissions\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-card>\r\n } @else {\r\n <mt-card class=\"h-full\">\r\n <div class=\"flex flex-col h-full\">\r\n <ng-template #headless>\r\n <div class=\"p-4 pb-2 mb-5 border-b border-surface\">\r\n <h2 class=\"text-lg font-semibold mb-3\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.levelPermissions\"\r\n : \"permissions.groupsPermissions\"\r\n ) | transloco\r\n }}\r\n </h2>\r\n </div>\r\n @if (permissionsLoading()) {\r\n <div class=\"mx-4\">\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n <p-skeleton class=\"my-4\" height=\"4rem\" />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"mb-5 p-3 mx-4 rounded-lg border-1 border-surface flex items-center justify-between\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'security.lock-unlocked-01'\"\r\n shape=\"square\"\r\n size=\"large\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + 'primary' + '-600)'\"\r\n >\r\n </mt-avatar>\r\n <div>\r\n <div class=\"text-sm font-semibold\">\r\n {{\r\n (selectedTab() === \"roles\"\r\n ? \"permissions.setAllProjectPermissions\"\r\n : \"permissions.setAllGroupPermissions\"\r\n ) | transloco\r\n }}\r\n </div>\r\n <div class=\"text-xs text-muted-color\">\r\n {{ \"permissions.recommendedForSimpleForms\" | transloco }}\r\n </div>\r\n </div>\r\n </div>\r\n <mt-toggle-field\r\n [formControl]=\"allPermissionsToggle\"\r\n ></mt-toggle-field>\r\n </div>\r\n\r\n <div class=\"flex-1 px-4 overflow-y-auto border-t border-surface\">\r\n <div class=\"space-y-3 my-5\">\r\n @if (selectedTab() === \"roles\") {\r\n @for (group of permissions(); track group.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ group.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(group)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n } @else {\r\n @for (group of groupPermissions(); track group.levelName) {\r\n <div class=\"flex flex-col justify-between gap-3\">\r\n @for (log of group.logs; track log.name) {\r\n <div\r\n class=\"p-2 border-1 border-surface rounded-lg flex items-center justify-between hover:bg-surface-100 transition-colors\"\r\n >\r\n <div class=\"flex items-center gap-3\">\r\n <mt-avatar\r\n [icon]=\"'editor.dotpoints-02'\"\r\n shape=\"square\"\r\n size=\"normal\"\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + 'surface' + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"\r\n 'var(--p-' + 'primary' + '-600)'\r\n \"\r\n >\r\n </mt-avatar>\r\n <span class=\"text-sm\">{{ log.name }}</span>\r\n </div>\r\n <mt-button\r\n [text]=\"true\"\r\n icon=\"custom.pencil\"\r\n severity=\"primary\"\r\n (click)=\"openPermissionDialog(log)\"\r\n >\r\n </mt-button>\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{\r\n \"permissions.noPermissionsFoundForSelectedGroup\"\r\n | transloco\r\n }}\r\n </div>\r\n }\r\n </div>\r\n } @empty {\r\n <div\r\n class=\"flex items-center justify-center h-full text-muted-color\"\r\n >\r\n {{ \"permissions.noPermissionsFound\" | transloco }}\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n }\r\n </ng-template>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n</div>\r\n" }]
|
|
962
906
|
}], ctorParameters: () => [] });
|
|
963
907
|
|
|
964
908
|
// store/index.ts
|
|
@@ -967,5 +911,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
967
911
|
* Generated bundle index. Do not edit.
|
|
968
912
|
*/
|
|
969
913
|
|
|
970
|
-
export { LoadGroupPermissions,
|
|
914
|
+
export { LoadGroupPermissions, LoadPermissions, LoadRoles, ModuleType, PermissionsActionKey, PermissionsEditDialog, PermissionsFacade, PermissionsPage, PermissionsState, Reset, SelectGroup, SelectRole, SetModuleInfo, ToggleAllGroupPermissions, ToggleAllLevelPermissions, UpdateGroupPermission, UpdateGroupPermissionLocally, UpdatePermission, UpdatePermissionLocally };
|
|
971
915
|
//# sourceMappingURL=masterteam-permissions.mjs.map
|