@ieeesa-npm/tenants 0.2.2 → 0.2.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.
@@ -6,3 +6,6 @@ export declare const TenantsValidationPatterns: {
6
6
  url: RegExp;
7
7
  alphaNumeric: RegExp;
8
8
  };
9
+ export declare const RolesValidation: {
10
+ roleNameMaxLength: number;
11
+ };
@@ -0,0 +1,85 @@
1
+ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import { FormGroup } from '@angular/forms';
4
+ import { AlignType, DynamicFormComponent, FormGrid, FormModel, SelectOption } from '@ieeesa-npm/presentation';
5
+ import { TenantApplicationsService } from '../../services/tenant-applications.service';
6
+ import { SharedService } from '@ieeesa-npm/shared';
7
+ import { TenantFunctionType } from '../../models/tenant-function-type.model';
8
+ import { TenantBasicInfo } from '../../models/tenant.model';
9
+ import { CreateRoleRequestPayload } from '../../models/roles-and-permissions.model';
10
+ import * as i0 from "@angular/core";
11
+ export declare class CreateModifyRoleComponent implements OnInit, OnDestroy {
12
+ private tenantAppService;
13
+ private sharedService;
14
+ destroy$: Subject<boolean>;
15
+ constants: any;
16
+ createRoleTexts: any;
17
+ leftButtonLabel: any;
18
+ rightButtonLabel: any;
19
+ colWidth: FormGrid;
20
+ createRoleFormGroup: FormModel;
21
+ createRoleFormGroupRef: FormGroup;
22
+ actionButtonAlign: AlignType;
23
+ dynamicFormComponent: DynamicFormComponent;
24
+ submitFormResponse: EventEmitter<any>;
25
+ formCancel: EventEmitter<any>;
26
+ tenantFunctionType: TenantFunctionType;
27
+ selectedTenantInfo: TenantBasicInfo | undefined;
28
+ createRolePayload: CreateRoleRequestPayload;
29
+ roleTypeOptions: SelectOption[];
30
+ constructor(tenantAppService: TenantApplicationsService, sharedService: SharedService);
31
+ ngOnInit(): void;
32
+ /**
33
+ * Gets the role types and updates the form control.
34
+ * @memberof CreateRoleComponent
35
+ */
36
+ getRoleTypes(): void;
37
+ /**
38
+ * Initialize the create role form group array.
39
+ * @memberof CreateRoleComponent
40
+ */
41
+ initializeCreateRoleFormGroup(): void;
42
+ /**
43
+ * Gets create role form group reference.
44
+ * @param {FormGroup[]} form
45
+ * @memberof CreateRoleComponent
46
+ */
47
+ getCreateRoleFormGroupRef(form: FormGroup[]): void;
48
+ /**
49
+ * Updates createRoleFormGroupRef on add role form change event.
50
+ * @param {FormGroup[]} form
51
+ * @memberof CreateRoleComponent
52
+ */
53
+ onCreateRoleFormChange(form: FormGroup[]): void;
54
+ /**
55
+ * Creates a new role on form submission and the form is valid.
56
+ * @param {FormGroup[]} form
57
+ * @memberof CreateRoleComponent
58
+ */
59
+ onCreateRoleFormSubmit(form: FormGroup[]): void;
60
+ /**
61
+ * Constructs create role payload from the form data and returns.
62
+ * @param {*} formData
63
+ * @return {CreateRoleRequestPayload}
64
+ * @memberof CreateRoleComponent
65
+ */
66
+ getCreateRolePayload(formData: any): CreateRoleRequestPayload;
67
+ /**
68
+ * Post the creates new role form data to the server on form submission to create a new role.
69
+ * * @param {CreateRoleRequestPayload} createRolePayload
70
+ * @memberof CreateRoleComponent
71
+ */
72
+ createRole(): void;
73
+ /**
74
+ * Emits form cancel event.
75
+ * @memberof CreateRoleComponent
76
+ */
77
+ onFormCancel(): void;
78
+ /**
79
+ * Implementation of ngOnDestroy lifecycle hook method to unsubscribe the open observable subscriptions.
80
+ * @memberof CreateRoleComponent
81
+ */
82
+ ngOnDestroy(): void;
83
+ static ɵfac: i0.ɵɵFactoryDeclaration<CreateModifyRoleComponent, never>;
84
+ static ɵcmp: i0.ɵɵComponentDeclaration<CreateModifyRoleComponent, "ieeesa-create-modify-role", never, {}, { "submitFormResponse": "submitFormResponse"; "formCancel": "formCancel"; }, never, never, true, never>;
85
+ }
@@ -127,6 +127,51 @@ export declare class TenantBasicDetailsComponent implements OnDestroy {
127
127
  addApplicationLabel: string;
128
128
  };
129
129
  };
130
+ createRole: {
131
+ heading: string;
132
+ label: {
133
+ leftButtonLabel: string;
134
+ rightButtonLabel: string;
135
+ appTitle: string;
136
+ roleType: string;
137
+ roleName: string;
138
+ ariaLabel: {
139
+ appTitle: string;
140
+ roleType: string;
141
+ roleName: string;
142
+ };
143
+ ariaDescribedById: {
144
+ appTitle: string;
145
+ roleType: string;
146
+ roleName: string;
147
+ };
148
+ };
149
+ message: {
150
+ error: {
151
+ required: string;
152
+ limit: {
153
+ roleNameMaxChars: string;
154
+ };
155
+ };
156
+ success: {
157
+ submission1: string;
158
+ submission2: string;
159
+ submission3: string;
160
+ };
161
+ };
162
+ supportText: {
163
+ roleType: string;
164
+ roleName: string;
165
+ };
166
+ errors: {
167
+ "3012": string;
168
+ "3013": string;
169
+ "3014": string;
170
+ "3015": string;
171
+ "3016": string;
172
+ "3011": string;
173
+ };
174
+ };
130
175
  editTenant: {
131
176
  message: {
132
177
  success: {
@@ -7,9 +7,10 @@ import { TenantsPermissions, UserPermission } from '../../models/tenants-permiss
7
7
  import { SharedService } from '@ieeesa-npm/shared';
8
8
  import { TenantsRoutesConfig } from '../../models/route-config.model';
9
9
  import { TenantBasicInfo } from '../../models/tenant.model';
10
+ import { TenantFunctionType } from '../../models/tenant-function-type.model';
10
11
  import { PageEvent } from '@angular/material/paginator';
11
12
  import { MatDialog } from '@angular/material/dialog';
12
- import { GetRolesAndPermissionsPayload, RolesAndPermissions, PaginationInfo, RoleInfo } from '../../models/roles-and-permissions.model';
13
+ import { GetRolesAndPermissionsPayload, RolesAndPermissions, PaginationInfo, RoleDetails } from '../../models/roles-and-permissions.model';
13
14
  import { PermissionType } from '../../models/permission-type.model';
14
15
  import * as i0 from "@angular/core";
15
16
  export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
@@ -59,8 +60,10 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
59
60
  alignmentType: typeof AlignType;
60
61
  userTenantsPermissions: TenantsPermissions[];
61
62
  permissionType: typeof PermissionType;
63
+ functionType: TenantFunctionType;
64
+ createRoleScreenTexts: any;
62
65
  roleMenuElement: HTMLElement;
63
- selectedRoleInfo: RoleInfo;
66
+ selectedRoleInfo: RoleDetails;
64
67
  constructor(dialog: MatDialog, breakpointObserverService: BreakpointObserverService, tenantAppService: TenantApplicationsService, globalErrorHandlerService: GlobalErrorHandlerService, sharedService: SharedService);
65
68
  /**
66
69
  * Initializes view tenant details component.
@@ -108,6 +111,7 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
108
111
  * @memberof ViewTenantDetailsComponent
109
112
  */
110
113
  trackByAccordionFn(index: number, item: AccordionInfo): number;
114
+ openCreateRoleForm(): void;
111
115
  /**
112
116
  * Sets the dialog options for edit tenant modal and calls openModal method.
113
117
  * @return -returns nothing
@@ -0,0 +1,27 @@
1
+ export interface RoleType {
2
+ roleTypeName: string;
3
+ viewOrder: number;
4
+ }
5
+ export interface RoleTypeConfiguration {
6
+ configFieldId: string;
7
+ configFieldValue: RoleType;
8
+ }
9
+ export interface RoleTypeResponse {
10
+ status: boolean;
11
+ message: string;
12
+ body: RoleTypeConfiguration[] | null | {
13
+ errorCodes: string[];
14
+ };
15
+ }
16
+ export interface RoleTypeOption {
17
+ id: string | number;
18
+ name: string;
19
+ order: number;
20
+ }
21
+ export interface RoleTypePayload {
22
+ appId: string;
23
+ configFieldName: string;
24
+ }
25
+ export interface GetRoleTypesPayload {
26
+ payload: RoleTypePayload;
27
+ }
@@ -23,14 +23,14 @@ export interface PaginationInfo {
23
23
  export interface GetRolesAndPermissionsPayload {
24
24
  payload: PaginationInfo;
25
25
  }
26
- export interface RoleInfo {
26
+ export interface RoleDetails {
27
27
  roleId: string;
28
28
  roleName: string;
29
29
  }
30
30
  export interface RolesAndPermissionsMapping {
31
31
  permissionId: string;
32
32
  permissionName: string;
33
- roleList: RoleInfo[];
33
+ roleList: RoleDetails[];
34
34
  }
35
35
  export interface GetRolesAndPermissionsResponse {
36
36
  status: boolean;
@@ -42,6 +42,23 @@ export interface GetRolesAndPermissionsResponse {
42
42
  };
43
43
  };
44
44
  }
45
+ export interface RoleInfo {
46
+ roleType: string;
47
+ roleName: string;
48
+ }
49
+ export interface CreateRoleInfo extends RoleInfo {
50
+ appId: string;
51
+ }
52
+ export interface CreateRoleRequestPayload {
53
+ payload: CreateRoleInfo;
54
+ }
55
+ export interface CreateRoleResponse {
56
+ status: boolean;
57
+ message: string;
58
+ body?: string | null | {
59
+ errorCodes: string[];
60
+ };
61
+ }
45
62
  export interface DeleteRoleRequestPayload {
46
63
  payload: {
47
64
  roleId: string;
@@ -1,4 +1,6 @@
1
1
  export declare enum TenantFunctionType {
2
2
  CREATE = "CREATE",
3
- EDIT = "EDIT"
3
+ EDIT = "EDIT",
4
+ CREATE_ROLE = "CREATE_ROLE",
5
+ EDIT_ROLE = "EDIT_ROLE"
4
6
  }
@@ -10,8 +10,9 @@ import { FeatureId, Features, GetFeaturesResponse } from '../models/features.mod
10
10
  import { AppTypeConfig, GetAppTypesResponse } from '../models/app-type-config.model';
11
11
  import { TenantPermissionsService } from './tenant-permissions.service';
12
12
  import { TenantFunctionType } from '../models/tenant-function-type.model';
13
- import { DeleteRoleRequestPayload, DeleteRoleResponse, GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse, Role } from '../models/roles-and-permissions.model';
13
+ import { CreateRoleResponse, GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse, RoleInfo, CreateRoleRequestPayload, DeleteRoleRequestPayload, DeleteRoleResponse, Role } from '../models/roles-and-permissions.model';
14
14
  import { UpdateTenantStatusRequestPayload, UpdateTenantStatusResponse } from '../models/update-tenant-status.model';
15
+ import { GetRoleTypesPayload, RoleTypeConfiguration, RoleTypeOption, RoleTypeResponse } from '../models/role-type.model';
15
16
  import * as i0 from "@angular/core";
16
17
  export declare class TenantApplicationsService {
17
18
  private httpService;
@@ -45,6 +46,11 @@ export declare class TenantApplicationsService {
45
46
  "2036": string;
46
47
  "2037": string;
47
48
  "2038": string;
49
+ /**
50
+ * Sets the user tenants information
51
+ * @param {TenantBasicInfo} tenantInfo
52
+ * @memberof TenantApplicationsService
53
+ */
48
54
  "2039": string;
49
55
  "2040": string;
50
56
  "2041": string;
@@ -66,6 +72,8 @@ export declare class TenantApplicationsService {
66
72
  checkBoxOptions: CheckboxOption[];
67
73
  appTypeInfo: RadioOption[];
68
74
  featureList: Features[];
75
+ roleTypeOptions: RoleTypeOption[];
76
+ newlyCreatedRole: RoleInfo;
69
77
  constructor(httpService: HttpService, tenantPermissionsService: TenantPermissionsService, tenantPermissionsMapService: TenantPermissionsMapService);
70
78
  setAppConfig(apiBaseUrl: string, userPermission: UserPermission[]): void;
71
79
  /**
@@ -158,6 +166,27 @@ export declare class TenantApplicationsService {
158
166
  * @memberof TenantApplicationsService
159
167
  */
160
168
  getApplicationTypes(): Observable<GetAppTypesResponse>;
169
+ /**
170
+ * Posts create role form data to server using HttpService to create a new role.
171
+ * @param {CreateRoleRequestPayload} createRolePayload
172
+ * @return {Observable<CreateRoleResponse>}
173
+ * @memberof TenantApplicationsService
174
+ */
175
+ createRole(createRolePayload: CreateRoleRequestPayload): Observable<CreateRoleResponse>;
176
+ /**
177
+ * Gets list of role types from server using HttpService.
178
+ * @param {GetRoleTypesPayload} payload
179
+ * @return {Observable<RoleTypeResponse>}
180
+ * @memberof TenantApplicationsService
181
+ */
182
+ getRoleTypes(payload: GetRoleTypesPayload): Observable<RoleTypeResponse>;
183
+ /**
184
+ * Constructs the select/dropdown options from the role types received from server.
185
+ * @param {RoleTypeConfiguration[]} roleTypeResponse
186
+ * @return {RoleTypeOption[]}
187
+ * @memberof TenantApplicationsService
188
+ */
189
+ getRoleTypeOptions(roleTypeResponse: RoleTypeConfiguration[]): RoleTypeOption[];
161
190
  /**
162
191
  * Posts tenant application form data to server using HttpService for creating new tenant application.
163
192
  * @param {CreateTenantPayload} createTenantPayload
@@ -202,6 +231,16 @@ export declare class TenantApplicationsService {
202
231
  * @return {TenantFunctionType} -tenant function type.
203
232
  */
204
233
  getTenantFunctionType(): TenantFunctionType;
234
+ /**
235
+ * Stores the newly created role information.
236
+ * @param {RoleInfo} newlyCreatedRole -create role information.
237
+ */
238
+ setNewlyCreatedRoleInfo(newlyCreatedRole: RoleInfo): void;
239
+ /**
240
+ * Returns the newly created role information.
241
+ * @return {RoleInfo} -create role information.
242
+ */
243
+ getNewlyCreatedRoleInfo(): RoleInfo;
205
244
  /**
206
245
  * Posts the edited tenant application form data to server using HttpService for updating the tenant information.
207
246
  * @param {CreateTenantPayload} editTenantPayload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/tenants",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"
package/public-api.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './lib/components/view-tenant-details/view-tenant-details.componen
3
3
  export * from './lib/components/create-tenant-application/create-tenant-application.component';
4
4
  export * from './lib/tenant-applications.component';
5
5
  export * from './lib/components/tenant-basic-details/tenant-basic-details.component';
6
+ export * from './lib/components/create-modify-role/create-modify-role.component';
6
7
  export * from './lib/models/app-type-config.model';
7
8
  export * from './lib/models/app-type.model';
8
9
  export * from './lib/models/tenant.model';
@@ -15,6 +16,7 @@ export * from './lib/models/table-column-schema-view-tenant-list.model';
15
16
  export * from './lib/models/roles-and-permissions.model';
16
17
  export * from './lib/models/update-tenant-status.model';
17
18
  export * from './lib/models/tenant-function-type.model';
19
+ export * from './lib/models/role-type.model';
18
20
  export * from './lib/models/role-menu-action.model';
19
21
  export * from './lib/services/tenant-applications.service';
20
22
  export * from './lib/services/tenant-permissions-map.service';