@flusys/ng-iam 9.1.0 → 9.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-DJ-A1gc2.mjs +685 -0
- package/fesm2022/flusys-ng-iam-action-form-page.component-DJ-A1gc2.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-action-list-page.component-Cf4Dhh5S.mjs → flusys-ng-iam-action-list-page.component-Br0PbgRa.mjs} +369 -166
- package/fesm2022/flusys-ng-iam-action-list-page.component-Br0PbgRa.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-iam-container.component-CIdxVCSW.mjs +141 -0
- package/fesm2022/flusys-ng-iam-iam-container.component-CIdxVCSW.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-permission-api.service-C7-Yxvz8.mjs +76 -0
- package/fesm2022/flusys-ng-iam-permission-api.service-C7-Yxvz8.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-permission-page.component-BlNt83uR.mjs +306 -0
- package/fesm2022/flusys-ng-iam-permission-page.component-BlNt83uR.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-role-api.service-OwPgmSFc.mjs +33 -0
- package/fesm2022/flusys-ng-iam-role-api.service-OwPgmSFc.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-role-form-page.component-DnkWkbTF.mjs +427 -0
- package/fesm2022/flusys-ng-iam-role-form-page.component-DnkWkbTF.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-role-list-page.component-BCO_gQ8k.mjs +685 -0
- package/fesm2022/flusys-ng-iam-role-list-page.component-BCO_gQ8k.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-tree-utils-B1pBG4At.mjs +110 -0
- package/fesm2022/flusys-ng-iam-tree-utils-B1pBG4At.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-user-action-selector.component-CAXEmJWx.mjs +4592 -0
- package/fesm2022/flusys-ng-iam-user-action-selector.component-CAXEmJWx.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam.mjs +2051 -2
- package/fesm2022/flusys-ng-iam.mjs.map +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-iam.d.ts +621 -604
- package/fesm2022/flusys-ng-iam-action-form-page.component-Dn0TD1Zu.mjs +0 -509
- package/fesm2022/flusys-ng-iam-action-form-page.component-Dn0TD1Zu.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-action-list-page.component-Cf4Dhh5S.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-Y7U2lGZk.mjs +0 -5584
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-Y7U2lGZk.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-iam-container.component-XBoIeQ0t.mjs +0 -105
- package/fesm2022/flusys-ng-iam-iam-container.component-XBoIeQ0t.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-permission-page.component-CCAQuZSJ.mjs +0 -204
- package/fesm2022/flusys-ng-iam-permission-page.component-CCAQuZSJ.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-form-page.component-EFjxhBRY.mjs +0 -352
- package/fesm2022/flusys-ng-iam-role-form-page.component-EFjxhBRY.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-list-page.component-DBfhjdkM.mjs +0 -486
- package/fesm2022/flusys-ng-iam-role-list-page.component-DBfhjdkM.mjs.map +0 -1
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, signal, computed, effect, Component } from '@angular/core';
|
|
3
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { form, required, FormField } from '@angular/forms/signals';
|
|
5
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
6
|
-
import { MessageService, CheckboxComponent, FButtonDirective, InputTextDirective, SelectComponent, TreeSelectComponent, UiIconComponent } from '@flusys/ng-ui';
|
|
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-Y7U2lGZk.mjs';
|
|
9
|
-
|
|
10
|
-
class ActionFormPageComponent {
|
|
11
|
-
route = inject(ActivatedRoute);
|
|
12
|
-
router = inject(Router);
|
|
13
|
-
actionApi = inject(ActionApiService);
|
|
14
|
-
messageService = inject(MessageService);
|
|
15
|
-
translateAdapter = inject(TranslateService, {
|
|
16
|
-
optional: true,
|
|
17
|
-
});
|
|
18
|
-
routeParams = toSignal(this.route.paramMap);
|
|
19
|
-
initialized = false;
|
|
20
|
-
translate(key, vars) {
|
|
21
|
-
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
22
|
-
}
|
|
23
|
-
isLoading = signal(false, /* @ts-ignore */
|
|
24
|
-
...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
25
|
-
existingAction = signal(null, /* @ts-ignore */
|
|
26
|
-
...(ngDevMode ? [{ debugName: "existingAction" }] : /* istanbul ignore next */ []));
|
|
27
|
-
isEditMode = computed(() => !!this.existingAction(), /* @ts-ignore */
|
|
28
|
-
...(ngDevMode ? [{ debugName: "isEditMode" }] : /* istanbul ignore next */ []));
|
|
29
|
-
allActionsForLogic = signal([], /* @ts-ignore */
|
|
30
|
-
...(ngDevMode ? [{ debugName: "allActionsForLogic" }] : /* istanbul ignore next */ []));
|
|
31
|
-
allActions = signal([], /* @ts-ignore */
|
|
32
|
-
...(ngDevMode ? [{ debugName: "allActions" }] : /* istanbul ignore next */ []));
|
|
33
|
-
parentTreeNodes = computed(() => buildActionParentTree(this.allActions(), this.existingAction()?.id), /* @ts-ignore */
|
|
34
|
-
...(ngDevMode ? [{ debugName: "parentTreeNodes" }] : /* istanbul ignore next */ []));
|
|
35
|
-
formModel = signal({
|
|
36
|
-
id: '',
|
|
37
|
-
name: '',
|
|
38
|
-
description: '',
|
|
39
|
-
code: '',
|
|
40
|
-
actionType: ActionType.BACKEND,
|
|
41
|
-
permissionLogic: null,
|
|
42
|
-
parentId: null,
|
|
43
|
-
serial: '',
|
|
44
|
-
isActive: true,
|
|
45
|
-
}, /* @ts-ignore */
|
|
46
|
-
...(ngDevMode ? [{ debugName: "formModel" }] : /* istanbul ignore next */ []));
|
|
47
|
-
actionTypes = computed(() => [
|
|
48
|
-
{
|
|
49
|
-
label: this.translate('iam.action.type.backend.label'),
|
|
50
|
-
value: ActionType.BACKEND,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: this.translate('iam.action.type.frontend.label'),
|
|
54
|
-
value: ActionType.FRONTEND,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
label: this.translate('iam.action.type.both.label'),
|
|
58
|
-
value: ActionType.BOTH,
|
|
59
|
-
},
|
|
60
|
-
], /* @ts-ignore */
|
|
61
|
-
...(ngDevMode ? [{ debugName: "actionTypes" }] : /* istanbul ignore next */ []));
|
|
62
|
-
actionForm = form(this.formModel, (f) => {
|
|
63
|
-
required(f.name, {
|
|
64
|
-
message: this.translate('shared.validation.required', {
|
|
65
|
-
field: this.translate('iam.action.name'),
|
|
66
|
-
}),
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
isFormValid = computed(() => {
|
|
70
|
-
const model = this.formModel();
|
|
71
|
-
return model.name.trim().length > 0;
|
|
72
|
-
}, /* @ts-ignore */
|
|
73
|
-
...(ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []));
|
|
74
|
-
constructor() {
|
|
75
|
-
effect(() => {
|
|
76
|
-
const params = this.routeParams();
|
|
77
|
-
if (!params || this.initialized)
|
|
78
|
-
return;
|
|
79
|
-
this.initialized = true;
|
|
80
|
-
this.initializeForm(params.get('id'));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async initializeForm(id) {
|
|
84
|
-
try {
|
|
85
|
-
const response = await this.actionApi.getAll({
|
|
86
|
-
pagination: { currentPage: 0, pageSize: 10000 },
|
|
87
|
-
select: ['id', 'name', 'code', 'actionType', 'permissionLogic', 'parentId'],
|
|
88
|
-
});
|
|
89
|
-
if (response?.success && response.data) {
|
|
90
|
-
this.allActionsForLogic.set(response.data.map((a) => ({
|
|
91
|
-
id: a.id,
|
|
92
|
-
name: a.name ?? this.translate('shared.unnamed'),
|
|
93
|
-
})));
|
|
94
|
-
this.allActions.set(response.data);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
// Ignored - form will show empty parent dropdown
|
|
99
|
-
}
|
|
100
|
-
if (id && id !== 'new') {
|
|
101
|
-
await this.loadAction(id);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async loadAction(id) {
|
|
105
|
-
this.isLoading.set(true);
|
|
106
|
-
try {
|
|
107
|
-
const response = await this.actionApi.findById(id, [
|
|
108
|
-
'id',
|
|
109
|
-
'name',
|
|
110
|
-
'description',
|
|
111
|
-
'code',
|
|
112
|
-
'actionType',
|
|
113
|
-
'permissionLogic',
|
|
114
|
-
'parentId',
|
|
115
|
-
'serial',
|
|
116
|
-
'isActive',
|
|
117
|
-
'readOnly',
|
|
118
|
-
]);
|
|
119
|
-
if (response?.success && response.data) {
|
|
120
|
-
const action = response.data;
|
|
121
|
-
if (action.readOnly) {
|
|
122
|
-
this.messageService.add({
|
|
123
|
-
severity: 'error',
|
|
124
|
-
summary: this.translate('shared.error'),
|
|
125
|
-
detail: this.translate('iam.action.readonly.edit.forbidden'),
|
|
126
|
-
});
|
|
127
|
-
this.router.navigate(['/iam/actions']);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
this.existingAction.set(action);
|
|
131
|
-
this.formModel.set({
|
|
132
|
-
id: action.id ?? '',
|
|
133
|
-
name: action.name ?? '',
|
|
134
|
-
description: action.description ?? '',
|
|
135
|
-
code: action.code ?? '',
|
|
136
|
-
actionType: action.actionType ?? ActionType.BACKEND,
|
|
137
|
-
permissionLogic: action.permissionLogic ?? null,
|
|
138
|
-
parentId: action.parentId ?? null,
|
|
139
|
-
serial: action.serial?.toString() ?? '',
|
|
140
|
-
isActive: action.isActive ?? true,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.router.navigate(['/iam/actions']);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
this.router.navigate(['/iam/actions']);
|
|
149
|
-
}
|
|
150
|
-
finally {
|
|
151
|
-
this.isLoading.set(false);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async onSubmit(event) {
|
|
155
|
-
event.preventDefault();
|
|
156
|
-
if (!this.isFormValid()) {
|
|
157
|
-
this.messageService.add({
|
|
158
|
-
severity: 'error',
|
|
159
|
-
summary: this.translate('shared.validation.error'),
|
|
160
|
-
detail: this.translate('shared.fill.required.fields'),
|
|
161
|
-
});
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.isLoading.set(true);
|
|
165
|
-
try {
|
|
166
|
-
const formValue = this.formModel();
|
|
167
|
-
const dto = {
|
|
168
|
-
...formValue,
|
|
169
|
-
description: formValue.description || undefined,
|
|
170
|
-
code: formValue.code || undefined,
|
|
171
|
-
parentId: formValue.parentId || undefined,
|
|
172
|
-
serial: formValue.serial ? parseInt(formValue.serial, 10) : undefined,
|
|
173
|
-
permissionLogic: formValue.permissionLogic ?? undefined,
|
|
174
|
-
};
|
|
175
|
-
const response = this.isEditMode()
|
|
176
|
-
? await this.actionApi.update(dto)
|
|
177
|
-
: await this.actionApi.insert(dto);
|
|
178
|
-
this.messageService.add({
|
|
179
|
-
severity: 'success',
|
|
180
|
-
summary: this.translate('shared.success'),
|
|
181
|
-
detail: response.messageKey
|
|
182
|
-
? this.translate(response.messageKey, response.messageVariables)
|
|
183
|
-
: (response.message ?? ''),
|
|
184
|
-
});
|
|
185
|
-
this.router.navigate(['/iam/actions']);
|
|
186
|
-
}
|
|
187
|
-
catch {
|
|
188
|
-
// Handled by global interceptor
|
|
189
|
-
}
|
|
190
|
-
finally {
|
|
191
|
-
this.isLoading.set(false);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
onBack() {
|
|
195
|
-
this.router.navigate(['/iam/actions']);
|
|
196
|
-
}
|
|
197
|
-
onLogicChange(logic) {
|
|
198
|
-
this.formModel.update((model) => ({ ...model, permissionLogic: logic }));
|
|
199
|
-
}
|
|
200
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionFormPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: ActionFormPageComponent, isStandalone: true, selector: "lib-action-form-page", ngImport: i0, template: `
|
|
202
|
-
<div class="card">
|
|
203
|
-
<h3 class="text-lg sm:text-xl font-semibold mb-4">
|
|
204
|
-
{{
|
|
205
|
-
isEditMode()
|
|
206
|
-
? ('iam.action.edit' | translate)
|
|
207
|
-
: ('iam.action.new' | translate)
|
|
208
|
-
}}
|
|
209
|
-
</h3>
|
|
210
|
-
|
|
211
|
-
<form
|
|
212
|
-
(submit)="onSubmit($event)"
|
|
213
|
-
class="grid grid-cols-1 md:grid-cols-2 gap-4"
|
|
214
|
-
>
|
|
215
|
-
<!-- Name -->
|
|
216
|
-
<div class="flex flex-col gap-2">
|
|
217
|
-
<label for="name" class="font-medium"
|
|
218
|
-
>{{ 'iam.action.name' | translate }} *</label
|
|
219
|
-
>
|
|
220
|
-
<input
|
|
221
|
-
fInputText
|
|
222
|
-
id="name"
|
|
223
|
-
[formField]="actionForm.name"
|
|
224
|
-
[placeholder]="'iam.action.name.placeholder' | translate"
|
|
225
|
-
/>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
<!-- Code -->
|
|
229
|
-
<div class="flex flex-col gap-2">
|
|
230
|
-
<label for="code" class="font-medium">{{
|
|
231
|
-
'iam.action.code' | translate
|
|
232
|
-
}}</label>
|
|
233
|
-
<input
|
|
234
|
-
fInputText
|
|
235
|
-
id="code"
|
|
236
|
-
[formField]="actionForm.code"
|
|
237
|
-
[placeholder]="'iam.action.code.placeholder' | translate"
|
|
238
|
-
/>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<!-- Description -->
|
|
242
|
-
<div class="flex flex-col gap-2">
|
|
243
|
-
<label for="description" class="font-medium">{{
|
|
244
|
-
'shared.description' | translate
|
|
245
|
-
}}</label>
|
|
246
|
-
<input
|
|
247
|
-
fInputText
|
|
248
|
-
id="description"
|
|
249
|
-
[formField]="actionForm.description"
|
|
250
|
-
[placeholder]="'shared.description.placeholder' | translate"
|
|
251
|
-
/>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
<!-- Action Type -->
|
|
255
|
-
<div class="flex flex-col gap-2">
|
|
256
|
-
<label for="actionType" class="font-medium"
|
|
257
|
-
>{{ 'iam.action.type' | translate }} *</label
|
|
258
|
-
>
|
|
259
|
-
<f-select
|
|
260
|
-
inputId="actionType"
|
|
261
|
-
[options]="actionTypes()"
|
|
262
|
-
optionLabel="label"
|
|
263
|
-
optionValue="value"
|
|
264
|
-
[formField]="actionForm.actionType"
|
|
265
|
-
[placeholder]="'iam.action.type' | translate"
|
|
266
|
-
/>
|
|
267
|
-
</div>
|
|
268
|
-
|
|
269
|
-
<!-- Parent Action -->
|
|
270
|
-
<div class="flex flex-col gap-2">
|
|
271
|
-
<label class="font-medium">{{
|
|
272
|
-
'iam.action.parent' | translate
|
|
273
|
-
}}</label>
|
|
274
|
-
<f-treeselect
|
|
275
|
-
[options]="parentTreeNodes()"
|
|
276
|
-
[formField]="actionForm.parentId"
|
|
277
|
-
[placeholder]="'iam.action.select.parent' | translate"
|
|
278
|
-
[filter]="true"
|
|
279
|
-
[showClear]="true"
|
|
280
|
-
/>
|
|
281
|
-
</div>
|
|
282
|
-
|
|
283
|
-
<!-- Order -->
|
|
284
|
-
<div class="flex flex-col gap-2">
|
|
285
|
-
<label for="serial" class="font-medium">{{
|
|
286
|
-
'shared.display.order' | translate
|
|
287
|
-
}}</label>
|
|
288
|
-
<input
|
|
289
|
-
fInputText
|
|
290
|
-
id="serial"
|
|
291
|
-
type="number"
|
|
292
|
-
[formField]="actionForm.serial"
|
|
293
|
-
[placeholder]="'shared.display.order.placeholder' | translate"
|
|
294
|
-
/>
|
|
295
|
-
</div>
|
|
296
|
-
|
|
297
|
-
<!-- Is Active -->
|
|
298
|
-
<div class="flex items-end gap-2 pb-1 md:col-span-2">
|
|
299
|
-
<f-checkbox
|
|
300
|
-
[formField]="actionForm.isActive"
|
|
301
|
-
[binary]="true"
|
|
302
|
-
inputId="isActive"
|
|
303
|
-
/>
|
|
304
|
-
<label for="isActive">{{ 'shared.active' | translate }}</label>
|
|
305
|
-
</div>
|
|
306
|
-
|
|
307
|
-
<!-- Permission Logic Builder -->
|
|
308
|
-
<div class="md:col-span-2">
|
|
309
|
-
<lib-logic-builder
|
|
310
|
-
[logic]="formModel().permissionLogic"
|
|
311
|
-
[actions]="allActionsForLogic()"
|
|
312
|
-
(logicChange)="onLogicChange($event)"
|
|
313
|
-
/>
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<!-- Actions -->
|
|
317
|
-
<div class="flex justify-end gap-2 md:col-span-2 pt-4">
|
|
318
|
-
<button
|
|
319
|
-
fButton
|
|
320
|
-
type="button"
|
|
321
|
-
severity="secondary"
|
|
322
|
-
[outlined]="true"
|
|
323
|
-
(click)="onBack()"
|
|
324
|
-
>
|
|
325
|
-
<span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
|
|
326
|
-
</button>
|
|
327
|
-
<button
|
|
328
|
-
fButton
|
|
329
|
-
type="submit"
|
|
330
|
-
[disabled]="!isFormValid() || isLoading()"
|
|
331
|
-
>
|
|
332
|
-
@if (isLoading()) {
|
|
333
|
-
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
334
|
-
}
|
|
335
|
-
<span pButtonLabel>{{
|
|
336
|
-
isEditMode()
|
|
337
|
-
? ('shared.update' | translate)
|
|
338
|
-
: ('shared.create' | translate)
|
|
339
|
-
}}</span>
|
|
340
|
-
</button>
|
|
341
|
-
</div>
|
|
342
|
-
</form>
|
|
343
|
-
</div>
|
|
344
|
-
`, isInline: true, dependencies: [{ kind: "component", type: CheckboxComponent, selector: "f-checkbox", inputs: ["label", "binary", "disabled", "readonly", "inputId", "invalid", "indeterminate", "variant", "size", "touched", "styleClass", "style", "checked"], outputs: ["onChange", "onBlur", "touch", "checkedChange"] }, { 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: "directive", type: InputTextDirective, selector: "[fInputText]", inputs: ["invalid", "touched", "variant", "size", "fluid"] }, { kind: "component", type: SelectComponent, selector: "f-select", inputs: ["options", "optionLabel", "optionValue", "placeholder", "disabled", "filter", "filterBy", "filterMatchMode", "filterLocale", "filterPlaceholder", "resetFilterOnHide", "autofocusFilter", "emptyMessage", "emptyFilterMessage", "showClear", "loading", "loadingIcon", "dropdownIcon", "clearIcon", "inputId", "invalid", "touched", "styleClass", "style", "appendTo", "editable", "readonly", "autofocus", "checkmark", "group", "optionGroupLabel", "optionGroupChildren", "virtualScroll", "virtualScrollItemSize", "lazy", "selectedObject"], outputs: ["onFilter", "onChange", "onShow", "onHide", "onBlur", "onFocus", "onClear", "onLazyLoad"] }, { kind: "component", type: TreeSelectComponent, selector: "f-treeselect", inputs: ["options", "placeholder", "inputId", "disabled", "filter", "filterBy", "selectionMode", "display", "propagateSelectionDown", "propagateSelectionUp", "showClear", "virtualScroll", "virtualScrollItemSize", "emptyMessage", "invalid", "touched", "styleClass", "style", "appendTo"] }, { kind: "component", type: UiIconComponent, selector: "ui-icon", inputs: ["name", "size", "spin", "fill", "severity"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "component", type: LogicBuilderComponent, selector: "lib-logic-builder", inputs: ["logic", "actions"], outputs: ["logicChange"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
345
|
-
}
|
|
346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionFormPageComponent, decorators: [{
|
|
347
|
-
type: Component,
|
|
348
|
-
args: [{
|
|
349
|
-
selector: 'lib-action-form-page',
|
|
350
|
-
imports: [
|
|
351
|
-
CheckboxComponent,
|
|
352
|
-
FButtonDirective,
|
|
353
|
-
InputTextDirective,
|
|
354
|
-
SelectComponent,
|
|
355
|
-
TreeSelectComponent,
|
|
356
|
-
UiIconComponent,
|
|
357
|
-
FormField,
|
|
358
|
-
LogicBuilderComponent,
|
|
359
|
-
TranslatePipe,
|
|
360
|
-
],
|
|
361
|
-
template: `
|
|
362
|
-
<div class="card">
|
|
363
|
-
<h3 class="text-lg sm:text-xl font-semibold mb-4">
|
|
364
|
-
{{
|
|
365
|
-
isEditMode()
|
|
366
|
-
? ('iam.action.edit' | translate)
|
|
367
|
-
: ('iam.action.new' | translate)
|
|
368
|
-
}}
|
|
369
|
-
</h3>
|
|
370
|
-
|
|
371
|
-
<form
|
|
372
|
-
(submit)="onSubmit($event)"
|
|
373
|
-
class="grid grid-cols-1 md:grid-cols-2 gap-4"
|
|
374
|
-
>
|
|
375
|
-
<!-- Name -->
|
|
376
|
-
<div class="flex flex-col gap-2">
|
|
377
|
-
<label for="name" class="font-medium"
|
|
378
|
-
>{{ 'iam.action.name' | translate }} *</label
|
|
379
|
-
>
|
|
380
|
-
<input
|
|
381
|
-
fInputText
|
|
382
|
-
id="name"
|
|
383
|
-
[formField]="actionForm.name"
|
|
384
|
-
[placeholder]="'iam.action.name.placeholder' | translate"
|
|
385
|
-
/>
|
|
386
|
-
</div>
|
|
387
|
-
|
|
388
|
-
<!-- Code -->
|
|
389
|
-
<div class="flex flex-col gap-2">
|
|
390
|
-
<label for="code" class="font-medium">{{
|
|
391
|
-
'iam.action.code' | translate
|
|
392
|
-
}}</label>
|
|
393
|
-
<input
|
|
394
|
-
fInputText
|
|
395
|
-
id="code"
|
|
396
|
-
[formField]="actionForm.code"
|
|
397
|
-
[placeholder]="'iam.action.code.placeholder' | translate"
|
|
398
|
-
/>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<!-- Description -->
|
|
402
|
-
<div class="flex flex-col gap-2">
|
|
403
|
-
<label for="description" class="font-medium">{{
|
|
404
|
-
'shared.description' | translate
|
|
405
|
-
}}</label>
|
|
406
|
-
<input
|
|
407
|
-
fInputText
|
|
408
|
-
id="description"
|
|
409
|
-
[formField]="actionForm.description"
|
|
410
|
-
[placeholder]="'shared.description.placeholder' | translate"
|
|
411
|
-
/>
|
|
412
|
-
</div>
|
|
413
|
-
|
|
414
|
-
<!-- Action Type -->
|
|
415
|
-
<div class="flex flex-col gap-2">
|
|
416
|
-
<label for="actionType" class="font-medium"
|
|
417
|
-
>{{ 'iam.action.type' | translate }} *</label
|
|
418
|
-
>
|
|
419
|
-
<f-select
|
|
420
|
-
inputId="actionType"
|
|
421
|
-
[options]="actionTypes()"
|
|
422
|
-
optionLabel="label"
|
|
423
|
-
optionValue="value"
|
|
424
|
-
[formField]="actionForm.actionType"
|
|
425
|
-
[placeholder]="'iam.action.type' | translate"
|
|
426
|
-
/>
|
|
427
|
-
</div>
|
|
428
|
-
|
|
429
|
-
<!-- Parent Action -->
|
|
430
|
-
<div class="flex flex-col gap-2">
|
|
431
|
-
<label class="font-medium">{{
|
|
432
|
-
'iam.action.parent' | translate
|
|
433
|
-
}}</label>
|
|
434
|
-
<f-treeselect
|
|
435
|
-
[options]="parentTreeNodes()"
|
|
436
|
-
[formField]="actionForm.parentId"
|
|
437
|
-
[placeholder]="'iam.action.select.parent' | translate"
|
|
438
|
-
[filter]="true"
|
|
439
|
-
[showClear]="true"
|
|
440
|
-
/>
|
|
441
|
-
</div>
|
|
442
|
-
|
|
443
|
-
<!-- Order -->
|
|
444
|
-
<div class="flex flex-col gap-2">
|
|
445
|
-
<label for="serial" class="font-medium">{{
|
|
446
|
-
'shared.display.order' | translate
|
|
447
|
-
}}</label>
|
|
448
|
-
<input
|
|
449
|
-
fInputText
|
|
450
|
-
id="serial"
|
|
451
|
-
type="number"
|
|
452
|
-
[formField]="actionForm.serial"
|
|
453
|
-
[placeholder]="'shared.display.order.placeholder' | translate"
|
|
454
|
-
/>
|
|
455
|
-
</div>
|
|
456
|
-
|
|
457
|
-
<!-- Is Active -->
|
|
458
|
-
<div class="flex items-end gap-2 pb-1 md:col-span-2">
|
|
459
|
-
<f-checkbox
|
|
460
|
-
[formField]="actionForm.isActive"
|
|
461
|
-
[binary]="true"
|
|
462
|
-
inputId="isActive"
|
|
463
|
-
/>
|
|
464
|
-
<label for="isActive">{{ 'shared.active' | translate }}</label>
|
|
465
|
-
</div>
|
|
466
|
-
|
|
467
|
-
<!-- Permission Logic Builder -->
|
|
468
|
-
<div class="md:col-span-2">
|
|
469
|
-
<lib-logic-builder
|
|
470
|
-
[logic]="formModel().permissionLogic"
|
|
471
|
-
[actions]="allActionsForLogic()"
|
|
472
|
-
(logicChange)="onLogicChange($event)"
|
|
473
|
-
/>
|
|
474
|
-
</div>
|
|
475
|
-
|
|
476
|
-
<!-- Actions -->
|
|
477
|
-
<div class="flex justify-end gap-2 md:col-span-2 pt-4">
|
|
478
|
-
<button
|
|
479
|
-
fButton
|
|
480
|
-
type="button"
|
|
481
|
-
severity="secondary"
|
|
482
|
-
[outlined]="true"
|
|
483
|
-
(click)="onBack()"
|
|
484
|
-
>
|
|
485
|
-
<span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
|
|
486
|
-
</button>
|
|
487
|
-
<button
|
|
488
|
-
fButton
|
|
489
|
-
type="submit"
|
|
490
|
-
[disabled]="!isFormValid() || isLoading()"
|
|
491
|
-
>
|
|
492
|
-
@if (isLoading()) {
|
|
493
|
-
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
494
|
-
}
|
|
495
|
-
<span pButtonLabel>{{
|
|
496
|
-
isEditMode()
|
|
497
|
-
? ('shared.update' | translate)
|
|
498
|
-
: ('shared.create' | translate)
|
|
499
|
-
}}</span>
|
|
500
|
-
</button>
|
|
501
|
-
</div>
|
|
502
|
-
</form>
|
|
503
|
-
</div>
|
|
504
|
-
`,
|
|
505
|
-
}]
|
|
506
|
-
}], ctorParameters: () => [] });
|
|
507
|
-
|
|
508
|
-
export { ActionFormPageComponent };
|
|
509
|
-
//# sourceMappingURL=flusys-ng-iam-action-form-page.component-Dn0TD1Zu.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flusys-ng-iam-action-form-page.component-Dn0TD1Zu.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,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flusys-ng-iam-action-list-page.component-Cf4Dhh5S.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 icon=\"search\" />\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,KA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