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

Fixing submission error message

parent e4e5a8ac
Pipeline #169269 passed with stages
in 5 minutes and 27 seconds
......@@ -27,6 +27,7 @@ import { Observable } from 'rxjs';
import { PopupMessageComponent } from '../popup-message/popup-message.component';
import { UtilService } from '../util/Util-services'
import { SubmissionResultDialogComponent } from '../submission-result-dialog/submission-result-dialog.component';
import { NonSubmissionResultDialogComponent } from '../non-submission-result-dialog/non-submission-result-dialog.component';
interface BooleanFieldInterface {
[key: string]: boolean;
......@@ -467,22 +468,26 @@ export class ChecklistComponent implements OnInit {
}
uploadFile(form) {
const formData: FormData = new FormData();
const observable: Observable<string> =
this._webinRestService.submitXml(
null,
null,
null,
form.spreadSheet,
null,
null,
null,
null,
null,
null,
form.value.centerName);
let redirectPath = "/app-checklist/sample/true"
this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath);
if (!this._webinRestService.isValidTabSubmissionFile(form.spreadSheet)) {
this.util.showError(this, NonSubmissionResultDialogComponent, "The uploaded file is not valid for sample submission. Please upload file in any of the following format: .csv, .tsv, .tab", "Submission Result")
} else {
const formData: FormData = new FormData();
const observable: Observable<string> =
this._webinRestService.submitXml(
null,
null,
null,
form.spreadSheet,
null,
null,
null,
null,
null,
null,
form.value.centerName);
let redirectPath = "/app-checklist/sample/true"
this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath);
}
}
getSampleSpecificFields() {
......
......@@ -11,6 +11,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { PopupMessageComponent } from '../popup-message/popup-message.component';
import { WebinAuthenticationService } from '../webin-authentication.service';
import { SubmissionResultDialogComponent } from '../submission-result-dialog/submission-result-dialog.component';
import { NonSubmissionResultDialogComponent } from '../non-submission-result-dialog/non-submission-result-dialog.component';
@Component({
selector: 'app-read-submission',
......@@ -116,23 +117,28 @@ export class ReadSubmissionComponent implements OnInit {
selectedChecklistObject["fields"] = this.selectedFieldsArray;
}
uploadFile(form) {
const formData: FormData = new FormData();
const observable: Observable<string> =
this._webinRestService.submitXml(
null,
null,
null,
null,
null,
form.spreadSheet,
null,
null,
null,
null,
this.centerName);
let redirectPath = "/read-submission";
this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath)
uloadFile(form) {
if (!this._webinRestService.isValidTabSubmissionFile(form.spreadSheet)) {
this.util.showError(this, NonSubmissionResultDialogComponent, "The uploaded file is not valid for read submission. Please upload file in any of the following format: .csv, .tsv, .tab", "Submission Result")
} else {
this._webinRestService.isValidTabSubmissionFile(form.spreadSheet);
const formData: FormData = new FormData();
const observable: Observable<string> =
this._webinRestService.submitXml(
null,
null,
null,
null,
null,
form.spreadSheet,
null,
null,
null,
null,
this.centerName);
let redirectPath = "/read-submission";
this.util.showSubmissionResponse(this, SubmissionResultDialogComponent, observable, redirectPath)
}
}
isEga(): boolean {
......
......@@ -343,4 +343,13 @@ export class WebinRestService implements WebinRestServiceInterface {
return this.postEmail(mail)
}
isValidTabSubmissionFile(blob: Blob) {
var fileName = (blob as File).name;
// Check if the file is NOT in valid format.
if (!(fileName.endsWith("tab") || fileName.endsWith("tsv") || fileName.endsWith("csv"))) {
return false;
}
return true;
}
}
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