@ieeesa-npm/tenants 0.1.2 → 0.1.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.
@@ -1,14 +1,18 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { BreakpointObserverService, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
3
- import { AccordionInfo } from '@ieeesa-npm/presentation';
3
+ import { AccordionInfo, Menu, PaginatorConfig, TableActions, AlignType, SlideToggleOption, TableColumnSchema } from '@ieeesa-npm/presentation';
4
4
  import { Subject } from 'rxjs';
5
5
  import { TenantInfo } from '../../models/tenants.model';
6
6
  import { TenantApplicationsService } from '../../services/tenant-applications.service';
7
7
  import { UserPermission } from '../../models/tenants-permission.model';
8
8
  import { SharedService } from '@ieeesa-npm/shared';
9
9
  import { TenantsRoutesConfig } from '../../models/route-config.model';
10
+ import { GetRolesAndPermissionsPayload, RolesAndPermissions } from '../../models/roles-and-permissions.model';
11
+ import { PageEvent } from '@angular/material/paginator';
12
+ import { MatDialog } from '@angular/material/dialog';
10
13
  import * as i0 from "@angular/core";
11
14
  export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
15
+ dialog: MatDialog;
12
16
  private breakpointObserverService;
13
17
  private tenantAppService;
14
18
  globalErrorHandlerService: GlobalErrorHandlerService;
@@ -28,8 +32,22 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
28
32
  };
29
33
  tenantDetails: TenantInfo;
30
34
  accordionInfoList: AccordionInfo[];
35
+ appId: string;
36
+ iconSize: any;
37
+ rolesAndPermissionsTableCaption: any;
38
+ rolesAndPermissionsTableHeaderName: any;
39
+ rolesAndPermissionsTableSupportMessage: any;
40
+ permissionsColumnClassNumber: number;
41
+ menuItems: Menu[];
42
+ columnSchema: TableColumnSchema[];
43
+ tableData: RolesAndPermissions[];
44
+ isRolesAndPermissionsExpanded: boolean;
45
+ paginatorConfig: PaginatorConfig;
46
+ tableActions: TableActions;
31
47
  viewTenantsRouteUrl: string;
32
- constructor(breakpointObserverService: BreakpointObserverService, tenantAppService: TenantApplicationsService, globalErrorHandlerService: GlobalErrorHandlerService, sharedService: SharedService);
48
+ alignmentType: typeof AlignType;
49
+ dialogRef: any;
50
+ constructor(dialog: MatDialog, breakpointObserverService: BreakpointObserverService, tenantAppService: TenantApplicationsService, globalErrorHandlerService: GlobalErrorHandlerService, sharedService: SharedService);
33
51
  /**
34
52
  * Initializes view tenant details component.
35
53
  * @return -returns nothing
@@ -41,11 +59,59 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
41
59
  * @memberof ViewTenantDetailsComponent
42
60
  */
43
61
  getTenantDetails(appId: string): void;
62
+ /**
63
+ * Display the corresponding tenant basic or feature details based on selected accordion.
64
+ * @param {AccordionInfo} accordionInfo
65
+ * @param {boolean} expanded
66
+ * @memberof ViewTenantDetailsComponent
67
+ */
68
+ showTenantDetails(accordionInfo: AccordionInfo, expanded: boolean): void;
69
+ /**
70
+ * Fetches the configured roles of the selected tenant and creates the column schema.
71
+ * @memberof ViewTenantDetailsComponent
72
+ */
73
+ getRolesAndInitializeTableSchema(): void;
74
+ /**
75
+ * Fetches the roles and permissions mappings for the selected tenant and and initialize table view.
76
+ * @param {GetRolesAndPermissionsPayload} payload
77
+ * @memberof ViewTenantDetailsComponent
78
+ */
79
+ getRolesAndPermissionsAndInitializeTableView(payload: GetRolesAndPermissionsPayload): void;
80
+ /**
81
+ * Fetch the roles and permissions records based on offset and page size while the pagination changes.
82
+ * @param {PageEvent} pageEvent
83
+ * @memberof ViewTenantDetailsComponent
84
+ */
85
+ onTablePaginationChange(pageEvent: PageEvent): void;
44
86
  /**
45
87
  * Keeps track of the accordion based on the element's ID in DOM tree.
46
88
  * @memberof ViewTenantDetailsComponent
47
89
  */
48
90
  trackByAccordionFn(index: number, item: AccordionInfo): number;
91
+ /**
92
+ * Calls openTenantStatusConfirmationModal to change the status of tenant on slide toggle change.
93
+ * @param {SlideToggleOption} slideToggleOption
94
+ * @memberof ViewTenantDetailsComponent
95
+ */
96
+ onSlideToggleChange(slideToggleOption: SlideToggleOption): void;
97
+ /**
98
+ * Opens the confirmation modal to inactivate/reactivate the tenant.
99
+ * @param {boolean} isActivate
100
+ * @memberof ViewTenantDetailsComponent
101
+ */
102
+ openTenantStatusConfirmationModal(isActivate: boolean): void;
103
+ /**
104
+ * Updates the tenant status to the server using http request and display success/error message based on request response (success or failure).
105
+ * @param {boolean} isActivate
106
+ * @memberof ViewTenantDetailsComponent
107
+ */
108
+ updateTenantStatus(isActivate: boolean): void;
109
+ /**
110
+ * Sets slide toggle checked status and label.
111
+ * @param {boolean} isActivate
112
+ * @memberof ViewTenantDetailsComponent
113
+ */
114
+ setSlideToggleStatus(isActivate: boolean): void;
49
115
  /**
50
116
  * Performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
51
117
  * @memberof ViewTenantDetailsComponent
@@ -0,0 +1,36 @@
1
+ export interface RolesAndPermissions {
2
+ permission: string;
3
+ roleIdsList: string[];
4
+ }
5
+ export interface Role {
6
+ roleId: string;
7
+ roleName: string;
8
+ }
9
+ export interface GetRolesResponse {
10
+ status: boolean;
11
+ message: string;
12
+ body?: Role[] | null | {
13
+ errorCodes: string[];
14
+ };
15
+ }
16
+ export interface GetRolesAndPermissionsPayload {
17
+ payload: {
18
+ offset: number;
19
+ pageSize: number;
20
+ };
21
+ }
22
+ export interface RolesAndPermissionsMapping {
23
+ permissionId: string;
24
+ permissionName: string;
25
+ roleList: Role[];
26
+ }
27
+ export interface GetRolesAndPermissionsResponse {
28
+ status: boolean;
29
+ message: string;
30
+ body: {
31
+ totalRecords: number;
32
+ rolePermissionDetails: RolesAndPermissionsMapping[] | null | {
33
+ errorCodes: string[];
34
+ };
35
+ };
36
+ }
@@ -0,0 +1,14 @@
1
+ export interface UpdateTenantStatusPayload {
2
+ appId: string;
3
+ status: boolean;
4
+ }
5
+ export interface UpdateTenantStatusResponse {
6
+ status: boolean;
7
+ message: string;
8
+ body?: string | null | {
9
+ errorCodes: string[];
10
+ };
11
+ }
12
+ export interface UpdateTenantStatusRequestPayload {
13
+ payload: UpdateTenantStatusPayload;
14
+ }
@@ -10,6 +10,8 @@ import { CheckboxOption, RadioOption } from '@ieeesa-npm/presentation';
10
10
  import { FeatureId, Features, GetFeaturesResponse } from '../models/features.model';
11
11
  import { AppTypeConfig, GetAppTypesResponse } from '../models/app-type-config.model';
12
12
  import { TenantPermissionsService } from './tenant-permissions.service';
13
+ import { GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse } from '../models/roles-and-permissions.model';
14
+ import { UpdateTenantStatusRequestPayload, UpdateTenantStatusResponse } from '../models/update-tenant-status.model';
13
15
  import * as i0 from "@angular/core";
14
16
  export declare class TenantApplicationsService {
15
17
  private httpService;
@@ -17,6 +19,8 @@ export declare class TenantApplicationsService {
17
19
  private tenantPermissionsMapService;
18
20
  tenantsText: {
19
21
  "2050": string;
22
+ "3007": string;
23
+ "3009": string;
20
24
  };
21
25
  apiBaseUrl: string;
22
26
  userPermission: UserPermission[];
@@ -111,6 +115,21 @@ export declare class TenantApplicationsService {
111
115
  * @memberof TenantApplicationsService
112
116
  */
113
117
  getFeatures(): Observable<GetFeaturesResponse>;
118
+ /**
119
+ * Gets list of roles from server using HttpService.
120
+ * @param {string} appId
121
+ * @return {*} {Observable<GetRolesResponse>}
122
+ * @memberof TenantApplicationsService
123
+ */
124
+ getRoles(appId: string): Observable<GetRolesResponse>;
125
+ /**
126
+ * Gets list of roles and permissions mappings from server using HttpService.
127
+ * @param {string} appId
128
+ * @param {GetRolesAndPermissionsPayload} payload
129
+ * @return {*} {Observable<GetRolesAndPermissionsResponse>}
130
+ * @memberof TenantApplicationsService
131
+ */
132
+ getRolesAndPermissionsMappings(appId: string, payload: GetRolesAndPermissionsPayload): Observable<GetRolesAndPermissionsResponse>;
114
133
  /**
115
134
  * Gets list of application types from server using HttpService.
116
135
  * @return {Observable<GetAppTypesResponse>}
@@ -137,10 +156,10 @@ export declare class TenantApplicationsService {
137
156
  */
138
157
  getApplicationTypeOptions(appTypeOptions: AppTypeConfig[]): RadioOption[];
139
158
  /**
140
- * Constructs the selected features id's.
141
- * @param {CheckboxOption[]} featureOptions
142
- * @returns {FeatureId[]}
143
- */
159
+ * Constructs the selected features id's.
160
+ * @param {CheckboxOption[]} featureOptions
161
+ * @returns {FeatureId[]}
162
+ */
144
163
  getFeatureIds(featureOptions: CheckboxOption[]): FeatureId[];
145
164
  /**
146
165
  * Sets the tenant basic information.
@@ -151,6 +170,13 @@ export declare class TenantApplicationsService {
151
170
  * Returns the tenant basic information.
152
171
  */
153
172
  get getTenantBasicInfo(): TenantBasicInfo;
173
+ /**
174
+ * Sends update request to the server to update the tenant application status to active/inactive using HttpService and returns the success or failure response.
175
+ * @param {UpdateTenantStatusRequestPayload} updateTenantStatusPayload
176
+ * @return {Observable<UpdateTenantStatusResponse>}
177
+ * @memberof TenantApplicationsService
178
+ */
179
+ updateTenantStatus(updateTenantStatusPayload: UpdateTenantStatusRequestPayload): Observable<UpdateTenantStatusResponse>;
154
180
  static ɵfac: i0.ɵɵFactoryDeclaration<TenantApplicationsService, never>;
155
181
  static ɵprov: i0.ɵɵInjectableDeclaration<TenantApplicationsService>;
156
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/tenants",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"
package/public-api.d.ts CHANGED
@@ -12,6 +12,8 @@ export * from './lib/models/permission-type.model';
12
12
  export * from './lib/models/tenants-permission.model';
13
13
  export * from './lib/models/route-config.model';
14
14
  export * from './lib/models/table-column-schema-view-tenant-list.model';
15
+ export * from './lib/models/roles-and-permissions.model';
16
+ export * from './lib/models/update-tenant-status.model';
15
17
  export * from './lib/services/tenant-applications.service';
16
18
  export * from './lib/services/tenant-permissions-map.service';
17
19
  export * from './lib/services/tenant-permissions.service';