@ieeesa-npm/groups 0.4.7 → 0.4.9

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.
@@ -2,4 +2,5 @@ export declare const GroupsValidationPatterns: {
2
2
  groupName: RegExp;
3
3
  shortName: RegExp;
4
4
  groupScope: RegExp;
5
+ email: RegExp;
5
6
  };
@@ -0,0 +1,108 @@
1
+ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { Subject } from 'rxjs';
4
+ import { AlertsService, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
5
+ import { FormGrid, FormModel, AlignType, CheckboxOption } from '@ieeesa-npm/presentation';
6
+ import { GroupsService } from '../../services/groups.service';
7
+ import { UserInfo } from '../../models/user-info.model';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * Component implements the view and functionalities to add group users to roster.
11
+ * @export
12
+ * @class AddUserRosterComponent
13
+ * @implements {OnInit}
14
+ * @implements {OnDestroy}
15
+ */
16
+ export declare class AddUserRosterComponent implements OnInit, OnDestroy {
17
+ private groupService;
18
+ private globalErrorHandlerService;
19
+ alertService: AlertsService;
20
+ destroy$: Subject<boolean>;
21
+ constants: any;
22
+ addUserRosterTexts: any;
23
+ leftButtonLabel: any;
24
+ rightButtonLabel: any;
25
+ isSubmitButtonDisabled: boolean;
26
+ colWidth: FormGrid;
27
+ searchUserFormGroup: FormModel;
28
+ addUserFormGroup: FormModel;
29
+ actionButtonAlign: AlignType;
30
+ addUserFormGroupRef: FormGroup;
31
+ isSearchUserForm: boolean;
32
+ userRoles: CheckboxOption[];
33
+ selectedUserRoles: string[];
34
+ userInfo: UserInfo;
35
+ isAddUserFormEmailSearch: boolean;
36
+ submitFormResponse: EventEmitter<any>;
37
+ formCancel: EventEmitter<any>;
38
+ constructor(groupService: GroupsService, globalErrorHandlerService: GlobalErrorHandlerService, alertService: AlertsService);
39
+ /**
40
+ * Initializes user roles and searchUserFormGroup.
41
+ * @memberof AddUserRosterComponent
42
+ */
43
+ ngOnInit(): void;
44
+ /**
45
+ * Creates search user form group
46
+ * @memberof AddUserRosterComponent
47
+ */
48
+ createSearchUserFormGroup(): void;
49
+ /**
50
+ * Checks form validity and searches the user by entered email.
51
+ * @param {FormGroup[]} form
52
+ * @memberof AddUserRosterComponent
53
+ */
54
+ onSearchUserFormSubmit(form: FormGroup[]): void;
55
+ /**
56
+ * Searches the user by entered email and gets the user details when the email id is found.
57
+ * @param {string} email
58
+ * @memberof AddUserRosterComponent
59
+ */
60
+ searchUserByEmail(email: string): void;
61
+ /**
62
+ * Validates whether the user is exists in the selected group and then creates add user form when the user does not exist in the selected group.
63
+ * @memberof AddUserRosterComponent
64
+ */
65
+ validateUserExistence(): void;
66
+ /**
67
+ * Handles add user form email search
68
+ * @param {string} email
69
+ * @memberof AddUserRosterComponent
70
+ */
71
+ formSearchApply(email: string): void;
72
+ /**
73
+ * Assigns role to user on form submission.
74
+ * @param {FormGroup[]} form
75
+ * @memberof AddUserRosterComponent
76
+ */
77
+ onAddUserFormSubmit(form: FormGroup[]): void;
78
+ /**
79
+ * Get add user form group reference.
80
+ * @param {FormGroup[]} form
81
+ * @memberof AddUserRosterComponent
82
+ */
83
+ getAddUserFormGroupRef(form: FormGroup[]): void;
84
+ /**
85
+ * Handles user role selection in add user form.
86
+ * @param {CheckboxOption} event
87
+ * @memberof AddUserRosterComponent
88
+ */
89
+ onUserRoleSelection(event: CheckboxOption): void;
90
+ /**
91
+ * Emits form cancel event.
92
+ * @memberof AddUserRosterComponent
93
+ */
94
+ onFormCancel(): void;
95
+ /**
96
+ * Handles the custom errors while searching user by email, validating user existence and adding new user to roster.
97
+ * @param {*} error
98
+ * @memberof AddUserRosterComponent
99
+ */
100
+ handleErrors(error: any): void;
101
+ /**
102
+ * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
103
+ * @memberof AddUserRosterComponent
104
+ */
105
+ ngOnDestroy(): void;
106
+ static ɵfac: i0.ɵɵFactoryDeclaration<AddUserRosterComponent, never>;
107
+ static ɵcmp: i0.ɵɵComponentDeclaration<AddUserRosterComponent, "ieeesa-add-user-roster", never, {}, { "submitFormResponse": "submitFormResponse"; "formCancel": "formCancel"; }, never, never, true, never>;
108
+ }
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, OnDestroy } from '@angular/core';
1
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { Subject } from 'rxjs';
3
3
  import { SortDirection } from '@angular/material/sort';
4
4
  import { TableColumnSchema, TableActions, CheckboxOption, ChipOption } from '@ieeesa-npm/presentation';
@@ -12,7 +12,7 @@ import * as i0 from "@angular/core";
12
12
  * @class ViewRosterComponent
13
13
  * @implements {OnDestroy}
14
14
  */
15
- export declare class ViewRosterComponent implements OnDestroy {
15
+ export declare class ViewRosterComponent implements OnInit, OnDestroy {
16
16
  private groupService;
17
17
  private alertService;
18
18
  private cdr;
@@ -30,6 +30,11 @@ export declare class ViewRosterComponent implements OnDestroy {
30
30
  defaultSortedColumn: string;
31
31
  defaultColumnSortDirection: SortDirection;
32
32
  constructor(groupService: GroupsService, alertService: AlertsService, cdr: ChangeDetectorRef, globalErrorHandlerService: GlobalErrorHandlerService);
33
+ /**
34
+ * Show add new user success message when canShowMessage is set true
35
+ * @memberof ViewRosterComponent
36
+ */
37
+ ngOnInit(): void;
33
38
  /**
34
39
  * Gets the group users by calling getGroupUsers() from groupService and sets tableData to display the users in a grid.
35
40
  * @memberof ViewRosterComponent
@@ -58,6 +63,11 @@ export declare class ViewRosterComponent implements OnDestroy {
58
63
  * @memberof ViewRosterComponent
59
64
  */
60
65
  handleErrors(error: any): void;
66
+ /**
67
+ * Emits openModalNotifier event with GroupFunctionType value as ADD_USER_TO_ROSTER
68
+ * @memberof ViewRosterComponent
69
+ */
70
+ onAddNewUser(): void;
61
71
  /**
62
72
  * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
63
73
  * @memberof ViewRosterComponent
@@ -27,6 +27,7 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
27
27
  viewGroupTexts: any;
28
28
  createGroupText: any;
29
29
  editGroupTexts: any;
30
+ addUserRosterTexts: any;
30
31
  isGroupSearchActive: boolean;
31
32
  isGroupFilterActive: boolean;
32
33
  isGroupSearchOrFilterActive: boolean;
@@ -54,6 +55,7 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
54
55
  functionType: GroupFunctionType;
55
56
  alignmentType: typeof AlignType;
56
57
  isSorting: boolean;
58
+ canReopenViewRosterModal: boolean;
57
59
  constructor(dialog: MatDialog, groupsService: GroupsService, alertService: AlertsService, breakpointObserverService: BreakpointObserverService, globalErrorHandlerService: GlobalErrorHandlerService);
58
60
  /**
59
61
  * Initialize the groups component.
@@ -75,6 +77,11 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
75
77
  * @memberof GroupsComponent
76
78
  */
77
79
  openEditGroupForm(editGroupInfo: EditGroupAndParentInfo): void;
80
+ /**
81
+ * Sets the dialog options for add users modal and calls openModal method.
82
+ * @memberof GroupsComponent
83
+ */
84
+ openAddUserRosterModal(): void;
78
85
  /**
79
86
  * Sets the dialog options for users modal and calls openModal method.
80
87
  * @param {GroupInfo} group
@@ -0,0 +1,30 @@
1
+ export interface SearchUserByEmailResponse {
2
+ status: boolean;
3
+ message: string;
4
+ body: {
5
+ userId: string;
6
+ email: string;
7
+ name: string;
8
+ };
9
+ }
10
+ export interface GetUserDetailsPayload {
11
+ payload: {
12
+ groupId: string;
13
+ userId: string;
14
+ };
15
+ }
16
+ export interface AddNewUserPayload {
17
+ payload: {
18
+ groupId: string;
19
+ userId: string;
20
+ roles: string[];
21
+ email: string;
22
+ };
23
+ }
24
+ export interface GroupUserDetailsResponse {
25
+ status: boolean;
26
+ message: string;
27
+ body?: string | null | {
28
+ errorCodes: string[];
29
+ };
30
+ }
@@ -3,5 +3,6 @@ export declare enum GroupFunctionType {
3
3
  EDIT = "EDIT",
4
4
  VIEW_ROSTER = "VIEW_ROSTER",
5
5
  FILTER = "FILTER",
6
+ ADD_USER_TO_ROSTER = "ADD_USER_TO_ROSTER",
6
7
  TOGGLE = "TOGGLE"
7
8
  }
@@ -0,0 +1,5 @@
1
+ export interface UserInfo {
2
+ email: string;
3
+ name: string;
4
+ userId: string;
5
+ }
@@ -1,4 +1,4 @@
1
- import { Observable } from 'rxjs';
1
+ import { Observable, BehaviorSubject } from 'rxjs';
2
2
  import { CreateGroupPayload, CreateGroupResponse } from '../models/create-group.model';
3
3
  import { GroupTypeConfiguration, GroupTypeConfigValue, GroupTypeResponse } from '../models/group-types.model';
4
4
  import { AlertsService, HttpService } from '@ieeesa-npm/utility';
@@ -9,6 +9,7 @@ import { SearchUsersPayload, FilterUsersByRolesPayload, GetGroupUsersResponse, U
9
9
  import { CheckboxOption } from '@ieeesa-npm/presentation';
10
10
  import { EditGroupPayload } from '../models/edit-group.model';
11
11
  import { GroupFunctionType } from '../models/group-function-type.model';
12
+ import { AddNewUserPayload, GetUserDetailsPayload, SearchUserByEmailResponse, GroupUserDetailsResponse } from '../models/add-new-user.model';
12
13
  import * as i0 from "@angular/core";
13
14
  /**
14
15
  * Groups service is an abstract layer and responsible for managing groups REST API calls.
@@ -37,21 +38,39 @@ export declare class GroupsService {
37
38
  "1016": string;
38
39
  "1017": string;
39
40
  "1018": string;
41
+ "1019": string;
40
42
  "1020": string;
43
+ "1021": string;
44
+ "1022": string;
45
+ "1023": string;
46
+ "1024": string;
47
+ "1025": string;
41
48
  "1026": string;
42
49
  "1027": string;
43
50
  "1028": string;
44
51
  "1029": string;
45
52
  "1030": string;
46
53
  "1031": string;
54
+ /**
55
+ * Gets the group users for the given group id.
56
+ * @param {string} groupId
57
+ * @return {Observable<GetGroupUsersResponse>}
58
+ * @memberof GroupsService
59
+ */
47
60
  "1032": string;
61
+ "2001": string;
48
62
  "2002": string;
63
+ "2010": string;
64
+ "2011": string;
49
65
  };
50
66
  apiBaseUrl: string;
51
67
  userPermission: any;
52
68
  selectedGroupInfo: GroupInfo | undefined;
53
69
  groupFunctionType: GroupFunctionType;
54
70
  selectedGroupParentInfo: GroupInfo | undefined;
71
+ openModalNotifier: BehaviorSubject<GroupFunctionType>;
72
+ groupTypeRoles: CheckboxOption[];
73
+ canShowMessage: boolean;
55
74
  constructor(httpService: HttpService, alertService: AlertsService);
56
75
  setAppConfig(apiBaseUrl: string, userPermission: any): void;
57
76
  /**
@@ -168,6 +187,39 @@ export declare class GroupsService {
168
187
  * @memberof GroupsService
169
188
  */
170
189
  getFormattedGroupTypes(groupTypeResponse: GroupTypeConfiguration[]): GroupTypeConfigValue;
190
+ /**
191
+ * Returns group user details if email is found, else throws error.
192
+ * @param {string} email
193
+ * @return {Observable<SearchUserByEmailResponse>}
194
+ * @memberof GroupsService
195
+ */
196
+ getUserByEmail(email: string): Observable<SearchUserByEmailResponse>;
197
+ /**
198
+ * Gets the user details for the selected group
199
+ * @param {GetUserDetailsPayload} payload
200
+ * @return {Observable<GroupUserDetailsResponse>}
201
+ * @memberof GroupsService
202
+ */
203
+ getGroupUserDetails(payload: GetUserDetailsPayload): Observable<GroupUserDetailsResponse>;
204
+ /**
205
+ * Posts add new user form data to the API for the selected group and returns the success or failure response.
206
+ * @param {AddNewUserPayload} addNewUserPayload
207
+ * @return {Observable<GroupUserDetailsResponse>}
208
+ * @memberof GroupsService
209
+ */
210
+ addNewGroupUser(addNewUserPayload: AddNewUserPayload): Observable<GroupUserDetailsResponse>;
211
+ /**
212
+ * Sets the loaded group type user roles
213
+ * @param {CheckboxOption[]} userRoles
214
+ * @memberof GroupsService
215
+ */
216
+ setGroupTypeUserRoles(userRoles: CheckboxOption[]): void;
217
+ /**
218
+ * Returns the group type user roles.
219
+ * @return {CheckboxOption[]}
220
+ * @memberof GroupsService
221
+ */
222
+ getGroupTypeUserRoles(): CheckboxOption[];
171
223
  static ɵfac: i0.ɵɵFactoryDeclaration<GroupsService, never>;
172
224
  static ɵprov: i0.ɵɵInjectableDeclaration<GroupsService>;
173
225
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/groups",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0",
7
- "@ieeesa-npm/presentation": "^0.6.5",
8
- "@ieeesa-npm/shared-styles": "^0.1.6",
9
- "@ieeesa-npm/utility": "^0.5.8"
7
+ "@ieeesa-npm/presentation": "^0.6.7",
8
+ "@ieeesa-npm/shared-styles": "^0.1.7",
9
+ "@ieeesa-npm/utility": "^0.5.9"
10
10
  },
11
11
  "dependencies": {
12
12
  "tslib": "^2.3.0"