@flusys/ng-iam 0.1.0-beta.3 → 1.0.0-rc
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/README.md +225 -25
- package/fesm2022/{flusys-ng-iam-action-form-page.component-BVWZMlLU.mjs → flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs} +181 -210
- package/fesm2022/flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-action-list-page.component-Daf93zpS.mjs +289 -0
- package/fesm2022/flusys-ng-iam-action-list-page.component-Daf93zpS.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-flusys-ng-iam-D_i24Gub.mjs → flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs} +967 -1087
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs +92 -0
- package/fesm2022/flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-permission-page.component-C0yLMdW5.mjs → flusys-ng-iam-permission-page.component-CmxOBJPu.mjs} +45 -16
- package/fesm2022/flusys-ng-iam-permission-page.component-CmxOBJPu.mjs.map +1 -0
- package/fesm2022/{flusys-ng-iam-role-form-page.component-Co6bbHik.mjs → flusys-ng-iam-role-form-page.component-ByNueI1a.mjs} +110 -138
- package/fesm2022/flusys-ng-iam-role-form-page.component-ByNueI1a.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam-role-list-page.component-CFly5KnH.mjs +316 -0
- package/fesm2022/flusys-ng-iam-role-list-page.component-CFly5KnH.mjs.map +1 -0
- package/fesm2022/flusys-ng-iam.mjs +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-iam.d.ts +89 -37
- package/fesm2022/flusys-ng-iam-action-form-page.component-BVWZMlLU.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-action-list-page.component-CCp7M7xo.mjs +0 -282
- package/fesm2022/flusys-ng-iam-action-list-page.component-CCp7M7xo.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-flusys-ng-iam-D_i24Gub.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-iam-container.component-BFKoNtdz.mjs +0 -97
- package/fesm2022/flusys-ng-iam-iam-container.component-BFKoNtdz.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-permission-page.component-C0yLMdW5.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-form-page.component-Co6bbHik.mjs.map +0 -1
- package/fesm2022/flusys-ng-iam-role-list-page.component-KJUVOrf0.mjs +0 -267
- package/fesm2022/flusys-ng-iam-role-list-page.component-KJUVOrf0.mjs.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { RouterOutlet, RouterLink, RouterLinkActive } from '@angular/router';
|
|
4
|
+
import { APP_CONFIG, getPermissionMode } from '@flusys/ng-core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* IAM Container Component
|
|
8
|
+
*
|
|
9
|
+
* Main container for IAM module with tab navigation
|
|
10
|
+
* Routes: Actions | Roles (conditional) | Users (permission assignment)
|
|
11
|
+
*/
|
|
12
|
+
class IamContainerComponent {
|
|
13
|
+
appConfig = inject(APP_CONFIG);
|
|
14
|
+
/** All available tabs */
|
|
15
|
+
allTabs = [
|
|
16
|
+
{
|
|
17
|
+
id: 'actions',
|
|
18
|
+
label: 'Actions',
|
|
19
|
+
icon: 'pi pi-bolt',
|
|
20
|
+
route: 'actions',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'roles',
|
|
24
|
+
label: 'Roles',
|
|
25
|
+
icon: 'pi pi-shield',
|
|
26
|
+
route: 'roles',
|
|
27
|
+
requiresRBAC: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'permissions',
|
|
31
|
+
label: 'Permissions',
|
|
32
|
+
icon: 'pi pi-key',
|
|
33
|
+
route: 'permissions',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
/** Visible tabs based on permission mode */
|
|
37
|
+
visibleTabs = computed(() => {
|
|
38
|
+
const permissionMode = getPermissionMode(this.appConfig);
|
|
39
|
+
return this.allTabs.filter((tab) => !tab.requiresRBAC || permissionMode === 'rbac' || permissionMode === 'full');
|
|
40
|
+
}, ...(ngDevMode ? [{ debugName: "visibleTabs" }] : []));
|
|
41
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: IamContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: IamContainerComponent, isStandalone: true, selector: "lib-iam-container", ngImport: i0, template: `
|
|
43
|
+
<div class="p-4">
|
|
44
|
+
<div class="mb-4">
|
|
45
|
+
<h1 class="text-xl sm:text-2xl font-bold m-0">Identity & Access Management</h1>
|
|
46
|
+
<p class="text-muted-color mt-1">Manage actions, roles, and user permissions</p>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="scrollbar-hide flex gap-1 mb-4 border-b border-surface overflow-x-auto flex-nowrap">
|
|
50
|
+
@for (tab of visibleTabs(); track tab.id) {
|
|
51
|
+
<a
|
|
52
|
+
[routerLink]="tab.route"
|
|
53
|
+
routerLinkActive="tab-active"
|
|
54
|
+
class="flex items-center gap-2 px-4 py-2 rounded-t-lg cursor-pointer transition-colors text-muted-color no-underline border-b-2 border-transparent -mb-px hover:bg-surface-hover [&.tab-active]:text-primary [&.tab-active]:border-primary [&.tab-active]:bg-surface-ground whitespace-nowrap shrink-0">
|
|
55
|
+
<i [class]="tab.icon"></i>
|
|
56
|
+
<span>{{ tab.label }}</span>
|
|
57
|
+
</a>
|
|
58
|
+
}
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<router-outlet />
|
|
62
|
+
</div>
|
|
63
|
+
`, isInline: true, styles: [".scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
64
|
+
}
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: IamContainerComponent, decorators: [{
|
|
66
|
+
type: Component,
|
|
67
|
+
args: [{ selector: 'lib-iam-container', standalone: true, imports: [RouterOutlet, RouterLink, RouterLinkActive], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
68
|
+
<div class="p-4">
|
|
69
|
+
<div class="mb-4">
|
|
70
|
+
<h1 class="text-xl sm:text-2xl font-bold m-0">Identity & Access Management</h1>
|
|
71
|
+
<p class="text-muted-color mt-1">Manage actions, roles, and user permissions</p>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="scrollbar-hide flex gap-1 mb-4 border-b border-surface overflow-x-auto flex-nowrap">
|
|
75
|
+
@for (tab of visibleTabs(); track tab.id) {
|
|
76
|
+
<a
|
|
77
|
+
[routerLink]="tab.route"
|
|
78
|
+
routerLinkActive="tab-active"
|
|
79
|
+
class="flex items-center gap-2 px-4 py-2 rounded-t-lg cursor-pointer transition-colors text-muted-color no-underline border-b-2 border-transparent -mb-px hover:bg-surface-hover [&.tab-active]:text-primary [&.tab-active]:border-primary [&.tab-active]:bg-surface-ground whitespace-nowrap shrink-0">
|
|
80
|
+
<i [class]="tab.icon"></i>
|
|
81
|
+
<span>{{ tab.label }}</span>
|
|
82
|
+
</a>
|
|
83
|
+
}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<router-outlet />
|
|
87
|
+
</div>
|
|
88
|
+
`, styles: [".scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}\n"] }]
|
|
89
|
+
}] });
|
|
90
|
+
|
|
91
|
+
export { IamContainerComponent };
|
|
92
|
+
//# sourceMappingURL=flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs","sources":["../../../projects/ng-iam/pages/iam-container/iam-container.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';\nimport { APP_CONFIG, getPermissionMode } from '@flusys/ng-core';\n\ninterface ITab {\n id: string;\n label: string;\n icon: string;\n route: string;\n requiresRBAC?: boolean;\n}\n\n/**\n * IAM Container Component\n *\n * Main container for IAM module with tab navigation\n * Routes: Actions | Roles (conditional) | Users (permission assignment)\n */\n@Component({\n selector: 'lib-iam-container',\n standalone: true,\n imports: [RouterOutlet, RouterLink, RouterLinkActive],\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: `\n .scrollbar-hide {\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar { display: none; }\n }\n `,\n template: `\n <div class=\"p-4\">\n <div class=\"mb-4\">\n <h1 class=\"text-xl sm:text-2xl font-bold m-0\">Identity & Access Management</h1>\n <p class=\"text-muted-color mt-1\">Manage actions, roles, and user permissions</p>\n </div>\n\n <div class=\"scrollbar-hide flex gap-1 mb-4 border-b border-surface overflow-x-auto flex-nowrap\">\n @for (tab of visibleTabs(); track tab.id) {\n <a\n [routerLink]=\"tab.route\"\n routerLinkActive=\"tab-active\"\n class=\"flex items-center gap-2 px-4 py-2 rounded-t-lg cursor-pointer transition-colors text-muted-color no-underline border-b-2 border-transparent -mb-px hover:bg-surface-hover [&.tab-active]:text-primary [&.tab-active]:border-primary [&.tab-active]:bg-surface-ground whitespace-nowrap shrink-0\">\n <i [class]=\"tab.icon\"></i>\n <span>{{ tab.label }}</span>\n </a>\n }\n </div>\n\n <router-outlet />\n </div>\n `,\n})\nexport class IamContainerComponent {\n private readonly appConfig = inject(APP_CONFIG);\n\n /** All available tabs */\n private readonly allTabs: ITab[] = [\n {\n id: 'actions',\n label: 'Actions',\n icon: 'pi pi-bolt',\n route: 'actions',\n },\n {\n id: 'roles',\n label: 'Roles',\n icon: 'pi pi-shield',\n route: 'roles',\n requiresRBAC: true,\n },\n {\n id: 'permissions',\n label: 'Permissions',\n icon: 'pi pi-key',\n route: 'permissions',\n },\n ];\n\n /** Visible tabs based on permission mode */\n readonly visibleTabs = computed(() => {\n const permissionMode = getPermissionMode(this.appConfig);\n return this.allTabs.filter(\n (tab) => !tab.requiresRBAC || permissionMode === 'rbac' || permissionMode === 'full'\n );\n });\n}\n"],"names":[],"mappings":";;;;;AAYA;;;;;AAKG;MAoCU,qBAAqB,CAAA;AACf,IAAA,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;;AAG9B,IAAA,OAAO,GAAW;AACjC,QAAA;AACE,YAAA,EAAE,EAAE,SAAS;AACb,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,IAAI,EAAE,YAAY;AAClB,YAAA,KAAK,EAAE,SAAS;AACjB,SAAA;AACD,QAAA;AACE,YAAA,EAAE,EAAE,OAAO;AACX,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,YAAY,EAA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AAA,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,uBAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAgCzC,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAnCjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAAA,UAAA,EACjB,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAAA,eAAA,EACpC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAQrC;;;;;;;;;;;;;;;;;;;;;AAqBT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,iHAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, signal, computed, Component } from '@angular/core';
|
|
3
|
-
import { AngularModule, PrimeModule } from '@flusys/ng-shared';
|
|
2
|
+
import { inject, signal, computed, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { COMPANY_ACTION_PERMISSIONS, USER_ACTION_PERMISSIONS, USER_ROLE_PERMISSIONS, ROLE_ACTION_PERMISSIONS, AngularModule, PrimeModule, HasPermissionDirective } from '@flusys/ng-shared';
|
|
4
4
|
import { APP_CONFIG, getPermissionMode, isCompanyFeatureEnabled } from '@flusys/ng-core';
|
|
5
|
-
import * as
|
|
5
|
+
import * as i2 from 'primeng/button';
|
|
6
6
|
import { ButtonModule } from 'primeng/button';
|
|
7
7
|
import { TabsModule } from 'primeng/tabs';
|
|
8
|
-
import { b as RoleActionSelectorComponent, C as CompanyActionSelectorComponent, U as UserRoleSelectorComponent, d as UserActionSelectorComponent } from './flusys-ng-iam-flusys-ng-iam-
|
|
8
|
+
import { b as RoleActionSelectorComponent, C as CompanyActionSelectorComponent, U as UserRoleSelectorComponent, d as UserActionSelectorComponent } from './flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs';
|
|
9
9
|
|
|
10
|
+
/** Permission codes for each tab */
|
|
11
|
+
const TAB_PERMISSIONS = {
|
|
12
|
+
'role-actions': ROLE_ACTION_PERMISSIONS.READ,
|
|
13
|
+
'user-roles': USER_ROLE_PERMISSIONS.READ,
|
|
14
|
+
'user-actions': USER_ACTION_PERMISSIONS.READ,
|
|
15
|
+
'company-actions': COMPANY_ACTION_PERMISSIONS.READ,
|
|
16
|
+
};
|
|
10
17
|
/**
|
|
11
18
|
* Permission Page Component
|
|
12
19
|
*
|
|
@@ -18,9 +25,9 @@ import { b as RoleActionSelectorComponent, C as CompanyActionSelectorComponent,
|
|
|
18
25
|
*/
|
|
19
26
|
class PermissionPageComponent {
|
|
20
27
|
appConfig = inject(APP_CONFIG);
|
|
21
|
-
activeTab = signal('
|
|
28
|
+
activeTab = signal('', ...(ngDevMode ? [{ debugName: "activeTab" }] : []));
|
|
22
29
|
/**
|
|
23
|
-
*
|
|
30
|
+
* All possible tabs based on permission mode (directive handles action permissions)
|
|
24
31
|
*/
|
|
25
32
|
availableTabs = computed(() => {
|
|
26
33
|
const permissionMode = getPermissionMode(this.appConfig);
|
|
@@ -31,10 +38,12 @@ class PermissionPageComponent {
|
|
|
31
38
|
id: 'role-actions',
|
|
32
39
|
label: 'Role-Actions',
|
|
33
40
|
icon: 'pi pi-shield',
|
|
41
|
+
permission: TAB_PERMISSIONS['role-actions'],
|
|
34
42
|
}, {
|
|
35
43
|
id: 'user-roles',
|
|
36
44
|
label: 'User-Roles',
|
|
37
45
|
icon: 'pi pi-user',
|
|
46
|
+
permission: TAB_PERMISSIONS['user-roles'],
|
|
38
47
|
});
|
|
39
48
|
}
|
|
40
49
|
// User-Action direct assignment (DIRECT or FULL mode)
|
|
@@ -43,6 +52,7 @@ class PermissionPageComponent {
|
|
|
43
52
|
id: 'user-actions',
|
|
44
53
|
label: 'User-Actions',
|
|
45
54
|
icon: 'pi pi-key',
|
|
55
|
+
permission: TAB_PERMISSIONS['user-actions'],
|
|
46
56
|
});
|
|
47
57
|
}
|
|
48
58
|
// Company-Action whitelist (if company feature enabled)
|
|
@@ -51,25 +61,41 @@ class PermissionPageComponent {
|
|
|
51
61
|
id: 'company-actions',
|
|
52
62
|
label: 'Company-Actions',
|
|
53
63
|
icon: 'pi pi-building',
|
|
64
|
+
permission: TAB_PERMISSIONS['company-actions'],
|
|
54
65
|
});
|
|
55
66
|
}
|
|
56
67
|
return tabs;
|
|
57
68
|
}, ...(ngDevMode ? [{ debugName: "availableTabs" }] : []));
|
|
69
|
+
constructor() {
|
|
70
|
+
// Set default tab to first available tab
|
|
71
|
+
effect(() => {
|
|
72
|
+
const tabs = this.availableTabs();
|
|
73
|
+
const currentTab = untracked(() => this.activeTab());
|
|
74
|
+
// Only set if no active tab or current tab is not in available tabs
|
|
75
|
+
if (!currentTab || !tabs.some((t) => t.id === currentTab)) {
|
|
76
|
+
if (tabs.length > 0) {
|
|
77
|
+
this.activeTab.set(tabs[0].id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
58
82
|
setActiveTab(tabId) {
|
|
59
83
|
this.activeTab.set(tabId);
|
|
60
84
|
}
|
|
61
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
62
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.
|
|
85
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: PermissionPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: PermissionPageComponent, isStandalone: true, selector: "lib-permission-page", ngImport: i0, template: `
|
|
63
87
|
<div class="card">
|
|
64
88
|
<h3 class="text-xl font-semibold mb-4">Permission Management</h3>
|
|
65
89
|
|
|
66
|
-
<div class="flex gap-2 mb-4">
|
|
90
|
+
<div class="scrollbar-hide flex gap-2 mb-4 overflow-x-auto flex-nowrap">
|
|
67
91
|
@for (tab of availableTabs(); track tab.id) {
|
|
68
92
|
<p-button
|
|
93
|
+
*hasPermission="tab.permission"
|
|
69
94
|
[label]="tab.label"
|
|
70
95
|
[icon]="tab.icon"
|
|
71
96
|
[outlined]="activeTab() !== tab.id"
|
|
72
97
|
size="small"
|
|
98
|
+
styleClass="shrink-0"
|
|
73
99
|
(onClick)="setActiveTab(tab.id)" />
|
|
74
100
|
}
|
|
75
101
|
</div>
|
|
@@ -91,15 +117,16 @@ class PermissionPageComponent {
|
|
|
91
117
|
}
|
|
92
118
|
</div>
|
|
93
119
|
</div>
|
|
94
|
-
`, isInline: true, styles: [":
|
|
120
|
+
`, isInline: true, styles: [".scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}\n"], 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: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: TabsModule }, { kind: "directive", type: HasPermissionDirective, selector: "[hasPermission]", inputs: ["hasPermission"] }, { kind: "component", type: RoleActionSelectorComponent, selector: "flusys-role-action-selector" }, { kind: "component", type: CompanyActionSelectorComponent, selector: "flusys-company-action-selector" }, { kind: "component", type: UserRoleSelectorComponent, selector: "flusys-user-role-selector" }, { kind: "component", type: UserActionSelectorComponent, selector: "flusys-user-action-selector" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
95
121
|
}
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: PermissionPageComponent, decorators: [{
|
|
97
123
|
type: Component,
|
|
98
|
-
args: [{ selector: 'lib-permission-page', standalone: true, imports: [
|
|
124
|
+
args: [{ selector: 'lib-permission-page', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
99
125
|
AngularModule,
|
|
100
126
|
PrimeModule,
|
|
101
127
|
ButtonModule,
|
|
102
128
|
TabsModule,
|
|
129
|
+
HasPermissionDirective,
|
|
103
130
|
RoleActionSelectorComponent,
|
|
104
131
|
CompanyActionSelectorComponent,
|
|
105
132
|
UserRoleSelectorComponent,
|
|
@@ -108,13 +135,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
108
135
|
<div class="card">
|
|
109
136
|
<h3 class="text-xl font-semibold mb-4">Permission Management</h3>
|
|
110
137
|
|
|
111
|
-
<div class="flex gap-2 mb-4">
|
|
138
|
+
<div class="scrollbar-hide flex gap-2 mb-4 overflow-x-auto flex-nowrap">
|
|
112
139
|
@for (tab of availableTabs(); track tab.id) {
|
|
113
140
|
<p-button
|
|
141
|
+
*hasPermission="tab.permission"
|
|
114
142
|
[label]="tab.label"
|
|
115
143
|
[icon]="tab.icon"
|
|
116
144
|
[outlined]="activeTab() !== tab.id"
|
|
117
145
|
size="small"
|
|
146
|
+
styleClass="shrink-0"
|
|
118
147
|
(onClick)="setActiveTab(tab.id)" />
|
|
119
148
|
}
|
|
120
149
|
</div>
|
|
@@ -136,8 +165,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
136
165
|
}
|
|
137
166
|
</div>
|
|
138
167
|
</div>
|
|
139
|
-
`, styles: [":
|
|
140
|
-
}] });
|
|
168
|
+
`, styles: [".scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}\n"] }]
|
|
169
|
+
}], ctorParameters: () => [] });
|
|
141
170
|
|
|
142
171
|
export { PermissionPageComponent };
|
|
143
|
-
//# sourceMappingURL=flusys-ng-iam-permission-page.component-
|
|
172
|
+
//# sourceMappingURL=flusys-ng-iam-permission-page.component-CmxOBJPu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flusys-ng-iam-permission-page.component-CmxOBJPu.mjs","sources":["../../../projects/ng-iam/pages/permission/permission-page.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, inject, signal, untracked } from '@angular/core';\nimport {\n AngularModule,\n HasPermissionDirective,\n PrimeModule,\n ROLE_ACTION_PERMISSIONS,\n USER_ROLE_PERMISSIONS,\n USER_ACTION_PERMISSIONS,\n COMPANY_ACTION_PERMISSIONS,\n} from '@flusys/ng-shared';\nimport { APP_CONFIG, getPermissionMode, isCompanyFeatureEnabled } from '@flusys/ng-core';\nimport { ButtonModule } from 'primeng/button';\nimport { TabsModule } from 'primeng/tabs';\nimport { RoleActionSelectorComponent } from '../../components/role-action-selector.component';\nimport { CompanyActionSelectorComponent } from '../../components/company-action-selector.component';\nimport { UserRoleSelectorComponent } from '../../components/user-role-selector.component';\nimport { UserActionSelectorComponent } from '../../components/user-action-selector.component';\n\n/** Permission codes for each tab */\nconst TAB_PERMISSIONS = {\n 'role-actions': ROLE_ACTION_PERMISSIONS.READ,\n 'user-roles': USER_ROLE_PERMISSIONS.READ,\n 'user-actions': USER_ACTION_PERMISSIONS.READ,\n 'company-actions': COMPANY_ACTION_PERMISSIONS.READ,\n} as const;\n\n/**\n * Permission Page Component\n *\n * Main permission management interface with tabs for:\n * - Role-Action Assignment (RBAC/FULL mode) - WITH LOGIC BUILDER\n * - User-Role Assignment (RBAC/FULL mode)\n * - User-Action Assignment (DIRECT/FULL mode)\n * - Company-Action Whitelist (if company feature enabled)\n */\n@Component({\n selector: 'lib-permission-page',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AngularModule,\n PrimeModule,\n ButtonModule,\n TabsModule,\n HasPermissionDirective,\n RoleActionSelectorComponent,\n CompanyActionSelectorComponent,\n UserRoleSelectorComponent,\n UserActionSelectorComponent\n ],\n styles: `\n .scrollbar-hide {\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar { display: none; }\n }\n `,\n template: `\n <div class=\"card\">\n <h3 class=\"text-xl font-semibold mb-4\">Permission Management</h3>\n\n <div class=\"scrollbar-hide flex gap-2 mb-4 overflow-x-auto flex-nowrap\">\n @for (tab of availableTabs(); track tab.id) {\n <p-button\n *hasPermission=\"tab.permission\"\n [label]=\"tab.label\"\n [icon]=\"tab.icon\"\n [outlined]=\"activeTab() !== tab.id\"\n size=\"small\"\n styleClass=\"shrink-0\"\n (onClick)=\"setActiveTab(tab.id)\" />\n }\n </div>\n\n <div class=\"mt-4\">\n @switch (activeTab()) {\n @case ('role-actions') {\n <flusys-role-action-selector />\n }\n @case ('user-roles') {\n <flusys-user-role-selector />\n }\n @case ('user-actions') {\n <flusys-user-action-selector />\n }\n @case ('company-actions') {\n <flusys-company-action-selector />\n }\n }\n </div>\n </div>\n `,\n})\nexport class PermissionPageComponent {\n private readonly appConfig = inject(APP_CONFIG);\n\n readonly activeTab = signal<string>('');\n\n /**\n * All possible tabs based on permission mode (directive handles action permissions)\n */\n readonly availableTabs = computed(() => {\n const permissionMode = getPermissionMode(this.appConfig);\n const tabs: Array<{ id: string; label: string; icon: string; permission: string }> = [];\n\n // Role-Action assignment (RBAC or FULL mode)\n if (permissionMode === 'rbac' || permissionMode === 'full') {\n tabs.push(\n {\n id: 'role-actions',\n label: 'Role-Actions',\n icon: 'pi pi-shield',\n permission: TAB_PERMISSIONS['role-actions'],\n },\n {\n id: 'user-roles',\n label: 'User-Roles',\n icon: 'pi pi-user',\n permission: TAB_PERMISSIONS['user-roles'],\n }\n );\n }\n\n // User-Action direct assignment (DIRECT or FULL mode)\n if (permissionMode === 'direct' || permissionMode === 'full') {\n tabs.push({\n id: 'user-actions',\n label: 'User-Actions',\n icon: 'pi pi-key',\n permission: TAB_PERMISSIONS['user-actions'],\n });\n }\n\n // Company-Action whitelist (if company feature enabled)\n if (isCompanyFeatureEnabled(this.appConfig)) {\n tabs.push({\n id: 'company-actions',\n label: 'Company-Actions',\n icon: 'pi pi-building',\n permission: TAB_PERMISSIONS['company-actions'],\n });\n }\n\n return tabs;\n });\n\n constructor() {\n // Set default tab to first available tab\n effect(() => {\n const tabs = this.availableTabs();\n const currentTab = untracked(() => this.activeTab());\n\n // Only set if no active tab or current tab is not in available tabs\n if (!currentTab || !tabs.some((t) => t.id === currentTab)) {\n if (tabs.length > 0) {\n this.activeTab.set(tabs[0].id);\n }\n }\n });\n }\n\n setActiveTab(tabId: string): void {\n this.activeTab.set(tabId);\n }\n}\n"],"names":["i1"],"mappings":";;;;;;;;;AAkBA;AACA,MAAM,eAAe,GAAG;IACtB,cAAc,EAAE,uBAAuB,CAAC,IAAI;IAC5C,YAAY,EAAE,qBAAqB,CAAC,IAAI;IACxC,cAAc,EAAE,uBAAuB,CAAC,IAAI;IAC5C,iBAAiB,EAAE,0BAA0B,CAAC,IAAI;CAC1C;AAEV;;;;;;;;AAQG;MA2DU,uBAAuB,CAAA;AACjB,IAAA,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;AAEtC,IAAA,SAAS,GAAG,MAAM,CAAS,EAAE,qDAAC;AA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,iHAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { inject, signal, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
3
4
|
import { form, required, FormField } from '@angular/forms/signals';
|
|
4
5
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
5
6
|
import { APP_CONFIG, isCompanyFeatureEnabled } from '@flusys/ng-core';
|
|
@@ -7,10 +8,11 @@ import { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';
|
|
|
7
8
|
import { AngularModule, PrimeModule } from '@flusys/ng-shared';
|
|
8
9
|
import { MessageService } from 'primeng/api';
|
|
9
10
|
import { firstValueFrom } from 'rxjs';
|
|
10
|
-
import { R as RoleApiService } from './flusys-ng-iam-flusys-ng-iam-
|
|
11
|
+
import { R as RoleApiService } from './flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs';
|
|
11
12
|
import * as i1 from '@angular/forms';
|
|
12
|
-
import * as i2 from 'primeng/
|
|
13
|
-
import * as i3 from 'primeng/
|
|
13
|
+
import * as i2 from 'primeng/button';
|
|
14
|
+
import * as i3 from 'primeng/checkbox';
|
|
15
|
+
import * as i4 from 'primeng/inputtext';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Role Form Page Component
|
|
@@ -23,6 +25,8 @@ class RoleFormPageComponent {
|
|
|
23
25
|
companyContext = inject(LAYOUT_AUTH_STATE);
|
|
24
26
|
roleApi = inject(RoleApiService);
|
|
25
27
|
messageService = inject(MessageService);
|
|
28
|
+
routeParams = toSignal(this.route.paramMap);
|
|
29
|
+
initialized = false;
|
|
26
30
|
/** Loading state */
|
|
27
31
|
isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
28
32
|
/** Existing role data when editing */
|
|
@@ -49,11 +53,17 @@ class RoleFormPageComponent {
|
|
|
49
53
|
const model = this.formModel();
|
|
50
54
|
return model.name.trim().length > 0;
|
|
51
55
|
}, ...(ngDevMode ? [{ debugName: "isFormValid" }] : []));
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
|
|
56
|
+
constructor() {
|
|
57
|
+
effect(() => {
|
|
58
|
+
const params = this.routeParams();
|
|
59
|
+
if (!params || this.initialized)
|
|
60
|
+
return;
|
|
61
|
+
this.initialized = true;
|
|
62
|
+
const id = params.get('id');
|
|
63
|
+
if (id && id !== 'new') {
|
|
64
|
+
this.loadRole(id);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
async loadRole(id) {
|
|
59
69
|
this.isLoading.set(true);
|
|
@@ -71,20 +81,12 @@ class RoleFormPageComponent {
|
|
|
71
81
|
});
|
|
72
82
|
}
|
|
73
83
|
else {
|
|
74
|
-
|
|
75
|
-
severity: 'error',
|
|
76
|
-
summary: 'Error',
|
|
77
|
-
detail: 'Role not found.',
|
|
78
|
-
});
|
|
84
|
+
// Error toast handled by global interceptor
|
|
79
85
|
this.router.navigate(['/iam/roles']);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
|
-
catch
|
|
83
|
-
|
|
84
|
-
severity: 'error',
|
|
85
|
-
summary: 'Error',
|
|
86
|
-
detail: 'Failed to load role.',
|
|
87
|
-
});
|
|
88
|
+
catch {
|
|
89
|
+
// Error toast handled by global interceptor
|
|
88
90
|
this.router.navigate(['/iam/roles']);
|
|
89
91
|
}
|
|
90
92
|
finally {
|
|
@@ -132,12 +134,8 @@ class RoleFormPageComponent {
|
|
|
132
134
|
}
|
|
133
135
|
this.router.navigate(['/iam/roles']);
|
|
134
136
|
}
|
|
135
|
-
catch
|
|
136
|
-
|
|
137
|
-
severity: 'error',
|
|
138
|
-
summary: 'Error',
|
|
139
|
-
detail: error.message || 'Failed to save role.',
|
|
140
|
-
});
|
|
137
|
+
catch {
|
|
138
|
+
// Error toast handled by global interceptor
|
|
141
139
|
}
|
|
142
140
|
finally {
|
|
143
141
|
this.isLoading.set(false);
|
|
@@ -146,69 +144,56 @@ class RoleFormPageComponent {
|
|
|
146
144
|
onBack() {
|
|
147
145
|
this.router.navigate(['/iam/roles']);
|
|
148
146
|
}
|
|
149
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.
|
|
147
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: RoleFormPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
148
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: RoleFormPageComponent, isStandalone: true, selector: "lib-role-form-page", ngImport: i0, template: `
|
|
151
149
|
<div class="card">
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</h3>
|
|
156
|
-
<p-button
|
|
157
|
-
label="Back"
|
|
158
|
-
icon="pi pi-arrow-left"
|
|
159
|
-
[outlined]="true"
|
|
160
|
-
(onClick)="onBack()" />
|
|
161
|
-
</div>
|
|
150
|
+
<h3 class="text-lg sm:text-xl font-semibold mb-4">
|
|
151
|
+
{{ isEditMode() ? 'Edit Role' : 'New Role' }}
|
|
152
|
+
</h3>
|
|
162
153
|
|
|
163
|
-
<form (ngSubmit)="onSubmit()">
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
placeholder="Enter role name" />
|
|
174
|
-
</div>
|
|
154
|
+
<form (ngSubmit)="onSubmit()" class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
155
|
+
<!-- Name -->
|
|
156
|
+
<div class="flex flex-col gap-2">
|
|
157
|
+
<label for="name" class="font-medium">Name *</label>
|
|
158
|
+
<input
|
|
159
|
+
pInputText
|
|
160
|
+
id="name"
|
|
161
|
+
[formField]="roleForm.name"
|
|
162
|
+
placeholder="Enter role name" />
|
|
163
|
+
</div>
|
|
175
164
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</div>
|
|
165
|
+
<!-- Description -->
|
|
166
|
+
<div class="flex flex-col gap-2">
|
|
167
|
+
<label for="description" class="font-medium">Description</label>
|
|
168
|
+
<input
|
|
169
|
+
pInputText
|
|
170
|
+
id="description"
|
|
171
|
+
[formField]="roleForm.description"
|
|
172
|
+
placeholder="Enter description" />
|
|
173
|
+
</div>
|
|
186
174
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
</div>
|
|
175
|
+
<!-- Order -->
|
|
176
|
+
<div class="flex flex-col gap-2">
|
|
177
|
+
<label for="serial" class="font-medium">Display Order</label>
|
|
178
|
+
<input
|
|
179
|
+
pInputText
|
|
180
|
+
id="serial"
|
|
181
|
+
type="number"
|
|
182
|
+
[formField]="roleForm.serial"
|
|
183
|
+
placeholder="Enter display order" />
|
|
184
|
+
</div>
|
|
198
185
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
</label>
|
|
207
|
-
</div>
|
|
186
|
+
<!-- Is Active -->
|
|
187
|
+
<div class="flex items-end gap-2 pb-1">
|
|
188
|
+
<p-checkbox
|
|
189
|
+
[formField]="roleForm.isActive"
|
|
190
|
+
[binary]="true"
|
|
191
|
+
inputId="isActive" />
|
|
192
|
+
<label for="isActive">Active</label>
|
|
208
193
|
</div>
|
|
209
194
|
|
|
210
195
|
<!-- Actions -->
|
|
211
|
-
<div class="flex justify-end gap-2
|
|
196
|
+
<div class="flex justify-end gap-2 md:col-span-2 pt-4">
|
|
212
197
|
<p-button
|
|
213
198
|
label="Cancel"
|
|
214
199
|
severity="secondary"
|
|
@@ -222,9 +207,9 @@ class RoleFormPageComponent {
|
|
|
222
207
|
</div>
|
|
223
208
|
</form>
|
|
224
209
|
</div>
|
|
225
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: PrimeModule }, { kind: "
|
|
210
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { 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: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "directive", type: i4.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
226
211
|
}
|
|
227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: RoleFormPageComponent, decorators: [{
|
|
228
213
|
type: Component,
|
|
229
214
|
args: [{
|
|
230
215
|
selector: 'lib-role-form-page',
|
|
@@ -233,66 +218,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
233
218
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
234
219
|
template: `
|
|
235
220
|
<div class="card">
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
</h3>
|
|
240
|
-
<p-button
|
|
241
|
-
label="Back"
|
|
242
|
-
icon="pi pi-arrow-left"
|
|
243
|
-
[outlined]="true"
|
|
244
|
-
(onClick)="onBack()" />
|
|
245
|
-
</div>
|
|
221
|
+
<h3 class="text-lg sm:text-xl font-semibold mb-4">
|
|
222
|
+
{{ isEditMode() ? 'Edit Role' : 'New Role' }}
|
|
223
|
+
</h3>
|
|
246
224
|
|
|
247
|
-
<form (ngSubmit)="onSubmit()">
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
placeholder="Enter role name" />
|
|
258
|
-
</div>
|
|
225
|
+
<form (ngSubmit)="onSubmit()" class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
226
|
+
<!-- Name -->
|
|
227
|
+
<div class="flex flex-col gap-2">
|
|
228
|
+
<label for="name" class="font-medium">Name *</label>
|
|
229
|
+
<input
|
|
230
|
+
pInputText
|
|
231
|
+
id="name"
|
|
232
|
+
[formField]="roleForm.name"
|
|
233
|
+
placeholder="Enter role name" />
|
|
234
|
+
</div>
|
|
259
235
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
</div>
|
|
236
|
+
<!-- Description -->
|
|
237
|
+
<div class="flex flex-col gap-2">
|
|
238
|
+
<label for="description" class="font-medium">Description</label>
|
|
239
|
+
<input
|
|
240
|
+
pInputText
|
|
241
|
+
id="description"
|
|
242
|
+
[formField]="roleForm.description"
|
|
243
|
+
placeholder="Enter description" />
|
|
244
|
+
</div>
|
|
270
245
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
</div>
|
|
246
|
+
<!-- Order -->
|
|
247
|
+
<div class="flex flex-col gap-2">
|
|
248
|
+
<label for="serial" class="font-medium">Display Order</label>
|
|
249
|
+
<input
|
|
250
|
+
pInputText
|
|
251
|
+
id="serial"
|
|
252
|
+
type="number"
|
|
253
|
+
[formField]="roleForm.serial"
|
|
254
|
+
placeholder="Enter display order" />
|
|
255
|
+
</div>
|
|
282
256
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
</label>
|
|
291
|
-
</div>
|
|
257
|
+
<!-- Is Active -->
|
|
258
|
+
<div class="flex items-end gap-2 pb-1">
|
|
259
|
+
<p-checkbox
|
|
260
|
+
[formField]="roleForm.isActive"
|
|
261
|
+
[binary]="true"
|
|
262
|
+
inputId="isActive" />
|
|
263
|
+
<label for="isActive">Active</label>
|
|
292
264
|
</div>
|
|
293
265
|
|
|
294
266
|
<!-- Actions -->
|
|
295
|
-
<div class="flex justify-end gap-2
|
|
267
|
+
<div class="flex justify-end gap-2 md:col-span-2 pt-4">
|
|
296
268
|
<p-button
|
|
297
269
|
label="Cancel"
|
|
298
270
|
severity="secondary"
|
|
@@ -308,7 +280,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
308
280
|
</div>
|
|
309
281
|
`,
|
|
310
282
|
}]
|
|
311
|
-
}] });
|
|
283
|
+
}], ctorParameters: () => [] });
|
|
312
284
|
|
|
313
285
|
export { RoleFormPageComponent };
|
|
314
|
-
//# sourceMappingURL=flusys-ng-iam-role-form-page.component-
|
|
286
|
+
//# sourceMappingURL=flusys-ng-iam-role-form-page.component-ByNueI1a.mjs.map
|