mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge remote-tracking branch 'origin/main' into CST-4510-entity-selection-porting
This commit is contained in:
@@ -52,15 +52,17 @@
|
||||
<table id="groups" class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.collectionOrCommunity' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
||||
<td>{{group.id}}</td>
|
||||
<td><a (click)="groupsDataService.startEditingNewGroup(group)"
|
||||
<td class="align-middle">{{group.id}}</td>
|
||||
<td class="align-middle"><a (click)="groupsDataService.startEditingNewGroup(group)"
|
||||
[routerLink]="[groupsDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
|
||||
<td class="align-middle">{{(group.object | async)?.payload?.name}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@@ -32,6 +32,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-eperson-form',
|
||||
@@ -272,7 +273,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
switchMap(([eperson, findListOptions]) => {
|
||||
if (eperson != null) {
|
||||
return this.groupsDataService.findAllByHref(eperson._links.groups.href, findListOptions);
|
||||
return this.groupsDataService.findAllByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
|
||||
}
|
||||
return observableOf(undefined);
|
||||
})
|
||||
|
@@ -14,9 +14,9 @@ import {
|
||||
combineLatest as observableCombineLatest,
|
||||
Observable,
|
||||
of as observableOf,
|
||||
Subscription
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import { catchError, map, switchMap, take } from 'rxjs/operators';
|
||||
import { catchError, map, switchMap, take, filter } from 'rxjs/operators';
|
||||
import { getCollectionEditRolesRoute } from '../../../collection-page/collection-page-routing-paths';
|
||||
import { getCommunityEditRolesRoute } from '../../../community-page/community-page-routing-paths';
|
||||
import { DSpaceObjectDataService } from '../../../core/data/dspace-object-data.service';
|
||||
@@ -34,7 +34,8 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import {
|
||||
getRemoteDataPayload,
|
||||
getFirstSucceededRemoteData,
|
||||
getFirstCompletedRemoteData
|
||||
getFirstCompletedRemoteData,
|
||||
getFirstSucceededRemoteDataPayload
|
||||
} from '../../../core/shared/operators';
|
||||
import { AlertType } from '../../../shared/alert/aletr-type';
|
||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||
@@ -65,6 +66,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
* Dynamic models for the inputs of form
|
||||
*/
|
||||
groupName: DynamicInputModel;
|
||||
groupCommunity: DynamicInputModel;
|
||||
groupDescription: DynamicTextAreaModel;
|
||||
|
||||
/**
|
||||
@@ -125,16 +127,16 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
public AlertTypeEnum = AlertType;
|
||||
|
||||
constructor(public groupDataService: GroupDataService,
|
||||
private ePersonDataService: EPersonDataService,
|
||||
private dSpaceObjectDataService: DSpaceObjectDataService,
|
||||
private formBuilderService: FormBuilderService,
|
||||
private translateService: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private route: ActivatedRoute,
|
||||
protected router: Router,
|
||||
private authorizationService: AuthorizationDataService,
|
||||
private modalService: NgbModal,
|
||||
public requestService: RequestService) {
|
||||
private ePersonDataService: EPersonDataService,
|
||||
private dSpaceObjectDataService: DSpaceObjectDataService,
|
||||
private formBuilderService: FormBuilderService,
|
||||
private translateService: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private route: ActivatedRoute,
|
||||
protected router: Router,
|
||||
private authorizationService: AuthorizationDataService,
|
||||
private modalService: NgbModal,
|
||||
public requestService: RequestService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -160,8 +162,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
observableCombineLatest(
|
||||
this.translateService.get(`${this.messagePrefix}.groupName`),
|
||||
this.translateService.get(`${this.messagePrefix}.groupCommunity`),
|
||||
this.translateService.get(`${this.messagePrefix}.groupDescription`)
|
||||
).subscribe(([groupName, groupDescription]) => {
|
||||
).subscribe(([groupName, groupCommunity, groupDescription]) => {
|
||||
this.groupName = new DynamicInputModel({
|
||||
id: 'groupName',
|
||||
label: groupName,
|
||||
@@ -171,6 +174,13 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
required: true,
|
||||
});
|
||||
this.groupCommunity = new DynamicInputModel({
|
||||
id: 'groupCommunity',
|
||||
label: groupCommunity,
|
||||
name: 'groupCommunity',
|
||||
required: false,
|
||||
readOnly: true,
|
||||
});
|
||||
this.groupDescription = new DynamicTextAreaModel({
|
||||
id: 'groupDescription',
|
||||
label: groupDescription,
|
||||
@@ -185,17 +195,36 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
this.subs.push(
|
||||
observableCombineLatest(
|
||||
this.groupDataService.getActiveGroup(),
|
||||
this.canEdit$
|
||||
).subscribe(([activeGroup, canEdit]) => {
|
||||
this.canEdit$,
|
||||
this.groupDataService.getActiveGroup()
|
||||
.pipe(filter((activeGroup) => hasValue(activeGroup)),switchMap((activeGroup) => this.getLinkedDSO(activeGroup).pipe(getFirstSucceededRemoteDataPayload())))
|
||||
).subscribe(([activeGroup, canEdit, linkedObject]) => {
|
||||
|
||||
if (activeGroup != null) {
|
||||
this.groupBeingEdited = activeGroup;
|
||||
this.formGroup.patchValue({
|
||||
groupName: activeGroup != null ? activeGroup.name : '',
|
||||
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
||||
});
|
||||
if (!canEdit || activeGroup.permanent) {
|
||||
this.formGroup.disable();
|
||||
|
||||
if (linkedObject?.name) {
|
||||
this.formBuilderService.insertFormGroupControl(1, this.formGroup, this.formModel, this.groupCommunity);
|
||||
this.formGroup.patchValue({
|
||||
groupName: activeGroup.name,
|
||||
groupCommunity: linkedObject?.name ?? '',
|
||||
groupDescription: activeGroup.firstMetadataValue('dc.description'),
|
||||
});
|
||||
} else {
|
||||
this.formModel = [
|
||||
this.groupName,
|
||||
this.groupDescription,
|
||||
];
|
||||
this.formGroup.patchValue({
|
||||
groupName: activeGroup.name,
|
||||
groupDescription: activeGroup.firstMetadataValue('dc.description'),
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!canEdit || activeGroup.permanent) {
|
||||
this.formGroup.disable();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
})
|
||||
);
|
||||
@@ -417,11 +446,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
if (hasValue(group) && hasValue(group._links.object.href)) {
|
||||
return this.getLinkedDSO(group).pipe(
|
||||
map((rd: RemoteData<DSpaceObject>) => {
|
||||
if (hasValue(rd) && hasValue(rd.payload)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return hasValue(rd) && hasValue(rd.payload);
|
||||
}),
|
||||
catchError(() => observableOf(false)),
|
||||
);
|
||||
|
@@ -38,17 +38,22 @@
|
||||
<table id="epersonsSearch" class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th>{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.identity' | translate}}</th>
|
||||
<th class="align-middle">{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let ePerson of (ePeopleSearchDtos | async)?.page">
|
||||
<td>{{ePerson.eperson.id}}</td>
|
||||
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||
<td class="align-middle">{{ePerson.eperson.id}}</td>
|
||||
<td class="align-middle"><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.eperson.name}}</a></td>
|
||||
<td>
|
||||
<td class="align-middle">
|
||||
{{messagePrefix + '.table.email' | translate}}: {{ ePerson.eperson.email ? ePerson.eperson.email : '-' }}<br/>
|
||||
{{messagePrefix + '.table.netid' | translate}}: {{ ePerson.eperson.netid ? ePerson.eperson.netid : '-' }}
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<div class="btn-group edit-field">
|
||||
<button *ngIf="(ePerson.memberOfGroup)"
|
||||
(click)="deleteMemberFromGroup(ePerson)"
|
||||
@@ -91,17 +96,22 @@
|
||||
<table id="ePeopleMembersOfGroup" class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th>{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.identity' | translate}}</th>
|
||||
<th class="align-middle">{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let ePerson of (ePeopleMembersOfGroupDtos | async)?.page">
|
||||
<td>{{ePerson.eperson.id}}</td>
|
||||
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||
<td class="align-middle">{{ePerson.eperson.id}}</td>
|
||||
<td class="align-middle"><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.eperson.name}}</a></td>
|
||||
<td>
|
||||
<td class="align-middle">
|
||||
{{messagePrefix + '.table.email' | translate}}: {{ ePerson.eperson.email ? ePerson.eperson.email : '-' }}<br/>
|
||||
{{messagePrefix + '.table.netid' | translate}}: {{ ePerson.eperson.netid ? ePerson.eperson.netid : '-' }}
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<div class="btn-group edit-field">
|
||||
<button (click)="deleteMemberFromGroup(ePerson)"
|
||||
class="btn btn-outline-danger btn-sm"
|
||||
|
@@ -35,17 +35,19 @@
|
||||
<table id="groupsSearch" class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th>{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.collectionOrCommunity' | translate}}</th>
|
||||
<th class="align-middle">{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let group of (searchResults$ | async)?.payload?.page">
|
||||
<td>{{group.id}}</td>
|
||||
<td><a (click)="groupDataService.startEditingNewGroup(group)"
|
||||
<td class="align-middle">{{group.id}}</td>
|
||||
<td class="align-middle"><a (click)="groupDataService.startEditingNewGroup(group)"
|
||||
[routerLink]="[groupDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
|
||||
<td>
|
||||
<td class="align-middle">{{(group.object | async)?.payload?.name}}</td>
|
||||
<td class="align-middle">
|
||||
<div class="btn-group edit-field">
|
||||
<button *ngIf="(isSubgroupOfGroup(group) | async) && !(isActiveGroup(group) | async)"
|
||||
(click)="deleteSubgroupFromGroup(group)"
|
||||
@@ -88,17 +90,19 @@
|
||||
<table id="subgroupsOfGroup" class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.id' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.name' | translate}}</th>
|
||||
<th scope="col" class="align-middle">{{messagePrefix + '.table.collectionOrCommunity' | translate}}</th>
|
||||
<th>{{messagePrefix + '.table.edit' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let group of (subGroups$ | async)?.payload?.page">
|
||||
<td>{{group.id}}</td>
|
||||
<td><a (click)="groupDataService.startEditingNewGroup(group)"
|
||||
<td class="align-middle">{{group.id}}</td>
|
||||
<td class="align-middle"><a (click)="groupDataService.startEditingNewGroup(group)"
|
||||
[routerLink]="[groupDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
|
||||
<td>
|
||||
<td class="align-middle">{{(group.object | async)?.payload?.name}}</td>
|
||||
<td class="align-middle">
|
||||
<div class="btn-group edit-field">
|
||||
<button (click)="deleteSubgroupFromGroup(group)"
|
||||
class="btn btn-outline-danger btn-sm deleteButton"
|
||||
|
@@ -17,6 +17,7 @@ import { NotificationsService } from '../../../../shared/notifications/notificat
|
||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||
import { NoContent } from '../../../../core/shared/NoContent.model';
|
||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
||||
|
||||
/**
|
||||
* Keys to keep track of specific subscriptions
|
||||
@@ -117,7 +118,10 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
switchMap((config) => this.groupDataService.findAllByHref(this.groupBeingEdited._links.subgroups.href, {
|
||||
currentPage: config.currentPage,
|
||||
elementsPerPage: config.pageSize
|
||||
}
|
||||
},
|
||||
true,
|
||||
true,
|
||||
followLink('object')
|
||||
))
|
||||
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
||||
this.subGroups$.next(rd);
|
||||
@@ -217,7 +221,8 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
switchMap((config) => this.groupDataService.searchGroups(this.currentSearchQuery, {
|
||||
currentPage: config.currentPage,
|
||||
elementsPerPage: config.pageSize
|
||||
}))
|
||||
}, true, true, followLink('object')
|
||||
))
|
||||
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
||||
this.searchResults$.next(rd);
|
||||
}));
|
||||
|
@@ -48,6 +48,7 @@
|
||||
<tr>
|
||||
<th scope="col">{{messagePrefix + 'table.id' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + 'table.name' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + 'table.collectionOrCommunity' | translate}}</th>
|
||||
<th scope="col">{{messagePrefix + 'table.members' | translate}}</th>
|
||||
<th>{{messagePrefix + 'table.edit' | translate}}</th>
|
||||
</tr>
|
||||
@@ -56,6 +57,7 @@
|
||||
<tr *ngFor="let groupDto of (groupsDto$ | async)?.page">
|
||||
<td>{{groupDto.group.id}}</td>
|
||||
<td>{{groupDto.group.name}}</td>
|
||||
<td>{{(groupDto.group.object | async)?.payload?.name}}</td>
|
||||
<td>{{groupDto.epersons?.totalElements + groupDto.subgroups?.totalElements}}</td>
|
||||
<td>
|
||||
<div class="btn-group edit-field">
|
||||
|
@@ -152,6 +152,7 @@ describe('GroupRegistryComponent', () => {
|
||||
return createSuccessfulRemoteDataObject$(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
||||
setIsAuthorized(true, true);
|
||||
paginationService = new PaginationServiceStub();
|
||||
@@ -200,6 +201,13 @@ describe('GroupRegistryComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should display community/collection name if present', () => {
|
||||
const collectionNamesFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(3)'));
|
||||
expect(collectionNamesFound.length).toEqual(2);
|
||||
expect(collectionNamesFound[0].nativeElement.textContent).toEqual('');
|
||||
expect(collectionNamesFound[1].nativeElement.textContent).toEqual('testgroupid2objectName');
|
||||
});
|
||||
|
||||
describe('edit buttons', () => {
|
||||
describe('when the user is a general admin', () => {
|
||||
beforeEach(fakeAsync(() => {
|
||||
@@ -213,7 +221,7 @@ describe('GroupRegistryComponent', () => {
|
||||
}));
|
||||
|
||||
it('should be active', () => {
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(4) button.btn-edit'));
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
|
||||
expect(editButtonsFound.length).toEqual(2);
|
||||
editButtonsFound.forEach((editButtonFound) => {
|
||||
expect(editButtonFound.nativeElement.disabled).toBeFalse();
|
||||
@@ -247,7 +255,7 @@ describe('GroupRegistryComponent', () => {
|
||||
}));
|
||||
|
||||
it('should be active', () => {
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(4) button.btn-edit'));
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
|
||||
expect(editButtonsFound.length).toEqual(2);
|
||||
editButtonsFound.forEach((editButtonFound) => {
|
||||
expect(editButtonFound.nativeElement.disabled).toBeFalse();
|
||||
@@ -266,7 +274,7 @@ describe('GroupRegistryComponent', () => {
|
||||
}));
|
||||
|
||||
it('should not be active', () => {
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(4) button.btn-edit'));
|
||||
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
|
||||
expect(editButtonsFound.length).toEqual(2);
|
||||
editButtonsFound.forEach((editButtonFound) => {
|
||||
expect(editButtonFound.nativeElement.disabled).toBeTrue();
|
||||
|
@@ -35,6 +35,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||
import { NoContent } from '../../core/shared/NoContent.model';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-groups-registry',
|
||||
@@ -132,8 +133,8 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return this.groupService.searchGroups(this.currentSearchQuery.trim(), {
|
||||
currentPage: paginationOptions.currentPage,
|
||||
elementsPerPage: paginationOptions.pageSize
|
||||
});
|
||||
elementsPerPage: paginationOptions.pageSize,
|
||||
}, true, true, followLink('object'));
|
||||
}),
|
||||
getAllSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
|
@@ -56,11 +56,11 @@ describe('EPersonDataService', () => {
|
||||
}
|
||||
|
||||
function init() {
|
||||
restEndpointURL = 'https://dspace.4science.it/dspace-spring-rest/api/eperson';
|
||||
restEndpointURL = 'https://rest.api/dspace-spring-rest/api/eperson';
|
||||
epersonsEndpoint = `${restEndpointURL}/epersons`;
|
||||
epeople = [EPersonMock, EPersonMock2];
|
||||
epeople$ = createSuccessfulRemoteDataObject$(createPaginatedList([epeople]));
|
||||
rdbService = getMockRemoteDataBuildServiceHrefMap(undefined, { 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons': epeople$ });
|
||||
rdbService = getMockRemoteDataBuildServiceHrefMap(undefined, { 'https://rest.api/dspace-spring-rest/api/eperson/epersons': epeople$ });
|
||||
halService = new HALEndpointServiceStub(restEndpointURL);
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
|
@@ -21,6 +21,7 @@ import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
describe('UploadBistreamComponent', () => {
|
||||
let comp: UploadBitstreamComponent;
|
||||
@@ -76,7 +77,8 @@ describe('UploadBistreamComponent', () => {
|
||||
const restEndpoint = 'fake-rest-endpoint';
|
||||
const mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
|
||||
getBitstreamsEndpoint: observableOf(restEndpoint),
|
||||
createBundle: createSuccessfulRemoteDataObject$(createdBundle)
|
||||
createBundle: createSuccessfulRemoteDataObject$(createdBundle),
|
||||
getBundles: createSuccessfulRemoteDataObject$([bundle])
|
||||
});
|
||||
const bundleService = jasmine.createSpyObj('bundleService', {
|
||||
getBitstreamsEndpoint: observableOf(restEndpoint),
|
||||
@@ -92,6 +94,22 @@ describe('UploadBistreamComponent', () => {
|
||||
removeByHrefSubstring: {}
|
||||
});
|
||||
|
||||
|
||||
describe('on init', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
createUploadBitstreamTestingModule({
|
||||
bundle: bundle.id
|
||||
});
|
||||
}));
|
||||
beforeEach(() => {
|
||||
loadFixtureAndComp();
|
||||
});
|
||||
it('should initialize the bundles', () => {
|
||||
expect(comp.bundlesRD$).toBeDefined();
|
||||
getTestScheduler().expectObservable(comp.bundlesRD$).toBe('(a|)', {a: createSuccessfulRemoteDataObject([bundle])});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when a file is uploaded', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
createUploadBitstreamTestingModule({});
|
||||
|
@@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { map, switchMap, take } from 'rxjs/operators';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
|
||||
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
|
||||
@@ -108,9 +108,7 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy {
|
||||
this.itemId = this.route.snapshot.params.id;
|
||||
this.entityType = this.route.snapshot.params['entity-type'];
|
||||
this.itemRD$ = this.route.data.pipe(map((data) => data.dso));
|
||||
this.bundlesRD$ = this.itemRD$.pipe(
|
||||
switchMap((itemRD: RemoteData<Item>) => itemRD.payload.bundles)
|
||||
);
|
||||
this.bundlesRD$ = this.itemService.getBundles(this.itemId);
|
||||
this.selectedBundleId = this.route.snapshot.queryParams.bundle;
|
||||
if (isNotEmpty(this.selectedBundleId)) {
|
||||
this.bundleService.findById(this.selectedBundleId).pipe(
|
||||
|
@@ -11,9 +11,9 @@ export const EPersonMock: EPerson = Object.assign(new EPerson(), {
|
||||
selfRegistered: false,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid',
|
||||
href: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/testid',
|
||||
},
|
||||
groups: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid/groups' }
|
||||
groups: { href: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/testid/groups' }
|
||||
},
|
||||
id: 'testid',
|
||||
uuid: 'testid',
|
||||
@@ -57,9 +57,9 @@ export const EPersonMock2: EPerson = Object.assign(new EPerson(), {
|
||||
selfRegistered: true,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid2',
|
||||
href: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/testid2',
|
||||
},
|
||||
groups: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid2/groups' }
|
||||
groups: { href: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/testid2/groups' }
|
||||
},
|
||||
id: 'testid2',
|
||||
uuid: 'testid2',
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import { Group } from '../../core/eperson/models/group.model';
|
||||
import { EPersonMock } from './eperson.mock';
|
||||
import { of } from 'rxjs';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils';
|
||||
|
||||
export const GroupMock2: Group = Object.assign(new Group(), {
|
||||
handle: null,
|
||||
@@ -9,16 +11,17 @@ export const GroupMock2: Group = Object.assign(new Group(), {
|
||||
selfRegistered: false,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2',
|
||||
href: 'https://rest.api/server/api/eperson/groups/testgroupid2',
|
||||
},
|
||||
subgroups: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/subgroups' },
|
||||
object: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/object' },
|
||||
epersons: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons' }
|
||||
subgroups: { href: 'https://rest.api/server/api/eperson/groups/testgroupid2/subgroups' },
|
||||
object: { href: 'https://rest.api/server/api/eperson/groups/testgroupid2/object' },
|
||||
epersons: { href: 'https://rest.api/server/api/eperson/groups/testgroupid2/epersons' }
|
||||
},
|
||||
_name: 'testgroupname2',
|
||||
id: 'testgroupid2',
|
||||
uuid: 'testgroupid2',
|
||||
type: 'group',
|
||||
object: createSuccessfulRemoteDataObject$({ name: 'testgroupid2objectName'})
|
||||
});
|
||||
|
||||
export const GroupMock: Group = Object.assign(new Group(), {
|
||||
@@ -29,11 +32,11 @@ export const GroupMock: Group = Object.assign(new Group(), {
|
||||
permanent: false,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid',
|
||||
href: 'https://rest.api/server/api/eperson/groups/testgroupid',
|
||||
},
|
||||
subgroups: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/subgroups' },
|
||||
object: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/object' },
|
||||
epersons: { href: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/epersons' }
|
||||
subgroups: { href: 'https://rest.api/server/api/eperson/groups/testgroupid/subgroups' },
|
||||
object: { href: 'https://rest.api/server/api/eperson/groups/testgroupid2/object' },
|
||||
epersons: { href: 'https://rest.api/server/api/eperson/groups/testgroupid/epersons' }
|
||||
},
|
||||
_name: 'testgroupname',
|
||||
id: 'testgroupid',
|
||||
|
@@ -284,6 +284,8 @@
|
||||
|
||||
"admin.access-control.epeople.form.table.name": "Name",
|
||||
|
||||
"admin.access-control.epeople.form.table.collectionOrCommunity": "Collection/Community",
|
||||
|
||||
"admin.access-control.epeople.form.memberOfNoGroups": "This EPerson is not a member of any groups",
|
||||
|
||||
"admin.access-control.epeople.form.goToGroups": "Add to groups",
|
||||
@@ -322,6 +324,8 @@
|
||||
|
||||
"admin.access-control.groups.table.name": "Name",
|
||||
|
||||
"admin.access-control.groups.table.collectionOrCommunity": "Collection/Community",
|
||||
|
||||
"admin.access-control.groups.table.members": "Members",
|
||||
|
||||
"admin.access-control.groups.table.edit": "Edit",
|
||||
@@ -350,6 +354,8 @@
|
||||
|
||||
"admin.access-control.groups.form.groupName": "Group name",
|
||||
|
||||
"admin.access-control.groups.form.groupCommunity": "Community or Collection",
|
||||
|
||||
"admin.access-control.groups.form.groupDescription": "Description",
|
||||
|
||||
"admin.access-control.groups.form.notification.created.success": "Successfully created Group \"{{name}}\"",
|
||||
@@ -398,6 +404,12 @@
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.name": "Name",
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.identity": "Identity",
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.email": "Email",
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.netid": "NetID",
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.edit": "Remove / Add",
|
||||
|
||||
"admin.access-control.groups.form.members-list.table.edit.buttons.remove": "Remove member with name \"{{name}}\"",
|
||||
@@ -434,6 +446,8 @@
|
||||
|
||||
"admin.access-control.groups.form.subgroups-list.table.name": "Name",
|
||||
|
||||
"admin.access-control.groups.form.subgroups-list.table.collectionOrCommunity": "Collection/Community",
|
||||
|
||||
"admin.access-control.groups.form.subgroups-list.table.edit": "Remove / Add",
|
||||
|
||||
"admin.access-control.groups.form.subgroups-list.table.edit.buttons.remove": "Remove subgroup with name \"{{name}}\"",
|
||||
|
Reference in New Issue
Block a user