mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
added JSON response, created new submission section
This commit is contained in:
@@ -104,6 +104,7 @@
|
|||||||
"https": "1.0.0",
|
"https": "1.0.0",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"js.clone": "0.0.3",
|
"js.clone": "0.0.3",
|
||||||
|
"json-loader": "^0.5.7",
|
||||||
"jsonschema": "1.2.2",
|
"jsonschema": "1.2.2",
|
||||||
"jwt-decode": "^2.2.0",
|
"jwt-decode": "^2.2.0",
|
||||||
"methods": "1.1.2",
|
"methods": "1.1.2",
|
||||||
|
@@ -96,6 +96,7 @@ import { EndpointMockingRestService } from './dspace-rest-v2/endpoint-mocking-re
|
|||||||
import { ENV_CONFIG, GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
import { ENV_CONFIG, GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
||||||
|
|
||||||
export const restServiceFactory = (cfg: GlobalConfig, mocks: MockResponseMap, http: HttpClient) => {
|
export const restServiceFactory = (cfg: GlobalConfig, mocks: MockResponseMap, http: HttpClient) => {
|
||||||
|
console.log('REST SERVICE FACTORY');
|
||||||
if (ENV_CONFIG.production) {
|
if (ENV_CONFIG.production) {
|
||||||
return new DSpaceRESTv2Service(http);
|
return new DSpaceRESTv2Service(http);
|
||||||
} else {
|
} else {
|
||||||
@@ -127,7 +128,6 @@ const PROVIDERS = [
|
|||||||
DSOResponseParsingService,
|
DSOResponseParsingService,
|
||||||
{ provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap },
|
{ provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap },
|
||||||
{ provide: DSpaceRESTv2Service, useFactory: restServiceFactory, deps: [GLOBAL_CONFIG, MOCK_RESPONSE_MAP, HttpClient]},
|
{ provide: DSpaceRESTv2Service, useFactory: restServiceFactory, deps: [GLOBAL_CONFIG, MOCK_RESPONSE_MAP, HttpClient]},
|
||||||
DSpaceRESTv2Service,
|
|
||||||
DynamicFormLayoutService,
|
DynamicFormLayoutService,
|
||||||
DynamicFormService,
|
DynamicFormService,
|
||||||
DynamicFormValidationService,
|
DynamicFormValidationService,
|
||||||
|
@@ -39,6 +39,7 @@ export class EndpointMockingRestService extends DSpaceRESTv2Service {
|
|||||||
get(absoluteURL: string): Observable<DSpaceRESTV2Response> {
|
get(absoluteURL: string): Observable<DSpaceRESTV2Response> {
|
||||||
const mockData = this.getMockData(absoluteURL);
|
const mockData = this.getMockData(absoluteURL);
|
||||||
if (isEmpty(mockData)) {
|
if (isEmpty(mockData)) {
|
||||||
|
console.log(absoluteURL);
|
||||||
return super.get(absoluteURL);
|
return super.get(absoluteURL);
|
||||||
} else {
|
} else {
|
||||||
return this.toMockResponse$(mockData);
|
return this.toMockResponse$(mockData);
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { InjectionToken } from '@angular/core';
|
import { InjectionToken } from '@angular/core';
|
||||||
import mockSuggestResponse from './mock-suggest-response.json';
|
import mockSubmissionResponse from './mock-submission-response.json';
|
||||||
|
|
||||||
export class MockResponseMap extends Map<string, any> {};
|
export class MockResponseMap extends Map<string, any> {};
|
||||||
|
|
||||||
export const MOCK_RESPONSE_MAP: InjectionToken<MockResponseMap> = new InjectionToken<MockResponseMap>('mockResponseMap');
|
export const MOCK_RESPONSE_MAP: InjectionToken<MockResponseMap> = new InjectionToken<MockResponseMap>('mockResponseMap');
|
||||||
|
|
||||||
export const mockResponseMap: MockResponseMap = new Map([
|
export const mockResponseMap: MockResponseMap = new Map([
|
||||||
[ '/discover/suggestions', mockSuggestResponse ]
|
[ 'workspaceitems', mockSubmissionResponse ]
|
||||||
]);
|
]);
|
||||||
|
377
src/app/core/dspace-rest-v2/mocks/mock-submission-response.json
Normal file
377
src/app/core/dspace-rest-v2/mocks/mock-submission-response.json
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
{
|
||||||
|
"id": 733,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"message": "error.validation.required",
|
||||||
|
"paths": [
|
||||||
|
"/sections/traditionalpageone/dc.title",
|
||||||
|
"/sections/traditionalpageone/dc.date.issued"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastModified": "2019-06-25T13:44:29.178+0000",
|
||||||
|
"sections": {
|
||||||
|
"license": {
|
||||||
|
"url": null,
|
||||||
|
"acceptanceDate": null,
|
||||||
|
"granted": false
|
||||||
|
},
|
||||||
|
"upload": {
|
||||||
|
"files": []
|
||||||
|
},
|
||||||
|
"collection": "51715dd3-5590-49f2-b227-6a663c849921",
|
||||||
|
"traditionalpagetwo": {},
|
||||||
|
"traditionalpageone": {}
|
||||||
|
},
|
||||||
|
"type": "workspaceitem",
|
||||||
|
"_links": {
|
||||||
|
"collection": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/collection"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/item"
|
||||||
|
},
|
||||||
|
"submissionDefinition": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/submissionDefinition"
|
||||||
|
},
|
||||||
|
"submitter": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733/submitter"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/submission/workspaceitems/733"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_embedded": {
|
||||||
|
"submitter": {
|
||||||
|
"id": "335647b6-8a52-4ecb-a8c1-7ebabb199bda",
|
||||||
|
"uuid": "335647b6-8a52-4ecb-a8c1-7ebabb199bda",
|
||||||
|
"name": "dspacedemo+admin@gmail.com",
|
||||||
|
"handle": null,
|
||||||
|
"metadata": {
|
||||||
|
"eperson.firstname": [
|
||||||
|
{
|
||||||
|
"value": "Demo",
|
||||||
|
"language": null,
|
||||||
|
"authority": null,
|
||||||
|
"confidence": -1,
|
||||||
|
"place": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eperson.language": [
|
||||||
|
{
|
||||||
|
"value": "en",
|
||||||
|
"language": null,
|
||||||
|
"authority": null,
|
||||||
|
"confidence": -1,
|
||||||
|
"place": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eperson.lastname": [
|
||||||
|
{
|
||||||
|
"value": "Site Administrator",
|
||||||
|
"language": null,
|
||||||
|
"authority": null,
|
||||||
|
"confidence": -1,
|
||||||
|
"place": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"netid": null,
|
||||||
|
"lastActive": "2019-06-25T13:44:28.616+0000",
|
||||||
|
"canLogIn": true,
|
||||||
|
"email": "dspacedemo+admin@gmail.com",
|
||||||
|
"requireCertificate": false,
|
||||||
|
"selfRegistered": false,
|
||||||
|
"type": "eperson",
|
||||||
|
"_links": {
|
||||||
|
"groups": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/eperson/epersons/335647b6-8a52-4ecb-a8c1-7ebabb199bda/groups"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/eperson/epersons/335647b6-8a52-4ecb-a8c1-7ebabb199bda"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_embedded": {
|
||||||
|
"groups": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"id": "0b692d3b-70b9-415f-a56d-e557f026accc",
|
||||||
|
"uuid": "0b692d3b-70b9-415f-a56d-e557f026accc",
|
||||||
|
"name": null,
|
||||||
|
"handle": null,
|
||||||
|
"metadata": {},
|
||||||
|
"inArchive": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"withdrawn": false,
|
||||||
|
"lastModified": "2019-06-25T13:44:29.160+0000",
|
||||||
|
"type": "item",
|
||||||
|
"_links": {
|
||||||
|
"bitstreams": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/bitstreams"
|
||||||
|
},
|
||||||
|
"owningCollection": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/owningCollection"
|
||||||
|
},
|
||||||
|
"relationships": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/relationships"
|
||||||
|
},
|
||||||
|
"templateItemOf": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/templateItemOf"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_embedded": {
|
||||||
|
"relationships": {
|
||||||
|
"_embedded": {
|
||||||
|
"relationships": []
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"number": 0,
|
||||||
|
"size": 0,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalElements": 0
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/relationships"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"owningCollection": null,
|
||||||
|
"templateItemOf": null,
|
||||||
|
"bitstreams": {
|
||||||
|
"_embedded": {
|
||||||
|
"bitstreams": []
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"number": 0,
|
||||||
|
"size": 0,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalElements": 0
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/items/0b692d3b-70b9-415f-a56d-e557f026accc/bitstreams"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"submissionDefinition": {
|
||||||
|
"id": "traditional",
|
||||||
|
"name": "traditional",
|
||||||
|
"type": "submissiondefinition",
|
||||||
|
"isDefault": true,
|
||||||
|
"_links": {
|
||||||
|
"collections": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections"
|
||||||
|
},
|
||||||
|
"sections": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_embedded": {
|
||||||
|
"collections": {
|
||||||
|
"_embedded": {
|
||||||
|
"collections": []
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"number": 0,
|
||||||
|
"size": 0,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalElements": 0
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sections": {
|
||||||
|
"_embedded": {
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"id": "collection",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "collection",
|
||||||
|
"visibility": {
|
||||||
|
"main": "HIDDEN",
|
||||||
|
"other": "HIDDEN"
|
||||||
|
},
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/collection"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "relationships",
|
||||||
|
"header": "submit.progressbar.relationships",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "relationships",
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/relationships"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "traditionalpageone",
|
||||||
|
"header": "submit.progressbar.describe.stepone",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "submission-form",
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/traditionalpageone"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionforms/traditionalpageone"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "traditionalpagetwo",
|
||||||
|
"header": "submit.progressbar.describe.steptwo",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "submission-form",
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "upload",
|
||||||
|
"header": "submit.progressbar.upload",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "upload",
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/upload"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionuploads/upload"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "license",
|
||||||
|
"header": "submit.progressbar.license",
|
||||||
|
"mandatory": true,
|
||||||
|
"sectionType": "license",
|
||||||
|
"visibility": {
|
||||||
|
"main": null,
|
||||||
|
"other": "READONLY"
|
||||||
|
},
|
||||||
|
"type": "submissionsection",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissionsections/license"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"number": 0,
|
||||||
|
"size": 20,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalElements": 5
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collection": {
|
||||||
|
"id": "51715dd3-5590-49f2-b227-6a663c849921",
|
||||||
|
"uuid": "51715dd3-5590-49f2-b227-6a663c849921",
|
||||||
|
"name": "1-step Workflow collection",
|
||||||
|
"handle": "123456789/500",
|
||||||
|
"metadata": {
|
||||||
|
"dc.description": [
|
||||||
|
{
|
||||||
|
"value": "Start a new <a href=\"/submit\">submission</a>.",
|
||||||
|
"language": null,
|
||||||
|
"authority": null,
|
||||||
|
"confidence": -1,
|
||||||
|
"place": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dc.title": [
|
||||||
|
{
|
||||||
|
"value": "1-step Workflow collection",
|
||||||
|
"language": null,
|
||||||
|
"authority": null,
|
||||||
|
"confidence": -1,
|
||||||
|
"place": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "collection",
|
||||||
|
"_links": {
|
||||||
|
"license": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/license"
|
||||||
|
},
|
||||||
|
"defaultAccessConditions": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/defaultAccessConditions"
|
||||||
|
},
|
||||||
|
"logo": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/logo"
|
||||||
|
},
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_embedded": {
|
||||||
|
"logo": null,
|
||||||
|
"defaultAccessConditions": {
|
||||||
|
"_embedded": {
|
||||||
|
"defaultAccessConditions": [
|
||||||
|
{
|
||||||
|
"id": 3649,
|
||||||
|
"name": null,
|
||||||
|
"groupUUID": "f2c7eb75-aec0-4604-ab7f-6676723818ad",
|
||||||
|
"action": "DEFAULT_BITSTREAM_READ",
|
||||||
|
"type": "resourcePolicy",
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/authz/resourcePolicies/3649"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
"number": 0,
|
||||||
|
"size": 20,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalElements": 1
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://dspace7.4science.cloud/dspace-spring-rest/api/core/collections/51715dd3-5590-49f2-b227-6a663c849921/defaultAccessConditions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,49 @@
|
|||||||
|
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormService } from '../../../shared/form/form.service';
|
||||||
|
import { SectionModelComponent } from '../models/section.model';
|
||||||
|
import { SectionDataObject } from '../models/section-data.model';
|
||||||
|
import { renderSectionFor } from '../sections-decorator';
|
||||||
|
import { SectionsType } from '../sections-type';
|
||||||
|
import { SubmissionService } from '../../submission.service';
|
||||||
|
import { SectionsService } from '../sections.service';
|
||||||
|
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||||
|
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component represents a section that contains a Form.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-submission-section-relationships',
|
||||||
|
styleUrls: ['./section-relationships.component.scss'],
|
||||||
|
templateUrl: './section-relationships.component.html',
|
||||||
|
})
|
||||||
|
@renderSectionFor(SectionsType.Relationships)
|
||||||
|
export class SubmissionSectionRelationshipComponent extends SectionModelComponent {
|
||||||
|
constructor(protected changeDetectorRef: ChangeDetectorRef,
|
||||||
|
protected collectionDataService: CollectionDataService,
|
||||||
|
protected formBuilderService: FormBuilderService,
|
||||||
|
protected formService: FormService,
|
||||||
|
protected operationsBuilder: JsonPatchOperationsBuilder,
|
||||||
|
protected sectionService: SectionsService,
|
||||||
|
protected submissionService: SubmissionService,
|
||||||
|
@Inject('collectionIdProvider') public injectedCollectionId: string,
|
||||||
|
@Inject('sectionDataProvider') public injectedSectionData: SectionDataObject,
|
||||||
|
@Inject('submissionIdProvider') public injectedSubmissionId: string) {
|
||||||
|
super(injectedCollectionId, injectedSectionData, injectedSubmissionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSectionStatus(): Observable<boolean> {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onSectionDestroy(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onSectionInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,49 @@
|
|||||||
|
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormService } from '../../../shared/form/form.service';
|
||||||
|
import { SectionModelComponent } from '../models/section.model';
|
||||||
|
import { SectionDataObject } from '../models/section-data.model';
|
||||||
|
import { renderSectionFor } from '../sections-decorator';
|
||||||
|
import { SectionsType } from '../sections-type';
|
||||||
|
import { SubmissionService } from '../../submission.service';
|
||||||
|
import { SectionsService } from '../sections.service';
|
||||||
|
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||||
|
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component represents a section that contains a Form.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-submission-section-relationships',
|
||||||
|
styleUrls: ['./section-relationships.component.scss'],
|
||||||
|
templateUrl: './section-relationships.component.html',
|
||||||
|
})
|
||||||
|
@renderSectionFor(SectionsType.Relationships)
|
||||||
|
export class SubmissionSectionRelationshipComponent extends SectionModelComponent {
|
||||||
|
constructor(protected changeDetectorRef: ChangeDetectorRef,
|
||||||
|
protected collectionDataService: CollectionDataService,
|
||||||
|
protected formBuilderService: FormBuilderService,
|
||||||
|
protected formService: FormService,
|
||||||
|
protected operationsBuilder: JsonPatchOperationsBuilder,
|
||||||
|
protected sectionService: SectionsService,
|
||||||
|
protected submissionService: SubmissionService,
|
||||||
|
@Inject('collectionIdProvider') public injectedCollectionId: string,
|
||||||
|
@Inject('sectionDataProvider') public injectedSectionData: SectionDataObject,
|
||||||
|
@Inject('submissionIdProvider') public injectedSubmissionId: string) {
|
||||||
|
super(injectedCollectionId, injectedSectionData, injectedSubmissionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSectionStatus(): Observable<boolean> {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onSectionDestroy(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onSectionInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
export enum SectionsType {
|
export enum SectionsType {
|
||||||
|
Relationships = 'relationships',
|
||||||
SubmissionForm = 'submission-form',
|
SubmissionForm = 'submission-form',
|
||||||
Upload = 'upload',
|
Upload = 'upload',
|
||||||
License = 'license',
|
License = 'license',
|
||||||
|
@@ -60,6 +60,8 @@ export class SubmissionService {
|
|||||||
*/
|
*/
|
||||||
protected timer$: Observable<any>;
|
protected timer$: Observable<any>;
|
||||||
|
|
||||||
|
private workspaceLinkPath = 'workspaceitems';
|
||||||
|
private workflowLinkPath = 'workflowitems';
|
||||||
/**
|
/**
|
||||||
* Initialize service variables
|
* Initialize service variables
|
||||||
* @param {GlobalConfig} EnvConfig
|
* @param {GlobalConfig} EnvConfig
|
||||||
@@ -98,7 +100,7 @@ export class SubmissionService {
|
|||||||
* observable of SubmissionObject
|
* observable of SubmissionObject
|
||||||
*/
|
*/
|
||||||
createSubmission(): Observable<SubmissionObject> {
|
createSubmission(): Observable<SubmissionObject> {
|
||||||
return this.restService.postToEndpoint('workspaceitems', {}).pipe(
|
return this.restService.postToEndpoint(this.workspaceLinkPath, {}).pipe(
|
||||||
map((workspaceitem: SubmissionObject) => workspaceitem[0]),
|
map((workspaceitem: SubmissionObject) => workspaceitem[0]),
|
||||||
catchError(() => observableOf({})))
|
catchError(() => observableOf({})))
|
||||||
}
|
}
|
||||||
@@ -116,7 +118,7 @@ export class SubmissionService {
|
|||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
headers = headers.append('Content-Type', 'text/uri-list');
|
headers = headers.append('Content-Type', 'text/uri-list');
|
||||||
options.headers = headers;
|
options.headers = headers;
|
||||||
return this.restService.postToEndpoint('workflowitems', selfUrl, null, options) as Observable<SubmissionObject[]>;
|
return this.restService.postToEndpoint(this.workspaceLinkPath, selfUrl, null, options) as Observable<SubmissionObject[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,9 +308,9 @@ export class SubmissionService {
|
|||||||
getSubmissionObjectLinkName(): string {
|
getSubmissionObjectLinkName(): string {
|
||||||
const url = this.router.routerState.snapshot.url;
|
const url = this.router.routerState.snapshot.url;
|
||||||
if (url.startsWith('/workspaceitems') || url.startsWith('/submit')) {
|
if (url.startsWith('/workspaceitems') || url.startsWith('/submit')) {
|
||||||
return 'workspaceitems';
|
return this.workspaceLinkPath;
|
||||||
} else if (url.startsWith('/workflowitems')) {
|
} else if (url.startsWith('/workflowitems')) {
|
||||||
return 'workflowitems';
|
return this.workflowLinkPath;
|
||||||
} else {
|
} else {
|
||||||
return 'edititems';
|
return 'edititems';
|
||||||
}
|
}
|
||||||
@@ -323,10 +325,10 @@ export class SubmissionService {
|
|||||||
getSubmissionScope(): SubmissionScopeType {
|
getSubmissionScope(): SubmissionScopeType {
|
||||||
let scope: SubmissionScopeType;
|
let scope: SubmissionScopeType;
|
||||||
switch (this.getSubmissionObjectLinkName()) {
|
switch (this.getSubmissionObjectLinkName()) {
|
||||||
case 'workspaceitems':
|
case this.workspaceLinkPath:
|
||||||
scope = SubmissionScopeType.WorkspaceItem;
|
scope = SubmissionScopeType.WorkspaceItem;
|
||||||
break;
|
break;
|
||||||
case 'workflowitems':
|
case this.workflowLinkPath:
|
||||||
scope = SubmissionScopeType.WorkflowItem;
|
scope = SubmissionScopeType.WorkflowItem;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
|
|||||||
*
|
*
|
||||||
* @param {ChangeDetectorRef} changeDetectorRef
|
* @param {ChangeDetectorRef} changeDetectorRef
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {SubmissionService} submissioService
|
* @param {SubmissionService} submissionService
|
||||||
* @param {Router} router
|
* @param {Router} router
|
||||||
* @param {TranslateService} translate
|
* @param {TranslateService} translate
|
||||||
* @param {ViewContainerRef} viewContainerRef
|
* @param {ViewContainerRef} viewContainerRef
|
||||||
@@ -64,7 +64,7 @@ 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 submissioService: SubmissionService,
|
private submissionService: SubmissionService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private viewContainerRef: ViewContainerRef) {
|
private viewContainerRef: ViewContainerRef) {
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ export class SubmissionSubmitComponent implements OnDestroy, OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// NOTE execute the code on the browser side only, otherwise it is executed twice
|
// NOTE execute the code on the browser side only, otherwise it is executed twice
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.submissioService.createSubmission()
|
this.submissionService.createSubmission()
|
||||||
.subscribe((submissionObject: SubmissionObject) => {
|
.subscribe((submissionObject: SubmissionObject) => {
|
||||||
// NOTE new submission is created on the browser side only
|
// NOTE new submission is created on the browser side only
|
||||||
if (isNotNull(submissionObject)) {
|
if (isNotNull(submissionObject)) {
|
||||||
|
@@ -5582,6 +5582,11 @@ jsesc@~0.5.0:
|
|||||||
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
|
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
|
||||||
integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=
|
integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=
|
||||||
|
|
||||||
|
json-loader@^0.5.7:
|
||||||
|
version "0.5.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"
|
||||||
|
integrity sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==
|
||||||
|
|
||||||
json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
|
json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
|
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
|
||||||
|
Reference in New Issue
Block a user