From 7613d238e10e80f9f7839778cc0ac506fe8708bf Mon Sep 17 00:00:00 2001 From: VijayHirudayasamy-bc <103512567+VijayHirudayasamy-bc@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:58:25 +0100 Subject: [PATCH] PR-Ppg 40 the manage groups functionality changes UI (#1283) * common component creation completed * org user view complete (#1250) * juki work added (#1253) * Ppg 40 manage user api inegration (#1254) * juki work added * role pending status functionlity done * Approval status changes * Group - Save button enable * Task 5412: PPG-40 - The Manage Groups functionality Changes - service tab creation (#1261) Co-authored-by: chudasama brijrajsinh * Feature/ppg 40 vijay the manage groups functionality changes UI (#1262) * Group related changes are done for manage my account page * normal users A/Cs are verified and fixed. * govuk table pending label implementation * Feature/ppg 40 vijay the manage groups functionality changes UI (#1272) * Group related changes are done for manage my account page * normal users A/Cs are verified and fixed. * can see all the group services * Ppg 40 tab group access - Fixed approval status in individual tab in manage my account page (#1273) * Task 5412: PPG-40 - The Manage Groups functionality Changes - service tab creation * PPG-40- Pending role access for individual user in manage my account page. * PPG-40-Fixed approval status label flag in Individual access tab in manage my account page --------- Co-authored-by: chudasama brijrajsinh * Buddy check changes * bug-5535-Manage user (Add/ Edit)/Manage my Account (User/Admin) - Accordion titles must be changed. * bug-5537-Manage my account - Groups - Show and hide link must be place as manage user. Now the links are displayed in right end of the page * Manage groups from manage my account --------- Co-authored-by: ajithmuthukumar-bc Co-authored-by: ajithmuthukumar-bc <99731656+ajithmuthukumar-bc@users.noreply.github.com> Co-authored-by: chudasama brijrajsinh Co-authored-by: jukibaskar-bc <130968637+jukibaskar-bc@users.noreply.github.com> --- .../accordion/accordion.component.html | 2 +- .../accordion/accordion.component.ts | 7 +- .../manage-group-view-component.html | 50 +++++--- ...e-user-add-single-user-detail.component.ts | 114 ++++++++---------- .../user-profile/user-profile-component.html | 35 +++--- .../user-profile/user-profile-component.ts | 40 +++--- 6 files changed, 132 insertions(+), 116 deletions(-) diff --git a/src/app/components/accordion/accordion.component.html b/src/app/components/accordion/accordion.component.html index 59834a2e3..b354fae8f 100644 --- a/src/app/components/accordion/accordion.component.html +++ b/src/app/components/accordion/accordion.component.html @@ -73,7 +73,7 @@ - + diff --git a/src/app/components/accordion/accordion.component.ts b/src/app/components/accordion/accordion.component.ts index 4316a624b..2ec1a58a1 100644 --- a/src/app/components/accordion/accordion.component.ts +++ b/src/app/components/accordion/accordion.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-accordion', @@ -27,7 +27,7 @@ export class AccordionComponent implements OnInit, OnChanges { // public groupShow: boolean = false; - constructor(private activatedRoute: ActivatedRoute,) { } + constructor(private router: Router, private activatedRoute: ActivatedRoute) { } ngOnChanges(): void { } @@ -60,6 +60,7 @@ export class AccordionComponent implements OnInit, OnChanges { } public goToEditGroup(groupId: any) { + let isFromManageMyAccount = this.router.url === '/profile'; let queryParams = this.activatedRoute.snapshot.queryParams; if(queryParams.data) { @@ -69,7 +70,7 @@ export class AccordionComponent implements OnInit, OnChanges { let data = { isEdit: true, groupId: groupId, - accessFrom: "users", + accessFrom: isFromManageMyAccount ? "profile" : "users", isUserAccess: true, userEditStatus: this.isEdit }; diff --git a/src/app/pages/manage-group/manage-group-view/manage-group-view-component.html b/src/app/pages/manage-group/manage-group-view/manage-group-view-component.html index fc470a0aa..892dd06a7 100644 --- a/src/app/pages/manage-group/manage-group-view/manage-group-view-component.html +++ b/src/app/pages/manage-group/manage-group-view/manage-group-view-component.html @@ -2,7 +2,7 @@

{{ 'SERVICE_FOR_GROUP' | translate }}

-

This group has access to the services below. To manage these, select 'Manage group services'.

+

This group has access to the services below. To manage these, select 'Manage + group services'.

{{'NONE'| translate}} @@ -102,14 +121,14 @@

{{ 'SERVICE_FOR_GROUP' | translate }}

- - +
@@ -120,7 +139,7 @@

{{ 'SERVICE_FOR_GROUP' | translate }}

Security Level - +
@@ -161,7 +180,8 @@

{{ 'LIST_OF_USERS_GROUP' | translate }}

diff --git a/src/app/pages/manage-user/manage-user-add-single-user-detail/manage-user-add-single-user-detail.component.ts b/src/app/pages/manage-user/manage-user-add-single-user-detail/manage-user-add-single-user-detail.component.ts index 2c8456fb7..164d2ebc9 100644 --- a/src/app/pages/manage-user/manage-user-add-single-user-detail/manage-user-add-single-user-detail.component.ts +++ b/src/app/pages/manage-user/manage-user-add-single-user-detail/manage-user-add-single-user-detail.component.ts @@ -41,7 +41,7 @@ import { Subscription } from 'rxjs'; }) export class ManageUserAddSingleUserDetailComponent extends FormBaseComponent - implements OnInit,OnDestroy { + implements OnInit, OnDestroy { public organisationId: string; public userProfileRequestInfo: UserProfileRequestInfo; public userProfileResponseInfo: UserProfileResponseInfo; @@ -66,21 +66,21 @@ export class ManageUserAddSingleUserDetailComponent public selectedApproveRequiredRole: any = [] public pendingRoledeleteDetails: any = [] public selectedGroupCheckboxes: any[] = []; - public orgUserGroupRoles:any[] = []; - public groupsMember:userGroupTableDetail = { - isAdmin:true, - headerText: "Groups assigned", + public orgUserGroupRoles: any[] = []; + public groupsMember: userGroupTableDetail = { + isAdmin: true, + headerText: "Groups this user is a member of", headerTextKey: "groupName", - accessTable:"groupsMember", - groupShow:true, + accessTable: "groupsMember", + groupShow: true, data: [], } - public noneGroupsMember:userGroupTableDetail = { - isAdmin:true, - headerText: "Groups unassigned", + public noneGroupsMember: userGroupTableDetail = { + isAdmin: true, + headerText: "Groups this user is not a member of", headerTextKey: "groupName", - accessTable:"noneGroupsMember", - groupShow:false, + accessTable: "noneGroupsMember", + groupShow: false, data: [] } public detailsData: any = [ @@ -99,7 +99,7 @@ export class ManageUserAddSingleUserDetailComponent private selectedRoleIds: number[] = [] public isInvalidDomain: boolean = false public subscription: Subscription = new Subscription; - public showRoleView:boolean = environment.appSetting.hideSimplifyRole + public showRoleView: boolean = environment.appSetting.hideSimplifyRole @ViewChildren('input') inputs!: QueryList; constructor( private organisationGroupService: WrapperOrganisationGroupService, @@ -116,7 +116,7 @@ export class ManageUserAddSingleUserDetailComponent private authService: AuthService, private locationStrategy: LocationStrategy, private organisationService: WrapperOrganisationService, - private sharedDataService:SharedDataService + private sharedDataService: SharedDataService ) { super( viewportScroller, @@ -154,7 +154,7 @@ export class ManageUserAddSingleUserDetailComponent localStorage.removeItem('user_approved_role'); localStorage.removeItem('user_access_name'); if (queryParams.data) { - this.subscription = this.sharedDataService.userEditDetails.subscribe((data)=>{ + this.subscription = this.sharedDataService.userEditDetails.subscribe((data) => { this.routeData = JSON.parse(atob(queryParams.data)); this.isEdit = this.routeData['isEdit']; this.editingUserName = sessionStorage.getItem(SessionStorageKey.ManageUserUserName) ?? ''; @@ -270,8 +270,8 @@ export class ManageUserAddSingleUserDetailComponent this.MFA_Enabled = this.formGroup.controls.mfaEnabled.value; } - private patchAdminMailData(){ - if(this.routeData.isCreatedByAdmin === true){ + private patchAdminMailData() { + if (this.routeData.isCreatedByAdmin === true) { this.formGroup.controls['firstName'].setValue( this.routeData.firstName ); @@ -282,8 +282,8 @@ export class ManageUserAddSingleUserDetailComponent this.routeData.userName ); } - } - + } + async getIdentityProviders() { let masterIdps = await this.configWrapperService.getIdentityProviders().toPromise().catch(); this.identityProviders = await this.organisationGroupService.getOrganisationIdentityProviders(this.organisationId).toPromise(); @@ -331,8 +331,8 @@ export class ManageUserAddSingleUserDetailComponent const orgGrpList = await this.organisationGroupService.getOrganisationGroupsWithRoles(this.organisationId).toPromise(); this.orgGroups = orgGrpList.groupList; for (const group of this.orgGroups) { - const isGroupOfUser:any = this.userProfileResponseInfo?.detail?.userGroups?.find((ug) => ug.groupId === group.groupId); - if(isGroupOfUser){ + const isGroupOfUser: any = this.userProfileResponseInfo?.detail?.userGroups?.find((ug) => ug.groupId === group.groupId); + if (isGroupOfUser) { // if(isGroupOfUser.approvalStatus === 0){ // const pendingApproveRole = group?.serviceRoleGroups?.find((pg:any)=>pg.id === isGroupOfUser.accessServiceRoleGroupId) // group.serviceRoleGroups.map((fc:any)=>{ @@ -342,21 +342,21 @@ export class ManageUserAddSingleUserDetailComponent // } // }) // } - group.serviceRoleGroups.map((fc:any)=>{ - var serviceGroupApprovalDetails:any = this.userProfileResponseInfo?.detail?.userGroups?.find((ug: any) => ug.groupId === group.groupId && ug.accessServiceRoleGroupId === fc.id); + group.serviceRoleGroups.map((fc: any) => { + var serviceGroupApprovalDetails: any = this.userProfileResponseInfo?.detail?.userGroups?.find((ug: any) => ug.groupId === group.groupId && ug.accessServiceRoleGroupId === fc.id); fc.approvalStatus = serviceGroupApprovalDetails?.approvalStatus; }); - + group.checked = true - group.serviceRoleGroups = group.serviceRoleGroups.filter((item: any) => item.approvalStatus === 0 || item.approvalStatus === 1); + group.serviceRoleGroups = group.serviceRoleGroups.filter((item: any) => item.approvalStatus === 0 || item.approvalStatus === 1); this.groupsMember.data.push(group) this.selectedGroupCheckboxes.push(group.groupId) - + group.serviceRoleGroups.forEach((element: any) => { - let groupRoles = this.orgUserGroupRoles.filter(e=> { return e.id == element.id}); - if(groupRoles.length <= 0 && (element.approvalStatus == 0 || element.approvalStatus ==1)){ + let groupRoles = this.orgUserGroupRoles.filter(e => { return e.id == element.id }); + if (groupRoles.length <= 0 && (element.approvalStatus == 0 || element.approvalStatus == 1)) { this.orgUserGroupRoles.push(element); - } + } }); } else { this.noneGroupsMember.data.push(group) @@ -548,8 +548,7 @@ export class ManageUserAddSingleUserDetailComponent if (!filterAlreadyExistRole) { this.selectedApproveRequiredRole.push(role.roleId) - }else - { + } else { // Remove below line to seperate normal and approval required role. It is added as we will not be using seperate api. Only user update api will be used this.selectedRoleIds.push(role.roleId); } @@ -622,13 +621,11 @@ export class ManageUserAddSingleUserDetailComponent }) }) localStorage.setItem('user_approved_role', JSON.stringify(matchRoles)); - localStorage.setItem('user_access_name',this.userProfileRequestInfo.userName); + localStorage.setItem('user_access_name', this.userProfileRequestInfo.userName); } } updateUser(form: FormGroup) { - console.log("selectedCheckboxes",this.selectedGroupCheckboxes) - debugger this.userProfileRequestInfo.detail.groupIds = this.selectedGroupCheckboxes this.wrapperUserService .updateUser( @@ -850,17 +847,17 @@ export class ManageUserAddSingleUserDetailComponent onUserRoleChecked(obj: any, isChecked: boolean) { var roleKey = obj.roleKey; if (isChecked == true) { - this.setMfaStatus(roleKey,true) + this.setMfaStatus(roleKey, true) if (obj.pendingStatus === true) { this.removePendingRole(obj) } } else if (isChecked == false) { - this.setMfaStatus(roleKey,false) + this.setMfaStatus(roleKey, false) } } - private setMfaStatus(roleKey: any,status:boolean) { + private setMfaStatus(roleKey: any, status: boolean) { if (roleKey == 'ORG_ADMINISTRATOR') { this.formGroup.controls['mfaEnabled'].setValue(status); this.isAutoDisableMFA = status; @@ -878,7 +875,6 @@ export class ManageUserAddSingleUserDetailComponent } } - public ResetAdditionalSecurity(): void { if (this.MFA_Enabled) { @@ -900,38 +896,37 @@ export class ManageUserAddSingleUserDetailComponent this.subscription.unsubscribe() } - public getDisbleRoleForService(orgRoleKey:any){ - if(orgRoleKey === 'ORG_DEFAULT_USER'){ - return true - } else { - return null - } + public getDisbleRoleForService(orgRoleKey: any) { + if (orgRoleKey === 'ORG_DEFAULT_USER') { + return true + } else { + return null + } } - - public groupsMemberCheckBoxAddRoles(data:any){ + public groupsMemberCheckBoxAddRoles(data: any) { this.selectedGroupCheckboxes.push(data.groupId); this.IsChangeInGroupSelection(this.userProfileResponseInfo?.detail?.userGroups?.map(x => x.groupId)); - + } - public groupsMemberCheckBoxRemoveRoles(data:any){ - this.selectedGroupCheckboxes = this.removeObjectById(this.selectedGroupCheckboxes,data.groupId); + public groupsMemberCheckBoxRemoveRoles(data: any) { + this.selectedGroupCheckboxes = this.removeObjectById(this.selectedGroupCheckboxes, data.groupId); this.IsChangeInGroupSelection(this.userProfileResponseInfo?.detail?.userGroups?.map(x => x.groupId)); } - public noneGroupsMemberCheckBoxAddRoles(data:any){ + public noneGroupsMemberCheckBoxAddRoles(data: any) { this.selectedGroupCheckboxes.push(data.groupId); this.IsChangeInGroupSelection(this.userProfileResponseInfo?.detail?.userGroups?.map(x => x.groupId)); - } - - public noneGroupsMemberCheckBoxRemoveRoles(data:any){ - this.selectedGroupCheckboxes = this.removeObjectById(this.selectedGroupCheckboxes,data.groupId); + } + + public noneGroupsMemberCheckBoxRemoveRoles(data: any) { + this.selectedGroupCheckboxes = this.removeObjectById(this.selectedGroupCheckboxes, data.groupId); this.IsChangeInGroupSelection(this.userProfileResponseInfo?.detail?.userGroups?.map(x => x.groupId)); } - private removeObjectById(arr:any, id:any) { + private removeObjectById(arr: any, id: any) { return arr.filter((item: any) => item !== id); } @@ -945,16 +940,13 @@ export class ManageUserAddSingleUserDetailComponent } } - public IsChangeInGroupSelection(responseGroups: any): void - { + public IsChangeInGroupSelection(responseGroups: any): void { var isSelectedAndResponseGroupsSame = !this.selectedGroupCheckboxes.every((groupId: any) => responseGroups.includes(groupId)); var isResponseGroupsSame = !responseGroups.every((groupId: any) => this.selectedGroupCheckboxes.includes(groupId)); - if(isSelectedAndResponseGroupsSame || isResponseGroupsSame) - { + if (isSelectedAndResponseGroupsSame || isResponseGroupsSame) { this.formChanged = true; } - else - { + else { this.formChanged = false; } } diff --git a/src/app/pages/user-profile/user-profile-component.html b/src/app/pages/user-profile/user-profile-component.html index 53c31d1eb..53360cb5e 100644 --- a/src/app/pages/user-profile/user-profile-component.html +++ b/src/app/pages/user-profile/user-profile-component.html @@ -141,23 +141,26 @@

{{ 'GROUPS' | translate }}

-

- +
+
+ - + +
diff --git a/src/app/pages/user-profile/user-profile-component.ts b/src/app/pages/user-profile/user-profile-component.ts index 286286712..550cba399 100644 --- a/src/app/pages/user-profile/user-profile-component.ts +++ b/src/app/pages/user-profile/user-profile-component.ts @@ -94,7 +94,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit { public groupsMember: userGroupTableDetail = { isAdmin: false, - headerText: "Groups assigned", + headerText: "Groups I am a member of", headerTextKey: "groupName", accessTable: "groupsMember", noRoleMessage: "You do not have access to any service through membership of this group.", @@ -104,7 +104,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit { } public noneGroupsMember: userGroupTableDetail = { isAdmin: false, - headerText: "Groups unassigned", + headerText: "Groups I am not a member of", headerTextKey: "groupName", accessTable: "noneGroupsMember", noRoleMessage: "You do not have access to any service through membership of this group.", @@ -292,25 +292,27 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit { }); } }); - - //Adding the pending approval service to the user role list with label pending approval - this.pendingRoleDetails && this.pendingRoleDetails.map((roleInfo: any) => { - var orgRole: any = orgRoles.find((r) => r.roleId == roleInfo.roleId); - if (orgRole) { - this.roleDataList.push({ - accessRoleName: orgRole.roleName, - serviceName: orgRole.serviceName, - description: orgRole.description, - serviceView: !this.showRoleView, - approvalStatus: roleInfo.approvalStatus - }); - } - }); + + //Adding the pending approval service to the user role list with label pending approval + this.pendingRoleDetails && this.pendingRoleDetails.map((roleInfo: any) => { + var orgRole: any = orgRoles.find((r) => r.roleId == roleInfo.roleId); + if (orgRole) { + this.roleDataList.push({ + accessRoleName: orgRole.roleName, + serviceName: orgRole.serviceName, + description: orgRole.description, + serviceView: !this.showRoleView, + approvalStatus: roleInfo.approvalStatus + }); + } + }); this.groupHint = "These are the services that you have access to." - } + } }); + await this.getOrgGroups(); + this.getUserContact(this.userName); this.onFormValueChange(); @@ -331,7 +333,6 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit { ]; } - await this.getOrgGroups(); } ngAfterViewChecked() { @@ -669,13 +670,12 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit { group.serviceRoleGroups = group.serviceRoleGroups.filter((item: any) => item.approvalStatus === 0 || item.approvalStatus === 1); this.groupsMember.data.push(group) this.selectedGroupCheckboxes.push(group.groupId) - group.serviceRoleGroups.forEach((element: any) => { let groupRoles = this.orgUserGroupRoles.filter(e => { return e.id == element.id }); if (groupRoles.length <= 0 && (element.approvalStatus == 0 || element.approvalStatus == 1)) { element.serviceView = true; this.orgUserGroupRoles.push(element); - } + } }); } else { if (this.isAdminUser) {
Group name{{headerText}}