@flusys/ng-iam 8.1.0 → 8.1.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.
- package/fesm2022/{flusys-ng-iam-action-form-page.component-CF_ixS-r.mjs → flusys-ng-iam-action-form-page.component-DunIW6W4.mjs} +2 -2
- package/fesm2022/{flusys-ng-iam-action-form-page.component-CF_ixS-r.mjs.map → flusys-ng-iam-action-form-page.component-DunIW6W4.mjs.map} +1 -1
- package/fesm2022/{flusys-ng-iam-action-list-page.component-BveT0xT6.mjs → flusys-ng-iam-action-list-page.component-CgoLgAqd.mjs} +118 -48
- package/fesm2022/flusys-ng-iam-action-list-page.component-CgoLgAqd.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-flusys-ng-iam-CjLr3bfY.mjs → flusys-ng-iam-flusys-ng-iam-CJC610eS.mjs} +8 -8
- package/fesm2022/{flusys-ng-iam-flusys-ng-iam-CjLr3bfY.mjs.map → flusys-ng-iam-flusys-ng-iam-CJC610eS.mjs.map} +1 -1
- package/fesm2022/{flusys-ng-iam-permission-page.component-CGtj1EiO.mjs → flusys-ng-iam-permission-page.component-y86NW53S.mjs} +2 -2
- package/fesm2022/{flusys-ng-iam-permission-page.component-CGtj1EiO.mjs.map → flusys-ng-iam-permission-page.component-y86NW53S.mjs.map} +1 -1
- package/fesm2022/{flusys-ng-iam-role-form-page.component-Cfc8za3D.mjs → flusys-ng-iam-role-form-page.component-H3qpNn3J.mjs} +2 -2
- package/fesm2022/{flusys-ng-iam-role-form-page.component-Cfc8za3D.mjs.map → flusys-ng-iam-role-form-page.component-H3qpNn3J.mjs.map} +1 -1
- package/fesm2022/{flusys-ng-iam-role-list-page.component-vFHxd3Q-.mjs → flusys-ng-iam-role-list-page.component-BoKQbhu5.mjs} +99 -46
- package/fesm2022/flusys-ng-iam-role-list-page.component-BoKQbhu5.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam.mjs +1 -1
- package/package.json +5 -5
- package/fesm2022/flusys-ng-iam-action-list-page.component-BveT0xT6.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-list-page.component-vFHxd3Q-.mjs.map +0 -1
|
@@ -5,7 +5,7 @@ import { form, required, FormField } from '@angular/forms/signals';
|
|
|
5
5
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
6
6
|
import { MessageService, CheckboxComponent, FButtonDirective, InputTextDirective, SelectComponent, TreeSelectComponent, UiIconComponent } from '@flusys/ng-ui';
|
|
7
7
|
import { TranslateService, TranslatePipe } from '@flusys/ng-shared';
|
|
8
|
-
import { A as ActionApiService, d as buildActionParentTree, a as ActionType, L as LogicBuilderComponent } from './flusys-ng-iam-flusys-ng-iam-
|
|
8
|
+
import { A as ActionApiService, d as buildActionParentTree, a as ActionType, L as LogicBuilderComponent } from './flusys-ng-iam-flusys-ng-iam-CJC610eS.mjs';
|
|
9
9
|
|
|
10
10
|
class ActionFormPageComponent {
|
|
11
11
|
route = inject(ActivatedRoute);
|
|
@@ -506,4 +506,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
506
506
|
}], ctorParameters: () => [] });
|
|
507
507
|
|
|
508
508
|
export { ActionFormPageComponent };
|
|
509
|
-
//# sourceMappingURL=flusys-ng-iam-action-form-page.component-
|
|
509
|
+
//# sourceMappingURL=flusys-ng-iam-action-form-page.component-DunIW6W4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flusys-ng-iam-action-form-page.component-CF_ixS-r.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 {\n CheckboxComponent,\n FButtonDirective,\n InputTextDirective,\n MessageService,\n SelectComponent,\n TreeSelectComponent,\n UiIconComponent,\n} from '@flusys/ng-ui';\nimport {\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 } 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 CheckboxComponent,\n FButtonDirective,\n InputTextDirective,\n SelectComponent,\n TreeSelectComponent,\n UiIconComponent,\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 (submit)=\"onSubmit($event)\"\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(event: Event): Promise<void> {\n event.preventDefault();\n\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":";;;;;;;;;MAkMa,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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A,EAAA,IAAA,EACT,qBAAqB,iHACrB,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAmJJ,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBA9JnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,OAAO,EAAE;wBACP,iBAAiB;wBACjB,gBAAgB;wBAChB,kBAAkB;wBAClB,eAAe;wBACf,mBAAmB;wBACnB,eAAe;wBACf,SAAS;wBACT,qBAAqB;wBACrB,aAAa;AACd,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"flusys-ng-iam-action-form-page.component-DunIW6W4.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 {\n CheckboxComponent,\n FButtonDirective,\n InputTextDirective,\n MessageService,\n SelectComponent,\n TreeSelectComponent,\n UiIconComponent,\n} from '@flusys/ng-ui';\nimport {\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 } 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 CheckboxComponent,\n FButtonDirective,\n InputTextDirective,\n SelectComponent,\n TreeSelectComponent,\n UiIconComponent,\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 (submit)=\"onSubmit($event)\"\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(event: Event): Promise<void> {\n event.preventDefault();\n\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 on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AClB,eAAe;wBACf,mBAAmB;wBACnB,eAAe;wBACf,SAAS;wBACT,qBAAqB;wBACrB,aAAa;AACd,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, signal, effect, untracked, Component } from '@angular/core';
|
|
2
|
+
import { inject, signal, computed, effect, untracked, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
3
5
|
import { Router } from '@angular/router';
|
|
6
|
+
import { APP_CONFIG, getPermissionMode } from '@flusys/ng-core';
|
|
4
7
|
import { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';
|
|
5
8
|
import { ACTION_PERMISSIONS, USER_ACTION_PERMISSIONS, TranslateService, HasPermissionDirective, TranslatePipe } from '@flusys/ng-shared';
|
|
6
|
-
import { MessageService, ConfirmationService, FButtonDirective, TagComponent, TooltipDirective, TreeTableComponent, TreeTableTogglerComponent, UiIconComponent } from '@flusys/ng-ui';
|
|
9
|
+
import { MessageService, ConfirmationService, FButtonDirective, IconFieldComponent, InputIconComponent, InputTextDirective, TagComponent, TooltipDirective, TreeTableComponent, TreeTableTogglerComponent, UiIconComponent } from '@flusys/ng-ui';
|
|
7
10
|
import { firstValueFrom } from 'rxjs';
|
|
8
|
-
import { A as ActionApiService,
|
|
11
|
+
import { A as ActionApiService, c as convertActionToTreeNode, a as ActionType, b as ActionPermittedUsersDialogComponent } from './flusys-ng-iam-flusys-ng-iam-CJC610eS.mjs';
|
|
9
12
|
|
|
13
|
+
function filterActionTree(nodes, search) {
|
|
14
|
+
const term = search.trim().toLowerCase();
|
|
15
|
+
if (!term)
|
|
16
|
+
return nodes;
|
|
17
|
+
const filter = (items) => items.reduce((acc, node) => {
|
|
18
|
+
const children = filter(node.children ?? []);
|
|
19
|
+
const matches = node.name?.toLowerCase().includes(term) ||
|
|
20
|
+
node.code?.toLowerCase().includes(term);
|
|
21
|
+
if (matches || children.length) {
|
|
22
|
+
acc.push({ ...node, children });
|
|
23
|
+
}
|
|
24
|
+
return acc;
|
|
25
|
+
}, []);
|
|
26
|
+
return filter(nodes);
|
|
27
|
+
}
|
|
10
28
|
class ActionListPageComponent {
|
|
11
29
|
ACTION_PERMISSIONS = ACTION_PERMISSIONS;
|
|
12
30
|
USER_ACTION_PERMISSIONS = USER_ACTION_PERMISSIONS;
|
|
13
31
|
router = inject(Router);
|
|
32
|
+
appConfig = inject(APP_CONFIG);
|
|
14
33
|
companyContext = inject(LAYOUT_AUTH_STATE);
|
|
15
34
|
actionApi = inject(ActionApiService);
|
|
16
35
|
messageService = inject(MessageService);
|
|
@@ -20,12 +39,22 @@ class ActionListPageComponent {
|
|
|
20
39
|
});
|
|
21
40
|
isLoading = signal(false, /* @ts-ignore */
|
|
22
41
|
...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
23
|
-
|
|
42
|
+
rawActions = signal([], /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "rawActions" }] : /* istanbul ignore next */ []));
|
|
44
|
+
_searchTerm = signal('', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "_searchTerm" }] : /* istanbul ignore next */ []));
|
|
46
|
+
searchTerm = this._searchTerm.asReadonly();
|
|
47
|
+
treeNodes = computed(() => convertActionToTreeNode(filterActionTree(this.rawActions(), this._searchTerm())), /* @ts-ignore */
|
|
24
48
|
...(ngDevMode ? [{ debugName: "treeNodes" }] : /* istanbul ignore next */ []));
|
|
25
49
|
permittedUsersDialogVisible = signal(false, /* @ts-ignore */
|
|
26
50
|
...(ngDevMode ? [{ debugName: "permittedUsersDialogVisible" }] : /* istanbul ignore next */ []));
|
|
27
51
|
selectedAction = signal(null, /* @ts-ignore */
|
|
28
52
|
...(ngDevMode ? [{ debugName: "selectedAction" }] : /* istanbul ignore next */ []));
|
|
53
|
+
showActionUsers = computed(() => {
|
|
54
|
+
const permissionMode = getPermissionMode(this.appConfig);
|
|
55
|
+
return permissionMode === 'direct' || permissionMode === 'full';
|
|
56
|
+
}, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "showActionUsers" }] : /* istanbul ignore next */ []));
|
|
29
58
|
translate(key, vars) {
|
|
30
59
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
31
60
|
}
|
|
@@ -49,7 +78,7 @@ class ActionListPageComponent {
|
|
|
49
78
|
this.isLoading.set(true);
|
|
50
79
|
try {
|
|
51
80
|
const response = await firstValueFrom(this.actionApi.getTree());
|
|
52
|
-
this.
|
|
81
|
+
this.rawActions.set(response?.success ? (response.data ?? []) : []);
|
|
53
82
|
}
|
|
54
83
|
catch {
|
|
55
84
|
// Handled by global interceptor
|
|
@@ -58,6 +87,9 @@ class ActionListPageComponent {
|
|
|
58
87
|
this.isLoading.set(false);
|
|
59
88
|
}
|
|
60
89
|
}
|
|
90
|
+
onSearchChange(value) {
|
|
91
|
+
this._searchTerm.set(value);
|
|
92
|
+
}
|
|
61
93
|
getActionTypeLabel(type) {
|
|
62
94
|
const key = ActionListPageComponent.TYPE_LABEL_KEYS[type] ?? 'shared.unknown';
|
|
63
95
|
return this.translate(key);
|
|
@@ -106,7 +138,7 @@ class ActionListPageComponent {
|
|
|
106
138
|
});
|
|
107
139
|
}
|
|
108
140
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionListPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
109
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
141
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: ActionListPageComponent, isStandalone: true, selector: "lib-action-list-page", ngImport: i0, template: `
|
|
110
142
|
<div class="card">
|
|
111
143
|
<div
|
|
112
144
|
class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4"
|
|
@@ -114,15 +146,30 @@ class ActionListPageComponent {
|
|
|
114
146
|
<h3 class="text-lg sm:text-xl font-semibold">
|
|
115
147
|
{{ 'iam.action.title' | translate }}
|
|
116
148
|
</h3>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
<div class="flex flex-wrap items-center gap-2 w-full sm:w-auto">
|
|
150
|
+
<f-iconfield class="w-full sm:w-64">
|
|
151
|
+
<f-inputicon
|
|
152
|
+
><ui-icon name="search" class="text-sm"></ui-icon
|
|
153
|
+
></f-inputicon>
|
|
154
|
+
<input
|
|
155
|
+
fInputText
|
|
156
|
+
type="text"
|
|
157
|
+
[ngModel]="searchTerm()"
|
|
158
|
+
(ngModelChange)="onSearchChange($event)"
|
|
159
|
+
[placeholder]="'shared.search' | translate"
|
|
160
|
+
class="w-full"
|
|
161
|
+
/>
|
|
162
|
+
</f-iconfield>
|
|
163
|
+
<button
|
|
164
|
+
fButton
|
|
165
|
+
*hasPermission="ACTION_PERMISSIONS.CREATE"
|
|
166
|
+
(click)="onCreate()"
|
|
167
|
+
class="w-full sm:w-auto"
|
|
168
|
+
>
|
|
169
|
+
<ui-icon pButtonIcon name="plus"></ui-icon>
|
|
170
|
+
<span pButtonLabel>{{ 'iam.action.new' | translate }}</span>
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
126
173
|
</div>
|
|
127
174
|
|
|
128
175
|
<div class="overflow-x-auto -mx-4 sm:mx-0">
|
|
@@ -195,17 +242,19 @@ class ActionListPageComponent {
|
|
|
195
242
|
>
|
|
196
243
|
<ui-icon pButtonIcon name="pencil"></ui-icon>
|
|
197
244
|
</button>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
245
|
+
@if (showActionUsers()) {
|
|
246
|
+
<button
|
|
247
|
+
fButton
|
|
248
|
+
*hasPermission="USER_ACTION_PERMISSIONS.READ"
|
|
249
|
+
[text]="true"
|
|
250
|
+
severity="secondary"
|
|
251
|
+
size="small"
|
|
252
|
+
[fTooltip]="'iam.permission.view.users' | translate"
|
|
253
|
+
(click)="onViewUsers(rowData)"
|
|
254
|
+
>
|
|
255
|
+
<ui-icon pButtonIcon name="users"></ui-icon>
|
|
256
|
+
</button>
|
|
257
|
+
}
|
|
209
258
|
<button
|
|
210
259
|
fButton
|
|
211
260
|
*hasPermission="ACTION_PERMISSIONS.DELETE"
|
|
@@ -238,7 +287,7 @@ class ActionListPageComponent {
|
|
|
238
287
|
[action]="selectedAction()"
|
|
239
288
|
(closed)="permittedUsersDialogVisible.set(false)"
|
|
240
289
|
/>
|
|
241
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: FButtonDirective, selector: "[fButton]", inputs: ["severity", "text", "outlined", "link", "variant", "rounded", "raised", "fluid", "disabled", "loading", "loadingIcon", "size", "label", "icon", "iconPos", "ariaLabel", "plain"] }, { kind: "component", type: TagComponent, selector: "f-tag", inputs: ["value", "severity", "icon", "rounded", "color", "styleClass", "style"] }, { kind: "directive", type: TooltipDirective, selector: "[fTooltip]", inputs: ["fTooltip", "tooltipPosition", "positionStyle", "tooltipStyleClass", "disabled", "tooltipEvent", "showDelay", "hideDelay", "life", "autoHide", "positionTop", "positionLeft", "escape"] }, { kind: "component", type: TreeTableComponent, selector: "f-treetable", inputs: ["value", "loading", "dataKey", "styleClass", "tableStyle", "scrollable", "scrollHeight", "resizableColumns", "lazy", "totalRecords", "paginator", "first", "rows", "rowsPerPageOptions", "showCurrentPageReport", "currentPageReportTemplate", "globalFilterFields", "filterDelay", "selectionMode", "sortMode", "virtualScroll", "virtualScrollItemSize", "sortField", "sortOrder", "multiSortMeta", "filters", "selection", "contextMenuSelection"], outputs: ["sortFieldChange", "sortOrderChange", "multiSortMetaChange", "filtersChange", "selectionChange", "contextMenuSelectionChange", "onLazyLoad", "onSort", "onFilter", "onNodeExpand", "onNodeCollapse", "onNodeSelect", "onNodeUnselect", "onRowContextMenu"] }, { kind: "component", type: TreeTableTogglerComponent, selector: "f-treetabletoggler", inputs: ["rowNode"] }, { kind: "component", type: UiIconComponent, selector: "ui-icon", inputs: ["name", "size", "spin", "fill", "severity"] }, { kind: "directive", type: HasPermissionDirective, selector: "[hasPermission]", inputs: ["hasPermission"] }, { kind: "component", type: ActionPermittedUsersDialogComponent, selector: "flusys-action-permitted-users-dialog", inputs: ["visible", "action"], outputs: ["closed"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
290
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: FButtonDirective, selector: "[fButton]", inputs: ["severity", "text", "outlined", "link", "variant", "rounded", "raised", "fluid", "disabled", "loading", "loadingIcon", "size", "label", "icon", "iconPos", "ariaLabel", "plain"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: IconFieldComponent, selector: "f-iconfield", inputs: ["iconPosition", "styleClass"] }, { kind: "component", type: InputIconComponent, selector: "f-inputicon", inputs: ["icon", "position", "styleClass", "style"] }, { kind: "directive", type: InputTextDirective, selector: "[fInputText]", inputs: ["invalid", "touched", "variant", "size", "fluid"] }, { kind: "component", type: TagComponent, selector: "f-tag", inputs: ["value", "severity", "icon", "rounded", "color", "styleClass", "style"] }, { kind: "directive", type: TooltipDirective, selector: "[fTooltip]", inputs: ["fTooltip", "tooltipPosition", "positionStyle", "tooltipStyleClass", "disabled", "tooltipEvent", "showDelay", "hideDelay", "life", "autoHide", "positionTop", "positionLeft", "escape"] }, { kind: "component", type: TreeTableComponent, selector: "f-treetable", inputs: ["value", "loading", "dataKey", "styleClass", "tableStyle", "scrollable", "scrollHeight", "resizableColumns", "lazy", "totalRecords", "paginator", "first", "rows", "rowsPerPageOptions", "showCurrentPageReport", "currentPageReportTemplate", "globalFilterFields", "filterDelay", "selectionMode", "sortMode", "virtualScroll", "virtualScrollItemSize", "sortField", "sortOrder", "multiSortMeta", "filters", "selection", "contextMenuSelection"], outputs: ["sortFieldChange", "sortOrderChange", "multiSortMetaChange", "filtersChange", "selectionChange", "contextMenuSelectionChange", "onLazyLoad", "onSort", "onFilter", "onNodeExpand", "onNodeCollapse", "onNodeSelect", "onNodeUnselect", "onRowContextMenu"] }, { kind: "component", type: TreeTableTogglerComponent, selector: "f-treetabletoggler", inputs: ["rowNode"] }, { kind: "component", type: UiIconComponent, selector: "ui-icon", inputs: ["name", "size", "spin", "fill", "severity"] }, { kind: "directive", type: HasPermissionDirective, selector: "[hasPermission]", inputs: ["hasPermission"] }, { kind: "component", type: ActionPermittedUsersDialogComponent, selector: "flusys-action-permitted-users-dialog", inputs: ["visible", "action"], outputs: ["closed"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
242
291
|
}
|
|
243
292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionListPageComponent, decorators: [{
|
|
244
293
|
type: Component,
|
|
@@ -246,6 +295,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
246
295
|
selector: 'lib-action-list-page',
|
|
247
296
|
imports: [
|
|
248
297
|
FButtonDirective,
|
|
298
|
+
FormsModule,
|
|
299
|
+
IconFieldComponent,
|
|
300
|
+
InputIconComponent,
|
|
301
|
+
InputTextDirective,
|
|
249
302
|
TagComponent,
|
|
250
303
|
TooltipDirective,
|
|
251
304
|
TreeTableComponent,
|
|
@@ -263,15 +316,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
263
316
|
<h3 class="text-lg sm:text-xl font-semibold">
|
|
264
317
|
{{ 'iam.action.title' | translate }}
|
|
265
318
|
</h3>
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
319
|
+
<div class="flex flex-wrap items-center gap-2 w-full sm:w-auto">
|
|
320
|
+
<f-iconfield class="w-full sm:w-64">
|
|
321
|
+
<f-inputicon
|
|
322
|
+
><ui-icon name="search" class="text-sm"></ui-icon
|
|
323
|
+
></f-inputicon>
|
|
324
|
+
<input
|
|
325
|
+
fInputText
|
|
326
|
+
type="text"
|
|
327
|
+
[ngModel]="searchTerm()"
|
|
328
|
+
(ngModelChange)="onSearchChange($event)"
|
|
329
|
+
[placeholder]="'shared.search' | translate"
|
|
330
|
+
class="w-full"
|
|
331
|
+
/>
|
|
332
|
+
</f-iconfield>
|
|
333
|
+
<button
|
|
334
|
+
fButton
|
|
335
|
+
*hasPermission="ACTION_PERMISSIONS.CREATE"
|
|
336
|
+
(click)="onCreate()"
|
|
337
|
+
class="w-full sm:w-auto"
|
|
338
|
+
>
|
|
339
|
+
<ui-icon pButtonIcon name="plus"></ui-icon>
|
|
340
|
+
<span pButtonLabel>{{ 'iam.action.new' | translate }}</span>
|
|
341
|
+
</button>
|
|
342
|
+
</div>
|
|
275
343
|
</div>
|
|
276
344
|
|
|
277
345
|
<div class="overflow-x-auto -mx-4 sm:mx-0">
|
|
@@ -344,17 +412,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
344
412
|
>
|
|
345
413
|
<ui-icon pButtonIcon name="pencil"></ui-icon>
|
|
346
414
|
</button>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
415
|
+
@if (showActionUsers()) {
|
|
416
|
+
<button
|
|
417
|
+
fButton
|
|
418
|
+
*hasPermission="USER_ACTION_PERMISSIONS.READ"
|
|
419
|
+
[text]="true"
|
|
420
|
+
severity="secondary"
|
|
421
|
+
size="small"
|
|
422
|
+
[fTooltip]="'iam.permission.view.users' | translate"
|
|
423
|
+
(click)="onViewUsers(rowData)"
|
|
424
|
+
>
|
|
425
|
+
<ui-icon pButtonIcon name="users"></ui-icon>
|
|
426
|
+
</button>
|
|
427
|
+
}
|
|
358
428
|
<button
|
|
359
429
|
fButton
|
|
360
430
|
*hasPermission="ACTION_PERMISSIONS.DELETE"
|
|
@@ -392,4 +462,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
392
462
|
}], ctorParameters: () => [] });
|
|
393
463
|
|
|
394
464
|
export { ActionListPageComponent };
|
|
395
|
-
//# sourceMappingURL=flusys-ng-iam-action-list-page.component-
|
|
465
|
+
//# sourceMappingURL=flusys-ng-iam-action-list-page.component-CgoLgAqd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flusys-ng-iam-action-list-page.component-CgoLgAqd.mjs","sources":["../../../projects/ng-iam/pages/action/action-list-page.component.ts"],"sourcesContent":["import {\n Component,\n computed,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { Router } from '@angular/router';\nimport { APP_CONFIG, getPermissionMode } from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport {\n ACTION_PERMISSIONS,\n HasPermissionDirective,\n TranslatePipe,\n TranslateService,\n USER_ACTION_PERMISSIONS,\n} from '@flusys/ng-shared';\nimport {\n ConfirmationService,\n FButtonDirective,\n IconFieldComponent,\n InputIconComponent,\n InputTextDirective,\n MessageService,\n TagComponent,\n TooltipDirective,\n TreeNode,\n TreeTableComponent,\n TreeTableTogglerComponent,\n UiIconComponent,\n} from '@flusys/ng-ui';\nimport { firstValueFrom } from 'rxjs';\nimport { ActionPermittedUsersDialogComponent } from '../../components/action-permitted-users-dialog.component';\nimport {\n ActionType,\n IAction,\n IActionTreeDto,\n} from '../../interfaces/action.interface';\nimport { ActionApiService } from '../../services/action-api.service';\nimport { convertActionToTreeNode } from '../../utils/tree-utils';\n\nfunction filterActionTree(\n nodes: IActionTreeDto[],\n search: string,\n): IActionTreeDto[] {\n const term = search.trim().toLowerCase();\n if (!term) return nodes;\n\n const filter = (items: IActionTreeDto[]): IActionTreeDto[] =>\n items.reduce<IActionTreeDto[]>((acc, node) => {\n const children = filter(node.children ?? []);\n const matches =\n node.name?.toLowerCase().includes(term) ||\n node.code?.toLowerCase().includes(term);\n if (matches || children.length) {\n acc.push({ ...node, children });\n }\n return acc;\n }, []);\n\n return filter(nodes);\n}\n\n@Component({\n selector: 'lib-action-list-page',\n imports: [\n FButtonDirective,\n FormsModule,\n IconFieldComponent,\n InputIconComponent,\n InputTextDirective,\n TagComponent,\n TooltipDirective,\n TreeTableComponent,\n TreeTableTogglerComponent,\n UiIconComponent,\n HasPermissionDirective,\n ActionPermittedUsersDialogComponent,\n TranslatePipe,\n ],\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 <div class=\"flex flex-wrap items-center gap-2 w-full sm:w-auto\">\n <f-iconfield class=\"w-full sm:w-64\">\n <f-inputicon\n ><ui-icon name=\"search\" class=\"text-sm\"></ui-icon\n ></f-inputicon>\n <input\n fInputText\n type=\"text\"\n [ngModel]=\"searchTerm()\"\n (ngModelChange)=\"onSearchChange($event)\"\n [placeholder]=\"'shared.search' | translate\"\n class=\"w-full\"\n />\n </f-iconfield>\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 </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 @if (showActionUsers()) {\n <button\n fButton\n *hasPermission=\"USER_ACTION_PERMISSIONS.READ\"\n [text]=\"true\"\n severity=\"secondary\"\n size=\"small\"\n [fTooltip]=\"'iam.permission.view.users' | translate\"\n (click)=\"onViewUsers(rowData)\"\n >\n <ui-icon pButtonIcon name=\"users\"></ui-icon>\n </button>\n }\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 <flusys-action-permitted-users-dialog\n [visible]=\"permittedUsersDialogVisible()\"\n [action]=\"selectedAction()\"\n (closed)=\"permittedUsersDialogVisible.set(false)\"\n />\n `,\n})\nexport class ActionListPageComponent {\n readonly ACTION_PERMISSIONS = ACTION_PERMISSIONS;\n readonly USER_ACTION_PERMISSIONS = USER_ACTION_PERMISSIONS;\n\n private readonly router = inject(Router);\n private readonly appConfig = inject(APP_CONFIG);\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 private readonly rawActions = signal<IActionTreeDto[]>([]);\n private readonly _searchTerm = signal('');\n readonly searchTerm = this._searchTerm.asReadonly();\n readonly treeNodes = computed<TreeNode<IAction>[]>(() =>\n convertActionToTreeNode(\n filterActionTree(this.rawActions(), this._searchTerm()),\n ),\n );\n readonly permittedUsersDialogVisible = signal(false);\n readonly selectedAction = signal<IAction | null>(null);\n readonly showActionUsers = computed(() => {\n const permissionMode = getPermissionMode(this.appConfig);\n return permissionMode === 'direct' || permissionMode === 'full';\n });\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.rawActions.set(response?.success ? (response.data ?? []) : []);\n } catch {\n // Handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n onSearchChange(value: string): void {\n this._searchTerm.set(value);\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 onViewUsers(action: IAction): void {\n this.selectedAction.set(action);\n this.permittedUsersDialogVisible.set(true);\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":[],"mappings":";;;;;;;;;;;;AA2CA,SAAS,gBAAgB,CACvB,KAAuB,EACvB,MAAc,EAAA;IAEd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE;AACxC,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;AAEvB,IAAA,MAAM,MAAM,GAAG,CAAC,KAAuB,KACrC,KAAK,CAAC,MAAM,CAAmB,CAAC,GAAG,EAAE,IAAI,KAAI;QAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC5C,QAAA,MAAM,OAAO,GACX,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;YACvC,IAAI,CAAC,IAAI,EAAE,WA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AA,IAAA,EAAA,WAAA,EAAA,IAAA,EACtB,mCAAmC,EAAA,QAAA,EAAA,sCAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,QAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EACnC,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAyJJ,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAxKnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,OAAO,EAAE;wBACP,gBAAgB;wBAChB,WAAW;wBACX,kBAAkB;wBAClB,kBAAkB;wBAClB,kBAAkB;wBAClB,YAAY;wBACZ,gBAAgB;wBAChB,kBAAkB;wBAClB,yBAAyB;wBACzB,eAAe;wBACf,sBAAsB;wBACtB,mCAAmC;wBACnC,aAAa;AACd,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqJT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
|
@@ -5346,15 +5346,15 @@ const IAM_ROUTES = [
|
|
|
5346
5346
|
children: [
|
|
5347
5347
|
{
|
|
5348
5348
|
path: '',
|
|
5349
|
-
loadComponent: () => import('./flusys-ng-iam-action-list-page.component-
|
|
5349
|
+
loadComponent: () => import('./flusys-ng-iam-action-list-page.component-CgoLgAqd.mjs').then((m) => m.ActionListPageComponent),
|
|
5350
5350
|
},
|
|
5351
5351
|
{
|
|
5352
5352
|
path: 'new',
|
|
5353
|
-
loadComponent: () => import('./flusys-ng-iam-action-form-page.component-
|
|
5353
|
+
loadComponent: () => import('./flusys-ng-iam-action-form-page.component-DunIW6W4.mjs').then((m) => m.ActionFormPageComponent),
|
|
5354
5354
|
},
|
|
5355
5355
|
{
|
|
5356
5356
|
path: ':id',
|
|
5357
|
-
loadComponent: () => import('./flusys-ng-iam-action-form-page.component-
|
|
5357
|
+
loadComponent: () => import('./flusys-ng-iam-action-form-page.component-DunIW6W4.mjs').then((m) => m.ActionFormPageComponent),
|
|
5358
5358
|
},
|
|
5359
5359
|
],
|
|
5360
5360
|
},
|
|
@@ -5365,15 +5365,15 @@ const IAM_ROUTES = [
|
|
|
5365
5365
|
children: [
|
|
5366
5366
|
{
|
|
5367
5367
|
path: '',
|
|
5368
|
-
loadComponent: () => import('./flusys-ng-iam-role-list-page.component-
|
|
5368
|
+
loadComponent: () => import('./flusys-ng-iam-role-list-page.component-BoKQbhu5.mjs').then((m) => m.RoleListPageComponent),
|
|
5369
5369
|
},
|
|
5370
5370
|
{
|
|
5371
5371
|
path: 'new',
|
|
5372
|
-
loadComponent: () => import('./flusys-ng-iam-role-form-page.component-
|
|
5372
|
+
loadComponent: () => import('./flusys-ng-iam-role-form-page.component-H3qpNn3J.mjs').then((m) => m.RoleFormPageComponent),
|
|
5373
5373
|
},
|
|
5374
5374
|
{
|
|
5375
5375
|
path: ':id',
|
|
5376
|
-
loadComponent: () => import('./flusys-ng-iam-role-form-page.component-
|
|
5376
|
+
loadComponent: () => import('./flusys-ng-iam-role-form-page.component-H3qpNn3J.mjs').then((m) => m.RoleFormPageComponent),
|
|
5377
5377
|
},
|
|
5378
5378
|
],
|
|
5379
5379
|
},
|
|
@@ -5388,7 +5388,7 @@ const IAM_ROUTES = [
|
|
|
5388
5388
|
COMPANY_ACTION_PERMISSIONS.READ,
|
|
5389
5389
|
]),
|
|
5390
5390
|
],
|
|
5391
|
-
loadComponent: () => import('./flusys-ng-iam-permission-page.component-
|
|
5391
|
+
loadComponent: () => import('./flusys-ng-iam-permission-page.component-y86NW53S.mjs').then((m) => m.PermissionPageComponent),
|
|
5392
5392
|
},
|
|
5393
5393
|
// Default redirect to the first tab the user has permission to see
|
|
5394
5394
|
{
|
|
@@ -5407,4 +5407,4 @@ const IAM_ROUTES = [
|
|
|
5407
5407
|
*/
|
|
5408
5408
|
|
|
5409
5409
|
export { ActionApiService as A, CompanyActionSelectorComponent as C, IAM_MESSAGES as I, LogicBuilderComponent as L, MAX_DROPDOWN_ITEMS as M, PermissionApiService as P, RoleApiService as R, UserRoleSelectorComponent as U, ActionType as a, ActionPermittedUsersDialogComponent as b, convertActionToTreeNode as c, buildActionParentTree as d, RolePermittedUsersDialogComponent as e, RoleActionSelectorComponent as f, UserActionSelectorComponent as g, ActionPermissionLogicService as h, IAM_ROUTES as i, MyPermissionsApiService as j, PermissionStateService as k, ProfilePermissionProviderAdapter as l, provideIamProviders as p };
|
|
5410
|
-
//# sourceMappingURL=flusys-ng-iam-flusys-ng-iam-
|
|
5410
|
+
//# sourceMappingURL=flusys-ng-iam-flusys-ng-iam-CJC610eS.mjs.map
|