Skip to content

Commit

Permalink
issue has beem fixed (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajithmuthukumar-bc authored May 17, 2023
1 parent 94e2762 commit 770d37e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 21 deletions.
13 changes: 6 additions & 7 deletions src/app/components/accordion/accordion.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<th scope="col" class="govuk-table__header border-bottom-0 govuk-text-align-right">
<p *ngIf="accessTable === 'groupsMember'" class="govuk-body"><a href="javascript:;"
class="govuk-link" (click)="onTopToggle()">{{groupShow ==
true ? 'hide all assigned' : (groupShow == false ? 'show all assigned' : '')}}
true ? 'hide all' : (groupShow == false ? 'show all' : '')}}
({{data.length}})</a></p>
<p *ngIf="accessTable === 'noneGroupsMember'" class="govuk-body"><a href="javascript:;"
class="govuk-link" (click)="onTopToggle()">{{groupShow ==
true ? 'hide all unassigned' : (groupShow == false ? 'show all unassigned' : '')}}
true ? 'hide all' : (groupShow == false ? 'show all' : '')}}
({{data.length}})</a></p>
</th>
</tr>
Expand Down Expand Up @@ -38,9 +38,9 @@
</li>
</span>
<ng-template #noRoleData >
<label class ="no-data-message"> {{!noRoleMessage? 'This user does not have access to any service through
their membership of this group.':noRoleMessage}} </label>

<!-- <label class ="no-data-message"> {{!noRoleMessage? 'This user does not have access to any service through
their membership of this group.':noRoleMessage}} </label> -->
<label class ="no-data-message"> {{noRoleText}} </label>
</ng-template>
</ul>
</div>
Expand Down Expand Up @@ -88,8 +88,7 @@
</li>
</span>
<ng-template #noRoleDataIsNotAdmin >
<label class ="no-data-message"> {{!noRoleMessage? 'This user does not have access to any service through
their membership of this group.':noRoleMessage}}</label>
<label class ="no-data-message">{{noRoleText}}</label>
</ng-template>
</ul>
</th>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/accordion/accordion.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
margin-bottom: 30px;
}
.no-data-message{
position: relative; left: -20px;
position: relative; left: -30px;
}
4 changes: 2 additions & 2 deletions src/app/components/accordion/accordion.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class AccordionComponent implements OnInit, OnChanges {
@Input() isAdmin!: boolean
@Input() accessTable!: string
@Input() groupShow!: boolean

@Input() noRoleText!: string
@Input() noRoleMessage!: string
@Input() noDataGroupsMemberMessage!: string
@Input() noDatanoneGroupsMemberMessage!: string
Expand Down Expand Up @@ -59,7 +59,7 @@ export class AccordionComponent implements OnInit, OnChanges {
el.style.display = (el.style.display === 'block') ? 'none' : 'block';
}

public goToEditGroup(groupId: any) {
public goToEditGroup(groupId: any) {
let isFromManageMyAccount = this.router.url === '/profile';
let queryParams = this.activatedRoute.snapshot.queryParams;
if(queryParams.data)
Expand Down
1 change: 1 addition & 0 deletions src/app/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export interface userGroupTableDetail {
headerText: string,
accessTable: string
groupShow: boolean
noRoleText?: any
noRoleMessage?: string | any
noDataGroupsMemberMessage?: string | any
noDatanoneGroupsMemberMessage?: string | any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">
</legend>
<app-details [detailsData]="detailsData[1]"></app-details>
</fieldset>
<app-accordion [headerTextKeys]="groupsMember.headerTextKey" [headerText]="groupsMember.headerText" [accessTable]="groupsMember.accessTable" [data]="groupsMember.data"
[isAdmin]="groupsMember.isAdmin" [groupShow]="groupsMember.groupShow"
(checkBoxAddRoles)="groupsMemberCheckBoxAddRoles($event)" (checkBoxRemoveRoles)="groupsMemberCheckBoxRemoveRoles($event)" ></app-accordion>

<app-accordion [headerTextKeys]="noneGroupsMember.headerTextKey" [headerText]="noneGroupsMember.headerText" [accessTable]="noneGroupsMember.accessTable" [data]="noneGroupsMember.data"
[isAdmin]="noneGroupsMember.isAdmin" [groupShow]="noneGroupsMember.groupShow"
(checkBoxAddRoles)="noneGroupsMemberCheckBoxAddRoles($event)" (checkBoxRemoveRoles)="noneGroupsMemberCheckBoxRemoveRoles($event)"></app-accordion>
<div *ngIf="isEdit">
<app-accordion [headerTextKeys]="groupsMember.headerTextKey" [headerText]="groupsMember.headerText" [accessTable]="groupsMember.accessTable" [data]="groupsMember.data"
[isAdmin]="groupsMember.isAdmin" [groupShow]="groupsMember.groupShow" [noRoleText]="groupsMember.noRoleText"
(checkBoxAddRoles)="groupsMemberCheckBoxAddRoles($event)" (checkBoxRemoveRoles)="groupsMemberCheckBoxRemoveRoles($event)" ></app-accordion>
</div>
<div>
<app-accordion [headerTextKeys]="noneGroupsMember.headerTextKey" [headerText]="noneGroupsMember.headerText" [accessTable]="noneGroupsMember.accessTable" [data]="noneGroupsMember.data"
[isAdmin]="noneGroupsMember.isAdmin" [groupShow]="noneGroupsMember.groupShow" [noRoleText]="noneGroupsMember.noRoleText"
(checkBoxAddRoles)="noneGroupsMemberCheckBoxAddRoles($event)" (checkBoxRemoveRoles)="noneGroupsMemberCheckBoxRemoveRoles($event)"></app-accordion>
</div>
<!-- <div class="govuk-form-group" id="user-group-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-heading-s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ export class ManageUserAddSingleUserDetailComponent
headerTextKey: "groupName",
accessTable: "groupsMember",
groupShow: true,
noRoleText:"This user does not have access to any service through their membership of this group.",
data: [],
}
public noneGroupsMember: userGroupTableDetail = {
isAdmin: true,
headerText: "Groups this user is not a member of",
headerTextKey: "groupName",
noRoleText: "This group is not assigned with access to any service.",
accessTable: "noneGroupsMember",
groupShow: false,
data: []
Expand Down Expand Up @@ -269,6 +271,7 @@ export class ManageUserAddSingleUserDetailComponent
this.patchAdminMailData()
}
this.MFA_Enabled = this.formGroup.controls.mfaEnabled.value;
this.setAccordionDetails()
}

private patchAdminMailData() {
Expand All @@ -285,6 +288,13 @@ export class ManageUserAddSingleUserDetailComponent
}
}

private setAccordionDetails(){
if(!this.isEdit){
this.noneGroupsMember.headerText = "Available groups"
this.noneGroupsMember.noRoleText = "This group is not assigned with access to any service."
}
}

async getIdentityProviders() {
let masterIdps = await this.configWrapperService.getIdentityProviders().toPromise().catch();
this.identityProviders = await this.organisationGroupService.getOrganisationIdentityProviders(this.organisationId).toPromise();
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/user-profile/user-profile-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h2 class="govuk-heading-s"> {{ 'GROUPS' | translate }}</h2>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<app-accordion [headerTextKeys]="groupsMember.headerTextKey"
[headerText]="groupsMember.headerText" [noRoleMessage]="groupsMember.noRoleMessage"
[headerText]="groupsMember.headerText" [noRoleText]="groupsMember.noRoleText"
[noDataGroupsMemberMessage]="groupsMember.noDataGroupsMemberMessage"
[accessTable]="groupsMember.accessTable" [data]="groupsMember.data"
[isAdmin]="groupsMember.isAdmin" [groupShow]="groupsMember.groupShow"
Expand All @@ -153,7 +153,7 @@ <h2 class="govuk-heading-s"> {{ 'GROUPS' | translate }}</h2>

<app-accordion *ngIf="noneGroupsMember.isAdmin"
[headerTextKeys]="noneGroupsMember.headerTextKey"
[noRoleMessage]="noneGroupsMember.noRoleMessage"
[noRoleText]="noneGroupsMember.noRoleText"
[noDatanoneGroupsMemberMessage]="noneGroupsMember.noDatanoneGroupsMemberMessage"
[headerText]="noneGroupsMember.headerText" [accessTable]="noneGroupsMember.accessTable"
[data]="noneGroupsMember.data" [isAdmin]="noneGroupsMember.isAdmin"
Expand Down
11 changes: 9 additions & 2 deletions src/app/pages/user-profile/user-profile-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
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.",
noRoleText: "You do not have access to any service through membership of this group.",
noDataGroupsMemberMessage: "You are not member of any group.",
groupShow: true,
data: [],
Expand All @@ -108,7 +108,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
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.",
noRoleText: "This group is not assigned with access to any service.",
noDatanoneGroupsMemberMessage: "There are no unassiged groups available for you.",
groupShow: false,
data: []
Expand Down Expand Up @@ -661,9 +661,16 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
this.groupsMember.isAdmin = this.isAdminUser;
this.noneGroupsMember.isAdmin = this.isAdminUser;
this.getGroupDetails()
this.setAccordinoForUser()
}


private setAccordinoForUser(){
if(!this.isAdminUser){
this.groupsMember.noRoleText = "You do not have access to any service through membership of this group."
}
}

private getGroupDetails(){
for (const group of this.orgGroups) {
const isGroupOfUser: any = this.userGroups?.find((ug) => ug.groupId === group.groupId);
Expand Down

0 comments on commit 770d37e

Please sign in to comment.