Skip to content

Commit 6ba8cbd

Browse files
authored
Merge branch 'main' into starts-with-text-missing-label
2 parents 30ae91b + 37a323e commit 6ba8cbd

291 files changed

Lines changed: 5087 additions & 1912 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ dspace-angular
413413
│ ├── merge-i18n-files.ts *
414414
│ ├── serve.ts *
415415
│ ├── sync-i18n-files.ts *
416-
│ ├── test-rest.ts *
417-
│ └── webpack.js *
416+
│ └── test-rest.ts *
418417
├── src * The source of the application
419418
│ ├── app * The source code of the application, subdivided by module/page.
420419
│ ├── assets * Folder for static resources

scripts/webpack.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/app/access-control/epeople-registry/epeople-registry.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ <h3 id="search" class="border-bottom pb-2">{{labelPrefix + 'search.head' | trans
6868
<tr *ngFor="let epersonDto of (ePeopleDto$ | async)?.page"
6969
[ngClass]="{'table-primary' : isActive(epersonDto.eperson) | async}">
7070
<td>{{epersonDto.eperson.id}}</td>
71-
<td>{{epersonDto.eperson.name}}</td>
71+
<td>{{ dsoNameService.getName(epersonDto.eperson) }}</td>
7272
<td>{{epersonDto.eperson.email}}</td>
7373
<td>
7474
<div class="btn-group edit-field">
7575
<button (click)="toggleEditEPerson(epersonDto.eperson)"
7676
class="btn btn-outline-primary btn-sm access-control-editEPersonButton"
77-
title="{{labelPrefix + 'table.edit.buttons.edit' | translate: {name: epersonDto.eperson.name} }}">
77+
title="{{labelPrefix + 'table.edit.buttons.edit' | translate: { name: dsoNameService.getName(epersonDto.eperson) } }}">
7878
<i class="fas fa-edit fa-fw"></i>
7979
</button>
8080
<button [disabled]="!epersonDto.ableToDelete" (click)="deleteEPerson(epersonDto.eperson)"
8181
class="delete-button btn btn-outline-danger btn-sm access-control-deleteEPersonButton"
82-
title="{{labelPrefix + 'table.edit.buttons.remove' | translate: {name: epersonDto.eperson.name} }}">
82+
title="{{labelPrefix + 'table.edit.buttons.remove' | translate: { name: dsoNameService.getName(epersonDto.eperson) } }}">
8383
<i class="fas fa-trash-alt fa-fw"></i>
8484
</button>
8585
</div>

src/app/access-control/epeople-registry/epeople-registry.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { RequestService } from '../../core/data/request.service';
2121
import { PageInfo } from '../../core/shared/page-info.model';
2222
import { NoContent } from '../../core/shared/NoContent.model';
2323
import { PaginationService } from '../../core/pagination/pagination.service';
24+
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
2425

2526
@Component({
2627
selector: 'ds-epeople-registry',
@@ -93,7 +94,9 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
9394
private router: Router,
9495
private modalService: NgbModal,
9596
private paginationService: PaginationService,
96-
public requestService: RequestService) {
97+
public requestService: RequestService,
98+
public dsoNameService: DSONameService,
99+
) {
97100
this.currentSearchQuery = '';
98101
this.currentSearchScope = 'metadata';
99102
this.searchForm = this.formBuilder.group(({
@@ -121,7 +124,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
121124
this.subs.push(this.ePeople$.pipe(
122125
switchMap((epeople: PaginatedList<EPerson>) => {
123126
if (epeople.pageInfo.totalElements > 0) {
124-
return combineLatest(...epeople.page.map((eperson) => {
127+
return combineLatest([...epeople.page.map((eperson: EPerson) => {
125128
return this.authorizationService.isAuthorized(FeatureID.CanDelete, hasValue(eperson) ? eperson.self : undefined).pipe(
126129
map((authorized) => {
127130
const epersonDtoModel: EpersonDtoModel = new EpersonDtoModel();
@@ -130,7 +133,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
130133
return epersonDtoModel;
131134
})
132135
);
133-
})).pipe(map((dtos: EpersonDtoModel[]) => {
136+
})]).pipe(map((dtos: EpersonDtoModel[]) => {
134137
return buildPaginatedList(epeople.pageInfo, dtos);
135138
}));
136139
} else {
@@ -237,7 +240,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
237240
if (hasValue(ePerson.id)) {
238241
this.epersonService.deleteEPerson(ePerson).pipe(getFirstCompletedRemoteData()).subscribe((restResponse: RemoteData<NoContent>) => {
239242
if (restResponse.hasSucceeded) {
240-
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', {name: ePerson.name}));
243+
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', {name: this.dsoNameService.getName(ePerson)}));
241244
} else {
242245
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + ePerson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.errorMessage);
243246
}

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ <h5>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h5>
6565
<tbody>
6666
<tr *ngFor="let group of (groups | async)?.payload?.page">
6767
<td class="align-middle">{{group.id}}</td>
68-
<td class="align-middle"><a (click)="groupsDataService.startEditingNewGroup(group)"
69-
[routerLink]="[groupsDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
70-
<td class="align-middle">{{(group.object | async)?.payload?.name}}</td>
68+
<td class="align-middle">
69+
<a (click)="groupsDataService.startEditingNewGroup(group)"
70+
[routerLink]="[groupsDataService.getGroupEditPageRouterLink(group)]">
71+
{{ dsoNameService.getName(group) }}
72+
</a>
73+
</td>
74+
<td class="align-middle">{{ dsoNameService.getName(undefined) }}</td>
7175
</tr>
7276
</tbody>
7377
</table>

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { ValidateEmailNotTaken } from './validators/email-taken.validator';
3737
import { Registration } from '../../../core/shared/registration.model';
3838
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
3939
import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component';
40+
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
4041

4142
@Component({
4243
selector: 'ds-eperson-form',
@@ -192,6 +193,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
192193
private paginationService: PaginationService,
193194
public requestService: RequestService,
194195
private epersonRegistrationService: EpersonRegistrationService,
196+
public dsoNameService: DSONameService,
195197
) {
196198
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
197199
this.epersonInitial = eperson;
@@ -212,14 +214,14 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
212214
*/
213215
initialisePage() {
214216

215-
observableCombineLatest(
217+
observableCombineLatest([
216218
this.translateService.get(`${this.messagePrefix}.firstName`),
217219
this.translateService.get(`${this.messagePrefix}.lastName`),
218220
this.translateService.get(`${this.messagePrefix}.email`),
219221
this.translateService.get(`${this.messagePrefix}.canLogIn`),
220222
this.translateService.get(`${this.messagePrefix}.requireCertificate`),
221223
this.translateService.get(`${this.messagePrefix}.emailHint`),
222-
).subscribe(([firstName, lastName, email, canLogIn, requireCertificate, emailHint]) => {
224+
]).subscribe(([firstName, lastName, email, canLogIn, requireCertificate, emailHint]) => {
223225
this.firstName = new DynamicInputModel({
224226
id: 'firstName',
225227
label: firstName,
@@ -386,10 +388,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
386388
getFirstCompletedRemoteData()
387389
).subscribe((rd: RemoteData<EPerson>) => {
388390
if (rd.hasSucceeded) {
389-
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.created.success', { name: ePersonToCreate.name }));
391+
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.created.success', { name: this.dsoNameService.getName(ePersonToCreate) }));
390392
this.submitForm.emit(ePersonToCreate);
391393
} else {
392-
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.created.failure', { name: ePersonToCreate.name }));
394+
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.created.failure', { name: this.dsoNameService.getName(ePersonToCreate) }));
393395
this.cancelForm.emit();
394396
}
395397
});
@@ -425,10 +427,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
425427
const response = this.epersonService.updateEPerson(editedEperson);
426428
response.pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData<EPerson>) => {
427429
if (rd.hasSucceeded) {
428-
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.edited.success', { name: editedEperson.name }));
430+
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.edited.success', { name: this.dsoNameService.getName(editedEperson) }));
429431
this.submitForm.emit(editedEperson);
430432
} else {
431-
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.edited.failure', { name: editedEperson.name }));
433+
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.edited.failure', { name: this.dsoNameService.getName(editedEperson) }));
432434
this.cancelForm.emit();
433435
}
434436
});
@@ -476,7 +478,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
476478
if (hasValue(eperson.id)) {
477479
this.epersonService.deleteEPerson(eperson).pipe(getFirstCompletedRemoteData()).subscribe((restResponse: RemoteData<NoContent>) => {
478480
if (restResponse.hasSucceeded) {
479-
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: eperson.name }));
481+
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: this.dsoNameService.getName(eperson) }));
480482
this.submitForm.emit();
481483
} else {
482484
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + eperson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.errorMessage);
@@ -554,7 +556,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
554556
.subscribe((list: PaginatedList<EPerson>) => {
555557
if (list.totalElements > 0) {
556558
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.' + notificationSection + '.failure.emailInUse', {
557-
name: ePerson.name,
559+
name: this.dsoNameService.getName(ePerson),
558560
email: ePerson.email
559561
}));
560562
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h2 class="border-bottom pb-2">
2626
<ds-alert *ngIf="groupBeingEdited?.permanent" [type]="AlertTypeEnum.Warning"
2727
[content]="messagePrefix + '.alert.permanent'"></ds-alert>
2828
<ds-alert *ngIf="!(canEdit$ | async) && (groupDataService.getActiveGroup() | async)" [type]="AlertTypeEnum.Warning"
29-
[content]="(messagePrefix + '.alert.workflowGroup' | translate:{ name: (getLinkedDSO(groupBeingEdited) | async)?.payload?.name, comcol: (getLinkedDSO(groupBeingEdited) | async)?.payload?.type, comcolEditRolesRoute: (getLinkedEditRolesRoute(groupBeingEdited) | async) })">
29+
[content]="(messagePrefix + '.alert.workflowGroup' | translate:{ name: dsoNameService.getName((getLinkedDSO(groupBeingEdited) | async)?.payload), comcol: (getLinkedDSO(groupBeingEdited) | async)?.payload?.type, comcolEditRolesRoute: (getLinkedEditRolesRoute(groupBeingEdited) | async) })">
3030
</ds-alert>
3131

3232
<ds-form [formId]="formId"

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import { NotificationsServiceStub } from '../../../shared/testing/notifications-
3636
import { Operation } from 'fast-json-patch';
3737
import { ValidateGroupExists } from './validators/group-exists.validator';
3838
import { NoContent } from '../../../core/shared/NoContent.model';
39+
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
40+
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
3941

4042
describe('GroupFormComponent', () => {
4143
let component: GroupFormComponent;
@@ -188,7 +190,7 @@ describe('GroupFormComponent', () => {
188190
translateService = getMockTranslateService();
189191
router = new RouterMock();
190192
notificationService = new NotificationsServiceStub();
191-
TestBed.configureTestingModule({
193+
return TestBed.configureTestingModule({
192194
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
193195
TranslateModule.forRoot({
194196
loader: {
@@ -198,7 +200,8 @@ describe('GroupFormComponent', () => {
198200
}),
199201
],
200202
declarations: [GroupFormComponent],
201-
providers: [GroupFormComponent,
203+
providers: [
204+
{ provide: DSONameService, useValue: new DSONameServiceMock() },
202205
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
203206
{ provide: GroupDataService, useValue: groupsDataServiceStub },
204207
{ provide: DSpaceObjectDataService, useValue: dsoDataServiceStub },
@@ -240,8 +243,8 @@ describe('GroupFormComponent', () => {
240243
fixture.detectChanges();
241244
});
242245

243-
it('should emit a new group using the correct values', waitForAsync(() => {
244-
fixture.whenStable().then(() => {
246+
it('should emit a new group using the correct values', (async () => {
247+
await fixture.whenStable().then(() => {
245248
expect(component.submitForm.emit).toHaveBeenCalledWith(expected);
246249
});
247250
}));
@@ -303,8 +306,8 @@ describe('GroupFormComponent', () => {
303306
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
304307
});
305308

306-
it('should emit the existing group using the correct new values', waitForAsync(() => {
307-
fixture.whenStable().then(() => {
309+
it('should emit the existing group using the correct new values', (async () => {
310+
await fixture.whenStable().then(() => {
308311
expect(component.submitForm.emit).toHaveBeenCalledWith(expected2);
309312
});
310313
}));

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { followLink } from '../../../shared/utils/follow-link-config.model';
4646
import { NoContent } from '../../../core/shared/NoContent.model';
4747
import { Operation } from 'fast-json-patch';
4848
import { ValidateGroupExists } from './validators/group-exists.validator';
49+
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
4950
import { environment } from '../../../../environments/environment';
5051

5152
@Component({
@@ -134,7 +135,8 @@ export class GroupFormComponent implements OnInit, OnDestroy {
134135
groupNameValueChangeSubscribe: Subscription;
135136

136137

137-
constructor(public groupDataService: GroupDataService,
138+
constructor(
139+
public groupDataService: GroupDataService,
138140
private ePersonDataService: EPersonDataService,
139141
private dSpaceObjectDataService: DSpaceObjectDataService,
140142
private formBuilderService: FormBuilderService,
@@ -145,7 +147,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
145147
private authorizationService: AuthorizationDataService,
146148
private modalService: NgbModal,
147149
public requestService: RequestService,
148-
protected changeDetectorRef: ChangeDetectorRef) {
150+
protected changeDetectorRef: ChangeDetectorRef,
151+
public dsoNameService: DSONameService,
152+
) {
149153
}
150154

151155
ngOnInit() {
@@ -331,7 +335,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
331335
.subscribe((list: PaginatedList<Group>) => {
332336
if (list.totalElements > 0) {
333337
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.' + notificationSection + '.failure.groupNameInUse', {
334-
name: group.name
338+
name: this.dsoNameService.getName(group),
335339
}));
336340
}
337341
}));
@@ -364,10 +368,10 @@ export class GroupFormComponent implements OnInit, OnDestroy {
364368
getFirstCompletedRemoteData()
365369
).subscribe((rd: RemoteData<Group>) => {
366370
if (rd.hasSucceeded) {
367-
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: rd.payload.name }));
371+
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: this.dsoNameService.getName(rd.payload) }));
368372
this.submitForm.emit(rd.payload);
369373
} else {
370-
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.edited.failure', { name: group.name }));
374+
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.edited.failure', { name: this.dsoNameService.getName(group) }));
371375
this.cancelForm.emit();
372376
}
373377
});
@@ -427,11 +431,11 @@ export class GroupFormComponent implements OnInit, OnDestroy {
427431
this.groupDataService.delete(group.id).pipe(getFirstCompletedRemoteData())
428432
.subscribe((rd: RemoteData<NoContent>) => {
429433
if (rd.hasSucceeded) {
430-
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.deleted.success', { name: group.name }));
434+
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.deleted.success', { name: this.dsoNameService.getName(group) }));
431435
this.onCancel();
432436
} else {
433437
this.notificationsService.error(
434-
this.translateService.get(this.messagePrefix + '.notification.deleted.failure.title', { name: group.name }),
438+
this.translateService.get(this.messagePrefix + '.notification.deleted.failure.title', { name: this.dsoNameService.getName(group) }),
435439
this.translateService.get(this.messagePrefix + '.notification.deleted.failure.content', { cause: rd.errorMessage }));
436440
}
437441
});

0 commit comments

Comments
 (0)