Skip to content

Commit ca40bf2

Browse files
author
Davide Negretti
committed
Merged in task/dspace-cris-2023_02_x/DSC-1542-davide (pull request DSpace#1921)
Task/dspace cris 2023 02 x/DSC-1542 davide
2 parents c21b4d1 + bb39406 commit ca40bf2

32 files changed

Lines changed: 247 additions & 7 deletions

src/app/shared/eperson-group-list/eperson-group-list.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
<td>{{entry.id}}</td>
2424
<td>{{dsoNameService.getName(entry)}}</td>
2525
<td class="text-center">
26-
<button class="btn btn-sm btn-outline-primary" (click)="emitSelect(entry)">
26+
<button class="btn btn-sm btn-outline-primary" *ngIf="!(isSelected(entry) | async)" (click)="emitSelect(entry)">
2727
{{'resource-policies.form.eperson-group-list.select.btn' | translate}}
2828
</button>
29+
<button class="btn btn-sm btn-primary" *ngIf="isSelected(entry) | async" (click)="emitDeselect(entry)">
30+
{{'resource-policies.form.eperson-group-list.deselect.btn' | translate}}
31+
</button>
2932
</td>
3033
</tr>
3134
</tbody>

src/app/shared/eperson-group-list/eperson-group-list.component.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ export class EpersonGroupListComponent implements OnInit, OnDestroy {
5555
*/
5656
@Output() select: EventEmitter<DSpaceObject> = new EventEmitter<DSpaceObject>();
5757

58+
/**
59+
* An event fired when a eperson or group is deselected.
60+
* Event's payload equals to DSpaceObject.
61+
*/
62+
@Output() deselect: EventEmitter<DSpaceObject> = new EventEmitter<DSpaceObject>();
63+
5864
/**
5965
* Current search query
6066
*/
@@ -204,5 +210,14 @@ export class EpersonGroupListComponent implements OnInit, OnDestroy {
204210
this.paginationService.clearPagination(this.paginationOptions.id);
205211
}
206212

207-
213+
/**
214+
* Method called when an entry is deselected.
215+
* Emit a new select Event
216+
*
217+
* @param entry The eperson or group selected
218+
*/
219+
emitDeselect(entry: DSpaceObject) {
220+
this.deselect.emit(entry);
221+
this.entrySelectedId.next(null);
222+
}
208223
}

src/app/shared/resource-policies/form/resource-policy-form.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
[displayReset]="false"></ds-form>
88
<div class="container-fluid">
99
<label for="ResourcePolicyObject">{{'resource-policies.form.eperson-group-list.label' | translate}}</label>
10-
<input id="ResourcePolicyObject" class="form-control mb-3" type="text" [value]="resourcePolicyTargetName$ | async">
10+
<input id="ResourcePolicyObject" class="form-control mb-3" type="text" [value]="resourcePolicyTargetName$ | async" disabled>
1111
<ul ngbNav #nav="ngbNav" class="nav-pills" [(activeId)]="navActiveId" (navChange)="onNavChange($event)">
1212
<li [ngbNavItem]="'eperson'">
1313
<a ngbNavLink>{{'resource-policies.form.eperson-group-list.tab.eperson' | translate}}</a>
1414
<ng-template ngbNavContent>
15-
<ds-eperson-group-list (select)="updateObjectSelected($event, true)"></ds-eperson-group-list>
15+
<ds-eperson-group-list (deselect)="updateObjectSelected($event, false, true)" (select)="updateObjectSelected($event, true)"></ds-eperson-group-list>
1616
</ng-template>
1717
</li>
1818
<li [ngbNavItem]="'group'">
1919
<a ngbNavLink>{{'resource-policies.form.eperson-group-list.tab.group' | translate}}</a>
2020
<ng-template ngbNavContent>
2121
<ds-eperson-group-list [isListOfEPerson]="false"
22+
(deselect)="updateObjectSelected($event, false, true)"
2223
(select)="updateObjectSelected($event, false)"></ds-eperson-group-list>
2324
</ng-template>
2425
</li>

src/app/shared/resource-policies/form/resource-policy-form.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,17 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
275275
/**
276276
* Update reference to the eperson or group that will be granted the permission
277277
*/
278-
updateObjectSelected(object: DSpaceObject, isEPerson: boolean): void {
278+
updateObjectSelected(object: DSpaceObject, isEPerson: boolean, deselect = false): void {
279279
this.resourcePolicyTargetUpdated = true;
280-
this.resourcePolicyGrant = object;
281280
this.resourcePolicyGrantType = isEPerson ? 'eperson' : 'group';
282-
this.resourcePolicyTargetName$.next(this.getResourcePolicyTargetName());
281+
282+
if (deselect) {
283+
this.resourcePolicyGrant = null;
284+
this.resourcePolicyTargetName$.next(null);
285+
} else {
286+
this.resourcePolicyGrant = object;
287+
this.resourcePolicyTargetName$.next(this.getResourcePolicyTargetName());
288+
}
283289
}
284290

285291
/**

src/assets/i18n/ar.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,6 +4227,10 @@
42274227
// TODO New key - Add a translation
42284228
"error.top-level-communities": "Error fetching top-level communities",
42294229

4230+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
4231+
// TODO New key - Add a translation
4232+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
4233+
42304234
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
42314235
// TODO New key - Add a translation
42324236
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -9741,6 +9745,10 @@
97419745
// TODO New key - Add a translation
97429746
"resource-policies.form.eperson-group-list.select.btn": "Select",
97439747

9748+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
9749+
// TODO New key - Add a translation
9750+
"resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
9751+
97449752
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
97459753
// TODO New key - Add a translation
97469754
"resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",

src/assets/i18n/bn.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,6 +3608,10 @@
36083608
// "error.top-level-communities": "Error fetching top-level communities",
36093609
"error.top-level-communities": "শীর্ষ-স্তরের সম্প্রদায়গুলো নিয়ে আসতে ত্রুটি হচ্ছে",
36103610

3611+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3612+
// TODO New key - Add a translation
3613+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3614+
36113615
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
36123616
// TODO New key - Add a translation
36133617
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -8401,6 +8405,10 @@
84018405
// "resource-policies.form.eperson-group-list.select.btn": "Select",
84028406
"resource-policies.form.eperson-group-list.select.btn": "নির্বাচন করুন",
84038407

8408+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8409+
// TODO New key - Add a translation
8410+
"resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8411+
84048412
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
84058413
"resource-policies.form.eperson-group-list.tab.eperson": "একটি ই-পারসনের জন্য অনুসন্ধান করুন",
84068414

src/assets/i18n/ca.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,6 +3538,10 @@
35383538
// "error.top-level-communities": "Error fetching top-level communities",
35393539
"error.top-level-communities": "Error en recuperar les comunitats de primer nivell",
35403540

3541+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3542+
// TODO New key - Add a translation
3543+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3544+
35413545
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
35423546
// TODO New key - Add a translation
35433547
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -8230,6 +8234,10 @@
82308234
// "resource-policies.form.eperson-group-list.select.btn": "Select",
82318235
"resource-policies.form.eperson-group-list.select.btn": "Seleccionar",
82328236

8237+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8238+
// TODO New key - Add a translation
8239+
"resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8240+
82338241
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
82348242
"resource-policies.form.eperson-group-list.tab.eperson": "Cerca un usuari",
82358243

src/assets/i18n/cs.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4193,6 +4193,10 @@
41934193
// "error.top-level-communities": "Error fetching top-level communities",
41944194
"error.top-level-communities": "Chyba během stahování komunit nejvyšší úrovně",
41954195

4196+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
4197+
// TODO New key - Add a translation
4198+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
4199+
41964200
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
41974201
// TODO New key - Add a translation
41984202
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -9660,6 +9664,10 @@
96609664
// TODO New key - Add a translation
96619665
"resource-policies.form.eperson-group-list.select.btn": "Select",
96629666

9667+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
9668+
// TODO New key - Add a translation
9669+
"resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
9670+
96639671
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
96649672
// TODO New key - Add a translation
96659673
"resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",

src/assets/i18n/de.json5

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3657,6 +3657,10 @@
36573657
// "error.top-level-communities": "Error fetching top-level communities",
36583658
"error.top-level-communities": "Hauptbereich konnte nicht geladen werden",
36593659

3660+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3661+
// TODO New key - Add a translation
3662+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3663+
36603664
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
36613665
// TODO New key - Add a translation
36623666
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -8531,6 +8535,9 @@
85318535
// "resource-policies.form.eperson-group-list.select.btn": "Select",
85328536
"resource-policies.form.eperson-group-list.select.btn": "Auswählen",
85338537

8538+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8539+
"resource-policies.form.eperson-group-list.deselect.btn": "Abwälhen",
8540+
85348541
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
85358542
"resource-policies.form.eperson-group-list.tab.eperson": "Suche nach einer Person",
85368543

src/assets/i18n/el.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,10 @@
35993599
// "error.top-level-communities": "Error fetching top-level communities",
36003600
"error.top-level-communities": "Σφάλμα κατά την ανάκτηση κοινοτήτων ανώτατου επιπέδου",
36013601

3602+
// "error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3603+
// TODO New key - Add a translation
3604+
"error.validation.cclicense.required": "You must grant this cclicense to complete your submission. If you are unable to grant the cclicense at this time, you may save your work and return later or remove the submission.",
3605+
36023606
// "error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
36033607
// TODO New key - Add a translation
36043608
"error.validation.custom-url.conflict": "The custom url has been already used, please try with a new one.",
@@ -8374,6 +8378,10 @@
83748378
// "resource-policies.form.eperson-group-list.select.btn": "Select",
83758379
"resource-policies.form.eperson-group-list.select.btn": "Επιλέγω",
83768380

8381+
// "resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8382+
// TODO New key - Add a translation
8383+
"resource-policies.form.eperson-group-list.deselect.btn": "Deselect",
8384+
83778385
// "resource-policies.form.eperson-group-list.tab.eperson": "Search for a ePerson",
83788386
"resource-policies.form.eperson-group-list.tab.eperson": "Αναζητήστε ένα ePerson",
83798387

0 commit comments

Comments
 (0)