@flusys/ng-iam 3.0.1 → 4.0.0-lts

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.
Files changed (25) hide show
  1. package/README.md +1 -1
  2. package/fesm2022/{flusys-ng-iam-action-form-page.component-eXpZNJ_H.mjs → flusys-ng-iam-action-form-page.component-BQx9yset.mjs} +62 -50
  3. package/fesm2022/flusys-ng-iam-action-form-page.component-BQx9yset.mjs.map +1 -0
  4. package/fesm2022/{flusys-ng-iam-action-list-page.component-BtJlGcTj.mjs → flusys-ng-iam-action-list-page.component-BrpZujxk.mjs} +51 -42
  5. package/fesm2022/flusys-ng-iam-action-list-page.component-BrpZujxk.mjs.map +1 -0
  6. package/fesm2022/{flusys-ng-iam-flusys-ng-iam-CJAQT60K.mjs → flusys-ng-iam-flusys-ng-iam-Co4ot9My.mjs} +641 -341
  7. package/fesm2022/flusys-ng-iam-flusys-ng-iam-Co4ot9My.mjs.map +1 -0
  8. package/fesm2022/{flusys-ng-iam-iam-container.component-UYJjqYV9.mjs → flusys-ng-iam-iam-container.component-CQA2B6cU.mjs} +14 -13
  9. package/fesm2022/flusys-ng-iam-iam-container.component-CQA2B6cU.mjs.map +1 -0
  10. package/fesm2022/{flusys-ng-iam-permission-page.component-DcgT7L3_.mjs → flusys-ng-iam-permission-page.component-Dpk90y72.mjs} +14 -13
  11. package/fesm2022/flusys-ng-iam-permission-page.component-Dpk90y72.mjs.map +1 -0
  12. package/fesm2022/{flusys-ng-iam-role-form-page.component-D_AAEay2.mjs → flusys-ng-iam-role-form-page.component-CVfRQpoa.mjs} +38 -35
  13. package/fesm2022/flusys-ng-iam-role-form-page.component-CVfRQpoa.mjs.map +1 -0
  14. package/fesm2022/{flusys-ng-iam-role-list-page.component-D4J1by6Q.mjs → flusys-ng-iam-role-list-page.component-BHB8X5r7.mjs} +41 -38
  15. package/fesm2022/flusys-ng-iam-role-list-page.component-BHB8X5r7.mjs.map +1 -0
  16. package/fesm2022/flusys-ng-iam.mjs +1 -1
  17. package/package.json +7 -5
  18. package/types/flusys-ng-iam.d.ts +13 -5
  19. package/fesm2022/flusys-ng-iam-action-form-page.component-eXpZNJ_H.mjs.map +0 -1
  20. package/fesm2022/flusys-ng-iam-action-list-page.component-BtJlGcTj.mjs.map +0 -1
  21. package/fesm2022/flusys-ng-iam-flusys-ng-iam-CJAQT60K.mjs.map +0 -1
  22. package/fesm2022/flusys-ng-iam-iam-container.component-UYJjqYV9.mjs.map +0 -1
  23. package/fesm2022/flusys-ng-iam-permission-page.component-DcgT7L3_.mjs.map +0 -1
  24. package/fesm2022/flusys-ng-iam-role-form-page.component-D_AAEay2.mjs.map +0 -1
  25. package/fesm2022/flusys-ng-iam-role-list-page.component-D4J1by6Q.mjs.map +0 -1
@@ -1,13 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { inject, signal, effect, untracked, Component } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
+ import { TRANSLATE_ADAPTER } from '@flusys/ng-core';
4
5
  import { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';
5
- import { ACTION_PERMISSIONS, AngularModule, PrimeModule, HasPermissionDirective } from '@flusys/ng-shared';
6
+ import { ACTION_PERMISSIONS, AngularModule, PrimeModule, HasPermissionDirective, TranslatePipe } from '@flusys/ng-shared';
6
7
  import { MessageService, ConfirmationService } from 'primeng/api';
7
8
  import * as i5 from 'primeng/tag';
8
9
  import { TagModule } from 'primeng/tag';
9
10
  import { firstValueFrom } from 'rxjs';
10
- import { A as ActionApiService, a as ActionType, c as convertActionToTreeNode } from './flusys-ng-iam-flusys-ng-iam-CJAQT60K.mjs';
11
+ import { A as ActionApiService, a as ActionType, c as convertActionToTreeNode } from './flusys-ng-iam-flusys-ng-iam-Co4ot9My.mjs';
11
12
  import * as i2 from 'primeng/button';
12
13
  import * as i6 from 'primeng/tooltip';
13
14
  import * as i7 from 'primeng/treetable';
@@ -19,18 +20,22 @@ class ActionListPageComponent {
19
20
  actionApi = inject(ActionApiService);
20
21
  messageService = inject(MessageService);
21
22
  confirmationService = inject(ConfirmationService);
23
+ translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });
22
24
  isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
23
25
  treeNodes = signal([], ...(ngDevMode ? [{ debugName: "treeNodes" }] : []));
24
- static TYPE_LABELS = {
25
- [ActionType.BACKEND]: 'Backend',
26
- [ActionType.FRONTEND]: 'Frontend',
27
- [ActionType.BOTH]: 'Both',
28
- };
26
+ translate(key, vars) {
27
+ return this.translateAdapter?.translate(key, vars) ?? key;
28
+ }
29
29
  static TYPE_SEVERITIES = {
30
30
  [ActionType.BACKEND]: 'info',
31
31
  [ActionType.FRONTEND]: 'success',
32
32
  [ActionType.BOTH]: 'warn',
33
33
  };
34
+ static TYPE_LABEL_KEYS = {
35
+ [ActionType.BACKEND]: 'iam.action.type.backend',
36
+ [ActionType.FRONTEND]: 'iam.action.type.frontend',
37
+ [ActionType.BOTH]: 'iam.action.type.both',
38
+ };
34
39
  constructor() {
35
40
  effect(() => {
36
41
  this.companyContext.currentCompanyInfo();
@@ -51,7 +56,8 @@ class ActionListPageComponent {
51
56
  }
52
57
  }
53
58
  getActionTypeLabel(type) {
54
- return ActionListPageComponent.TYPE_LABELS[type] ?? 'Unknown';
59
+ const key = ActionListPageComponent.TYPE_LABEL_KEYS[type] ?? 'shared.unknown';
60
+ return this.translate(key);
55
61
  }
56
62
  getActionTypeSeverity(type) {
57
63
  return ActionListPageComponent.TYPE_SEVERITIES[type] ?? 'info';
@@ -66,14 +72,18 @@ class ActionListPageComponent {
66
72
  if (!action?.id || !action?.name)
67
73
  return;
68
74
  this.confirmationService.confirm({
69
- message: `Are you sure you want to delete action "${action.name}"?`,
70
- header: 'Confirm Delete',
75
+ message: this.translate('shared.confirm.delete.item', { name: action.name }),
76
+ header: this.translate('iam.action.delete.title'),
71
77
  icon: 'pi pi-exclamation-triangle',
72
78
  accept: async () => {
73
79
  try {
74
80
  await this.actionApi.deleteAsync({ id: action.id, type: 'delete' });
75
81
  await this.loadActions();
76
- this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Action deleted successfully' });
82
+ this.messageService.add({
83
+ severity: 'success',
84
+ summary: this.translate('shared.success'),
85
+ detail: this.translate('iam.action.delete.success'),
86
+ });
77
87
  }
78
88
  catch {
79
89
  // Handled by global interceptor
@@ -85,10 +95,10 @@ class ActionListPageComponent {
85
95
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", type: ActionListPageComponent, isStandalone: true, selector: "lib-action-list-page", ngImport: i0, template: `
86
96
  <div class="card">
87
97
  <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
88
- <h3 class="text-lg sm:text-xl font-semibold">Actions</h3>
98
+ <h3 class="text-lg sm:text-xl font-semibold">{{ 'iam.action.title' | translate }}</h3>
89
99
  <p-button
90
100
  *hasPermission="ACTION_PERMISSIONS.CREATE"
91
- label="New Action"
101
+ [label]="'iam.action.new' | translate"
92
102
  icon="pi pi-plus"
93
103
  (onClick)="onCreate()"
94
104
  styleClass="w-full sm:w-auto" />
@@ -103,12 +113,12 @@ class ActionListPageComponent {
103
113
  [tableStyle]="{ 'min-width': '50rem' }">
104
114
  <ng-template #header>
105
115
  <tr>
106
- <th>Name</th>
107
- <th class="hidden md:table-cell">Code</th>
108
- <th>Type</th>
109
- <th class="hidden sm:table-cell">Active</th>
110
- <th class="hidden lg:table-cell">Read Only</th>
111
- <th class="w-[100px]">Actions</th>
116
+ <th>{{ 'iam.action.name' | translate }}</th>
117
+ <th class="hidden md:table-cell">{{ 'iam.action.code' | translate }}</th>
118
+ <th>{{ 'iam.action.type' | translate }}</th>
119
+ <th class="hidden sm:table-cell">{{ 'shared.active' | translate }}</th>
120
+ <th class="hidden lg:table-cell">{{ 'shared.read.only' | translate }}</th>
121
+ <th class="w-[100px]">{{ 'shared.actions' | translate }}</th>
112
122
  </tr>
113
123
  </ng-template>
114
124
  <ng-template #body let-rowNode let-rowData="rowData">
@@ -125,12 +135,12 @@ class ActionListPageComponent {
125
135
  </td>
126
136
  <td class="hidden sm:table-cell">
127
137
  <p-tag
128
- [value]="rowData.isActive ? 'Active' : 'Inactive'"
138
+ [value]="rowData.isActive ? ('shared.active' | translate) : ('shared.inactive' | translate)"
129
139
  [severity]="rowData.isActive ? 'success' : 'secondary'" />
130
140
  </td>
131
141
  <td class="hidden lg:table-cell">
132
142
  <p-tag
133
- [value]="rowData.readOnly ? 'Yes' : 'No'"
143
+ [value]="rowData.readOnly ? ('shared.yes' | translate) : ('shared.no' | translate)"
134
144
  [severity]="rowData.readOnly ? 'warn' : 'secondary'" />
135
145
  </td>
136
146
  <td>
@@ -141,7 +151,7 @@ class ActionListPageComponent {
141
151
  [text]="true"
142
152
  severity="secondary"
143
153
  size="small"
144
- pTooltip="Edit"
154
+ [pTooltip]="'shared.edit' | translate"
145
155
  (onClick)="onEdit(rowData)" />
146
156
  <p-button
147
157
  *hasPermission="ACTION_PERMISSIONS.DELETE"
@@ -149,7 +159,7 @@ class ActionListPageComponent {
149
159
  [text]="true"
150
160
  severity="danger"
151
161
  size="small"
152
- pTooltip="Delete"
162
+ [pTooltip]="'shared.delete' | translate"
153
163
  [disabled]="rowData.readOnly"
154
164
  (onClick)="onDelete(rowData)" />
155
165
  </div>
@@ -158,27 +168,26 @@ class ActionListPageComponent {
158
168
  </ng-template>
159
169
  <ng-template #emptymessage>
160
170
  <tr>
161
- <td colspan="6" class="text-center py-4 text-muted-color">No actions found.</td>
171
+ <td colspan="6" class="text-center py-4 text-muted-color">{{ 'iam.action.no.actions' | translate }}</td>
162
172
  </tr>
163
173
  </ng-template>
164
174
  </p-treeTable>
165
175
  </div>
166
176
  </div>
167
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "ngmodule", type: PrimeModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i5.Tag, selector: "p-tag", inputs: ["styleClass", "severity", "value", "icon", "rounded"] }, { kind: "directive", type: i6.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }, { kind: "component", type: i7.TreeTable, selector: "p-treeTable, p-treetable, p-tree-table", inputs: ["columns", "styleClass", "tableStyle", "tableStyleClass", "autoLayout", "lazy", "lazyLoadOnInit", "paginator", "rows", "first", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "customSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "compareSelectionBy", "rowHover", "loading", "loadingIcon", "showLoader", "scrollable", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "frozenColumns", "resizableColumns", "columnResizeMode", "reorderableColumns", "contextMenu", "rowTrackBy", "filters", "globalFilterFields", "filterDelay", "filterMode", "filterLocale", "paginatorLocale", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "value", "virtualRowHeight", "selectionKeys", "showGridlines"], outputs: ["selectionChange", "contextMenuSelectionChange", "onFilter", "onNodeExpand", "onNodeCollapse", "onPage", "onSort", "onLazyLoad", "sortFunction", "onColResize", "onColReorder", "onNodeSelect", "onNodeUnselect", "onContextMenuSelect", "onHeaderCheckboxToggle", "onEditInit", "onEditComplete", "onEditCancel", "selectionKeysChange"] }, { kind: "component", type: i7.TreeTableToggler, selector: "p-treeTableToggler, p-treetabletoggler, p-treetable-toggler", inputs: ["rowNode"] }, { kind: "ngmodule", type: TagModule }, { kind: "directive", type: HasPermissionDirective, selector: "[hasPermission]", inputs: ["hasPermission"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
177
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "ngmodule", type: PrimeModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i5.Tag, selector: "p-tag", inputs: ["styleClass", "severity", "value", "icon", "rounded"] }, { kind: "directive", type: i6.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }, { kind: "component", type: i7.TreeTable, selector: "p-treeTable, p-treetable, p-tree-table", inputs: ["columns", "styleClass", "tableStyle", "tableStyleClass", "autoLayout", "lazy", "lazyLoadOnInit", "paginator", "rows", "first", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "customSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "compareSelectionBy", "rowHover", "loading", "loadingIcon", "showLoader", "scrollable", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "frozenColumns", "resizableColumns", "columnResizeMode", "reorderableColumns", "contextMenu", "rowTrackBy", "filters", "globalFilterFields", "filterDelay", "filterMode", "filterLocale", "paginatorLocale", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "value", "virtualRowHeight", "selectionKeys", "showGridlines"], outputs: ["selectionChange", "contextMenuSelectionChange", "onFilter", "onNodeExpand", "onNodeCollapse", "onPage", "onSort", "onLazyLoad", "sortFunction", "onColResize", "onColReorder", "onNodeSelect", "onNodeUnselect", "onContextMenuSelect", "onHeaderCheckboxToggle", "onEditInit", "onEditComplete", "onEditCancel", "selectionKeysChange"] }, { kind: "component", type: i7.TreeTableToggler, selector: "p-treeTableToggler, p-treetabletoggler, p-treetable-toggler", inputs: ["rowNode"] }, { kind: "ngmodule", type: TagModule }, { kind: "directive", type: HasPermissionDirective, selector: "[hasPermission]", inputs: ["hasPermission"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
168
178
  }
169
179
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ActionListPageComponent, decorators: [{
170
180
  type: Component,
171
181
  args: [{
172
182
  selector: 'lib-action-list-page',
173
- imports: [AngularModule, PrimeModule, TagModule, HasPermissionDirective],
174
- changeDetection: ChangeDetectionStrategy.OnPush,
183
+ imports: [AngularModule, PrimeModule, TagModule, HasPermissionDirective, TranslatePipe],
175
184
  template: `
176
185
  <div class="card">
177
186
  <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
178
- <h3 class="text-lg sm:text-xl font-semibold">Actions</h3>
187
+ <h3 class="text-lg sm:text-xl font-semibold">{{ 'iam.action.title' | translate }}</h3>
179
188
  <p-button
180
189
  *hasPermission="ACTION_PERMISSIONS.CREATE"
181
- label="New Action"
190
+ [label]="'iam.action.new' | translate"
182
191
  icon="pi pi-plus"
183
192
  (onClick)="onCreate()"
184
193
  styleClass="w-full sm:w-auto" />
@@ -193,12 +202,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
193
202
  [tableStyle]="{ 'min-width': '50rem' }">
194
203
  <ng-template #header>
195
204
  <tr>
196
- <th>Name</th>
197
- <th class="hidden md:table-cell">Code</th>
198
- <th>Type</th>
199
- <th class="hidden sm:table-cell">Active</th>
200
- <th class="hidden lg:table-cell">Read Only</th>
201
- <th class="w-[100px]">Actions</th>
205
+ <th>{{ 'iam.action.name' | translate }}</th>
206
+ <th class="hidden md:table-cell">{{ 'iam.action.code' | translate }}</th>
207
+ <th>{{ 'iam.action.type' | translate }}</th>
208
+ <th class="hidden sm:table-cell">{{ 'shared.active' | translate }}</th>
209
+ <th class="hidden lg:table-cell">{{ 'shared.read.only' | translate }}</th>
210
+ <th class="w-[100px]">{{ 'shared.actions' | translate }}</th>
202
211
  </tr>
203
212
  </ng-template>
204
213
  <ng-template #body let-rowNode let-rowData="rowData">
@@ -215,12 +224,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
215
224
  </td>
216
225
  <td class="hidden sm:table-cell">
217
226
  <p-tag
218
- [value]="rowData.isActive ? 'Active' : 'Inactive'"
227
+ [value]="rowData.isActive ? ('shared.active' | translate) : ('shared.inactive' | translate)"
219
228
  [severity]="rowData.isActive ? 'success' : 'secondary'" />
220
229
  </td>
221
230
  <td class="hidden lg:table-cell">
222
231
  <p-tag
223
- [value]="rowData.readOnly ? 'Yes' : 'No'"
232
+ [value]="rowData.readOnly ? ('shared.yes' | translate) : ('shared.no' | translate)"
224
233
  [severity]="rowData.readOnly ? 'warn' : 'secondary'" />
225
234
  </td>
226
235
  <td>
@@ -231,7 +240,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
231
240
  [text]="true"
232
241
  severity="secondary"
233
242
  size="small"
234
- pTooltip="Edit"
243
+ [pTooltip]="'shared.edit' | translate"
235
244
  (onClick)="onEdit(rowData)" />
236
245
  <p-button
237
246
  *hasPermission="ACTION_PERMISSIONS.DELETE"
@@ -239,7 +248,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
239
248
  [text]="true"
240
249
  severity="danger"
241
250
  size="small"
242
- pTooltip="Delete"
251
+ [pTooltip]="'shared.delete' | translate"
243
252
  [disabled]="rowData.readOnly"
244
253
  (onClick)="onDelete(rowData)" />
245
254
  </div>
@@ -248,7 +257,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
248
257
  </ng-template>
249
258
  <ng-template #emptymessage>
250
259
  <tr>
251
- <td colspan="6" class="text-center py-4 text-muted-color">No actions found.</td>
260
+ <td colspan="6" class="text-center py-4 text-muted-color">{{ 'iam.action.no.actions' | translate }}</td>
252
261
  </tr>
253
262
  </ng-template>
254
263
  </p-treeTable>
@@ -259,4 +268,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
259
268
  }], ctorParameters: () => [] });
260
269
 
261
270
  export { ActionListPageComponent };
262
- //# sourceMappingURL=flusys-ng-iam-action-list-page.component-BtJlGcTj.mjs.map
271
+ //# sourceMappingURL=flusys-ng-iam-action-list-page.component-BrpZujxk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flusys-ng-iam-action-list-page.component-BrpZujxk.mjs","sources":["../../../projects/ng-iam/pages/action/action-list-page.component.ts"],"sourcesContent":["import { Component, effect, inject, signal, untracked } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { TRANSLATE_ADAPTER } from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport { ACTION_PERMISSIONS, AngularModule, HasPermissionDirective, PrimeModule, TranslatePipe } from '@flusys/ng-shared';\nimport { ConfirmationService, MessageService, TreeNode } from 'primeng/api';\nimport { TagModule } from 'primeng/tag';\nimport { firstValueFrom } from 'rxjs';\nimport { ActionType, IAction } from '../../interfaces/action.interface';\nimport { ActionApiService } from '../../services/action-api.service';\nimport { convertActionToTreeNode } from '../../utils/tree-utils';\n\n@Component({\n selector: 'lib-action-list-page',\n imports: [AngularModule, PrimeModule, TagModule, HasPermissionDirective, TranslatePipe],\n template: `\n <div class=\"card\">\n <div class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\">\n <h3 class=\"text-lg sm:text-xl font-semibold\">{{ 'iam.action.title' | translate }}</h3>\n <p-button\n *hasPermission=\"ACTION_PERMISSIONS.CREATE\"\n [label]=\"'iam.action.new' | translate\"\n icon=\"pi pi-plus\"\n (onClick)=\"onCreate()\"\n styleClass=\"w-full sm:w-auto\" />\n </div>\n\n <div class=\"overflow-x-auto -mx-4 sm:mx-0\">\n <p-treeTable\n [value]=\"treeNodes()\"\n [loading]=\"isLoading()\"\n dataKey=\"id\"\n styleClass=\"p-treetable-sm\"\n [tableStyle]=\"{ 'min-width': '50rem' }\">\n <ng-template #header>\n <tr>\n <th>{{ 'iam.action.name' | translate }}</th>\n <th class=\"hidden md:table-cell\">{{ 'iam.action.code' | translate }}</th>\n <th>{{ 'iam.action.type' | translate }}</th>\n <th class=\"hidden sm:table-cell\">{{ 'shared.active' | translate }}</th>\n <th class=\"hidden lg:table-cell\">{{ 'shared.read.only' | translate }}</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 <p-treeTableToggler [rowNode]=\"rowNode\" />\n {{ rowData.name }}\n </td>\n <td class=\"hidden md:table-cell\">{{ rowData.code ?? '-' }}</td>\n <td>\n <p-tag\n [value]=\"getActionTypeLabel(rowData.actionType)\"\n [severity]=\"getActionTypeSeverity(rowData.actionType)\" />\n </td>\n <td class=\"hidden sm:table-cell\">\n <p-tag\n [value]=\"rowData.isActive ? ('shared.active' | translate) : ('shared.inactive' | translate)\"\n [severity]=\"rowData.isActive ? 'success' : 'secondary'\" />\n </td>\n <td class=\"hidden lg:table-cell\">\n <p-tag\n [value]=\"rowData.readOnly ? ('shared.yes' | translate) : ('shared.no' | translate)\"\n [severity]=\"rowData.readOnly ? 'warn' : 'secondary'\" />\n </td>\n <td>\n <div class=\"flex gap-1\">\n <p-button\n *hasPermission=\"ACTION_PERMISSIONS.UPDATE\"\n icon=\"pi pi-pencil\"\n [text]=\"true\"\n severity=\"secondary\"\n size=\"small\"\n [pTooltip]=\"'shared.edit' | translate\"\n (onClick)=\"onEdit(rowData)\" />\n <p-button\n *hasPermission=\"ACTION_PERMISSIONS.DELETE\"\n icon=\"pi pi-trash\"\n [text]=\"true\"\n severity=\"danger\"\n size=\"small\"\n [pTooltip]=\"'shared.delete' | translate\"\n [disabled]=\"rowData.readOnly\"\n (onClick)=\"onDelete(rowData)\" />\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\">{{ 'iam.action.no.actions' | translate }}</td>\n </tr>\n </ng-template>\n </p-treeTable>\n </div>\n </div>\n `,\n})\nexport class ActionListPageComponent {\n readonly ACTION_PERMISSIONS = ACTION_PERMISSIONS;\n\n private readonly router = inject(Router);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE);\n private readonly actionApi = inject(ActionApiService);\n private readonly messageService = inject(MessageService);\n private readonly confirmationService = inject(ConfirmationService);\n private readonly translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });\n\n readonly isLoading = signal(false);\n readonly treeNodes = signal<TreeNode<IAction>[]>([]);\n\n private translate(key: string, vars?: Record<string, string | number>): string {\n return this.translateAdapter?.translate(key, vars) ?? key;\n }\n\n private static readonly TYPE_SEVERITIES: Record<ActionType, 'info' | 'success' | 'warn'> = {\n [ActionType.BACKEND]: 'info',\n [ActionType.FRONTEND]: 'success',\n [ActionType.BOTH]: 'warn',\n };\n\n private static readonly TYPE_LABEL_KEYS: Record<ActionType, string> = {\n [ActionType.BACKEND]: 'iam.action.type.backend',\n [ActionType.FRONTEND]: 'iam.action.type.frontend',\n [ActionType.BOTH]: 'iam.action.type.both',\n };\n\n constructor() {\n effect(() => {\n this.companyContext.currentCompanyInfo();\n untracked(() => this.loadActions());\n });\n }\n\n private async loadActions(): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await firstValueFrom(this.actionApi.getTree());\n this.treeNodes.set(convertActionToTreeNode(response?.success ? response.data ?? [] : []));\n } catch {\n // Handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n getActionTypeLabel(type: ActionType): string {\n const key = ActionListPageComponent.TYPE_LABEL_KEYS[type] ?? 'shared.unknown';\n return this.translate(key);\n }\n\n getActionTypeSeverity(type: ActionType): 'info' | 'success' | 'warn' {\n return ActionListPageComponent.TYPE_SEVERITIES[type] ?? 'info';\n }\n\n onCreate(): void {\n this.router.navigate(['/iam/actions/new']);\n }\n\n onEdit(action: IAction): void {\n this.router.navigate(['/iam/actions', action.id]);\n }\n\n onDelete(action: IAction): void {\n if (!action?.id || !action?.name) return;\n\n this.confirmationService.confirm({\n message: this.translate('shared.confirm.delete.item', { name: action.name }),\n header: this.translate('iam.action.delete.title'),\n icon: 'pi pi-exclamation-triangle',\n accept: async () => {\n try {\n await this.actionApi.deleteAsync({ id: action.id, type: 'delete' });\n await this.loadActions();\n this.messageService.add({\n severity: 'success',\n summary: this.translate('shared.success'),\n detail: this.translate('iam.action.delete.success'),\n });\n } catch {\n // Handled by global interceptor\n }\n },\n });\n }\n}\n"],"names":["i1","i2","i3","i4"],"mappings":";;;;;;;;;;;;;;;MAmGa,uBAAuB,CAAA;IACzB,kBAAkB,GAAG,kBAA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