Skip to content

Commit 6975fd1

Browse files
authored
Merge pull request DSpace#2627 from DSpace/backport-2545-to-dspace-7_x
[Port dspace-7_x] Fix "Edit Group" page always requests all member Subgroups & EPersons
2 parents 787feae + d305e60 commit 6975fd1

16 files changed

Lines changed: 552 additions & 608 deletions

File tree

src/app/access-control/group-registry/group-form/group-form.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,14 @@ export class GroupFormComponent implements OnInit, OnDestroy {
230230
this.groupBeingEdited = activeGroup;
231231

232232
if (linkedObject?.name) {
233-
this.formBuilderService.insertFormGroupControl(1, this.formGroup, this.formModel, this.groupCommunity);
234-
this.formGroup.patchValue({
235-
groupName: activeGroup.name,
236-
groupCommunity: linkedObject?.name ?? '',
237-
groupDescription: activeGroup.firstMetadataValue('dc.description'),
238-
});
233+
if (!this.formGroup.controls.groupCommunity) {
234+
this.formBuilderService.insertFormGroupControl(1, this.formGroup, this.formModel, this.groupCommunity);
235+
this.formGroup.patchValue({
236+
groupName: activeGroup.name,
237+
groupCommunity: linkedObject?.name ?? '',
238+
groupDescription: activeGroup.firstMetadataValue('dc.description'),
239+
});
240+
}
239241
} else {
240242
this.formModel = [
241243
this.groupName,
Lines changed: 61 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,17 @@
11
<ng-container>
22
<h3 class="border-bottom pb-2">{{messagePrefix + '.head' | translate}}</h3>
33

4-
<h4 id="search" class="border-bottom pb-2">
5-
<span
6-
*dsContextHelp="{
7-
content: 'admin.access-control.groups.form.tooltip.editGroup.addEpeople',
8-
id: 'edit-group-add-epeople',
9-
iconPlacement: 'right',
10-
tooltipPlacement: ['top', 'right', 'bottom']
11-
}"
12-
>
13-
{{messagePrefix + '.search.head' | translate}}
14-
</span>
15-
</h4>
16-
17-
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="d-flex justify-content-between">
18-
<div>
19-
<select name="scope" id="scope" formControlName="scope" class="form-control" aria-label="Search scope">
20-
<option value="metadata">{{messagePrefix + '.search.scope.metadata' | translate}}</option>
21-
<option value="email">{{messagePrefix + '.search.scope.email' | translate}}</option>
22-
</select>
23-
</div>
24-
<div class="flex-grow-1 mr-3 ml-3">
25-
<div class="form-group input-group">
26-
<input type="text" name="query" id="query" formControlName="query"
27-
class="form-control" aria-label="Search input">
28-
<span class="input-group-append">
29-
<button type="submit" class="search-button btn btn-primary">
30-
<i class="fas fa-search"></i> {{ messagePrefix + '.search.button' | translate }}</button>
31-
</span>
32-
</div>
33-
</div>
34-
<div>
35-
<button (click)="clearFormAndResetResult();"
36-
class="btn btn-secondary">{{messagePrefix + '.button.see-all' | translate}}</button>
37-
</div>
38-
</form>
4+
<h4>{{messagePrefix + '.headMembers' | translate}}</h4>
395

40-
<ds-pagination *ngIf="(ePeopleSearchDtos | async)?.totalElements > 0"
41-
[paginationOptions]="configSearch"
42-
[pageInfoState]="(ePeopleSearchDtos | async)"
43-
[collectionSize]="(ePeopleSearchDtos | async)?.totalElements"
6+
<ds-pagination *ngIf="(ePeopleMembersOfGroup | async)?.totalElements > 0"
7+
[paginationOptions]="config"
8+
[pageInfoState]="(ePeopleMembersOfGroup | async)"
9+
[collectionSize]="(ePeopleMembersOfGroup | async)?.totalElements"
4410
[hideGear]="true"
4511
[hidePagerWhenSinglePage]="true">
4612

4713
<div class="table-responsive">
48-
<table id="epersonsSearch" class="table table-striped table-hover table-bordered">
14+
<table id="ePeopleMembersOfGroup" class="table table-striped table-hover table-bordered">
4915
<thead>
5016
<tr>
5117
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
@@ -55,35 +21,26 @@ <h4 id="search" class="border-bottom pb-2">
5521
</tr>
5622
</thead>
5723
<tbody>
58-
<tr *ngFor="let ePerson of (ePeopleSearchDtos | async)?.page">
59-
<td class="align-middle">{{ePerson.eperson.id}}</td>
24+
<tr *ngFor="let eperson of (ePeopleMembersOfGroup | async)?.page">
25+
<td class="align-middle">{{eperson.id}}</td>
6026
<td class="align-middle">
61-
<a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
27+
<a (click)="ePersonDataService.startEditingNewEPerson(eperson)"
6228
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">
63-
{{ dsoNameService.getName(ePerson.eperson) }}
29+
{{ dsoNameService.getName(eperson) }}
6430
</a>
6531
</td>
6632
<td class="align-middle">
67-
{{messagePrefix + '.table.email' | translate}}: {{ ePerson.eperson.email ? ePerson.eperson.email : '-' }}<br/>
68-
{{messagePrefix + '.table.netid' | translate}}: {{ ePerson.eperson.netid ? ePerson.eperson.netid : '-' }}
33+
{{messagePrefix + '.table.email' | translate}}: {{ eperson.email ? eperson.email : '-' }}<br/>
34+
{{messagePrefix + '.table.netid' | translate}}: {{ eperson.netid ? eperson.netid : '-' }}
6935
</td>
7036
<td class="align-middle">
7137
<div class="btn-group edit-field">
72-
<button *ngIf="ePerson.memberOfGroup"
73-
(click)="deleteMemberFromGroup(ePerson)"
38+
<button (click)="deleteMemberFromGroup(eperson)"
7439
[disabled]="actionConfig.remove.disabled"
7540
[ngClass]="['btn btn-sm', actionConfig.remove.css]"
76-
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: { name: dsoNameService.getName(ePerson.eperson) } }}">
41+
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: { name: dsoNameService.getName(eperson) } }}">
7742
<i [ngClass]="actionConfig.remove.icon"></i>
7843
</button>
79-
80-
<button *ngIf="!ePerson.memberOfGroup"
81-
(click)="addMemberToGroup(ePerson)"
82-
[disabled]="actionConfig.add.disabled"
83-
[ngClass]="['btn btn-sm', actionConfig.add.css]"
84-
title="{{messagePrefix + '.table.edit.buttons.add' | translate: { name: dsoNameService.getName(ePerson.eperson) } }}">
85-
<i [ngClass]="actionConfig.add.icon"></i>
86-
</button>
8744
</div>
8845
</td>
8946
</tr>
@@ -93,23 +50,50 @@ <h4 id="search" class="border-bottom pb-2">
9350

9451
</ds-pagination>
9552

96-
<div *ngIf="(ePeopleSearchDtos | async)?.totalElements == 0 && searchDone"
97-
class="alert alert-info w-100 mb-2"
53+
<div *ngIf="(ePeopleMembersOfGroup | async) == undefined || (ePeopleMembersOfGroup | async)?.totalElements == 0" class="alert alert-info w-100 mb-2"
9854
role="alert">
99-
{{messagePrefix + '.no-items' | translate}}
55+
{{messagePrefix + '.no-members-yet' | translate}}
10056
</div>
10157

102-
<h4>{{messagePrefix + '.headMembers' | translate}}</h4>
58+
<h4 id="search" class="border-bottom pb-2">
59+
<span
60+
*dsContextHelp="{
61+
content: 'admin.access-control.groups.form.tooltip.editGroup.addEpeople',
62+
id: 'edit-group-add-epeople',
63+
iconPlacement: 'right',
64+
tooltipPlacement: ['top', 'right', 'bottom']
65+
}"
66+
>
67+
{{messagePrefix + '.search.head' | translate}}
68+
</span>
69+
</h4>
10370

104-
<ds-pagination *ngIf="(ePeopleMembersOfGroupDtos | async)?.totalElements > 0"
105-
[paginationOptions]="config"
106-
[pageInfoState]="(ePeopleMembersOfGroupDtos | async)"
107-
[collectionSize]="(ePeopleMembersOfGroupDtos | async)?.totalElements"
71+
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="d-flex justify-content-between">
72+
<div class="flex-grow-1 mr-3">
73+
<div class="form-group input-group mr-3">
74+
<input type="text" name="query" id="query" formControlName="query"
75+
class="form-control" aria-label="Search input">
76+
<span class="input-group-append">
77+
<button type="submit" class="search-button btn btn-primary">
78+
<i class="fas fa-search"></i> {{ messagePrefix + '.search.button' | translate }}</button>
79+
</span>
80+
</div>
81+
</div>
82+
<div>
83+
<button (click)="clearFormAndResetResult();"
84+
class="btn btn-secondary">{{messagePrefix + '.button.see-all' | translate}}</button>
85+
</div>
86+
</form>
87+
88+
<ds-pagination *ngIf="(ePeopleSearch | async)?.totalElements > 0"
89+
[paginationOptions]="configSearch"
90+
[pageInfoState]="(ePeopleSearch | async)"
91+
[collectionSize]="(ePeopleSearch | async)?.totalElements"
10892
[hideGear]="true"
10993
[hidePagerWhenSinglePage]="true">
11094

11195
<div class="table-responsive">
112-
<table id="ePeopleMembersOfGroup" class="table table-striped table-hover table-bordered">
96+
<table id="epersonsSearch" class="table table-striped table-hover table-bordered">
11397
<thead>
11498
<tr>
11599
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
@@ -119,32 +103,24 @@ <h4>{{messagePrefix + '.headMembers' | translate}}</h4>
119103
</tr>
120104
</thead>
121105
<tbody>
122-
<tr *ngFor="let ePerson of (ePeopleMembersOfGroupDtos | async)?.page">
123-
<td class="align-middle">{{ePerson.eperson.id}}</td>
106+
<tr *ngFor="let eperson of (ePeopleSearch | async)?.page">
107+
<td class="align-middle">{{eperson.id}}</td>
124108
<td class="align-middle">
125-
<a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
109+
<a (click)="ePersonDataService.startEditingNewEPerson(eperson)"
126110
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">
127-
{{ dsoNameService.getName(ePerson.eperson) }}
111+
{{ dsoNameService.getName(eperson) }}
128112
</a>
129113
</td>
130114
<td class="align-middle">
131-
{{messagePrefix + '.table.email' | translate}}: {{ ePerson.eperson.email ? ePerson.eperson.email : '-' }}<br/>
132-
{{messagePrefix + '.table.netid' | translate}}: {{ ePerson.eperson.netid ? ePerson.eperson.netid : '-' }}
115+
{{messagePrefix + '.table.email' | translate}}: {{ eperson.email ? eperson.email : '-' }}<br/>
116+
{{messagePrefix + '.table.netid' | translate}}: {{ eperson.netid ? eperson.netid : '-' }}
133117
</td>
134118
<td class="align-middle">
135119
<div class="btn-group edit-field">
136-
<button *ngIf="ePerson.memberOfGroup"
137-
(click)="deleteMemberFromGroup(ePerson)"
138-
[disabled]="actionConfig.remove.disabled"
139-
[ngClass]="['btn btn-sm', actionConfig.remove.css]"
140-
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: { name: dsoNameService.getName(ePerson.eperson) } }}">
141-
<i [ngClass]="actionConfig.remove.icon"></i>
142-
</button>
143-
<button *ngIf="!ePerson.memberOfGroup"
144-
(click)="addMemberToGroup(ePerson)"
120+
<button (click)="addMemberToGroup(eperson)"
145121
[disabled]="actionConfig.add.disabled"
146122
[ngClass]="['btn btn-sm', actionConfig.add.css]"
147-
title="{{messagePrefix + '.table.edit.buttons.add' | translate: { name: dsoNameService.getName(ePerson.eperson) } }}">
123+
title="{{messagePrefix + '.table.edit.buttons.add' | translate: { name: dsoNameService.getName(eperson) } }}">
148124
<i [ngClass]="actionConfig.add.icon"></i>
149125
</button>
150126
</div>
@@ -156,9 +132,10 @@ <h4>{{messagePrefix + '.headMembers' | translate}}</h4>
156132

157133
</ds-pagination>
158134

159-
<div *ngIf="(ePeopleMembersOfGroupDtos | async) == undefined || (ePeopleMembersOfGroupDtos | async)?.totalElements == 0" class="alert alert-info w-100 mb-2"
135+
<div *ngIf="(ePeopleSearch | async)?.totalElements == 0 && searchDone"
136+
class="alert alert-info w-100 mb-2"
160137
role="alert">
161-
{{messagePrefix + '.no-members-yet' | translate}}
138+
{{messagePrefix + '.no-items' | translate}}
162139
</div>
163140

164141
</ng-container>

0 commit comments

Comments
 (0)