mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'origin/main' into CST-5270-sherpa-romeo-integration
# Conflicts: # src/app/submission/objects/submission-objects.effects.ts
This commit is contained in:
@@ -9,4 +9,9 @@ EXPOSE 4000
|
|||||||
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
|
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
|
||||||
# See, for example https://github.com/yarnpkg/yarn/issues/5540
|
# See, for example https://github.com/yarnpkg/yarn/issues/5540
|
||||||
RUN yarn install --network-timeout 300000
|
RUN yarn install --network-timeout 300000
|
||||||
CMD yarn run start:dev
|
|
||||||
|
# On startup, run in DEVELOPMENT mode (this defaults to live reloading enabled, etc).
|
||||||
|
# Listen / accept connections from all IP addresses.
|
||||||
|
# NOTE: At this time it is only possible to run Docker container in Production mode
|
||||||
|
# if you have a public IP. See https://github.com/DSpace/dspace-angular/issues/1485
|
||||||
|
CMD yarn serve --host 0.0.0.0
|
||||||
|
@@ -42,6 +42,7 @@ describe('New Submission page', () => {
|
|||||||
cy.get('button#deposit').click();
|
cy.get('button#deposit').click();
|
||||||
|
|
||||||
// A warning alert should display.
|
// A warning alert should display.
|
||||||
|
cy.get('ds-notification div.alert-success').should('not.exist');
|
||||||
cy.get('ds-notification div.alert-warning').should('be.visible');
|
cy.get('ds-notification div.alert-warning').should('be.visible');
|
||||||
|
|
||||||
// First section should have an exclamation error in the header
|
// First section should have an exclamation error in the header
|
||||||
|
@@ -1,21 +1,35 @@
|
|||||||
import { Component, HostListener, Injector, OnInit } from '@angular/core';
|
import { Component, HostListener, Injector, OnInit } from '@angular/core';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { combineLatest, combineLatest as observableCombineLatest, Observable, BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject, combineLatest as observableCombineLatest, combineLatest, Observable } from 'rxjs';
|
||||||
import { debounceTime, first, map, take, filter, distinctUntilChanged, withLatestFrom } from 'rxjs/operators';
|
import { debounceTime, distinctUntilChanged, filter, first, map, take, withLatestFrom } from 'rxjs/operators';
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
import {
|
import {
|
||||||
ScriptDataService,
|
METADATA_EXPORT_SCRIPT_NAME,
|
||||||
METADATA_IMPORT_SCRIPT_NAME,
|
METADATA_IMPORT_SCRIPT_NAME,
|
||||||
METADATA_EXPORT_SCRIPT_NAME
|
ScriptDataService
|
||||||
} from '../../core/data/processes/script-data.service';
|
} from '../../core/data/processes/script-data.service';
|
||||||
import { slideHorizontal, slideSidebar } from '../../shared/animations/slide';
|
import { slideHorizontal, slideSidebar } from '../../shared/animations/slide';
|
||||||
import { CreateCollectionParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component';
|
import {
|
||||||
import { CreateCommunityParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component';
|
CreateCollectionParentSelectorComponent
|
||||||
import { CreateItemParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
|
} from '../../shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component';
|
||||||
import { EditCollectionSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component';
|
import {
|
||||||
import { EditCommunitySelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component';
|
CreateCommunityParentSelectorComponent
|
||||||
import { EditItemSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component';
|
} from '../../shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component';
|
||||||
import { ExportMetadataSelectorComponent } from '../../shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component';
|
import {
|
||||||
|
CreateItemParentSelectorComponent
|
||||||
|
} from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
|
||||||
|
import {
|
||||||
|
EditCollectionSelectorComponent
|
||||||
|
} from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component';
|
||||||
|
import {
|
||||||
|
EditCommunitySelectorComponent
|
||||||
|
} from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component';
|
||||||
|
import {
|
||||||
|
EditItemSelectorComponent
|
||||||
|
} from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component';
|
||||||
|
import {
|
||||||
|
ExportMetadataSelectorComponent
|
||||||
|
} from '../../shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component';
|
||||||
import { LinkMenuItemModel } from '../../shared/menu/menu-item/models/link.model';
|
import { LinkMenuItemModel } from '../../shared/menu/menu-item/models/link.model';
|
||||||
import { OnClickMenuItemModel } from '../../shared/menu/menu-item/models/onclick.model';
|
import { OnClickMenuItemModel } from '../../shared/menu/menu-item/models/onclick.model';
|
||||||
import { TextMenuItemModel } from '../../shared/menu/menu-item/models/text.model';
|
import { TextMenuItemModel } from '../../shared/menu/menu-item/models/text.model';
|
||||||
@@ -26,7 +40,7 @@ import { AuthorizationDataService } from '../../core/data/feature-authorization/
|
|||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
import { MenuID } from '../../shared/menu/menu-id.model';
|
import { MenuID } from '../../shared/menu/menu-id.model';
|
||||||
import { MenuItemType } from '../../shared/menu/menu-item-type.model';
|
import { MenuItemType } from '../../shared/menu/menu-item-type.model';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component representing the admin sidebar
|
* Component representing the admin sidebar
|
||||||
@@ -86,12 +100,12 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
|||||||
* Set and calculate all initial values of the instance variables
|
* Set and calculate all initial values of the instance variables
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.createMenu();
|
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.sidebarWidth = this.variableService.getVariable('sidebarItemsWidth');
|
this.sidebarWidth = this.variableService.getVariable('sidebarItemsWidth');
|
||||||
this.authService.isAuthenticated()
|
this.authService.isAuthenticated()
|
||||||
.subscribe((loggedIn: boolean) => {
|
.subscribe((loggedIn: boolean) => {
|
||||||
if (loggedIn) {
|
if (loggedIn) {
|
||||||
|
this.createMenu();
|
||||||
this.menuService.showMenu(this.menuID);
|
this.menuService.showMenu(this.menuID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -368,10 +382,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
|
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
|
||||||
|
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
||||||
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)
|
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)
|
||||||
).pipe(
|
]).pipe(
|
||||||
filter(([authorized, metadataExportScriptExists]: boolean[]) => authorized && metadataExportScriptExists),
|
filter(([authorized, metadataExportScriptExists]: boolean[]) => authorized && metadataExportScriptExists),
|
||||||
take(1)
|
take(1)
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
@@ -430,10 +444,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
|||||||
shouldPersistOnRouteChange: true
|
shouldPersistOnRouteChange: true
|
||||||
})));
|
})));
|
||||||
|
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
||||||
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)
|
this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)
|
||||||
).pipe(
|
]).pipe(
|
||||||
filter(([authorized, metadataImportScriptExists]: boolean[]) => authorized && metadataImportScriptExists),
|
filter(([authorized, metadataImportScriptExists]: boolean[]) => authorized && metadataImportScriptExists),
|
||||||
take(1)
|
take(1)
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
@@ -559,10 +573,10 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
|||||||
* Create menu sections dependent on whether or not the current user can manage access control groups
|
* Create menu sections dependent on whether or not the current user can manage access control groups
|
||||||
*/
|
*/
|
||||||
createAccessControlMenuSections() {
|
createAccessControlMenuSections() {
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
||||||
this.authorizationService.isAuthorized(FeatureID.CanManageGroups)
|
this.authorizationService.isAuthorized(FeatureID.CanManageGroups)
|
||||||
).subscribe(([isSiteAdmin, canManageGroups]) => {
|
]).subscribe(([isSiteAdmin, canManageGroups]) => {
|
||||||
const menuList = [
|
const menuList = [
|
||||||
/* Access Control */
|
/* Access Control */
|
||||||
{
|
{
|
||||||
|
@@ -201,7 +201,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
resolveEndFound = false;
|
resolveEndFound = false;
|
||||||
this.isRouteLoading$.next(true);
|
this.isRouteLoading$.next(true);
|
||||||
this.isThemeLoading$.next(true);
|
|
||||||
} else if (event instanceof ResolveEnd) {
|
} else if (event instanceof ResolveEnd) {
|
||||||
resolveEndFound = true;
|
resolveEndFound = true;
|
||||||
const activatedRouteSnapShot: ActivatedRouteSnapshot = event.state.root;
|
const activatedRouteSnapShot: ActivatedRouteSnapshot = event.state.root;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div class="outer-wrapper" *ngIf="!shouldShowFullscreenLoader; else fullScreenLoader">
|
<div class="outer-wrapper" [class.d-none]="shouldShowFullscreenLoader">
|
||||||
<ds-themed-admin-sidebar></ds-themed-admin-sidebar>
|
<ds-themed-admin-sidebar></ds-themed-admin-sidebar>
|
||||||
<div class="inner-wrapper" [@slideSidebarPadding]="{
|
<div class="inner-wrapper" [@slideSidebarPadding]="{
|
||||||
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
|
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
|
||||||
@@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
<ds-notifications-board [options]="notificationOptions">
|
<ds-notifications-board [options]="notificationOptions">
|
||||||
</ds-notifications-board>
|
</ds-notifications-board>
|
||||||
<ng-template #fullScreenLoader>
|
|
||||||
<div class="ds-full-screen-loader">
|
<div class="ds-full-screen-loader" *ngIf="shouldShowFullscreenLoader">
|
||||||
<ds-loading [showMessage]="false"></ds-loading>
|
<ds-loading [showMessage]="false"></ds-loading>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
|
||||||
|
@@ -4,6 +4,7 @@ import { FormBuilder } from '@angular/forms';
|
|||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { SearchEvent } from '../eperson-group-list.component';
|
import { SearchEvent } from '../eperson-group-list.component';
|
||||||
|
import { isNotNull } from '../../../../empty.util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A component used to show a search box for groups.
|
* A component used to show a search box for groups.
|
||||||
@@ -54,7 +55,7 @@ export class GroupSearchBoxComponent {
|
|||||||
submit(data: any) {
|
submit(data: any) {
|
||||||
const event: SearchEvent = {
|
const event: SearchEvent = {
|
||||||
scope: '',
|
scope: '',
|
||||||
query: data.query
|
query: isNotNull(data) ? data.query : ''
|
||||||
};
|
};
|
||||||
this.search.emit(event);
|
this.search.emit(event);
|
||||||
}
|
}
|
||||||
|
@@ -421,7 +421,8 @@ export class SaveSubmissionFormSuccessAction implements Action {
|
|||||||
payload: {
|
payload: {
|
||||||
submissionId: string;
|
submissionId: string;
|
||||||
submissionObject: SubmissionObject[];
|
submissionObject: SubmissionObject[];
|
||||||
notify?: boolean
|
showNotifications?: boolean;
|
||||||
|
showErrors?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,9 +432,13 @@ export class SaveSubmissionFormSuccessAction implements Action {
|
|||||||
* the submission's ID
|
* the submission's ID
|
||||||
* @param submissionObject
|
* @param submissionObject
|
||||||
* the submission's Object
|
* the submission's Object
|
||||||
|
* @param showNotifications
|
||||||
|
* a boolean representing if to show notifications on save
|
||||||
|
* @param showErrors
|
||||||
|
* a boolean representing if to show errors on save
|
||||||
*/
|
*/
|
||||||
constructor(submissionId: string, submissionObject: SubmissionObject[], notify?: boolean) {
|
constructor(submissionId: string, submissionObject: SubmissionObject[], showNotifications?: boolean, showErrors?: boolean) {
|
||||||
this.payload = { submissionId, submissionObject, notify };
|
this.payload = { submissionId, submissionObject, showNotifications, showErrors };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -237,6 +237,7 @@ describe('SubmissionObjectEffects test suite', () => {
|
|||||||
b: new SaveSubmissionFormSuccessAction(
|
b: new SaveSubmissionFormSuccessAction(
|
||||||
submissionId,
|
submissionId,
|
||||||
mockSubmissionRestResponse as any,
|
mockSubmissionRestResponse as any,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@@ -260,6 +261,7 @@ describe('SubmissionObjectEffects test suite', () => {
|
|||||||
b: new SaveSubmissionFormSuccessAction(
|
b: new SaveSubmissionFormSuccessAction(
|
||||||
submissionId,
|
submissionId,
|
||||||
mockSubmissionRestResponse as any,
|
mockSubmissionRestResponse as any,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@@ -884,6 +886,7 @@ describe('SubmissionObjectEffects test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
||||||
|
expect(notificationsServiceStub.warning).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a SAVE_SUBMISSION_FORM_SUCCESS action when there are errors', () => {
|
it('should return a SAVE_SUBMISSION_FORM_SUCCESS action when there are errors', () => {
|
||||||
@@ -910,10 +913,11 @@ describe('SubmissionObjectEffects test suite', () => {
|
|||||||
submissionJsonPatchOperationsServiceStub.jsonPatchByResourceType.and.returnValue(observableOf(response));
|
submissionJsonPatchOperationsServiceStub.jsonPatchByResourceType.and.returnValue(observableOf(response));
|
||||||
|
|
||||||
const expected = cold('--b-', {
|
const expected = cold('--b-', {
|
||||||
b: new SaveSubmissionFormSuccessAction(submissionId, response as any[])
|
b: new SaveSubmissionFormSuccessAction(submissionId, response as any[], false, true)
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
||||||
|
expect(notificationsServiceStub.warning).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => {
|
it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => {
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { WorkspaceitemSectionSherpaPoliciesObject } from './../../core/submission/models/workspaceitem-section-sherpa-policies.model';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@@ -44,7 +43,7 @@ import {
|
|||||||
UpdateSectionDataAction,
|
UpdateSectionDataAction,
|
||||||
UpdateSectionDataSuccessAction
|
UpdateSectionDataSuccessAction
|
||||||
} from './submission-objects.actions';
|
} from './submission-objects.actions';
|
||||||
import { SubmissionObjectEntry } from './submission-objects.reducer';
|
import { SubmissionObjectEntry} from './submission-objects.reducer';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators';
|
import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators';
|
||||||
@@ -66,7 +65,7 @@ export class SubmissionObjectEffects {
|
|||||||
map((action: InitSubmissionFormAction) => {
|
map((action: InitSubmissionFormAction) => {
|
||||||
const definition = action.payload.submissionDefinition;
|
const definition = action.payload.submissionDefinition;
|
||||||
const mappedActions = [];
|
const mappedActions = [];
|
||||||
definition.sections.page.forEach((sectionDefinition: any, index) => {
|
definition.sections.page.forEach((sectionDefinition: any) => {
|
||||||
const selfLink = sectionDefinition._links.self.href || sectionDefinition._links.self;
|
const selfLink = sectionDefinition._links.self.href || sectionDefinition._links.self;
|
||||||
const sectionId = selfLink.substr(selfLink.lastIndexOf('/') + 1);
|
const sectionId = selfLink.substr(selfLink.lastIndexOf('/') + 1);
|
||||||
const config = sectionDefinition._links.config ? (sectionDefinition._links.config.href || sectionDefinition._links.config) : '';
|
const config = sectionDefinition._links.config ? (sectionDefinition._links.config.href || sectionDefinition._links.config) : '';
|
||||||
@@ -78,7 +77,6 @@ export class SubmissionObjectEffects {
|
|||||||
sectionData = action.payload.item.metadata;
|
sectionData = action.payload.item.metadata;
|
||||||
}
|
}
|
||||||
const sectionErrors = isNotEmpty(action.payload.errors) ? (action.payload.errors[sectionId] || null) : null;
|
const sectionErrors = isNotEmpty(action.payload.errors) ? (action.payload.errors[sectionId] || null) : null;
|
||||||
|
|
||||||
mappedActions.push(
|
mappedActions.push(
|
||||||
new InitSectionAction(
|
new InitSectionAction(
|
||||||
action.payload.submissionId,
|
action.payload.submissionId,
|
||||||
@@ -93,123 +91,7 @@ export class SubmissionObjectEffects {
|
|||||||
sectionErrors
|
sectionErrors
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (index === definition.sections.page.length - 1) {
|
|
||||||
mappedActions.push(
|
|
||||||
new InitSectionAction(
|
|
||||||
action.payload.submissionId,
|
|
||||||
'sherpaPolicies',
|
|
||||||
'submit.progressbar.sherpaPolicies',
|
|
||||||
'submit.progressbar.sherpaPolicies',
|
|
||||||
true,
|
|
||||||
SectionsType.SherpaPolicies,
|
|
||||||
{ main: null, other: 'READONLY' },
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
'id': 'sherpaPolicies',
|
|
||||||
'retrievalTime': '2022-04-20T09:44:39.870+00:00',
|
|
||||||
'sherpaResponse': [
|
|
||||||
{
|
|
||||||
'error': false,
|
|
||||||
'message': null,
|
|
||||||
'metadata': {
|
|
||||||
'id': 23803,
|
|
||||||
'uri': 'http://v2.sherpa.ac.uk/id/publication/23803',
|
|
||||||
'dateCreated': '2012-11-20 14:51:52',
|
|
||||||
'dateModified': '2020-03-06 11:25:54',
|
|
||||||
'inDOAJ': false,
|
|
||||||
'publiclyVisible': true
|
|
||||||
},
|
|
||||||
'journals': [{
|
|
||||||
'titles': ['The Lancet', 'Lancet'],
|
|
||||||
'url': 'http://www.thelancet.com/journals/lancet/issue/current',
|
|
||||||
'issns': ['0140-6736', '1474-547X'],
|
|
||||||
'romeoPub': 'Elsevier: The Lancet',
|
|
||||||
'zetoPub': 'Elsevier: The Lancet',
|
|
||||||
'publisher': {
|
|
||||||
'name': 'Elsevier',
|
|
||||||
'relationshipType': null,
|
|
||||||
'country': null,
|
|
||||||
'uri': 'http://www.elsevier.com/',
|
|
||||||
'identifier': null,
|
|
||||||
'publicationCount': 0,
|
|
||||||
'paidAccessDescription': 'Open access',
|
|
||||||
'paidAccessUrl': 'https://www.elsevier.com/about/open-science/open-access'
|
|
||||||
},
|
|
||||||
'publishers': [{
|
|
||||||
'name': 'Elsevier',
|
|
||||||
'relationshipType': null,
|
|
||||||
'country': null,
|
|
||||||
'uri': 'http://www.elsevier.com/',
|
|
||||||
'identifier': null,
|
|
||||||
'publicationCount': 0,
|
|
||||||
'paidAccessDescription': 'Open access',
|
|
||||||
'paidAccessUrl': 'https://www.elsevier.com/about/open-science/open-access'
|
|
||||||
}],
|
|
||||||
'policies': [{
|
|
||||||
'id': 0,
|
|
||||||
'openAccessPermitted': false,
|
|
||||||
'uri': null,
|
|
||||||
'internalMoniker': 'Lancet',
|
|
||||||
'permittedVersions': [{
|
|
||||||
'articleVersion': 'submitted',
|
|
||||||
'option': 1,
|
|
||||||
'conditions': ['Upon publication publisher copyright and source must be acknowledged', 'Upon publication must link to publisher version'],
|
|
||||||
'prerequisites': [],
|
|
||||||
'locations': ['Author\'s Homepage', 'Preprint Repository'],
|
|
||||||
'licenses': [],
|
|
||||||
'embargo': null
|
|
||||||
}, {
|
|
||||||
'articleVersion': 'accepted',
|
|
||||||
'option': 1,
|
|
||||||
'conditions': ['Publisher copyright and source must be acknowledged', 'Must link to publisher version'],
|
|
||||||
'prerequisites': [],
|
|
||||||
'locations': ['Author\'s Homepage', 'Institutional Website'],
|
|
||||||
'licenses': ['CC BY-NC-ND'],
|
|
||||||
'embargo': null
|
|
||||||
}, {
|
|
||||||
'articleVersion': 'accepted',
|
|
||||||
'option': 2,
|
|
||||||
'conditions': ['Publisher copyright and source must be acknowledged', 'Must link to publisher version'],
|
|
||||||
'prerequisites': ['If Required by Funder'],
|
|
||||||
'locations': ['Non-Commercial Repository'],
|
|
||||||
'licenses': ['CC BY-NC-ND'],
|
|
||||||
'embargo': null
|
|
||||||
}, {
|
|
||||||
'articleVersion': 'accepted',
|
|
||||||
'option': 3,
|
|
||||||
'conditions': ['Publisher copyright and source must be acknowledged', 'Must link to publisher version'],
|
|
||||||
'prerequisites': [],
|
|
||||||
'locations': ['Non-Commercial Repository'],
|
|
||||||
'licenses': [],
|
|
||||||
'embargo': null
|
|
||||||
}],
|
|
||||||
'urls': {
|
|
||||||
'http://download.thelancet.com/flatcontentassets/authors/lancet-information-for-authors.pdf': 'Guidelines for Authors',
|
|
||||||
'http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2813%2960720-5/fulltext': 'The Lancet journals welcome a new open access policy',
|
|
||||||
'http://www.thelancet.com/lancet-information-for-authors/after-publication': 'What happens after publication?',
|
|
||||||
'http://www.thelancet.com/lancet/information-for-authors/disclosure-of-results': 'Disclosure of results before publication',
|
|
||||||
'https://www.elsevier.com/__data/assets/pdf_file/0005/78476/external-embargo-list.pdf': 'Journal Embargo Period List',
|
|
||||||
'https://www.elsevier.com/__data/assets/pdf_file/0011/78473/UK-Embargo-Periods.pdf': 'Journal Embargo List for UK Authors'
|
|
||||||
},
|
|
||||||
'openAccessProhibited': false,
|
|
||||||
'publicationCount': 0,
|
|
||||||
'preArchiving': 'can',
|
|
||||||
'postArchiving': 'can',
|
|
||||||
'pubArchiving': 'cannot'
|
|
||||||
}],
|
|
||||||
'inDOAJ': false
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
} as WorkspaceitemSectionSherpaPoliciesObject,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
console.log(mappedActions);
|
|
||||||
return { action: action, definition: definition, mappedActions: mappedActions };
|
return { action: action, definition: definition, mappedActions: mappedActions };
|
||||||
}),
|
}),
|
||||||
mergeMap((result) => {
|
mergeMap((result) => {
|
||||||
@@ -245,7 +127,7 @@ export class SubmissionObjectEffects {
|
|||||||
this.submissionService.getSubmissionObjectLinkName(),
|
this.submissionService.getSubmissionObjectLinkName(),
|
||||||
action.payload.submissionId,
|
action.payload.submissionId,
|
||||||
'sections').pipe(
|
'sections').pipe(
|
||||||
map((response: SubmissionObject[]) => new SaveSubmissionFormSuccessAction(action.payload.submissionId, response, action.payload.isManual)),
|
map((response: SubmissionObject[]) => new SaveSubmissionFormSuccessAction(action.payload.submissionId, response, action.payload.isManual, action.payload.isManual)),
|
||||||
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));
|
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));
|
||||||
})));
|
})));
|
||||||
|
|
||||||
@@ -271,7 +153,8 @@ export class SubmissionObjectEffects {
|
|||||||
withLatestFrom(this.store$),
|
withLatestFrom(this.store$),
|
||||||
map(([action, currentState]: [SaveSubmissionFormSuccessAction, any]) => {
|
map(([action, currentState]: [SaveSubmissionFormSuccessAction, any]) => {
|
||||||
return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId],
|
return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId],
|
||||||
action.payload.submissionObject, action.payload.submissionId, currentState.forms, action.payload.notify);
|
action.payload.submissionObject, action.payload.submissionId, currentState.forms,
|
||||||
|
action.payload.showNotifications, action.payload.showErrors);
|
||||||
}),
|
}),
|
||||||
mergeMap((actions) => observableFrom(actions))));
|
mergeMap((actions) => observableFrom(actions))));
|
||||||
|
|
||||||
@@ -284,7 +167,7 @@ export class SubmissionObjectEffects {
|
|||||||
withLatestFrom(this.store$),
|
withLatestFrom(this.store$),
|
||||||
map(([action, currentState]: [SaveSubmissionSectionFormSuccessAction, any]) => {
|
map(([action, currentState]: [SaveSubmissionSectionFormSuccessAction, any]) => {
|
||||||
return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId],
|
return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId],
|
||||||
action.payload.submissionObject, action.payload.submissionId, currentState.forms, false);
|
action.payload.submissionObject, action.payload.submissionId, currentState.forms, false, false);
|
||||||
}),
|
}),
|
||||||
mergeMap((actions) => observableFrom(actions))));
|
mergeMap((actions) => observableFrom(actions))));
|
||||||
|
|
||||||
@@ -335,7 +218,13 @@ export class SubmissionObjectEffects {
|
|||||||
if (this.canDeposit(response)) {
|
if (this.canDeposit(response)) {
|
||||||
return new DepositSubmissionAction(action.payload.submissionId);
|
return new DepositSubmissionAction(action.payload.submissionId);
|
||||||
} else {
|
} else {
|
||||||
return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response);
|
this.notificationsService.warning(
|
||||||
|
null,
|
||||||
|
this.translate.instant('submission.sections.general.cannot_deposit'),
|
||||||
|
null,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response, false, true);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));
|
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));
|
||||||
@@ -481,18 +370,23 @@ export class SubmissionObjectEffects {
|
|||||||
* A boolean that indicate if show notification or not
|
* A boolean that indicate if show notification or not
|
||||||
* @return SubmissionObjectAction[]
|
* @return SubmissionObjectAction[]
|
||||||
* List of SubmissionObjectAction to dispatch
|
* List of SubmissionObjectAction to dispatch
|
||||||
|
* @param showNotifications
|
||||||
|
* A boolean representing if to show notifications on save
|
||||||
|
* @param showErrors
|
||||||
|
* A boolean representing if to show errors on save
|
||||||
*/
|
*/
|
||||||
protected parseSaveResponse(
|
protected parseSaveResponse(
|
||||||
currentState: SubmissionObjectEntry,
|
currentState: SubmissionObjectEntry,
|
||||||
response: SubmissionObject[],
|
response: SubmissionObject[],
|
||||||
submissionId: string,
|
submissionId: string,
|
||||||
forms: FormState,
|
forms: FormState,
|
||||||
notify: boolean = true): SubmissionObjectAction[] {
|
showNotifications: boolean = true,
|
||||||
|
showErrors: boolean = true): SubmissionObjectAction[] {
|
||||||
|
|
||||||
const mappedActions = [];
|
const mappedActions = [];
|
||||||
|
|
||||||
if (isNotEmpty(response)) {
|
if (isNotEmpty(response)) {
|
||||||
if (notify) {
|
if (showNotifications) {
|
||||||
this.notificationsService.success(null, this.translate.get('submission.sections.general.save_success_notice'));
|
this.notificationsService.success(null, this.translate.get('submission.sections.general.save_success_notice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +398,7 @@ export class SubmissionObjectEffects {
|
|||||||
if (errors && !isEmpty(errors)) {
|
if (errors && !isEmpty(errors)) {
|
||||||
// to avoid dispatching an action for every error, create an array of errors per section
|
// to avoid dispatching an action for every error, create an array of errors per section
|
||||||
errorsList = parseSectionErrors(errors);
|
errorsList = parseSectionErrors(errors);
|
||||||
if (notify) {
|
if (showNotifications) {
|
||||||
this.notificationsService.warning(null, this.translate.get('submission.sections.general.sections_not_valid'));
|
this.notificationsService.warning(null, this.translate.get('submission.sections.general.sections_not_valid'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,12 +417,12 @@ export class SubmissionObjectEffects {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notify && !currentState.sections[sectionId].enabled) {
|
if (showNotifications && !currentState.sections[sectionId].enabled) {
|
||||||
this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType);
|
this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sectionForm = getForm(forms, currentState, sectionId);
|
const sectionForm = getForm(forms, currentState, sectionId);
|
||||||
const filteredErrors = filterErrors(sectionForm, sectionErrors, currentState.sections[sectionId].sectionType, notify);
|
const filteredErrors = filterErrors(sectionForm, sectionErrors, currentState.sections[sectionId].sectionType, showErrors);
|
||||||
mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, filteredErrors, sectionErrors));
|
mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, filteredErrors, sectionErrors));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -3828,6 +3828,8 @@
|
|||||||
|
|
||||||
"submission.sections.general.add-more": "Add more",
|
"submission.sections.general.add-more": "Add more",
|
||||||
|
|
||||||
|
"submission.sections.general.cannot_deposit": "Deposit cannot be completed due to errors in the form.<br>Please fill out all required fields to complete the deposit.",
|
||||||
|
|
||||||
"submission.sections.general.collection": "Collection",
|
"submission.sections.general.collection": "Collection",
|
||||||
|
|
||||||
"submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.",
|
"submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.",
|
||||||
|
Reference in New Issue
Block a user