added JSON response, created new submission section

This commit is contained in:
lotte
2019-06-25 16:35:26 +02:00
parent deef684d70
commit 0746aaed43
12 changed files with 497 additions and 12 deletions

View File

@@ -60,6 +60,8 @@ export class SubmissionService {
*/
protected timer$: Observable<any>;
private workspaceLinkPath = 'workspaceitems';
private workflowLinkPath = 'workflowitems';
/**
* Initialize service variables
* @param {GlobalConfig} EnvConfig
@@ -98,7 +100,7 @@ export class SubmissionService {
* observable of SubmissionObject
*/
createSubmission(): Observable<SubmissionObject> {
return this.restService.postToEndpoint('workspaceitems', {}).pipe(
return this.restService.postToEndpoint(this.workspaceLinkPath, {}).pipe(
map((workspaceitem: SubmissionObject) => workspaceitem[0]),
catchError(() => observableOf({})))
}
@@ -116,7 +118,7 @@ export class SubmissionService {
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'text/uri-list');
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 {
const url = this.router.routerState.snapshot.url;
if (url.startsWith('/workspaceitems') || url.startsWith('/submit')) {
return 'workspaceitems';
return this.workspaceLinkPath;
} else if (url.startsWith('/workflowitems')) {
return 'workflowitems';
return this.workflowLinkPath;
} else {
return 'edititems';
}
@@ -323,10 +325,10 @@ export class SubmissionService {
getSubmissionScope(): SubmissionScopeType {
let scope: SubmissionScopeType;
switch (this.getSubmissionObjectLinkName()) {
case 'workspaceitems':
case this.workspaceLinkPath:
scope = SubmissionScopeType.WorkspaceItem;
break;
case 'workflowitems':
case this.workflowLinkPath:
scope = SubmissionScopeType.WorkflowItem;
break;
}