@ieeesa-npm/tenants 0.4.2 → 0.4.4
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/.eslintrc.json +31 -0
- package/ng-package.json +8 -0
- package/package.json +12 -25
- package/src/lib/assets/constants.json +454 -0
- package/src/lib/assets/tenant-validations.ts +18 -0
- package/src/lib/assets/tenants-mock.ts +1240 -0
- package/src/lib/components/create-modify-group-type/create-modify-group-type.component.html +15 -0
- package/src/lib/components/create-modify-group-type/create-modify-group-type.component.scss +44 -0
- package/src/lib/components/create-modify-group-type/create-modify-group-type.component.spec.ts +574 -0
- package/src/lib/components/create-modify-group-type/create-modify-group-type.component.ts +602 -0
- package/src/lib/components/create-modify-role/create-modify-role.component.html +15 -0
- package/src/lib/components/create-modify-role/create-modify-role.component.scss +83 -0
- package/src/lib/components/create-modify-role/create-modify-role.component.spec.ts +346 -0
- package/src/lib/components/create-modify-role/create-modify-role.component.ts +321 -0
- package/src/lib/components/create-tenant-application/create-tenant-application.component.html +18 -0
- package/src/lib/components/create-tenant-application/create-tenant-application.component.scss +73 -0
- package/src/lib/components/create-tenant-application/create-tenant-application.component.spec.ts +775 -0
- package/src/lib/components/create-tenant-application/create-tenant-application.component.ts +638 -0
- package/src/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.html +22 -0
- package/src/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.scss +79 -0
- package/src/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.spec.ts +716 -0
- package/src/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.ts +504 -0
- package/src/lib/components/tenant-basic-details/tenant-basic-details.component.html +44 -0
- package/src/lib/components/tenant-basic-details/tenant-basic-details.component.scss +16 -0
- package/src/lib/components/tenant-basic-details/tenant-basic-details.component.spec.ts +115 -0
- package/src/lib/components/tenant-basic-details/tenant-basic-details.component.ts +109 -0
- package/src/lib/components/view-tenant-details/view-tenant-details.component.html +195 -0
- package/src/lib/components/view-tenant-details/view-tenant-details.component.scss +163 -0
- package/src/lib/components/view-tenant-details/view-tenant-details.component.spec.ts +1221 -0
- package/src/lib/components/view-tenant-details/view-tenant-details.component.ts +876 -0
- package/src/lib/components/view-tenant-group-types/view-tenant-group-types.component.html +10 -0
- package/src/lib/components/view-tenant-group-types/view-tenant-group-types.component.scss +44 -0
- package/src/lib/components/view-tenant-group-types/view-tenant-group-types.component.spec.ts +410 -0
- package/src/lib/components/view-tenant-group-types/view-tenant-group-types.component.ts +219 -0
- package/src/lib/components/view-tenants-list/view-tenants-list.component.html +32 -0
- package/src/lib/components/view-tenants-list/view-tenants-list.component.scss +35 -0
- package/src/lib/components/view-tenants-list/view-tenants-list.component.spec.ts +464 -0
- package/src/lib/components/view-tenants-list/view-tenants-list.component.ts +388 -0
- package/src/lib/models/app-type-config.model.ts +14 -0
- package/src/lib/models/app-type.model.ts +5 -0
- package/src/lib/models/create-group-type-config.model.ts +18 -0
- package/src/lib/models/create-group-type.model.ts +46 -0
- package/src/lib/models/feature-permission-id.model.ts +6 -0
- package/src/lib/models/features.model.ts +15 -0
- package/src/lib/models/form-status.model.ts +5 -0
- package/src/lib/models/permission-type.model.ts +9 -0
- package/src/lib/models/role-menu-action.model.ts +5 -0
- package/src/lib/models/role-type.model.ts +34 -0
- package/src/lib/models/roles-and-permissions-table-type.model.ts +5 -0
- package/src/lib/models/roles-and-permissions.model.ts +113 -0
- package/src/lib/models/route-config.model.ts +4 -0
- package/src/lib/models/table-column-schema-view-tenant-list.model.ts +21 -0
- package/src/lib/models/tenant-function-type.model.ts +10 -0
- package/src/lib/models/tenant.model.ts +47 -0
- package/src/lib/models/tenants-permission.model.ts +9 -0
- package/src/lib/models/update-tenant-status.model.ts +12 -0
- package/src/lib/models/view-tenant-group-types.model.ts +34 -0
- package/src/lib/services/tenant-applications.service.spec.ts +1245 -0
- package/src/lib/services/tenant-applications.service.ts +798 -0
- package/src/lib/services/tenant-permissions-map.service.spec.ts +25 -0
- package/src/lib/services/tenant-permissions-map.service.ts +28 -0
- package/src/lib/services/tenant-permissions.service.spec.ts +62 -0
- package/src/lib/services/tenant-permissions.service.ts +49 -0
- package/src/lib/tenant-applications.component.html +0 -0
- package/src/lib/tenant-applications.component.scss +0 -0
- package/src/lib/tenant-applications.component.spec.ts +28 -0
- package/src/lib/tenant-applications.component.ts +12 -0
- package/src/lib/tenant-applications.module.ts +8 -0
- package/{public-api.d.ts → src/public-api.ts} +40 -30
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/ieeesa-npm-tenants.mjs +0 -5
- package/esm2022/lib/assets/constants.json +0 -390
- package/esm2022/lib/assets/tenant-validations.mjs +0 -13
- package/esm2022/lib/components/create-modify-role/create-modify-role.component.mjs +0 -280
- package/esm2022/lib/components/create-tenant-application/create-tenant-application.component.mjs +0 -512
- package/esm2022/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.mjs +0 -391
- package/esm2022/lib/components/tenant-basic-details/tenant-basic-details.component.mjs +0 -95
- package/esm2022/lib/components/view-tenant-details/view-tenant-details.component.mjs +0 -708
- package/esm2022/lib/components/view-tenant-group-types/view-tenant-group-types.component.mjs +0 -174
- package/esm2022/lib/components/view-tenants-list/view-tenants-list.component.mjs +0 -334
- package/esm2022/lib/models/app-type-config.model.mjs +0 -2
- package/esm2022/lib/models/app-type.model.mjs +0 -7
- package/esm2022/lib/models/feature-permission-id.model.mjs +0 -8
- package/esm2022/lib/models/features.model.mjs +0 -2
- package/esm2022/lib/models/form-status.model.mjs +0 -7
- package/esm2022/lib/models/permission-type.model.mjs +0 -12
- package/esm2022/lib/models/role-menu-action.model.mjs +0 -7
- package/esm2022/lib/models/role-type.model.mjs +0 -2
- package/esm2022/lib/models/roles-and-permissions-table-type.model.mjs +0 -7
- package/esm2022/lib/models/roles-and-permissions.model.mjs +0 -2
- package/esm2022/lib/models/route-config.model.mjs +0 -2
- package/esm2022/lib/models/table-column-schema-view-tenant-list.model.mjs +0 -16
- package/esm2022/lib/models/tenant-function-type.model.mjs +0 -10
- package/esm2022/lib/models/tenant.model.mjs +0 -2
- package/esm2022/lib/models/tenants-permission.model.mjs +0 -2
- package/esm2022/lib/models/update-tenant-status.model.mjs +0 -2
- package/esm2022/lib/models/view-tenant-group-types.model.mjs +0 -9
- package/esm2022/lib/services/tenant-applications.service.mjs +0 -542
- package/esm2022/lib/services/tenant-permissions-map.service.mjs +0 -36
- package/esm2022/lib/services/tenant-permissions.service.mjs +0 -38
- package/esm2022/lib/tenant-applications.component.mjs +0 -14
- package/esm2022/lib/tenant-applications.module.mjs +0 -16
- package/esm2022/public-api.mjs +0 -34
- package/fesm2022/ieeesa-npm-tenants.mjs +0 -3565
- package/fesm2022/ieeesa-npm-tenants.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/assets/tenant-validations.d.ts +0 -11
- package/lib/components/create-modify-role/create-modify-role.component.d.ts +0 -103
- package/lib/components/create-tenant-application/create-tenant-application.component.d.ts +0 -128
- package/lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component.d.ts +0 -106
- package/lib/components/tenant-basic-details/tenant-basic-details.component.d.ts +0 -408
- package/lib/components/view-tenant-details/view-tenant-details.component.d.ts +0 -216
- package/lib/components/view-tenant-group-types/view-tenant-group-types.component.d.ts +0 -58
- package/lib/components/view-tenants-list/view-tenants-list.component.d.ts +0 -134
- package/lib/models/app-type-config.model.d.ts +0 -14
- package/lib/models/app-type.model.d.ts +0 -4
- package/lib/models/feature-permission-id.model.d.ts +0 -4
- package/lib/models/features.model.d.ts +0 -15
- package/lib/models/form-status.model.d.ts +0 -4
- package/lib/models/permission-type.model.d.ts +0 -8
- package/lib/models/role-menu-action.model.d.ts +0 -4
- package/lib/models/role-type.model.d.ts +0 -27
- package/lib/models/roles-and-permissions-table-type.model.d.ts +0 -4
- package/lib/models/roles-and-permissions.model.d.ts +0 -119
- package/lib/models/route-config.model.d.ts +0 -4
- package/lib/models/table-column-schema-view-tenant-list.model.d.ts +0 -20
- package/lib/models/tenant-function-type.model.d.ts +0 -7
- package/lib/models/tenant.model.d.ts +0 -51
- package/lib/models/tenants-permission.model.d.ts +0 -9
- package/lib/models/update-tenant-status.model.d.ts +0 -14
- package/lib/models/view-tenant-group-types.model.d.ts +0 -27
- package/lib/services/tenant-applications.service.d.ts +0 -357
- package/lib/services/tenant-permissions-map.service.d.ts +0 -13
- package/lib/services/tenant-permissions.service.d.ts +0 -22
- package/lib/tenant-applications.component.d.ts +0 -5
- package/lib/tenant-applications.module.d.ts +0 -6
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
Component,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
Input,
|
|
6
|
+
OnDestroy,
|
|
7
|
+
OnInit,
|
|
8
|
+
Output,
|
|
9
|
+
ViewEncapsulation,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import {
|
|
12
|
+
DataTableComponent,
|
|
13
|
+
ModalComponent,
|
|
14
|
+
PaginatorConfig,
|
|
15
|
+
TableActions,
|
|
16
|
+
TableColumnSchema,
|
|
17
|
+
TableColumnSortDirection,
|
|
18
|
+
TableColumnType,
|
|
19
|
+
} from '@ieeesa-npm/presentation';
|
|
20
|
+
import { Subject, takeUntil } from 'rxjs';
|
|
21
|
+
import * as constants from '../../assets/constants.json';
|
|
22
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
23
|
+
import {
|
|
24
|
+
AlertType,
|
|
25
|
+
AlertsService,
|
|
26
|
+
BreakpointObserverService,
|
|
27
|
+
ModalType,
|
|
28
|
+
} from '@ieeesa-npm/utility';
|
|
29
|
+
import { TenantsRoutesConfig } from '../../models/route-config.model';
|
|
30
|
+
import { SharedService } from '@ieeesa-npm/shared';
|
|
31
|
+
import { TenantApplicationsService } from '../../services/tenant-applications.service';
|
|
32
|
+
import { Router } from '@angular/router';
|
|
33
|
+
import { PageEvent } from '@angular/material/paginator';
|
|
34
|
+
import { Sort } from '@angular/material/sort';
|
|
35
|
+
import {
|
|
36
|
+
TenantStatus,
|
|
37
|
+
PermissionType,
|
|
38
|
+
} from '../../models/permission-type.model';
|
|
39
|
+
import {
|
|
40
|
+
TenantsPermissions,
|
|
41
|
+
UserPermission,
|
|
42
|
+
} from '../../models/tenants-permission.model';
|
|
43
|
+
import {
|
|
44
|
+
ViewTenantsColumnSchemaDef,
|
|
45
|
+
SortOrderBy,
|
|
46
|
+
GetTenantsPayload,
|
|
47
|
+
} from '../../models/table-column-schema-view-tenant-list.model';
|
|
48
|
+
import { MatDialog } from '@angular/material/dialog';
|
|
49
|
+
import { CreateTenantApplicationComponent } from '../create-tenant-application/create-tenant-application.component';
|
|
50
|
+
import { SortConfig, TenantBasicInfo } from '../../models/tenant.model';
|
|
51
|
+
import { Features } from '../../models/features.model';
|
|
52
|
+
import { TenantFunctionType } from '../../models/tenant-function-type.model';
|
|
53
|
+
@Component({
|
|
54
|
+
selector: 'ieeesa-view-tenants-list',
|
|
55
|
+
templateUrl: './view-tenants-list.component.html',
|
|
56
|
+
styleUrls: ['./view-tenants-list.component.scss'],
|
|
57
|
+
standalone: true,
|
|
58
|
+
imports: [CommonModule, MatButtonModule, DataTableComponent],
|
|
59
|
+
encapsulation: ViewEncapsulation.None,
|
|
60
|
+
})
|
|
61
|
+
export class ViewTenantsListComponent implements OnInit, OnDestroy {
|
|
62
|
+
destroy$: Subject<boolean> = new Subject<boolean>();
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
constants: any = constants;
|
|
65
|
+
viewTenantsConstants = this.constants?.viewTenants;
|
|
66
|
+
isMobileView = false;
|
|
67
|
+
@Input() tenantsPageInfo: {
|
|
68
|
+
tenantsTitle: string;
|
|
69
|
+
} = {
|
|
70
|
+
tenantsTitle: '',
|
|
71
|
+
};
|
|
72
|
+
@Input() apiBaseURL = '';
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
@Input() routePaths!: TenantsRoutesConfig;
|
|
75
|
+
@Input() userPermissions!: UserPermission[];
|
|
76
|
+
@Input() defaultSortedColumn: string = ViewTenantsColumnSchemaDef.APP_ID;
|
|
77
|
+
@Output() createTenant = new EventEmitter();
|
|
78
|
+
@Output() viewTenantsDetails: EventEmitter<TenantBasicInfo> =
|
|
79
|
+
new EventEmitter<TenantBasicInfo>();
|
|
80
|
+
tableData!: TenantBasicInfo[];
|
|
81
|
+
columnSchema!: TableColumnSchema[];
|
|
82
|
+
tableActions: TableActions = {
|
|
83
|
+
isPaginationNeeded: true,
|
|
84
|
+
};
|
|
85
|
+
tableColumns = this.viewTenantsConstants?.tableColumns;
|
|
86
|
+
emptyFieldValueReplacedBy =
|
|
87
|
+
this.viewTenantsConstants?.emptyFieldValueReplacedBy;
|
|
88
|
+
paginatorConfig: PaginatorConfig = {
|
|
89
|
+
recordsPerPage: this.viewTenantsConstants?.pageSizeOptions[0],
|
|
90
|
+
pageSizeOptions: this.viewTenantsConstants.pageSizeOptions,
|
|
91
|
+
totalRecords: 0,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
userTenantsPermissions!: TenantsPermissions[];
|
|
95
|
+
permissionType = PermissionType;
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
dialogRef: any;
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
createTenantScreenTexts: any = this.constants?.createTenant;
|
|
100
|
+
defaultColumnSortDirection = true;
|
|
101
|
+
pageEvent!: PageEvent;
|
|
102
|
+
sortConfig!: SortConfig;
|
|
103
|
+
constructor(
|
|
104
|
+
// eslint-disable-next-line no-unused-vars
|
|
105
|
+
public dialog: MatDialog,
|
|
106
|
+
// eslint-disable-next-line no-unused-vars
|
|
107
|
+
public alertService: AlertsService,
|
|
108
|
+
// eslint-disable-next-line no-unused-vars
|
|
109
|
+
private breakpointObserverService: BreakpointObserverService,
|
|
110
|
+
// eslint-disable-next-line no-unused-vars
|
|
111
|
+
private sharedService: SharedService,
|
|
112
|
+
// eslint-disable-next-line no-unused-vars
|
|
113
|
+
private tenantApplicationsService: TenantApplicationsService,
|
|
114
|
+
// eslint-disable-next-line no-unused-vars
|
|
115
|
+
private router: Router
|
|
116
|
+
) {
|
|
117
|
+
this.breakpointObserverService
|
|
118
|
+
.getBreakpoint()
|
|
119
|
+
.pipe(takeUntil(this.destroy$))
|
|
120
|
+
.subscribe((result: { matches: boolean }) => {
|
|
121
|
+
this.isMobileView = result.matches;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sets the user permissions, router config path, base API URL, table column schema and gets the tenants list.
|
|
127
|
+
* @memberof ViewTenantsListComponent
|
|
128
|
+
*/
|
|
129
|
+
ngOnInit(): void {
|
|
130
|
+
this.userTenantsPermissions =
|
|
131
|
+
this.tenantApplicationsService?.filterPermission(this.userPermissions);
|
|
132
|
+
this.tenantApplicationsService?.setAppConfig(
|
|
133
|
+
this.apiBaseURL,
|
|
134
|
+
this.userPermissions
|
|
135
|
+
);
|
|
136
|
+
this.tenantsPageInfo = {
|
|
137
|
+
tenantsTitle: this.viewTenantsConstants?.tenantsTitle,
|
|
138
|
+
};
|
|
139
|
+
this.routePaths = this.routePaths ?? this.constants?.routeConfigPath;
|
|
140
|
+
this.sharedService?.setRoutePaths(this.routePaths);
|
|
141
|
+
this.configureTableInfo();
|
|
142
|
+
this.defaultSortedColumn = this.columnSchema[0].columnDef;
|
|
143
|
+
this.getTenantsAndInitializeTableView(this.getTenantsPayload());
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Validates permission based access for provided feature.
|
|
147
|
+
* @param {PermissionType} permissionType
|
|
148
|
+
* @return {boolean}
|
|
149
|
+
* @memberof ViewTenantsListComponent
|
|
150
|
+
*/
|
|
151
|
+
validateAccess(permissionType: PermissionType): boolean {
|
|
152
|
+
return this.tenantApplicationsService.validateAccess(
|
|
153
|
+
permissionType,
|
|
154
|
+
this.userTenantsPermissions
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Configures table schema to display the tenants in table view.
|
|
159
|
+
* @memberof ViewTenantsListComponent
|
|
160
|
+
*/
|
|
161
|
+
configureTableInfo(): void {
|
|
162
|
+
this.columnSchema = [
|
|
163
|
+
{
|
|
164
|
+
id: 1,
|
|
165
|
+
columnDef: ViewTenantsColumnSchemaDef.APP_ID,
|
|
166
|
+
heading: this.tableColumns?.appId,
|
|
167
|
+
columnType: TableColumnType.LINK,
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
169
|
+
cellData: (element: any) => `${element.appId}`,
|
|
170
|
+
isSortableColumn: true,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 2,
|
|
174
|
+
columnDef: ViewTenantsColumnSchemaDef.APP_TITLE,
|
|
175
|
+
heading: this.tableColumns?.appTitle,
|
|
176
|
+
columnType: TableColumnType.TEXT,
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178
|
+
cellData: (element: any) =>
|
|
179
|
+
`${element.appTitle ?? this.emptyFieldValueReplacedBy}`,
|
|
180
|
+
isSortableColumn: true,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 3,
|
|
184
|
+
columnDef: ViewTenantsColumnSchemaDef.APP_DESCRIPTION,
|
|
185
|
+
heading: this.tableColumns?.appDescription,
|
|
186
|
+
columnType: TableColumnType.TEXT,
|
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
|
+
cellData: (element: any) =>
|
|
189
|
+
`${element.appDescription ?? this.emptyFieldValueReplacedBy}`,
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
{
|
|
193
|
+
id: 4,
|
|
194
|
+
columnDef: ViewTenantsColumnSchemaDef.FEATURES,
|
|
195
|
+
heading: this.tableColumns?.features,
|
|
196
|
+
columnType: TableColumnType.TEXT,
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
198
|
+
cellData: (element: any) =>
|
|
199
|
+
`${
|
|
200
|
+
element?.features && element?.features?.length > 0
|
|
201
|
+
? this.formatFeaturesName(element?.features)
|
|
202
|
+
: this.emptyFieldValueReplacedBy
|
|
203
|
+
}`,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: 5,
|
|
207
|
+
columnDef: ViewTenantsColumnSchemaDef.STATUS,
|
|
208
|
+
heading: this.tableColumns?.status,
|
|
209
|
+
columnType: TableColumnType.TEXT,
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
211
|
+
cellData: (element: any) =>
|
|
212
|
+
`${element.status ? TenantStatus.ACTIVE : TenantStatus.INACTIVE}`,
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Format the features name in to single sentence with comma separated.
|
|
219
|
+
* @memberof ViewTenantsListComponent
|
|
220
|
+
*/
|
|
221
|
+
formatFeaturesName(features: Features[]): string {
|
|
222
|
+
return features
|
|
223
|
+
.map((feature: Features) => {
|
|
224
|
+
// eslint-disable-next-line no-unused-expressions
|
|
225
|
+
return feature.featureName;
|
|
226
|
+
})
|
|
227
|
+
?.join(', ');
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Fetching details of tenants and initialize table view
|
|
231
|
+
* @param {GetTenantsPayload} payload
|
|
232
|
+
* @memberof ViewTenantsListComponent
|
|
233
|
+
*/
|
|
234
|
+
getTenantsAndInitializeTableView(payload: GetTenantsPayload): void {
|
|
235
|
+
this.tenantApplicationsService
|
|
236
|
+
.getTenantsList(payload)
|
|
237
|
+
.pipe(takeUntil(this.destroy$))
|
|
238
|
+
.subscribe({
|
|
239
|
+
next: (response) => {
|
|
240
|
+
this.tableData = response?.body?.appDetails as TenantBasicInfo[];
|
|
241
|
+
this.paginatorConfig.totalRecords = response?.body
|
|
242
|
+
?.totalRecords as number;
|
|
243
|
+
},
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
245
|
+
error: (error: any) => {
|
|
246
|
+
this.sharedService.handleErrors(error, this.constants?.errors);
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Sets the dialog options for create tenant modal and calls openModal method.
|
|
252
|
+
* @return -returns nothing
|
|
253
|
+
* @memberof ViewTenantsListComponent
|
|
254
|
+
*/
|
|
255
|
+
openCreateTenantForm(): void {
|
|
256
|
+
this.tenantApplicationsService.setTenantFunctionType(
|
|
257
|
+
TenantFunctionType.CREATE
|
|
258
|
+
);
|
|
259
|
+
const dialogOptions = {
|
|
260
|
+
heading: this.viewTenantsConstants?.addTenant,
|
|
261
|
+
isCloseNeeded: true,
|
|
262
|
+
componentReference: CreateTenantApplicationComponent,
|
|
263
|
+
modalType: ModalType.FORM,
|
|
264
|
+
};
|
|
265
|
+
this.openModal(dialogOptions, 'ieeesa-create-tenant');
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Opens modal component with received params and handles form submission success and errors.
|
|
269
|
+
* @param {*} dialogOptions
|
|
270
|
+
* @param {string} [className]
|
|
271
|
+
* @return -returns nothing
|
|
272
|
+
* @memberof ViewTenantsListComponent
|
|
273
|
+
*/
|
|
274
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-inferrable-types, no-unused-vars
|
|
275
|
+
openModal(
|
|
276
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
277
|
+
dialogOptions: any,
|
|
278
|
+
className?: string
|
|
279
|
+
): void {
|
|
280
|
+
className = className ?? '';
|
|
281
|
+
this.dialogRef = this.dialog?.open(ModalComponent, {
|
|
282
|
+
data: dialogOptions,
|
|
283
|
+
width: '',
|
|
284
|
+
panelClass: ['ieeesa-modal-dialog', className],
|
|
285
|
+
ariaModal: true,
|
|
286
|
+
});
|
|
287
|
+
this.dialogRef?.componentInstance?.submitFormResponse
|
|
288
|
+
.pipe(takeUntil(this.destroy$))
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, no-unused-vars
|
|
290
|
+
.subscribe((result: any) => {
|
|
291
|
+
this.dialogRef?.close();
|
|
292
|
+
const appTitle =
|
|
293
|
+
this.tenantApplicationsService.getNewTenantInfo?.appTitle;
|
|
294
|
+
this.sharedService.showAlertMessage(
|
|
295
|
+
AlertType?.SUCCESS,
|
|
296
|
+
`${appTitle} ${this.createTenantScreenTexts?.message?.success?.submission}`
|
|
297
|
+
);
|
|
298
|
+
this.getTenantsAndInitializeTableView(this.getTenantsPayload());
|
|
299
|
+
});
|
|
300
|
+
this.dialogRef?.componentInstance?.formCancel
|
|
301
|
+
.pipe(takeUntil(this.destroy$))
|
|
302
|
+
.subscribe(() => {
|
|
303
|
+
this.dialogRef?.close();
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Sorts the tenants by application id or title in ascending or descending.
|
|
308
|
+
* @param {Sort} sort
|
|
309
|
+
* @memberof ViewTenantsListComponent
|
|
310
|
+
*/
|
|
311
|
+
onSortTenants(sort: Sort): void {
|
|
312
|
+
this.defaultSortedColumn = sort.active;
|
|
313
|
+
this.defaultColumnSortDirection =
|
|
314
|
+
sort.direction === TableColumnSortDirection.ASCENDING;
|
|
315
|
+
this.sortConfig = {
|
|
316
|
+
sort: sort,
|
|
317
|
+
isSortedByAscending: this.defaultColumnSortDirection,
|
|
318
|
+
};
|
|
319
|
+
this.getTenantsAndInitializeTableView(this.getTenantsPayload());
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Constructs and returns the payload for fetching the tenants list.
|
|
323
|
+
* @returns GetTenantsPayload
|
|
324
|
+
*/
|
|
325
|
+
getTenantsPayload(): GetTenantsPayload {
|
|
326
|
+
const payload: GetTenantsPayload = {
|
|
327
|
+
payload: {
|
|
328
|
+
offset: this.pageEvent?.pageIndex
|
|
329
|
+
? (this.pageEvent?.pageIndex as number)
|
|
330
|
+
: 0,
|
|
331
|
+
pageSize: this.pageEvent?.pageSize
|
|
332
|
+
? (this.pageEvent?.pageSize as number)
|
|
333
|
+
: this.paginatorConfig?.recordsPerPage,
|
|
334
|
+
sortedBy: this.sortConfig?.sort?.active
|
|
335
|
+
? (this.sortConfig?.sort?.active as string)
|
|
336
|
+
: ViewTenantsColumnSchemaDef.APP_ID,
|
|
337
|
+
sortedOrderBy: this.filterSortedOrderBy(
|
|
338
|
+
this.sortConfig?.isSortedByAscending
|
|
339
|
+
? (this.sortConfig?.isSortedByAscending as boolean)
|
|
340
|
+
: this.defaultColumnSortDirection
|
|
341
|
+
),
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
return payload;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Returning sorting order according to column definition.
|
|
348
|
+
* @param defaultColumnSortDirection
|
|
349
|
+
* @returns SortOrderBy.ASC | SortOrderBy.DESC
|
|
350
|
+
*/
|
|
351
|
+
filterSortedOrderBy(defaultColumnSortDirection: boolean): string {
|
|
352
|
+
return defaultColumnSortDirection ? SortOrderBy.ASC : SortOrderBy.DESC;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Get the the records according to pagination.
|
|
356
|
+
* @param {{
|
|
357
|
+
* pageOffset: number;
|
|
358
|
+
* pageLimit: number;
|
|
359
|
+
* }} pageEvent
|
|
360
|
+
* @memberof ViewTenantsListComponent
|
|
361
|
+
*/
|
|
362
|
+
onTablePaginationChange(pageEvent: PageEvent): void {
|
|
363
|
+
this.pageEvent = pageEvent;
|
|
364
|
+
this.getTenantsAndInitializeTableView(this.getTenantsPayload());
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Navigates to view tenants detail component.
|
|
368
|
+
* @param {{tenantInfo: TenantBasicInfo}}
|
|
369
|
+
* @memberof ViewTenantsListComponent
|
|
370
|
+
*/
|
|
371
|
+
navigateToViewTenantDetails(tenantInfo: TenantBasicInfo): void {
|
|
372
|
+
if (tenantInfo) {
|
|
373
|
+
this.tenantApplicationsService.setSelectedTenantInformation(tenantInfo);
|
|
374
|
+
}
|
|
375
|
+
if (this.routePaths?.viewTenantDetails)
|
|
376
|
+
this.router.navigate([this.routePaths?.viewTenantDetails], {queryParams: {id: tenantInfo?.appId}});
|
|
377
|
+
else this.viewTenantsDetails.emit(tenantInfo);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
|
|
381
|
+
* @memberof ViewTenantsListComponent
|
|
382
|
+
* @return -returns nothing
|
|
383
|
+
*/
|
|
384
|
+
ngOnDestroy(): void {
|
|
385
|
+
this.destroy$.next(true);
|
|
386
|
+
this.destroy$.unsubscribe();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppType } from "./app-type.model";
|
|
2
|
+
|
|
3
|
+
export interface AppTypeConfig {
|
|
4
|
+
configFieldId: string;
|
|
5
|
+
configFieldValue: {
|
|
6
|
+
type: AppType;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface GetAppTypesResponse {
|
|
11
|
+
status: boolean;
|
|
12
|
+
message: string;
|
|
13
|
+
body: AppTypeConfig[] | null | { errorCodes: string[] };
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
export enum Settings {
|
|
3
|
+
ALLOW_SUB_GROUPS = 'Allow Sub-Groups',
|
|
4
|
+
ALLOW_ROSTERS = 'Rosters Enabled',
|
|
5
|
+
ALLOW_ALTERNATE_VOTING = 'Allow Alternate Voting',
|
|
6
|
+
HAS_CLASSIFICATION = 'Has Classification',
|
|
7
|
+
ALLOW_EDIT = 'Allow Edit',
|
|
8
|
+
ALLOW_DELETE = 'Allow Delete',
|
|
9
|
+
}
|
|
10
|
+
/* eslint-disable no-unused-vars */
|
|
11
|
+
export enum VotingMemberLevelRole {
|
|
12
|
+
VOTING_MEMBER_PRINCIPAL = 'Voting Member (Principal)',
|
|
13
|
+
VOTING_MEMBER_ALTERNATE = 'Voting Member (Alternate)',
|
|
14
|
+
}
|
|
15
|
+
export enum RosterTypeLOVCode {
|
|
16
|
+
INDIVIDUAL = 'IND',
|
|
17
|
+
ENTITY = 'EN',
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LOV } from '@ieeesa-npm/shared';
|
|
2
|
+
|
|
3
|
+
export interface GetRosterTypeOrSettingsResponse {
|
|
4
|
+
status: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
body?: LOV[] | null | { errorCodes: string[] };
|
|
7
|
+
}
|
|
8
|
+
export interface ConfigFieldValue {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
businessRule: {
|
|
12
|
+
rosterType: string;
|
|
13
|
+
allowEdit: boolean;
|
|
14
|
+
allowRoster: boolean;
|
|
15
|
+
allowSubGroup: boolean;
|
|
16
|
+
allowAlternateVoting: boolean;
|
|
17
|
+
allowDelete: boolean;
|
|
18
|
+
hasClassification: boolean;
|
|
19
|
+
allowedGroupType: string[];
|
|
20
|
+
isRootGroup: boolean;
|
|
21
|
+
};
|
|
22
|
+
hierarchy?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CreatedOrModifiedGroupTypeInfo {
|
|
25
|
+
appId: string;
|
|
26
|
+
roles: {
|
|
27
|
+
roleId: string;
|
|
28
|
+
}[];
|
|
29
|
+
configFieldName: string;
|
|
30
|
+
configFieldValue: ConfigFieldValue;
|
|
31
|
+
}
|
|
32
|
+
export interface CreateGroupTypeRequestPayload {
|
|
33
|
+
payload: {
|
|
34
|
+
appId: string;
|
|
35
|
+
roles: {
|
|
36
|
+
roleId: string;
|
|
37
|
+
}[];
|
|
38
|
+
configFieldName: string;
|
|
39
|
+
configFieldValue: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface CreateGroupTypeResponse {
|
|
43
|
+
status: boolean;
|
|
44
|
+
message: string;
|
|
45
|
+
body?: string | null | { errorCodes: string[] };
|
|
46
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Features {
|
|
2
|
+
featureId: string;
|
|
3
|
+
featureName: string;
|
|
4
|
+
isDefault: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface FeatureId {
|
|
8
|
+
featureId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface GetFeaturesResponse {
|
|
12
|
+
status: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
body: Features[] | null | { errorCodes: string[] };
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface RoleType {
|
|
2
|
+
roleTypeName: string;
|
|
3
|
+
viewOrder: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface RoleTypeConfiguration {
|
|
7
|
+
configFieldId: string;
|
|
8
|
+
configFieldValue: RoleType;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RoleTypeResponse {
|
|
12
|
+
status: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
body:
|
|
15
|
+
| RoleTypeConfiguration[]
|
|
16
|
+
| null
|
|
17
|
+
| {
|
|
18
|
+
errorCodes: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface RoleTypeOption {
|
|
23
|
+
id: string | number;
|
|
24
|
+
name: string;
|
|
25
|
+
order: number;
|
|
26
|
+
}
|
|
27
|
+
export interface RoleTypePayload {
|
|
28
|
+
appId: string;
|
|
29
|
+
configFieldName: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface GetRoleTypesPayload {
|
|
33
|
+
payload: RoleTypePayload;
|
|
34
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export interface RolesAndPermissions {
|
|
2
|
+
permission: string;
|
|
3
|
+
roleIdsList: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface Role {
|
|
6
|
+
roleId: string;
|
|
7
|
+
roleName: string;
|
|
8
|
+
roleType: string;
|
|
9
|
+
roleTypeName: string;
|
|
10
|
+
viewOrder: number;
|
|
11
|
+
}
|
|
12
|
+
export interface GetRolesResponse {
|
|
13
|
+
status: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
body?: Role[] | null | { errorCodes: string[] };
|
|
16
|
+
}
|
|
17
|
+
export interface PaginationInfo {
|
|
18
|
+
offset: number;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
}
|
|
21
|
+
export interface GetRolesAndPermissionsPayload {
|
|
22
|
+
payload: PaginationInfo;
|
|
23
|
+
}
|
|
24
|
+
export interface RoleDetails {
|
|
25
|
+
roleId: string;
|
|
26
|
+
roleName: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RolesAndPermissionsMapping {
|
|
29
|
+
permissionId: string;
|
|
30
|
+
permissionName: string;
|
|
31
|
+
roleList: RoleDetails[];
|
|
32
|
+
}
|
|
33
|
+
export interface GetRolesAndPermissionsResponse {
|
|
34
|
+
status: boolean;
|
|
35
|
+
message: string;
|
|
36
|
+
body: {
|
|
37
|
+
totalRecords: number;
|
|
38
|
+
rolePermissionDetails:
|
|
39
|
+
| RolesAndPermissionsMapping[]
|
|
40
|
+
| null
|
|
41
|
+
| { errorCodes: string[] };
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface RoleInfo {
|
|
46
|
+
roleType?: string;
|
|
47
|
+
roleName: string;
|
|
48
|
+
roleId?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CreateModifyRoleInfo extends RoleInfo {
|
|
52
|
+
appId: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface CreateModifyRoleRequestPayload {
|
|
56
|
+
payload: CreateModifyRoleInfo;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CreateModifyRoleResponse {
|
|
60
|
+
status: boolean;
|
|
61
|
+
message: string;
|
|
62
|
+
body?: string | null | { errorCodes: string[] };
|
|
63
|
+
}
|
|
64
|
+
export interface DeleteRoleRequestPayload {
|
|
65
|
+
payload: {
|
|
66
|
+
roleId: string;
|
|
67
|
+
appId: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface DeleteRoleResponse {
|
|
71
|
+
status: boolean;
|
|
72
|
+
message: string;
|
|
73
|
+
body?: string | null | { errorCodes: string[] };
|
|
74
|
+
}
|
|
75
|
+
export interface Permission {
|
|
76
|
+
permissionId: string;
|
|
77
|
+
permissionName: string;
|
|
78
|
+
}
|
|
79
|
+
export interface GetPermissionsResponse {
|
|
80
|
+
status: boolean;
|
|
81
|
+
message: string;
|
|
82
|
+
body?: Permission[] | null | { errorCodes: string[] };
|
|
83
|
+
}
|
|
84
|
+
export interface RoleOrPermissionMapping {
|
|
85
|
+
roleOrPermissionName: string;
|
|
86
|
+
roleOrPermissionId: string;
|
|
87
|
+
status: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface MapRolesAndPermissions {
|
|
90
|
+
appId: string;
|
|
91
|
+
permissionId: string | null;
|
|
92
|
+
roleId: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface ModifiedRolesAndPermissionsMapping
|
|
95
|
+
extends MapRolesAndPermissions {
|
|
96
|
+
status: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface RolePermissionMappingRequestPayload {
|
|
99
|
+
payload: MapRolesAndPermissions;
|
|
100
|
+
}
|
|
101
|
+
export interface RolePermissionMappingResponse {
|
|
102
|
+
status: boolean;
|
|
103
|
+
message: string;
|
|
104
|
+
body?: RoleDetails[] | Permission[] | { errorCodes: string[] };
|
|
105
|
+
}
|
|
106
|
+
export interface RolesAndPermissionsRequestPayload {
|
|
107
|
+
payload: ModifiedRolesAndPermissionsMapping[];
|
|
108
|
+
}
|
|
109
|
+
export interface RolesAndPermissionsResponse {
|
|
110
|
+
status: boolean;
|
|
111
|
+
message: string;
|
|
112
|
+
body?: string | { errorCodes: string[] };
|
|
113
|
+
}
|