Merge remote-tracking branch 'upstream/main' into w2p-78407_allow-html-in-license-section

This commit is contained in:
Bruno Roemers
2021-04-14 19:06:44 +02:00
29 changed files with 211 additions and 114 deletions

View File

@@ -53,6 +53,9 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn- restore-keys: ${{ runner.os }}-yarn-
- name: Install the latest chromedriver compatible with the installed chrome version
run: yarn global add chromedriver --detect_chromedriver_version
- name: Install Yarn dependencies - name: Install Yarn dependencies
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
@@ -94,7 +97,9 @@ jobs:
run: curl http://localhost:8080/server/api run: curl http://localhost:8080/server/api
- name: Run e2e tests (integration tests) - name: Run e2e tests (integration tests)
run: yarn run e2e:ci run: |
chromedriver --url-base='/wd/hub' --port=4444 &
yarn run e2e:ci
- name: Shutdown Docker containers - name: Shutdown Docker containers
run: docker-compose -f ./docker/docker-compose-ci.yml down run: docker-compose -f ./docker/docker-compose-ci.yml down

View File

@@ -7,4 +7,8 @@ config.capabilities = {
} }
}; };
// don't use protractor's webdriver, as it may be incompatible with the installed chrome version
config.directConnect = false;
config.seleniumAddress = 'http://localhost:4444/wd/hub';
exports.config = config; exports.config = config;

View File

@@ -32,7 +32,7 @@
"lint": "ng lint", "lint": "ng lint",
"lint-fix": "ng lint --fix=true", "lint-fix": "ng lint --fix=true",
"e2e": "ng e2e", "e2e": "ng e2e",
"e2e:ci": "ng e2e --protractor-config=./e2e/protractor-ci.conf.js", "e2e:ci": "ng e2e --webdriver-update=false --protractor-config=./e2e/protractor-ci.conf.js",
"compile:server": "webpack --config webpack.server.config.js --progress --color", "compile:server": "webpack --config webpack.server.config.js --progress --color",
"serve:ssr": "node dist/server", "serve:ssr": "node dist/server",
"clean:coverage": "rimraf coverage", "clean:coverage": "rimraf coverage",

View File

@@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="d-flex flex-wrap"> <div class="d-flex flex-wrap">
<div> <div>
<h1 class="display-3">Welcome to the DSpace 7 Preview</h1> <h1 class="display-3">DSpace 7</h1>
<p class="lead">DSpace is the world leading open source repository platform that enables organisations to:</p> <p class="lead">DSpace is the world leading open source repository platform that enables organisations to:</p>
</div> </div>
</div> </div>
@@ -13,6 +13,8 @@
</li> </li>
<li>issue permanent urls and trustworthy identifiers, including optional integrations with handle.net and DataCite DOI</li> <li>issue permanent urls and trustworthy identifiers, including optional integrations with handle.net and DataCite DOI</li>
</ul> </ul>
<p>Join an international community of <A HREF="https://wiki.duraspace.org/display/DSPACE/DSpace+Positioning" TARGET="_NEW">leading institutions using DSpace</A>.</p> <p>Join an international community of <a href="https://wiki.lyrasis.org/display/DSPACE/DSpace+Positioning"
target="_blank">leading institutions using DSpace</a>.
</p>
</div> </div>
</div> </div>

View File

@@ -45,32 +45,32 @@ export const sendRequest = (requestService: RequestService) =>
(source: Observable<RestRequest>): Observable<RestRequest> => (source: Observable<RestRequest>): Observable<RestRequest> =>
source.pipe(tap((request: RestRequest) => requestService.send(request))); source.pipe(tap((request: RestRequest) => requestService.send(request)));
export const getRemoteDataPayload = () => export const getRemoteDataPayload = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<T> => (source: Observable<RemoteData<T>>): Observable<T> =>
source.pipe(map((remoteData: RemoteData<T>) => remoteData.payload)); source.pipe(map((remoteData: RemoteData<T>) => remoteData.payload));
export const getPaginatedListPayload = () => export const getPaginatedListPayload = <T>() =>
<T>(source: Observable<PaginatedList<T>>): Observable<T[]> => (source: Observable<PaginatedList<T>>): Observable<T[]> =>
source.pipe(map((list: PaginatedList<T>) => list.page)); source.pipe(map((list: PaginatedList<T>) => list.page));
export const getAllCompletedRemoteData = () => export const getAllCompletedRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(filter((rd: RemoteData<T>) => hasValue(rd) && rd.hasCompleted)); source.pipe(filter((rd: RemoteData<T>) => hasValue(rd) && rd.hasCompleted));
export const getFirstCompletedRemoteData = () => export const getFirstCompletedRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(getAllCompletedRemoteData(), take(1)); source.pipe(getAllCompletedRemoteData(), take(1));
export const takeUntilCompletedRemoteData = () => export const takeUntilCompletedRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(takeWhile((rd: RemoteData<T>) => hasNoValue(rd) || rd.isLoading, true)); source.pipe(takeWhile((rd: RemoteData<T>) => hasNoValue(rd) || rd.isLoading, true));
export const getFirstSucceededRemoteData = () => export const getFirstSucceededRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(filter((rd: RemoteData<T>) => rd.hasSucceeded), take(1)); source.pipe(filter((rd: RemoteData<T>) => rd.hasSucceeded), take(1));
export const getFirstSucceededRemoteWithNotEmptyData = () => export const getFirstSucceededRemoteWithNotEmptyData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(find((rd: RemoteData<T>) => rd.hasSucceeded && isNotEmpty(rd.payload))); source.pipe(find((rd: RemoteData<T>) => rd.hasSucceeded && isNotEmpty(rd.payload)));
/** /**
@@ -83,8 +83,8 @@ export const getFirstSucceededRemoteWithNotEmptyData = () =>
* These operators were created as a first step in refactoring * These operators were created as a first step in refactoring
* out all the instances where this is used incorrectly. * out all the instances where this is used incorrectly.
*/ */
export const getFirstSucceededRemoteDataPayload = () => export const getFirstSucceededRemoteDataPayload = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<T> => (source: Observable<RemoteData<T>>): Observable<T> =>
source.pipe( source.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload() getRemoteDataPayload()
@@ -100,8 +100,8 @@ export const getFirstSucceededRemoteDataPayload = () =>
* These operators were created as a first step in refactoring * These operators were created as a first step in refactoring
* out all the instances where this is used incorrectly. * out all the instances where this is used incorrectly.
*/ */
export const getFirstSucceededRemoteDataWithNotEmptyPayload = () => export const getFirstSucceededRemoteDataWithNotEmptyPayload = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<T> => (source: Observable<RemoteData<T>>): Observable<T> =>
source.pipe( source.pipe(
getFirstSucceededRemoteWithNotEmptyData(), getFirstSucceededRemoteWithNotEmptyData(),
getRemoteDataPayload() getRemoteDataPayload()
@@ -117,8 +117,8 @@ export const getFirstSucceededRemoteDataWithNotEmptyPayload = () =>
* These operators were created as a first step in refactoring * These operators were created as a first step in refactoring
* out all the instances where this is used incorrectly. * out all the instances where this is used incorrectly.
*/ */
export const getAllSucceededRemoteDataPayload = () => export const getAllSucceededRemoteDataPayload = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<T> => (source: Observable<RemoteData<T>>): Observable<T> =>
source.pipe( source.pipe(
getAllSucceededRemoteData(), getAllSucceededRemoteData(),
getRemoteDataPayload() getRemoteDataPayload()
@@ -138,8 +138,8 @@ export const getAllSucceededRemoteDataPayload = () =>
* These operators were created as a first step in refactoring * These operators were created as a first step in refactoring
* out all the instances where this is used incorrectly. * out all the instances where this is used incorrectly.
*/ */
export const getFirstSucceededRemoteListPayload = () => export const getFirstSucceededRemoteListPayload = <T>() =>
<T>(source: Observable<RemoteData<PaginatedList<T>>>): Observable<T[]> => (source: Observable<RemoteData<PaginatedList<T>>>): Observable<T[]> =>
source.pipe( source.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
@@ -160,8 +160,8 @@ export const getFirstSucceededRemoteListPayload = () =>
* These operators were created as a first step in refactoring * These operators were created as a first step in refactoring
* out all the instances where this is used incorrectly. * out all the instances where this is used incorrectly.
*/ */
export const getAllSucceededRemoteListPayload = () => export const getAllSucceededRemoteListPayload = <T>() =>
<T>(source: Observable<RemoteData<PaginatedList<T>>>): Observable<T[]> => (source: Observable<RemoteData<PaginatedList<T>>>): Observable<T[]> =>
source.pipe( source.pipe(
getAllSucceededRemoteData(), getAllSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
@@ -174,8 +174,8 @@ export const getAllSucceededRemoteListPayload = () =>
* @param router The router used to navigate to a new page * @param router The router used to navigate to a new page
* @param authService Service to check if the user is authenticated * @param authService Service to check if the user is authenticated
*/ */
export const redirectOn4xx = (router: Router, authService: AuthService) => export const redirectOn4xx = <T>(router: Router, authService: AuthService) =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
observableCombineLatest(source, authService.isAuthenticated()).pipe( observableCombineLatest(source, authService.isAuthenticated()).pipe(
map(([rd, isAuthenticated]: [RemoteData<T>, boolean]) => { map(([rd, isAuthenticated]: [RemoteData<T>, boolean]) => {
if (rd.hasFailed) { if (rd.hasFailed) {
@@ -229,16 +229,16 @@ export const returnEndUserAgreementUrlTreeOnFalse = (router: Router, redirect: s
return hasAgreed ? hasAgreed : router.createUrlTree([getEndUserAgreementPath()], { queryParams }); return hasAgreed ? hasAgreed : router.createUrlTree([getEndUserAgreementPath()], { queryParams });
})); }));
export const getFinishedRemoteData = () => export const getFinishedRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(find((rd: RemoteData<T>) => !rd.isLoading)); source.pipe(find((rd: RemoteData<T>) => !rd.isLoading));
export const getAllSucceededRemoteData = () => export const getAllSucceededRemoteData = <T>() =>
<T>(source: Observable<RemoteData<T>>): Observable<RemoteData<T>> => (source: Observable<RemoteData<T>>): Observable<RemoteData<T>> =>
source.pipe(filter((rd: RemoteData<T>) => rd.hasSucceeded)); source.pipe(filter((rd: RemoteData<T>) => rd.hasSucceeded));
export const toDSpaceObjectListRD = () => export const toDSpaceObjectListRD = <T extends DSpaceObject>() =>
<T extends DSpaceObject>(source: Observable<RemoteData<PaginatedList<SearchResult<T>>>>): Observable<RemoteData<PaginatedList<T>>> => (source: Observable<RemoteData<PaginatedList<SearchResult<T>>>>): Observable<RemoteData<PaginatedList<T>>> =>
source.pipe( source.pipe(
filter((rd: RemoteData<PaginatedList<SearchResult<T>>>) => rd.hasSucceeded), filter((rd: RemoteData<PaginatedList<SearchResult<T>>>) => rd.hasSucceeded),
map((rd: RemoteData<PaginatedList<SearchResult<T>>>) => { map((rd: RemoteData<PaginatedList<SearchResult<T>>>) => {

View File

@@ -56,7 +56,7 @@
<p class="m-0"> <p class="m-0">
<a class="text-white" href="http://www.dspace.org/">{{ 'footer.link.dspace' | translate}}</a> <a class="text-white" href="http://www.dspace.org/">{{ 'footer.link.dspace' | translate}}</a>
{{ 'footer.copyright' | translate:{year: dateObj | date:'y'} }} {{ 'footer.copyright' | translate:{year: dateObj | date:'y'} }}
<a class="text-white" href="http://www.duraspace.org/">{{ 'footer.link.duraspace' | translate}}</a> <a class="text-white" href="https://www.lyrasis.org/">{{ 'footer.link.lyrasis' | translate}}</a>
</p> </p>
<ul class="footer-info list-unstyled small d-flex justify-content-center mb-0"> <ul class="footer-info list-unstyled small d-flex justify-content-center mb-0">
<li> <li>

View File

@@ -11,7 +11,7 @@
'd-none': value?.isVirtual && (model.hasSelectableMetadata || context?.index > 0)}"> 'd-none': value?.isVirtual && (model.hasSelectableMetadata || context?.index > 0)}">
<div [ngClass]="getClass('grid', 'control')"> <div [ngClass]="getClass('grid', 'control')">
<ng-container #componentViewContainer></ng-container> <ng-container #componentViewContainer></ng-container>
<small *ngIf="hasHint && (model.repeatable === false || context?.index === context?.context?.groups?.length - 1) && (!showErrorMessages || errorMessages.length === 0)" <small *ngIf="hasHint && ((model.repeatable === false && (isRelationship === false || value?.value === null)) || (model.repeatable === true && context?.index === context?.context?.groups?.length - 1)) && (!showErrorMessages || errorMessages.length === 0)"
class="text-muted ds-hint" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"></small> class="text-muted ds-hint" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"></small>
<!-- In case of repeatable fields show empty space for all elements except the first --> <!-- In case of repeatable fields show empty space for all elements except the first -->
<div *ngIf="context?.index !== null <div *ngIf="context?.index !== null
@@ -35,7 +35,7 @@
<option *ngFor="let lang of model.languageCodes" [value]="lang.code">{{lang.display}}</option> <option *ngFor="let lang of model.languageCodes" [value]="lang.code">{{lang.display}}</option>
</select> </select>
</div> </div>
<div *ngIf="isRelationship && !isVirtual()" class="col-auto text-center"> <div *ngIf="isRelationship" class="col-auto text-center">
<button class="btn btn-secondary" <button class="btn btn-secondary"
type="button" type="button"
ngbTooltip="{{'form.lookup-help' | translate}}" ngbTooltip="{{'form.lookup-help' | translate}}"

View File

@@ -23,7 +23,7 @@ class CustomLoader implements TranslateLoader {
'footer': { 'footer': {
'copyright': 'copyright © 2002-{{ year }}', 'copyright': 'copyright © 2002-{{ year }}',
'link.dspace': 'DSpace software', 'link.dspace': 'DSpace software',
'link.duraspace': 'DuraSpace' 'link.lyrasis': 'LYRASIS'
} }
}); });
} }

View File

@@ -17,12 +17,14 @@ import { RouterStub } from '../../shared/testing/router.stub';
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
import { mockSubmissionObject } from '../../shared/mocks/submission.mock'; import { mockSubmissionObject } from '../../shared/mocks/submission.mock';
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
import { ItemDataService } from '../../core/data/item-data.service';
describe('SubmissionEditComponent Component', () => { describe('SubmissionEditComponent Component', () => {
let comp: SubmissionEditComponent; let comp: SubmissionEditComponent;
let fixture: ComponentFixture<SubmissionEditComponent>; let fixture: ComponentFixture<SubmissionEditComponent>;
let submissionServiceStub: SubmissionServiceStub; let submissionServiceStub: SubmissionServiceStub;
let itemDataService: ItemDataService;
let router: RouterStub; let router: RouterStub;
const submissionId = '826'; const submissionId = '826';
@@ -30,6 +32,9 @@ describe('SubmissionEditComponent Component', () => {
const submissionObject: any = mockSubmissionObject; const submissionObject: any = mockSubmissionObject;
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
itemDataService = jasmine.createSpyObj('itemDataService', {
findByHref: createSuccessfulRemoteDataObject$(submissionObject.item),
});
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
TranslateModule.forRoot(), TranslateModule.forRoot(),
@@ -41,6 +46,7 @@ describe('SubmissionEditComponent Component', () => {
providers: [ providers: [
{ provide: NotificationsService, useClass: NotificationsServiceStub }, { provide: NotificationsService, useClass: NotificationsServiceStub },
{ provide: SubmissionService, useClass: SubmissionServiceStub }, { provide: SubmissionService, useClass: SubmissionServiceStub },
{ provide: ItemDataService, useValue: itemDataService },
{ provide: TranslateService, useValue: getMockTranslateService() }, { provide: TranslateService, useValue: getMockTranslateService() },
{ provide: Router, useValue: new RouterStub() }, { provide: Router, useValue: new RouterStub() },
{ provide: ActivatedRoute, useValue: route }, { provide: ActivatedRoute, useValue: route },
@@ -63,7 +69,7 @@ describe('SubmissionEditComponent Component', () => {
router = null; router = null;
}); });
it('should init properly when a valid SubmissionObject has been retrieved', fakeAsync(() => { it('should init properly when a valid SubmissionObject has been retrieved',() => {
route.testParams = { id: submissionId }; route.testParams = { id: submissionId };
submissionServiceStub.retrieveSubmission.and.returnValue( submissionServiceStub.retrieveSubmission.and.returnValue(
@@ -78,9 +84,9 @@ describe('SubmissionEditComponent Component', () => {
expect(comp.sections).toBe(submissionObject.sections); expect(comp.sections).toBe(submissionObject.sections);
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition); expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
})); });
it('should redirect to mydspace when an empty SubmissionObject has been retrieved', fakeAsync(() => { it('should redirect to mydspace when an empty SubmissionObject has been retrieved',() => {
route.testParams = { id: submissionId }; route.testParams = { id: submissionId };
submissionServiceStub.retrieveSubmission.and.returnValue(createSuccessfulRemoteDataObject$({}) submissionServiceStub.retrieveSubmission.and.returnValue(createSuccessfulRemoteDataObject$({})
@@ -90,9 +96,9 @@ describe('SubmissionEditComponent Component', () => {
expect(router.navigate).toHaveBeenCalled(); expect(router.navigate).toHaveBeenCalled();
})); });
it('should not has effects when an invalid SubmissionObject has been retrieved', fakeAsync(() => { it('should not has effects when an invalid SubmissionObject has been retrieved',() => {
route.testParams = { id: submissionId }; route.testParams = { id: submissionId };
submissionServiceStub.retrieveSubmission.and.returnValue(observableOf(null)); submissionServiceStub.retrieveSubmission.and.returnValue(observableOf(null));
@@ -104,6 +110,6 @@ describe('SubmissionEditComponent Component', () => {
expect(comp.selfUrl).toBeUndefined(); expect(comp.selfUrl).toBeUndefined();
expect(comp.sections).toBeUndefined(); expect(comp.sections).toBeUndefined();
expect(comp.submissionDefinition).toBeUndefined(); expect(comp.submissionDefinition).toBeUndefined();
})); });
}); });

View File

@@ -2,11 +2,11 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators'; import { filter, switchMap, debounceTime } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model'; import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
import { hasValue, isEmpty, isNotNull } from '../../shared/empty.util'; import { hasValue, isEmpty, isNotNull, isNotEmptyOperator } from '../../shared/empty.util';
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model'; import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
import { SubmissionService } from '../submission.service'; import { SubmissionService } from '../submission.service';
import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsService } from '../../shared/notifications/notifications.service';
@@ -14,6 +14,9 @@ import { SubmissionObject } from '../../core/submission/models/submission-object
import { Collection } from '../../core/shared/collection.model'; import { Collection } from '../../core/shared/collection.model';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
import { getAllSucceededRemoteData } from '../../core/shared/operators';
import { ItemDataService } from '../../core/data/item-data.service';
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
/** /**
* This component allows to edit an existing workspaceitem/workflowitem. * This component allows to edit an existing workspaceitem/workflowitem.
@@ -60,6 +63,16 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
* @type {Array} * @type {Array}
*/ */
private subs: Subscription[] = []; private subs: Subscription[] = [];
/**
* BehaviorSubject containing the self link to the item for this submission
* @private
*/
private itemLink$: BehaviorSubject<string> = new BehaviorSubject(undefined);
/**
* The item for this submission.
*/
public item: Item; public item: Item;
/** /**
@@ -69,6 +82,7 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {ActivatedRoute} route * @param {ActivatedRoute} route
* @param {Router} router * @param {Router} router
* @param {ItemDataService} itemDataService
* @param {SubmissionService} submissionService * @param {SubmissionService} submissionService
* @param {TranslateService} translate * @param {TranslateService} translate
*/ */
@@ -76,6 +90,7 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private itemDataService: ItemDataService,
private submissionService: SubmissionService, private submissionService: SubmissionService,
private translate: TranslateService) { private translate: TranslateService) {
} }
@@ -84,32 +99,47 @@ export class SubmissionEditComponent implements OnDestroy, OnInit {
* Retrieve workspaceitem/workflowitem from server and initialize all instance variables * Retrieve workspaceitem/workflowitem from server and initialize all instance variables
*/ */
ngOnInit() { ngOnInit() {
this.subs.push(this.route.paramMap.pipe( this.subs.push(
switchMap((params: ParamMap) => this.submissionService.retrieveSubmission(params.get('id'))), this.route.paramMap.pipe(
// NOTE new submission is retrieved on the browser side only, so get null on server side rendering switchMap((params: ParamMap) => this.submissionService.retrieveSubmission(params.get('id'))),
filter((submissionObjectRD: RemoteData<SubmissionObject>) => isNotNull(submissionObjectRD)) // NOTE new submission is retrieved on the browser side only, so get null on server side rendering
).subscribe((submissionObjectRD: RemoteData<SubmissionObject>) => { filter((submissionObjectRD: RemoteData<SubmissionObject>) => isNotNull(submissionObjectRD))
if (submissionObjectRD.hasSucceeded) { ).subscribe((submissionObjectRD: RemoteData<SubmissionObject>) => {
if (isEmpty(submissionObjectRD.payload)) { if (submissionObjectRD.hasSucceeded) {
this.notificationsService.info(null, this.translate.get('submission.general.cannot_submit')); if (isEmpty(submissionObjectRD.payload)) {
this.router.navigate(['/mydspace']); this.notificationsService.info(null, this.translate.get('submission.general.cannot_submit'));
this.router.navigate(['/mydspace']);
} else {
this.submissionId = submissionObjectRD.payload.id.toString();
this.collectionId = (submissionObjectRD.payload.collection as Collection).id;
this.selfUrl = submissionObjectRD.payload._links.self.href;
this.sections = submissionObjectRD.payload.sections;
this.itemLink$.next(submissionObjectRD.payload._links.item.href);
this.item = submissionObjectRD.payload.item;
this.submissionDefinition = (submissionObjectRD.payload.submissionDefinition as SubmissionDefinitionsModel);
}
} else { } else {
this.submissionId = submissionObjectRD.payload.id.toString(); if (submissionObjectRD.statusCode === 404) {
this.collectionId = (submissionObjectRD.payload.collection as Collection).id; // redirect to not found page
this.selfUrl = submissionObjectRD.payload._links.self.href; this.router.navigate(['/404'], { skipLocationChange: true });
this.sections = submissionObjectRD.payload.sections; }
this.item = submissionObjectRD.payload.item as Item; // TODO handle generic error
this.submissionDefinition = (submissionObjectRD.payload.submissionDefinition as SubmissionDefinitionsModel);
this.changeDetectorRef.detectChanges();
} }
} else { }),
if (submissionObjectRD.statusCode === 404) { this.itemLink$.pipe(
// redirect to not found page isNotEmptyOperator(),
this.router.navigate(['/404'], { skipLocationChange: true }); switchMap((itemLink: string) =>
} this.itemDataService.findByHref(itemLink)
// TODO handle generic error ),
} getAllSucceededRemoteData(),
})); // Multiple sources can update the item in quick succession.
// We only want to rerender the form if the item is unchanged for some time
debounceTime(300),
).subscribe((itemRd: RemoteData<Item>) => {
this.item = itemRd.payload;
this.changeDetectorRef.detectChanges();
}),
);
} }
/** /**

View File

@@ -15,18 +15,24 @@ import { RouterStub } from '../../shared/testing/router.stub';
import { mockSubmissionObject } from '../../shared/mocks/submission.mock'; import { mockSubmissionObject } from '../../shared/mocks/submission.mock';
import { SubmissionSubmitComponent } from './submission-submit.component'; import { SubmissionSubmitComponent } from './submission-submit.component';
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
import { ItemDataService } from '../../core/data/item-data.service';
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
describe('SubmissionSubmitComponent Component', () => { describe('SubmissionSubmitComponent Component', () => {
let comp: SubmissionSubmitComponent; let comp: SubmissionSubmitComponent;
let fixture: ComponentFixture<SubmissionSubmitComponent>; let fixture: ComponentFixture<SubmissionSubmitComponent>;
let submissionServiceStub: SubmissionServiceStub; let submissionServiceStub: SubmissionServiceStub;
let itemDataService: ItemDataService;
let router: RouterStub; let router: RouterStub;
const submissionId = '826'; const submissionId = '826';
const submissionObject: any = mockSubmissionObject; const submissionObject: any = mockSubmissionObject;
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
itemDataService = jasmine.createSpyObj('itemDataService', {
findByHref: createSuccessfulRemoteDataObject$(submissionObject.item),
});
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
TranslateModule.forRoot(), TranslateModule.forRoot(),
@@ -38,6 +44,7 @@ describe('SubmissionSubmitComponent Component', () => {
providers: [ providers: [
{ provide: NotificationsService, useClass: NotificationsServiceStub }, { provide: NotificationsService, useClass: NotificationsServiceStub },
{ provide: SubmissionService, useClass: SubmissionServiceStub }, { provide: SubmissionService, useClass: SubmissionServiceStub },
{ provide: ItemDataService, useValue: itemDataService },
{ provide: TranslateService, useValue: getMockTranslateService() }, { provide: TranslateService, useValue: getMockTranslateService() },
{ provide: Router, useValue: new RouterStub() }, { provide: Router, useValue: new RouterStub() },
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
@@ -60,7 +67,7 @@ describe('SubmissionSubmitComponent Component', () => {
router = null; router = null;
}); });
it('should init properly when a valid SubmissionObject has been retrieved', fakeAsync(() => { it('should init properly when a valid SubmissionObject has been retrieved',() => {
submissionServiceStub.createSubmission.and.returnValue(observableOf(submissionObject)); submissionServiceStub.createSubmission.and.returnValue(observableOf(submissionObject));
@@ -72,9 +79,9 @@ describe('SubmissionSubmitComponent Component', () => {
expect(comp.sections).toBe(submissionObject.sections); expect(comp.sections).toBe(submissionObject.sections);
expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition); expect(comp.submissionDefinition).toBe(submissionObject.submissionDefinition);
})); });
it('should redirect to mydspace when an empty SubmissionObject has been retrieved', fakeAsync(() => { it('should redirect to mydspace when an empty SubmissionObject has been retrieved',() => {
submissionServiceStub.createSubmission.and.returnValue(observableOf({})); submissionServiceStub.createSubmission.and.returnValue(observableOf({}));
@@ -82,9 +89,9 @@ describe('SubmissionSubmitComponent Component', () => {
expect(router.navigate).toHaveBeenCalled(); expect(router.navigate).toHaveBeenCalled();
})); });
it('should not has effects when an invalid SubmissionObject has been retrieved', fakeAsync(() => { it('should not has effects when an invalid SubmissionObject has been retrieved',() => {
submissionServiceStub.createSubmission.and.returnValue(observableOf(null)); submissionServiceStub.createSubmission.and.returnValue(observableOf(null));
@@ -94,6 +101,6 @@ describe('SubmissionSubmitComponent Component', () => {
expect(comp.collectionId).toBeUndefined(); expect(comp.collectionId).toBeUndefined();
expect(comp.selfUrl).toBeUndefined(); expect(comp.selfUrl).toBeUndefined();
expect(comp.submissionDefinition).toBeUndefined(); expect(comp.submissionDefinition).toBeUndefined();
})); });
}); });

View File

@@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { hasValue, isEmpty, isNotNull } from '../../shared/empty.util'; import { hasValue, isEmpty, isNotNull, isNotEmptyOperator } from '../../shared/empty.util';
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model'; import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsService } from '../../shared/notifications/notifications.service';
@@ -12,6 +12,11 @@ import { SubmissionObject } from '../../core/submission/models/submission-object
import { Collection } from '../../core/shared/collection.model'; import { Collection } from '../../core/shared/collection.model';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model'; import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
import { switchMap, debounceTime } from 'rxjs/operators';
import { getAllSucceededRemoteData } from '../../core/shared/operators';
import { RemoteData } from '../../core/data/remote-data';
import { ItemDataService } from '../../core/data/item-data.service';
/** /**
* This component allows to submit a new workspaceitem. * This component allows to submit a new workspaceitem.
@@ -28,6 +33,16 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
* @type {string} * @type {string}
*/ */
public collectionId: string; public collectionId: string;
/**
* BehaviorSubject containing the self link to the item for this submission
* @private
*/
private itemLink$: BehaviorSubject<string> = new BehaviorSubject(undefined);
/**
* The item for this submission.
*/
public item: Item; public item: Item;
/** /**
@@ -71,6 +86,7 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
* *
* @param {ChangeDetectorRef} changeDetectorRef * @param {ChangeDetectorRef} changeDetectorRef
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {ItemDataService} itemDataService
* @param {SubmissionService} submissionService * @param {SubmissionService} submissionService
* @param {Router} router * @param {Router} router
* @param {TranslateService} translate * @param {TranslateService} translate
@@ -80,13 +96,16 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
constructor(private changeDetectorRef: ChangeDetectorRef, constructor(private changeDetectorRef: ChangeDetectorRef,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private router: Router, private router: Router,
private itemDataService: ItemDataService,
private submissionService: SubmissionService, private submissionService: SubmissionService,
private translate: TranslateService, private translate: TranslateService,
private viewContainerRef: ViewContainerRef, private viewContainerRef: ViewContainerRef,
private route: ActivatedRoute) { private route: ActivatedRoute) {
this.route this.route
.queryParams .queryParams
.subscribe((params) => { this.collectionParam = (params.collection); }); .subscribe((params) => {
this.collectionParam = (params.collection);
});
} }
/** /**
@@ -108,11 +127,24 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
this.selfUrl = submissionObject._links.self.href; this.selfUrl = submissionObject._links.self.href;
this.submissionDefinition = (submissionObject.submissionDefinition as SubmissionDefinitionsModel); this.submissionDefinition = (submissionObject.submissionDefinition as SubmissionDefinitionsModel);
this.submissionId = submissionObject.id; this.submissionId = submissionObject.id;
this.itemLink$.next(submissionObject._links.item.href);
this.item = submissionObject.item as Item; this.item = submissionObject.item as Item;
this.changeDetectorRef.detectChanges();
} }
} }
}) }),
this.itemLink$.pipe(
isNotEmptyOperator(),
switchMap((itemLink: string) =>
this.itemDataService.findByHref(itemLink)
),
getAllSucceededRemoteData(),
// Multiple sources can update the item in quick succession.
// We only want to rerender the form if the item is unchanged for some time
debounceTime(300),
).subscribe((itemRd: RemoteData<Item>) => {
this.item = itemRd.payload;
this.changeDetectorRef.detectChanges();
})
); );
} }

View File

@@ -2287,9 +2287,9 @@
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2245,8 +2245,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "software DSpace", "footer.link.dspace": "software DSpace",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2014,8 +2014,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace Software", "footer.link.dspace": "DSpace Software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -1241,7 +1241,7 @@
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
"footer.link.cookies": "Cookie settings", "footer.link.cookies": "Cookie settings",

View File

@@ -2081,8 +2081,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "Software DSpace", "footer.link.dspace": "Software DSpace",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -1891,8 +1891,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace-ohjelmisto", "footer.link.dspace": "DSpace-ohjelmisto",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2082,8 +2082,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -1748,8 +1748,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace szoftver", "footer.link.dspace": "DSpace szoftver",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
"footer.link.cookies": "Süti beállítások", "footer.link.cookies": "Süti beállítások",

View File

@@ -2287,9 +2287,9 @@
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -1886,8 +1886,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2080,8 +2080,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2287,9 +2287,9 @@
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2037,8 +2037,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2037,8 +2037,8 @@
// "footer.link.dspace": "DSpace software", // "footer.link.dspace": "DSpace software",
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2287,9 +2287,9 @@
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -2287,9 +2287,9 @@
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.dspace": "DSpace software", "footer.link.dspace": "DSpace software",
// "footer.link.duraspace": "DuraSpace", // "footer.link.lyrasis": "LYRASIS",
// TODO New key - Add a translation // TODO New key - Add a translation
"footer.link.duraspace": "DuraSpace", "footer.link.lyrasis": "LYRASIS",
// "footer.link.cookies": "Cookie settings", // "footer.link.cookies": "Cookie settings",
// TODO New key - Add a translation // TODO New key - Add a translation

View File

@@ -3,7 +3,7 @@
<div class="jumbotron jumbotron-fluid"> <div class="jumbotron jumbotron-fluid">
<div class="d-flex flex-wrap"> <div class="d-flex flex-wrap">
<div> <div>
<h1 class="display-3">DSpace 7</h1> <h1 class="display-3">DSpace 7 - Beta 5</h1>
<p class="lead">DSpace is the world leading open source repository platform that enables <p class="lead">DSpace is the world leading open source repository platform that enables
organisations to:</p> organisations to:</p>
</div> </div>
@@ -20,6 +20,17 @@
</li> </li>
</ul> </ul>
<p>Join an international community of <a href="https://wiki.lyrasis.org/display/DSPACE/DSpace+Positioning" target="_blank">leading institutions using DSpace</a>.</p> <p>Join an international community of <a href="https://wiki.lyrasis.org/display/DSPACE/DSpace+Positioning" target="_blank">leading institutions using DSpace</a>.</p>
<p>Participate in the <a href="https://wiki.lyrasis.org/display/DSPACE/DSpace+Release+7.0+Testathon+Page"
target="_blank">official community Testathon</a>
from <strong>April 19th through May 7th</strong>. The test user accounts below have their password set to the name of
this
software in lowercase.</p>
<ul>
<li>Demo Site Administrator = dspacedemo+admin@gmail.com</li>
<li>Demo Community Administrator = dspacedemo+commadmin@gmail.com</li>
<li>Demo Collection Administrator = dspacedemo+colladmin@gmail.com</li>
<li>Demo Submitter = dspacedemo+submit@gmail.com</li>
</ul>
</div> </div>
</div> </div>
<small class="credits">Photo by <a href="https://www.pexels.com/@inspiredimages">@inspiredimages</a></small> <small class="credits">Photo by <a href="https://www.pexels.com/@inspiredimages">@inspiredimages</a></small>