Commit d62c5fc3 authored by Rajkumar-D's avatar Rajkumar-D
Browse files

Fixing: ENA-4304 and ENA-3879

parent 301bc560
Pipeline #164870 passed with stages
in 3 minutes and 35 seconds
...@@ -167,6 +167,10 @@ export class ChecklistComponent implements OnInit { ...@@ -167,6 +167,10 @@ export class ChecklistComponent implements OnInit {
this.selectedChecklist = checklist; this.selectedChecklist = checklist;
this.selectedFields = {}; this.selectedFields = {};
this.mandatoryFields = {}; this.mandatoryFields = {};
// Add sample related fields when checklist type is sample.
if (this.checklistType === ChecklistType.sample) {
this.selectedChecklist.fieldGroups.push(this.getSampleSpecificFields())
}
this.selectedChecklist.fieldGroups.forEach((fieldGroup) => { this.selectedChecklist.fieldGroups.forEach((fieldGroup) => {
fieldGroup.fields.forEach((field) => { fieldGroup.fields.forEach((field) => {
this.selectedFields[field.label] = (field.mandatory === 'mandatory'); this.selectedFields[field.label] = (field.mandatory === 'mandatory');
...@@ -462,7 +466,6 @@ export class ChecklistComponent implements OnInit { ...@@ -462,7 +466,6 @@ export class ChecklistComponent implements OnInit {
} }
uploadFile(form) { uploadFile(form) {
const formData: FormData = new FormData(); const formData: FormData = new FormData();
const observable: Observable<string> = const observable: Observable<string> =
...@@ -482,6 +485,40 @@ export class ChecklistComponent implements OnInit { ...@@ -482,6 +485,40 @@ export class ChecklistComponent implements OnInit {
this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath); this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath);
} }
getSampleSpecificFields() {
let sampleSpecificFields = {
name: "Sample Details",
fields: [{
name: "sample_alias",
label: "Sample alias (unique name)",
description: "Unique name of the sample. If not selected system will auto generate an unique alias",
mandatory: "optional",
textChoice: [],
type: "TEXT_FIELD",
units: []
},
{
name: "sample_title",
label: "Sample title",
description: "Title of the sample",
mandatory: "optional",
textChoice: [],
type: "TEXT_FIELD",
units: []
},
{
name: "sample_description",
label: "Sample description",
description: "Description of the sample",
mandatory: "optional",
textChoice: [],
type: "TEXT_FIELD",
units: []
}]
}
return sampleSpecificFields;
}
isBroker(): boolean { isBroker(): boolean {
return this._webinAuthenticationService.isBroker(); return this._webinAuthenticationService.isBroker();
} }
......
...@@ -41,8 +41,25 @@ ...@@ -41,8 +41,25 @@
</div> </div>
<div *ngIf="webinAccessionDataSource"> <div *ngIf="webinAccessionDataSource">
<div class="app-success"> <div class="app-success">
<i class="material-icons">done</i> <i class="material-icons" style="float:left">done</i>
<span *ngIf="!displayMessage"> The submission was successful.</span> <div style="margin-left: 5%;" class="mat-body" *ngIf="!displayMessage && projectAccession">
<p>Thank you for your submission.</p>
<p>Please use the project accession {{projectAccession}} when <a
href="https://ena-docs.readthedocs.io/en/latest/submit/general-guide/accessions.html#how-to-cite-your-ena-study">citing
your data in publications</a></p>
<p *ngIf="projectStatus == 'PRIVATE'">
Your study will be held private until {{projectReleaseDateStr}}. You must release this study once data
associated with it has been published. The release date can be changed by editing the study in 'Studies
Report'.
</p>
<p>Any citations should be added by editing the study in 'Studies Report'. </p>
<p>If you need further assistance please contact the <a href="https://www.ebi.ac.uk/ena/browser/support">ENA
helpdesk</a></p>
</div>
<span *ngIf="!displayMessage && webinAccessionDataSource.data[0].type != 'PROJECT'"> The submission was
successful.</span>
<span *ngIf="displayMessage"> {{displayMessage}}</span> <span *ngIf="displayMessage"> {{displayMessage}}</span>
</div> </div>
</div> </div>
......
...@@ -48,6 +48,9 @@ export class SubmissionResultComponent { ...@@ -48,6 +48,9 @@ export class SubmissionResultComponent {
message; message;
errorMessage; errorMessage;
resultError; resultError;
projectAccession: string;
projectStatus: string;
projectReleaseDateStr: string;
projectLinkError; projectLinkError;
projectLinkMessage; projectLinkMessage;
showReceiptXml = false; showReceiptXml = false;
...@@ -97,6 +100,14 @@ export class SubmissionResultComponent { ...@@ -97,6 +100,14 @@ export class SubmissionResultComponent {
this.result = this._webinRestService.parseResult(data); this.result = this._webinRestService.parseResult(data);
// console.log('** Webin submission **', this.result); // console.log('** Webin submission **', this.result);
// Find project submission and used its response for displaying different success message.
let projectResult = this.result.accessions.find(element => element.type === "PROJECT")
if (projectResult) {
this.projectAccession = projectResult.accession;
this.projectStatus = this.result.releaseStatus;
this.projectReleaseDateStr = this.result.releaseDate.slice(0, 10);
}
if (this.result.isError) { if (this.result.isError) {
this.webinErrorDataSource = new MatTableDataSource<WebinError>(this.result.errors); this.webinErrorDataSource = new MatTableDataSource<WebinError>(this.result.errors);
this.webinErrorDataSource.paginator = this.webinErrorPaginator; this.webinErrorDataSource.paginator = this.webinErrorPaginator;
...@@ -136,12 +147,12 @@ export class SubmissionResultComponent { ...@@ -136,12 +147,12 @@ export class SubmissionResultComponent {
} else { } else {
// For project linking // For project linking
var projectAccession = this.result.accessions.find(element => element.type === "PROJECT").accession; this.projectAccession = this.result.accessions.find(element => element.type === "PROJECT").accession;
projectLinkJsonForUpdate["projectId"] = projectAccession; projectLinkJsonForUpdate["projectId"] = this.projectAccession;
// Delete projectLink before insert / update // Delete projectLink before insert / update
if (projectLinkJsonForDelete["parentId"] || projectLinkJsonForDelete["childIds"].length > 0) { if (projectLinkJsonForDelete["parentId"] || projectLinkJsonForDelete["childIds"].length > 0) {
projectLinkJsonForDelete["projectId"] = projectAccession; projectLinkJsonForDelete["projectId"] = this.projectAccession;
console.log("Delete project link: " + JSON.stringify(projectLinkJsonForDelete)) console.log("Delete project link: " + JSON.stringify(projectLinkJsonForDelete))
this.deleteProjectLink(projectLinkJsonForDelete); this.deleteProjectLink(projectLinkJsonForDelete);
} }
......
...@@ -19,6 +19,7 @@ import { tap, startWith, map, debounceTime, catchError } from 'rxjs/operators'; ...@@ -19,6 +19,7 @@ import { tap, startWith, map, debounceTime, catchError } from 'rxjs/operators';
import { ReportType } from './report-type.enum'; import { ReportType } from './report-type.enum';
import { WebinRestServiceInterface } from './webin-rest.service.interface'; import { WebinRestServiceInterface } from './webin-rest.service.interface';
import { WebinAuthenticationService } from './webin-authentication.service'; import { WebinAuthenticationService } from './webin-authentication.service';
import { stringify } from '@angular/compiler/src/util';
@Injectable() @Injectable()
...@@ -245,7 +246,10 @@ export class WebinRestService implements WebinRestServiceInterface { ...@@ -245,7 +246,10 @@ export class WebinRestService implements WebinRestServiceInterface {
xml: data, xml: data,
date: date, date: date,
accessions: [], accessions: [],
errors: [] errors: [],
// Fields for Project / study
releaseDate: String,
releaseStatus: String
}; };
let i = 0; let i = 0;
...@@ -271,6 +275,12 @@ export class WebinRestService implements WebinRestServiceInterface { ...@@ -271,6 +275,12 @@ export class WebinRestService implements WebinRestServiceInterface {
accession: childNode.getAttribute('accession'), accession: childNode.getAttribute('accession'),
alias: childNode.getAttribute('alias') alias: childNode.getAttribute('alias')
}); });
// Save project details for displaying project specific message.
if (childNode.tagName === 'PROJECT') {
receipt.releaseDate = childNode.getAttribute('holdUntilDate');
receipt.releaseStatus = childNode.getAttribute('status');
}
} }
} }
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment