@flusys/ng-iam 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{flusys-ng-iam-action-form-page.component-Ci56tFEu.mjs → flusys-ng-iam-action-form-page.component-CF_ixS-r.mjs} +18 -15
- package/fesm2022/flusys-ng-iam-action-form-page.component-CF_ixS-r.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-action-list-page.component-BRi_CpGl.mjs → flusys-ng-iam-action-list-page.component-BveT0xT6.mjs} +62 -10
- package/fesm2022/flusys-ng-iam-action-list-page.component-BveT0xT6.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-flusys-ng-iam-BEAhj9ma.mjs → flusys-ng-iam-flusys-ng-iam-CjLr3bfY.mjs} +661 -169
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-CjLr3bfY.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-iam-container.component-D0m8u6nu.mjs → flusys-ng-iam-iam-container.component-XBoIeQ0t.mjs} +4 -4
- package/fesm2022/{flusys-ng-iam-iam-container.component-D0m8u6nu.mjs.map → flusys-ng-iam-iam-container.component-XBoIeQ0t.mjs.map} +1 -1
- package/fesm2022/{flusys-ng-iam-permission-page.component-CVaxwwcS.mjs → flusys-ng-iam-permission-page.component-CGtj1EiO.mjs} +12 -11
- package/fesm2022/flusys-ng-iam-permission-page.component-CGtj1EiO.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-role-form-page.component-ByMbnQ53.mjs → flusys-ng-iam-role-form-page.component-Cfc8za3D.mjs} +20 -14
- package/fesm2022/flusys-ng-iam-role-form-page.component-Cfc8za3D.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-role-list-page.component-BCtoWvFQ.mjs → flusys-ng-iam-role-list-page.component-vFHxd3Q-.mjs} +61 -10
- package/fesm2022/flusys-ng-iam-role-list-page.component-vFHxd3Q-.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam.mjs +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-iam.d.ts +99 -72
- package/fesm2022/flusys-ng-iam-action-form-page.component-Ci56tFEu.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-action-list-page.component-BRi_CpGl.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-BEAhj9ma.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-permission-page.component-CVaxwwcS.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-form-page.component-ByMbnQ53.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-list-page.component-BCtoWvFQ.mjs.map +0 -1
package/types/flusys-ng-iam.d.ts
CHANGED
|
@@ -8,29 +8,17 @@ import * as _flusys_ng_ui from '@flusys/ng-ui';
|
|
|
8
8
|
import { ConfirmationService } from '@flusys/ng-ui';
|
|
9
9
|
import { Routes } from '@angular/router';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Company entity interface
|
|
13
|
-
* Shared across IAM components
|
|
14
|
-
*/
|
|
15
11
|
interface ICompany {
|
|
16
12
|
id: string;
|
|
17
13
|
name: string;
|
|
18
14
|
slug?: string;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
/**
|
|
22
|
-
* User entity interface
|
|
23
|
-
* Shared across IAM components
|
|
24
|
-
*/
|
|
25
17
|
interface IUser {
|
|
26
18
|
id: string;
|
|
27
19
|
name: string;
|
|
28
20
|
email: string;
|
|
29
21
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Branch entity interface
|
|
32
|
-
* Used in user permission assignments
|
|
33
|
-
*/
|
|
34
22
|
interface IBranch {
|
|
35
23
|
id: string;
|
|
36
24
|
name: string;
|
|
@@ -152,6 +140,16 @@ interface IUserRoleResponseDto {
|
|
|
152
140
|
branchId: string | null;
|
|
153
141
|
createdAt: Date;
|
|
154
142
|
}
|
|
143
|
+
interface IRoleUserResponseDto {
|
|
144
|
+
id: string;
|
|
145
|
+
userId: string;
|
|
146
|
+
createdAt: Date;
|
|
147
|
+
}
|
|
148
|
+
interface IActionUserResponseDto {
|
|
149
|
+
id: string;
|
|
150
|
+
userId: string;
|
|
151
|
+
createdAt: Date;
|
|
152
|
+
}
|
|
155
153
|
interface IMyPermissionsResponseDto {
|
|
156
154
|
frontendActions: Array<{
|
|
157
155
|
code: string;
|
|
@@ -183,8 +181,6 @@ interface IGetUserActionsDto {
|
|
|
183
181
|
companyId?: string;
|
|
184
182
|
branchId?: string;
|
|
185
183
|
}
|
|
186
|
-
interface IGetRoleActionsDto {
|
|
187
|
-
}
|
|
188
184
|
interface IGetUserRolesDto {
|
|
189
185
|
branchId?: string;
|
|
190
186
|
}
|
|
@@ -263,6 +259,10 @@ declare class PermissionApiService extends BaseApiService {
|
|
|
263
259
|
getUserRoles(userId: string, query?: IGetUserRolesDto): Observable<ISingleResponse<IUserRoleResponseDto[]>>;
|
|
264
260
|
assignRoleActions(data: IAssignRoleActionsDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
265
261
|
getRoleActions(roleId: string): Observable<ISingleResponse<IRoleActionResponseDto[]>>;
|
|
262
|
+
/** Reverse lookup: users assigned to a role */
|
|
263
|
+
getRoleUsers(roleId: string): Observable<ISingleResponse<IRoleUserResponseDto[]>>;
|
|
264
|
+
/** Reverse lookup: users directly assigned an action */
|
|
265
|
+
getActionUsers(actionId: string): Observable<ISingleResponse<IActionUserResponseDto[]>>;
|
|
266
266
|
assignCompanyActions(data: IAssignCompanyActionsDto): Observable<ISingleResponse<IPermissionOperationResultDto>>;
|
|
267
267
|
getCompanyActions(companyId: string): Observable<ISingleResponse<ICompanyActionResponseDto[]>>;
|
|
268
268
|
/** Effective roles for the authenticated user — merges company-wide and login-branch-specific assignments */
|
|
@@ -307,7 +307,6 @@ declare class PermissionStateService {
|
|
|
307
307
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PermissionStateService>;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
/** Internal node with ID for UI tree tracking */
|
|
311
310
|
interface IBuilderNode {
|
|
312
311
|
id: string;
|
|
313
312
|
type: 'group' | 'action';
|
|
@@ -315,7 +314,6 @@ interface IBuilderNode {
|
|
|
315
314
|
actionId?: string;
|
|
316
315
|
children?: IBuilderNode[];
|
|
317
316
|
}
|
|
318
|
-
/** Visual builder for AND/OR permission logic trees */
|
|
319
317
|
declare class LogicBuilderComponent {
|
|
320
318
|
readonly logic: _angular_core.InputSignal<ILogicNode | null>;
|
|
321
319
|
readonly actions: _angular_core.InputSignal<{
|
|
@@ -323,7 +321,6 @@ declare class LogicBuilderComponent {
|
|
|
323
321
|
name: string;
|
|
324
322
|
}[]>;
|
|
325
323
|
readonly logicChange: _angular_core.OutputEmitterRef<ILogicNode | null>;
|
|
326
|
-
/** Internal builder tree state (private writable + public readonly pattern) */
|
|
327
324
|
private readonly _builderTree;
|
|
328
325
|
readonly builderLogic: _angular_core.Signal<IBuilderNode | null>;
|
|
329
326
|
constructor();
|
|
@@ -333,9 +330,7 @@ declare class LogicBuilderComponent {
|
|
|
333
330
|
addChildNode(parentId: string, type: 'group' | 'action'): void;
|
|
334
331
|
removeNode(nodeId: string): void;
|
|
335
332
|
updateActionId(nodeId: string, actionId: string): void;
|
|
336
|
-
/** Updates a node in the tree and emits the change */
|
|
337
333
|
private updateNode;
|
|
338
|
-
/** Sets the tree and emits the change */
|
|
339
334
|
private updateTreeAndEmit;
|
|
340
335
|
private updateNodeInTree;
|
|
341
336
|
private removeNodeFromTree;
|
|
@@ -431,33 +426,9 @@ declare class CompanyActionSelectorComponent extends BaseActionSelectorComponent
|
|
|
431
426
|
}
|
|
432
427
|
|
|
433
428
|
/**
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* **Architecture:**
|
|
439
|
-
* - Presentation: DataTable for role list
|
|
440
|
-
* - Business Logic: Role assignment without dependency validation
|
|
441
|
-
* - State: Signals with computed dependencies
|
|
442
|
-
*
|
|
443
|
-
* **Core Features:**
|
|
444
|
-
* - User dropdown with async loading
|
|
445
|
-
* - Branch selector (if company feature enabled)
|
|
446
|
-
* - Role assignment management (add/remove)
|
|
447
|
-
* - Real-time change tracking
|
|
448
|
-
*
|
|
449
|
-
* **Granularity:**
|
|
450
|
-
* - Company-wide: branchId = undefined
|
|
451
|
-
* - Branch-specific: branchId = selected value
|
|
452
|
-
*
|
|
453
|
-
* **Performance:**
|
|
454
|
-
* - Computed signals for reactive updates
|
|
455
|
-
* - Branch filtering on company context change
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```html
|
|
459
|
-
* <flusys-user-role-selector />
|
|
460
|
-
* ```
|
|
429
|
+
* Manages user role assignments with branch-level granularity:
|
|
430
|
+
* `branchId === undefined` means a company-wide assignment, a set value
|
|
431
|
+
* scopes the assignment to that specific branch.
|
|
461
432
|
*/
|
|
462
433
|
declare class UserRoleSelectorComponent {
|
|
463
434
|
readonly USER_ROLE_PERMISSIONS: {
|
|
@@ -494,37 +465,13 @@ declare class UserRoleSelectorComponent {
|
|
|
494
465
|
readonly pendingRemove: _angular_core.Signal<IRole[]>;
|
|
495
466
|
readonly canSave: _angular_core.Signal<boolean>;
|
|
496
467
|
constructor();
|
|
497
|
-
/**
|
|
498
|
-
* Load user's permitted branches
|
|
499
|
-
*/
|
|
500
468
|
private loadUserBranches;
|
|
501
|
-
/**
|
|
502
|
-
* Load roles and assignments for selected user
|
|
503
|
-
*/
|
|
504
469
|
private loadData;
|
|
505
|
-
/**
|
|
506
|
-
* Get tooltip for role checkbox
|
|
507
|
-
*/
|
|
508
470
|
getTooltip(role: IRole): string;
|
|
509
|
-
/**
|
|
510
|
-
* Handle role checkbox toggle
|
|
511
|
-
*/
|
|
512
471
|
onRoleToggle(role: IRole, newValue: boolean): void;
|
|
513
|
-
/**
|
|
514
|
-
* Toggle all roles
|
|
515
|
-
*/
|
|
516
472
|
toggleAll(): void;
|
|
517
|
-
/**
|
|
518
|
-
* Set all role selections to a given value
|
|
519
|
-
*/
|
|
520
473
|
protected setAllSelections(value: boolean): void;
|
|
521
|
-
/**
|
|
522
|
-
* Save changes to backend
|
|
523
|
-
*/
|
|
524
474
|
saveChanges(): Promise<void>;
|
|
525
|
-
/**
|
|
526
|
-
* Reset component state
|
|
527
|
-
*/
|
|
528
475
|
private resetState;
|
|
529
476
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserRoleSelectorComponent, never>;
|
|
530
477
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserRoleSelectorComponent, "flusys-user-role-selector", never, {}, {}, never, never, true, never>;
|
|
@@ -571,6 +518,86 @@ declare class UserActionSelectorComponent extends BaseActionSelectorComponent {
|
|
|
571
518
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserActionSelectorComponent, "flusys-user-action-selector", never, {}, {}, never, never, true, never>;
|
|
572
519
|
}
|
|
573
520
|
|
|
521
|
+
interface RolePermittedUserRow {
|
|
522
|
+
id: string;
|
|
523
|
+
userId: string;
|
|
524
|
+
userName: string;
|
|
525
|
+
userEmail: string;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Read-only viewer for users assigned to a role, with a remove-only action
|
|
529
|
+
* per user. Assigning new users stays on the user-centric
|
|
530
|
+
* `UserRoleSelectorComponent` flow — this dialog intentionally has no "add"
|
|
531
|
+
* affordance. Since IAM stays independent of the auth package, user display
|
|
532
|
+
* info is resolved via the `USER_PROVIDER` injection token rather than a
|
|
533
|
+
* direct join.
|
|
534
|
+
*/
|
|
535
|
+
declare class RolePermittedUsersDialogComponent {
|
|
536
|
+
readonly USER_ROLE_PERMISSIONS: {
|
|
537
|
+
readonly READ: "user-role.read";
|
|
538
|
+
readonly ASSIGN: "user-role.assign";
|
|
539
|
+
};
|
|
540
|
+
private readonly permissionApi;
|
|
541
|
+
private readonly userProvider;
|
|
542
|
+
private readonly confirmationService;
|
|
543
|
+
private readonly messageService;
|
|
544
|
+
private readonly translateAdapter;
|
|
545
|
+
private t;
|
|
546
|
+
readonly visible: _angular_core.InputSignal<boolean>;
|
|
547
|
+
readonly role: _angular_core.InputSignal<IRole | null>;
|
|
548
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
549
|
+
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
550
|
+
readonly isRemoving: _angular_core.WritableSignal<boolean>;
|
|
551
|
+
readonly users: _angular_core.WritableSignal<RolePermittedUserRow[]>;
|
|
552
|
+
constructor();
|
|
553
|
+
private loadUsers;
|
|
554
|
+
private resolveUserInfo;
|
|
555
|
+
onRemove(user: RolePermittedUserRow): void;
|
|
556
|
+
onClose(): void;
|
|
557
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RolePermittedUsersDialogComponent, never>;
|
|
558
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RolePermittedUsersDialogComponent, "flusys-role-permitted-users-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; "role": { "alias": "role"; "required": true; "isSignal": true; }; }, { "closed": "closed"; }, never, never, true, never>;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
interface ActionPermittedUserRow {
|
|
562
|
+
id: string;
|
|
563
|
+
userId: string;
|
|
564
|
+
userName: string;
|
|
565
|
+
userEmail: string;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Read-only viewer for users directly assigned an action, with a remove-only
|
|
569
|
+
* action per user. Assigning new users stays on the user-centric
|
|
570
|
+
* `UserActionSelectorComponent` flow — this dialog intentionally has no
|
|
571
|
+
* "add" affordance. Since IAM stays independent of the auth package, user
|
|
572
|
+
* display info is resolved via the `USER_PROVIDER` injection token rather
|
|
573
|
+
* than a direct join.
|
|
574
|
+
*/
|
|
575
|
+
declare class ActionPermittedUsersDialogComponent {
|
|
576
|
+
readonly USER_ACTION_PERMISSIONS: {
|
|
577
|
+
readonly READ: "user-action.read";
|
|
578
|
+
readonly ASSIGN: "user-action.assign";
|
|
579
|
+
};
|
|
580
|
+
private readonly permissionApi;
|
|
581
|
+
private readonly userProvider;
|
|
582
|
+
private readonly confirmationService;
|
|
583
|
+
private readonly messageService;
|
|
584
|
+
private readonly translateAdapter;
|
|
585
|
+
private t;
|
|
586
|
+
readonly visible: _angular_core.InputSignal<boolean>;
|
|
587
|
+
readonly action: _angular_core.InputSignal<IAction | null>;
|
|
588
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
589
|
+
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
590
|
+
readonly isRemoving: _angular_core.WritableSignal<boolean>;
|
|
591
|
+
readonly users: _angular_core.WritableSignal<ActionPermittedUserRow[]>;
|
|
592
|
+
constructor();
|
|
593
|
+
private loadUsers;
|
|
594
|
+
private resolveUserInfo;
|
|
595
|
+
onRemove(user: ActionPermittedUserRow): void;
|
|
596
|
+
onClose(): void;
|
|
597
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionPermittedUsersDialogComponent, never>;
|
|
598
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ActionPermittedUsersDialogComponent, "flusys-action-permitted-users-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; "action": { "alias": "action"; "required": true; "isSignal": true; }; }, { "closed": "closed"; }, never, never, true, never>;
|
|
599
|
+
}
|
|
600
|
+
|
|
574
601
|
/**
|
|
575
602
|
* Profile Permission Provider Adapter
|
|
576
603
|
*
|
|
@@ -617,5 +644,5 @@ declare function provideIamProviders(): Provider[];
|
|
|
617
644
|
*/
|
|
618
645
|
declare const IAM_ROUTES: Routes;
|
|
619
646
|
|
|
620
|
-
export { ActionApiService, ActionPermissionLogicService, ActionType, CompanyActionSelectorComponent, IAM_MESSAGES, IAM_ROUTES, LogicBuilderComponent, MAX_DROPDOWN_ITEMS, MyPermissionsApiService, PermissionApiService, PermissionStateService, ProfilePermissionProviderAdapter, RoleActionSelectorComponent, RoleApiService, UserActionSelectorComponent, UserRoleSelectorComponent, provideIamProviders };
|
|
621
|
-
export type { IAction, IActionTreeDto, IAssignCompanyActionsDto, IAssignRoleActionsDto, IAssignUserActionsDto, IAssignUserRolesDto, IBranch, ICompany, ICompanyActionResponseDto, ICreateActionDto, ICreateRoleDto, IGetMyPermissionsDto,
|
|
647
|
+
export { ActionApiService, ActionPermissionLogicService, ActionPermittedUsersDialogComponent, ActionType, CompanyActionSelectorComponent, IAM_MESSAGES, IAM_ROUTES, LogicBuilderComponent, MAX_DROPDOWN_ITEMS, MyPermissionsApiService, PermissionApiService, PermissionStateService, ProfilePermissionProviderAdapter, RoleActionSelectorComponent, RoleApiService, RolePermittedUsersDialogComponent, UserActionSelectorComponent, UserRoleSelectorComponent, provideIamProviders };
|
|
648
|
+
export type { IAction, IActionTreeDto, IActionUserResponseDto, IAssignCompanyActionsDto, IAssignRoleActionsDto, IAssignUserActionsDto, IAssignUserRolesDto, IBranch, ICompany, ICompanyActionResponseDto, ICreateActionDto, ICreateRoleDto, IGetMyPermissionsDto, IGetUserActionsDto, IGetUserRolesDto, IMyPermissionsResponseDto, IPermissionItemDto, IPermissionOperationResultDto, IPrerequisiteActionDto, IPrerequisiteValidationError, IRole, IRoleActionResponseDto, IRoleQueryDto, IRoleUserResponseDto, IUpdateActionDto, IUpdateRoleDto, IUser, IUserActionResponseDto, IUserRoleResponseDto, PermissionAction };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flusys-ng-iam-action-form-page.component-Ci56tFEu.mjs","sources":["../../../projects/ng-iam/pages/action/action-form-page.component.ts"],"sourcesContent":["import { Component, computed, effect, inject, signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { form, FormField, required } from '@angular/forms/signals';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { MessageService } from '@flusys/ng-ui';\nimport {\n AngularModule,\n ILogicNode,\n TranslatePipe,\n TranslateService,\n} from '@flusys/ng-shared';\nimport { LogicBuilderComponent } from '../../components/logic-builder.component';\nimport { ActionType, IAction } from '../../interfaces/action.interface';\nimport { ActionApiService } from '../../services/action-api.service';\nimport { TreeNode, UiModule } from '@flusys/ng-ui';\nimport { buildActionParentTree } from '../../utils/tree-utils';\n\ninterface IActionFormModel {\n id: string;\n name: string;\n description: string;\n code: string;\n actionType: ActionType;\n permissionLogic: ILogicNode | null;\n parentId: string | null;\n serial: string;\n isActive: boolean;\n}\n\n@Component({\n selector: 'lib-action-form-page',\n imports: [\n AngularModule,\n UiModule,\n FormField,\n LogicBuilderComponent,\n TranslatePipe,\n ],\n template: `\n <div class=\"card\">\n <h3 class=\"text-lg sm:text-xl font-semibold mb-4\">\n {{\n isEditMode()\n ? ('iam.action.edit' | translate)\n : ('iam.action.new' | translate)\n }}\n </h3>\n\n <form\n (ngSubmit)=\"onSubmit()\"\n class=\"grid grid-cols-1 md:grid-cols-2 gap-4\"\n >\n <!-- Name -->\n <div class=\"flex flex-col gap-2\">\n <label for=\"name\" class=\"font-medium\"\n >{{ 'iam.action.name' | translate }} *</label\n >\n <input\n fInputText\n id=\"name\"\n [formField]=\"actionForm.name\"\n [placeholder]=\"'iam.action.name.placeholder' | translate\"\n />\n </div>\n\n <!-- Code -->\n <div class=\"flex flex-col gap-2\">\n <label for=\"code\" class=\"font-medium\">{{\n 'iam.action.code' | translate\n }}</label>\n <input\n fInputText\n id=\"code\"\n [formField]=\"actionForm.code\"\n [placeholder]=\"'iam.action.code.placeholder' | translate\"\n />\n </div>\n\n <!-- Description -->\n <div class=\"flex flex-col gap-2\">\n <label for=\"description\" class=\"font-medium\">{{\n 'shared.description' | translate\n }}</label>\n <input\n fInputText\n id=\"description\"\n [formField]=\"actionForm.description\"\n [placeholder]=\"'shared.description.placeholder' | translate\"\n />\n </div>\n\n <!-- Action Type -->\n <div class=\"flex flex-col gap-2\">\n <label for=\"actionType\" class=\"font-medium\"\n >{{ 'iam.action.type' | translate }} *</label\n >\n <f-select\n inputId=\"actionType\"\n [options]=\"actionTypes()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [formField]=\"actionForm.actionType\"\n [placeholder]=\"'iam.action.type' | translate\"\n />\n </div>\n\n <!-- Parent Action -->\n <div class=\"flex flex-col gap-2\">\n <label class=\"font-medium\">{{\n 'iam.action.parent' | translate\n }}</label>\n <f-treeselect\n [options]=\"parentTreeNodes()\"\n [formField]=\"actionForm.parentId\"\n [placeholder]=\"'iam.action.select.parent' | translate\"\n [filter]=\"true\"\n [showClear]=\"true\"\n />\n </div>\n\n <!-- Order -->\n <div class=\"flex flex-col gap-2\">\n <label for=\"serial\" class=\"font-medium\">{{\n 'shared.display.order' | translate\n }}</label>\n <input\n fInputText\n id=\"serial\"\n type=\"number\"\n [formField]=\"actionForm.serial\"\n [placeholder]=\"'shared.display.order.placeholder' | translate\"\n />\n </div>\n\n <!-- Is Active -->\n <div class=\"flex items-end gap-2 pb-1 md:col-span-2\">\n <f-checkbox\n [formField]=\"actionForm.isActive\"\n [binary]=\"true\"\n inputId=\"isActive\"\n />\n <label for=\"isActive\">{{ 'shared.active' | translate }}</label>\n </div>\n\n <!-- Permission Logic Builder -->\n <div class=\"md:col-span-2\">\n <lib-logic-builder\n [logic]=\"formModel().permissionLogic\"\n [actions]=\"allActionsForLogic()\"\n (logicChange)=\"onLogicChange($event)\"\n />\n </div>\n\n <!-- Actions -->\n <div class=\"flex justify-end gap-2 md:col-span-2 pt-4\">\n <button\n fButton\n type=\"button\"\n severity=\"secondary\"\n [outlined]=\"true\"\n (click)=\"onBack()\"\n >\n <span pButtonLabel>{{ 'shared.cancel' | translate }}</span>\n </button>\n <button\n fButton\n type=\"submit\"\n [disabled]=\"!isFormValid() || isLoading()\"\n >\n @if (isLoading()) {\n <ui-icon pButtonIcon name=\"spinner\" [spin]=\"true\"></ui-icon>\n }\n <span pButtonLabel>{{ \n isEditMode()\n ? ('shared.update' | translate)\n : ('shared.create' | translate)\n }}</span>\n </button>\n </div>\n </form>\n </div>\n `,\n})\nexport class ActionFormPageComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly actionApi = inject(ActionApiService);\n private readonly messageService = inject(MessageService);\n private readonly translateAdapter = inject(TranslateService, {\n optional: true,\n });\n private readonly routeParams = toSignal(this.route.paramMap);\n private initialized = false;\n\n private translate(\n key: string,\n vars?: Record<string, string | number>,\n ): string {\n return this.translateAdapter?.translate(key, vars) ?? key;\n }\n\n readonly isLoading = signal(false);\n readonly existingAction = signal<IAction | null>(null);\n readonly isEditMode = computed(() => !!this.existingAction());\n readonly allActionsForLogic = signal<Array<{ id: string; name: string }>>([]);\n readonly allActions = signal<IAction[]>([]);\n\n readonly parentTreeNodes = computed<TreeNode<IAction>[]>(() =>\n buildActionParentTree(this.allActions(), this.existingAction()?.id),\n );\n\n readonly formModel = signal<IActionFormModel>({\n id: '',\n name: '',\n description: '',\n code: '',\n actionType: ActionType.BACKEND,\n permissionLogic: null,\n parentId: null,\n serial: '',\n isActive: true,\n });\n\n readonly actionTypes = computed(() => [\n {\n label: this.translate('iam.action.type.backend.label'),\n value: ActionType.BACKEND,\n },\n {\n label: this.translate('iam.action.type.frontend.label'),\n value: ActionType.FRONTEND,\n },\n {\n label: this.translate('iam.action.type.both.label'),\n value: ActionType.BOTH,\n },\n ]);\n\n readonly actionForm = form(this.formModel, (f) => {\n required(f.name, {\n message: this.translate('shared.validation.required', {\n field: this.translate('iam.action.name'),\n }),\n });\n });\n\n readonly isFormValid = computed(() => {\n const model = this.formModel();\n return model.name.trim().length > 0;\n });\n\n constructor() {\n effect(() => {\n const params = this.routeParams();\n if (!params || this.initialized) return;\n\n this.initialized = true;\n this.initializeForm(params.get('id'));\n });\n }\n\n private async initializeForm(id: string | null): Promise<void> {\n try {\n const response = await this.actionApi.getAll({\n pagination: { currentPage: 0, pageSize: 10000 },\n select: ['id', 'name', 'code', 'actionType', 'permissionLogic', 'parentId'],\n });\n if (response?.success && response.data) {\n this.allActionsForLogic.set(\n response.data.map((a) => ({\n id: a.id!,\n name: a.name ?? this.translate('shared.unnamed'),\n })),\n );\n this.allActions.set(response.data);\n }\n } catch {\n // Ignored - form will show empty parent dropdown\n }\n\n if (id && id !== 'new') {\n await this.loadAction(id);\n }\n }\n\n async loadAction(id: string): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await this.actionApi.findById(id, [\n 'id',\n 'name',\n 'description',\n 'code',\n 'actionType',\n 'permissionLogic',\n 'parentId',\n 'serial',\n 'isActive',\n 'readOnly',\n ]);\n\n if (response?.success && response.data) {\n const action = response.data;\n\n if (action.readOnly) {\n this.messageService.add({\n severity: 'error',\n summary: this.translate('shared.error'),\n detail: this.translate('iam.action.readonly.edit.forbidden'),\n });\n this.router.navigate(['/iam/actions']);\n return;\n }\n\n this.existingAction.set(action);\n this.formModel.set({\n id: action.id ?? '',\n name: action.name ?? '',\n description: action.description ?? '',\n code: action.code ?? '',\n actionType: action.actionType ?? ActionType.BACKEND,\n permissionLogic: action.permissionLogic ?? null,\n parentId: action.parentId ?? null,\n serial: action.serial?.toString() ?? '',\n isActive: action.isActive ?? true,\n });\n } else {\n this.router.navigate(['/iam/actions']);\n }\n } catch {\n this.router.navigate(['/iam/actions']);\n } finally {\n this.isLoading.set(false);\n }\n }\n\n async onSubmit(): Promise<void> {\n if (!this.isFormValid()) {\n this.messageService.add({\n severity: 'error',\n summary: this.translate('shared.validation.error'),\n detail: this.translate('shared.fill.required.fields'),\n });\n return;\n }\n\n this.isLoading.set(true);\n\n try {\n const formValue = this.formModel();\n const dto = {\n ...formValue,\n description: formValue.description || undefined,\n code: formValue.code || undefined,\n parentId: formValue.parentId || undefined,\n serial: formValue.serial ? parseInt(formValue.serial, 10) : undefined,\n permissionLogic: formValue.permissionLogic ?? undefined,\n };\n\n const response = this.isEditMode()\n ? await this.actionApi.update(dto)\n : await this.actionApi.insert(dto);\n\n this.messageService.add({\n severity: 'success',\n summary: this.translate('shared.success'),\n detail: response.messageKey\n ? this.translate(\n response.messageKey,\n response.messageVariables as Record<string, string | number>,\n )\n : (response.message ?? ''),\n });\n\n this.router.navigate(['/iam/actions']);\n } catch {\n // Handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n onBack(): void {\n this.router.navigate(['/iam/actions']);\n }\n\n onLogicChange(logic: ILogicNode | null): void {\n this.formModel.update((model) => ({ ...model, permissionLogic: logic }));\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;MAuLa,uBAAuB,CAAA;AACjB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACpC,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE;AAC3D,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;IACe,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IACpD,WAAW,GAAG,KAAK;IAEnB,SAAS,CACf,GAAW,EACX,IAAsC,EAAA;AAEtC,QAAA,OAAO,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,GAAG;IAC3D;IAES,SAAS,GAAG,MAAM,CAAC,KAAK;kFAAC;IACzB,cAAc,GAAG,MAAM,CAAiB,IAAI;uFAAC;IAC7C,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;mFAAC;IACpD,kBAAkB,GAAG,MAAM,CAAsC,EAAE;2FAAC;IACpE,UAAU,GAAG,MAAM,CAAY,EAAE;mFAAC;AAElC,IAAA,eAAe,GAAG,QAAQ,CAAsB,MACvD,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,EAAE,CAAC;wFACpE;IAEQ,SAAS,GAAG,MAAM,CAAmB;AAC5C,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,WAAW,EAAE,E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,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACT,qBAAqB,iHACrB,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAmJJ,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBA1JnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,OAAO,EAAE;wBACP,aAAa;wBACb,QAAQ;wBACR,SAAS;wBACT,qBAAqB;wBACrB,aAAa;AACd,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flusys-ng-iam-action-list-page.component-BRi_CpGl.mjs","sources":["../../../projects/ng-iam/pages/action/action-list-page.component.ts"],"sourcesContent":["import { Component, effect, inject, signal, untracked } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport {\n ACTION_PERMISSIONS,\n AngularModule,\n HasPermissionDirective,\n TranslatePipe,\n TranslateService,\n} from '@flusys/ng-shared';\nimport {\n ConfirmationService,\n MessageService,\n TreeNode,\n UiModule,\n} from '@flusys/ng-ui';\nimport { firstValueFrom } from 'rxjs';\nimport { ActionType, IAction } from '../../interfaces/action.interface';\nimport { ActionApiService } from '../../services/action-api.service';\nimport { convertActionToTreeNode } from '../../utils/tree-utils';\n\n@Component({\n selector: 'lib-action-list-page',\n imports: [AngularModule, UiModule, HasPermissionDirective, TranslatePipe],\n template: `\n <div class=\"card\">\n <div\n class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\"\n >\n <h3 class=\"text-lg sm:text-xl font-semibold\">\n {{ 'iam.action.title' | translate }}\n </h3>\n <button\n fButton\n *hasPermission=\"ACTION_PERMISSIONS.CREATE\"\n (click)=\"onCreate()\"\n class=\"w-full sm:w-auto\"\n >\n <ui-icon pButtonIcon name=\"plus\"></ui-icon>\n <span pButtonLabel>{{ 'iam.action.new' | translate }}</span>\n </button>\n </div>\n\n <div class=\"overflow-x-auto -mx-4 sm:mx-0\">\n <f-treetable\n [value]=\"treeNodes()\"\n [loading]=\"isLoading()\"\n dataKey=\"id\"\n [tableStyle]=\"{ 'min-width': '50rem' }\"\n >\n <ng-template #header>\n <tr>\n <th>{{ 'iam.action.name' | translate }}</th>\n <th class=\"hidden md:table-cell\">\n {{ 'iam.action.code' | translate }}\n </th>\n <th>{{ 'iam.action.type' | translate }}</th>\n <th class=\"hidden sm:table-cell\">\n {{ 'shared.active' | translate }}\n </th>\n <th class=\"hidden lg:table-cell\">\n {{ 'shared.read.only' | translate }}\n </th>\n <th class=\"w-[100px]\">{{ 'shared.actions' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template #body let-rowNode let-rowData=\"rowData\">\n <tr>\n <td>\n <f-treetabletoggler [rowNode]=\"rowNode\" />\n {{ rowData.name }}\n </td>\n <td class=\"hidden md:table-cell\">{{ rowData.code ?? '-' }}</td>\n <td>\n <f-tag\n [value]=\"getActionTypeLabel(rowData.actionType)\"\n [severity]=\"getActionTypeSeverity(rowData.actionType)\"\n />\n </td>\n <td class=\"hidden sm:table-cell\">\n <f-tag\n [value]=\"\n rowData.isActive\n ? ('shared.active' | translate)\n : ('shared.inactive' | translate)\n \"\n [severity]=\"rowData.isActive ? 'success' : 'secondary'\"\n />\n </td>\n <td class=\"hidden lg:table-cell\">\n <f-tag\n [value]=\"\n rowData.readOnly\n ? ('shared.yes' | translate)\n : ('shared.no' | translate)\n \"\n [severity]=\"rowData.readOnly ? 'warn' : 'secondary'\"\n />\n </td>\n <td>\n <div class=\"flex gap-1\">\n <button\n fButton\n *hasPermission=\"ACTION_PERMISSIONS.UPDATE\"\n [text]=\"true\"\n severity=\"secondary\"\n size=\"small\"\n [disabled]=\"rowData.readOnly\"\n [fTooltip]=\"'shared.edit' | translate\"\n (click)=\"onEdit(rowData)\"\n >\n <ui-icon pButtonIcon name=\"pencil\"></ui-icon>\n </button>\n <button\n fButton\n *hasPermission=\"ACTION_PERMISSIONS.DELETE\"\n [text]=\"true\"\n severity=\"danger\"\n size=\"small\"\n [fTooltip]=\"'shared.delete' | translate\"\n [disabled]=\"rowData.readOnly\"\n (click)=\"onDelete(rowData)\"\n >\n <ui-icon pButtonIcon name=\"trash\"></ui-icon>\n </button>\n </div>\n </td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr>\n <td colspan=\"6\" class=\"text-center py-4 text-muted-color\">\n {{ 'iam.action.no.actions' | translate }}\n </td>\n </tr>\n </ng-template>\n </f-treetable>\n </div>\n </div>\n `,\n})\nexport class ActionListPageComponent {\n readonly ACTION_PERMISSIONS = ACTION_PERMISSIONS;\n\n private readonly router = inject(Router);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE);\n private readonly actionApi = inject(ActionApiService);\n private readonly messageService = inject(MessageService);\n private readonly confirmationService = inject(ConfirmationService);\n private readonly translateAdapter = inject(TranslateService, {\n optional: true,\n });\n\n readonly isLoading = signal(false);\n readonly treeNodes = signal<TreeNode<IAction>[]>([]);\n\n private translate(\n key: string,\n vars?: Record<string, string | number>,\n ): string {\n return this.translateAdapter?.translate(key, vars) ?? key;\n }\n\n private static readonly TYPE_SEVERITIES: Record<\n ActionType,\n 'info' | 'success' | 'warn'\n > = {\n [ActionType.BACKEND]: 'info',\n [ActionType.FRONTEND]: 'success',\n [ActionType.BOTH]: 'warn',\n };\n\n private static readonly TYPE_LABEL_KEYS: Record<ActionType, string> = {\n [ActionType.BACKEND]: 'iam.action.type.backend',\n [ActionType.FRONTEND]: 'iam.action.type.frontend',\n [ActionType.BOTH]: 'iam.action.type.both',\n };\n\n constructor() {\n effect(() => {\n this.companyContext.currentCompanyInfo();\n untracked(() => this.loadActions());\n });\n }\n\n private async loadActions(): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await firstValueFrom(this.actionApi.getTree());\n this.treeNodes.set(\n convertActionToTreeNode(response?.success ? (response.data ?? []) : []),\n );\n } catch {\n // Handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n getActionTypeLabel(type: ActionType): string {\n const key =\n ActionListPageComponent.TYPE_LABEL_KEYS[type] ?? 'shared.unknown';\n return this.translate(key);\n }\n\n getActionTypeSeverity(type: ActionType): 'info' | 'success' | 'warn' {\n return ActionListPageComponent.TYPE_SEVERITIES[type] ?? 'info';\n }\n\n onCreate(): void {\n this.router.navigate(['/iam/actions/new']);\n }\n\n onEdit(action: IAction): void {\n this.router.navigate(['/iam/actions', action.id]);\n }\n\n onDelete(action: IAction): void {\n if (!action?.id || !action?.name) return;\n\n this.confirmationService.confirm({\n message: this.translate('shared.confirm.delete.item', {\n name: action.name,\n }),\n header: this.translate('iam.action.delete.title'),\n icon: 'exclamation-triangle',\n accept: async () => {\n try {\n const response = await this.actionApi.delete({\n id: action.id,\n type: 'permanent',\n });\n await this.loadActions();\n this.messageService.add({\n severity: 'success',\n summary: this.translate('shared.success'),\n detail: response?.messageKey\n ? this.translate(\n response.messageKey,\n response.messageVariables as Record<string, string | number>,\n )\n : (response?.message ?? ''),\n });\n } catch {\n // Handled by global interceptor\n }\n },\n });\n }\n}\n"],"names":["i1"],"mappings":";;;;;;;;;;MA6Ia,uBAAuB,CAAA;IACzB,kBAAkB,GAAG,kBAAkB;AAE/B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACpC,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,mBAAmB,GAAG,MAAM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