@ieeesa-npm/tenants 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,13 +174,18 @@ export declare class TenantBasicDetailsComponent implements OnDestroy {
174
174
  ariaLabel: {
175
175
  alert: string;
176
176
  };
177
+ deleteRoleConfirmationMessage: string;
178
+ deleteRolePromptMessage: string;
177
179
  };
178
180
  errors: {
179
181
  "2050": string;
180
182
  "2051": string;
181
183
  "2054": string;
182
184
  "3007": string;
185
+ "3008": string;
183
186
  "3009": string;
187
+ "3010": string;
188
+ "3011": string;
184
189
  };
185
190
  tenantAccordionInfo: {
186
191
  id: number;
@@ -229,6 +234,13 @@ export declare class TenantBasicDetailsComponent implements OnDestroy {
229
234
  isToolTipNeeded: boolean;
230
235
  }[];
231
236
  };
237
+ deleteRole: {
238
+ message: {
239
+ success: {
240
+ submission: string;
241
+ };
242
+ };
243
+ };
232
244
  routeConfigPath: {
233
245
  viewTenants: string;
234
246
  viewTenantDetails: string;
@@ -1,6 +1,6 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { BreakpointObserverService, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
3
- import { AccordionInfo, Menu, PaginatorConfig, TableActions, AlignType, RadioOption, IconButton, SlideToggleOption, TableColumnSchema, AccordionDetails } from '@ieeesa-npm/presentation';
3
+ import { AccordionInfo, Menu, PaginatorConfig, TableActions, AlignType, RadioOption, IconButton, SlideToggleOption, TableColumnSchema, AccordionDetails, TableColumnMenuInfo } from '@ieeesa-npm/presentation';
4
4
  import { Subject } from 'rxjs';
5
5
  import { TenantApplicationsService } from '../../services/tenant-applications.service';
6
6
  import { TenantsPermissions, UserPermission } from '../../models/tenants-permission.model';
@@ -9,7 +9,7 @@ import { TenantsRoutesConfig } from '../../models/route-config.model';
9
9
  import { TenantBasicInfo } from '../../models/tenant.model';
10
10
  import { PageEvent } from '@angular/material/paginator';
11
11
  import { MatDialog } from '@angular/material/dialog';
12
- import { GetRolesAndPermissionsPayload, RolesAndPermissions } from '../../models/roles-and-permissions.model';
12
+ import { GetRolesAndPermissionsPayload, RolesAndPermissions, PaginationInfo, RoleInfo } from '../../models/roles-and-permissions.model';
13
13
  import { PermissionType } from '../../models/permission-type.model';
14
14
  import * as i0 from "@angular/core";
15
15
  export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
@@ -45,6 +45,9 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
45
45
  tableData: RolesAndPermissions[];
46
46
  isRolesAndPermissionsExpanded: boolean;
47
47
  paginatorConfig: PaginatorConfig;
48
+ tablePagination: PaginationInfo;
49
+ rolesAndPermissionsClassName: string;
50
+ headerElementClassName: string;
48
51
  tableActions: TableActions;
49
52
  viewTenantsRouteUrl: string;
50
53
  dialogRef: any;
@@ -52,9 +55,12 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
52
55
  appTypeOptions: RadioOption[];
53
56
  isBasicDetailsExpanded: boolean;
54
57
  editTenantScreenTexts: any;
58
+ deleteRoleScreenTexts: any;
55
59
  alignmentType: typeof AlignType;
56
60
  userTenantsPermissions: TenantsPermissions[];
57
61
  permissionType: typeof PermissionType;
62
+ roleMenuElement: HTMLElement;
63
+ selectedRoleInfo: RoleInfo;
58
64
  constructor(dialog: MatDialog, breakpointObserverService: BreakpointObserverService, tenantAppService: TenantApplicationsService, globalErrorHandlerService: GlobalErrorHandlerService, sharedService: SharedService);
59
65
  /**
60
66
  * Initializes view tenant details component.
@@ -91,6 +97,12 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
91
97
  * @memberof ViewTenantDetailsComponent
92
98
  */
93
99
  onTablePaginationChange(pageEvent: PageEvent): void;
100
+ /**
101
+ * Captures the selected role's information and performs edit or delete action basis on the selected menu item.
102
+ * @param {TableColumnMenuInfo} roleMenuInfo
103
+ * @memberof ViewTenantDetailsComponent
104
+ */
105
+ onRoleMenuClick(roleMenuInfo: TableColumnMenuInfo): void;
94
106
  /**
95
107
  * Keeps track of the accordion based on the element's ID in DOM tree.
96
108
  * @memberof ViewTenantDetailsComponent
@@ -140,12 +152,28 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
140
152
  */
141
153
  getApplicationTypes(): void;
142
154
  /**
143
- * Validates permission based access for provided feature.
144
- * @param {PermissionType} permissionType
145
- * @return {boolean}
146
- * @memberof ViewTenantDetailsComponent
147
- */
155
+ * Validates permission based access for provided feature.
156
+ * @param {PermissionType} permissionType
157
+ * @return {boolean}
158
+ * @memberof ViewTenantDetailsComponent
159
+ */
148
160
  validateAccess(permissionType: PermissionType): boolean;
161
+ /**
162
+ * Posts the details of the role to be deleted to the server using http request and display success/error message based on request response (success or failure).
163
+ * @memberof ViewTenantDetailsComponent
164
+ */
165
+ deleteRole(): void;
166
+ /**
167
+ * Sets the role menu HTMLElement.
168
+ * @param {HTMLElement} menuButton
169
+ * @memberof ViewTenantDetailsComponent
170
+ */
171
+ selectedRoleMenuElement(menuButton: HTMLElement): void;
172
+ /**
173
+ * Opens the confirmation modal to get user confirmation to delete the role.
174
+ * @memberof ViewTenantDetailsComponent
175
+ */
176
+ openDeleteRoleModal(): void;
149
177
  /**
150
178
  * Performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
151
179
  * @memberof ViewTenantDetailsComponent
@@ -0,0 +1,4 @@
1
+ export declare enum RoleMenuAction {
2
+ EDIT_ROLE = 1,
3
+ DELETE_ROLE = 2
4
+ }
@@ -5,6 +5,9 @@ export interface RolesAndPermissions {
5
5
  export interface Role {
6
6
  roleId: string;
7
7
  roleName: string;
8
+ roleType: string;
9
+ roleTypeName: string;
10
+ viewOrder: number;
8
11
  }
9
12
  export interface GetRolesResponse {
10
13
  status: boolean;
@@ -13,16 +16,21 @@ export interface GetRolesResponse {
13
16
  errorCodes: string[];
14
17
  };
15
18
  }
19
+ export interface PaginationInfo {
20
+ offset: number;
21
+ pageSize: number;
22
+ }
16
23
  export interface GetRolesAndPermissionsPayload {
17
- payload: {
18
- offset: number;
19
- pageSize: number;
20
- };
24
+ payload: PaginationInfo;
25
+ }
26
+ export interface RoleInfo {
27
+ roleId: string;
28
+ roleName: string;
21
29
  }
22
30
  export interface RolesAndPermissionsMapping {
23
31
  permissionId: string;
24
32
  permissionName: string;
25
- roleList: Role[];
33
+ roleList: RoleInfo[];
26
34
  }
27
35
  export interface GetRolesAndPermissionsResponse {
28
36
  status: boolean;
@@ -34,3 +42,16 @@ export interface GetRolesAndPermissionsResponse {
34
42
  };
35
43
  };
36
44
  }
45
+ export interface DeleteRoleRequestPayload {
46
+ payload: {
47
+ roleId: string;
48
+ appId: string;
49
+ };
50
+ }
51
+ export interface DeleteRoleResponse {
52
+ status: boolean;
53
+ message: string;
54
+ body?: string | null | {
55
+ errorCodes: string[];
56
+ };
57
+ }
@@ -10,7 +10,7 @@ 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 { GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse } from '../models/roles-and-permissions.model';
13
+ import { DeleteRoleRequestPayload, DeleteRoleResponse, GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse, Role } from '../models/roles-and-permissions.model';
14
14
  import { UpdateTenantStatusRequestPayload, UpdateTenantStatusResponse } from '../models/update-tenant-status.model';
15
15
  import * as i0 from "@angular/core";
16
16
  export declare class TenantApplicationsService {
@@ -22,7 +22,10 @@ export declare class TenantApplicationsService {
22
22
  "2051": string;
23
23
  "2054": string;
24
24
  "3007": string;
25
+ "3008": string;
25
26
  "3009": string;
27
+ "3010": string;
28
+ "3011": string;
26
29
  };
27
30
  apiBaseUrl: string;
28
31
  userPermission: UserPermission[];
@@ -41,11 +44,6 @@ export declare class TenantApplicationsService {
41
44
  "2035": string;
42
45
  "2036": string;
43
46
  "2037": string;
44
- /**
45
- * Returns the tenants information
46
- * @return {TenantBasicInfo}
47
- * @memberof TenantApplicationsService
48
- */
49
47
  "2038": string;
50
48
  "2039": string;
51
49
  "2040": string;
@@ -225,6 +223,20 @@ export declare class TenantApplicationsService {
225
223
  * @memberof TenantApplicationsService
226
224
  */
227
225
  getFeaturesList(features: CheckboxOption[]): Features[];
226
+ /**
227
+ * Returns sorted role list data.
228
+ * @param {Role[]} roleList
229
+ * @return {Role[]}
230
+ * @memberof TenantApplicationsService
231
+ */
232
+ sortRolesByRoleType(roleList: Role[]): Role[];
233
+ /**
234
+ * Posts the role details to server using HttpService for deleting the role.
235
+ * @param {DeleteRoleRequestPayload} deleteRoleRequestPayload
236
+ * @return {Observable<DeleteRoleResponse>}
237
+ * @memberof TenantApplicationsService
238
+ */
239
+ deleteRole(deleteRolePayload: DeleteRoleRequestPayload): Observable<DeleteRoleResponse>;
228
240
  static ɵfac: i0.ɵɵFactoryDeclaration<TenantApplicationsService, never>;
229
241
  static ɵprov: i0.ɵɵInjectableDeclaration<TenantApplicationsService>;
230
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/tenants",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"
package/public-api.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from './lib/models/table-column-schema-view-tenant-list.model';
15
15
  export * from './lib/models/roles-and-permissions.model';
16
16
  export * from './lib/models/update-tenant-status.model';
17
17
  export * from './lib/models/tenant-function-type.model';
18
+ export * from './lib/models/role-menu-action.model';
18
19
  export * from './lib/services/tenant-applications.service';
19
20
  export * from './lib/services/tenant-permissions-map.service';
20
21
  export * from './lib/services/tenant-permissions.service';