Commit f4591d30 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix: in plot alignment mode, query is still not required

parent 4c292dd6
...@@ -378,11 +378,6 @@ dgenies.run.valid_form = function () { ...@@ -378,11 +378,6 @@ dgenies.run.valid_form = function () {
dgenies.run.add_error("Target file is required!"); dgenies.run.add_error("Target file is required!");
has_errors = true; has_errors = true;
} }
if ($("input#queryidx").val().length === 0) {
$("label.file-queryidx").addClass("error");
dgenies.run.add_error("Query file is required!");
has_errors = true;
}
if ($("input#alignfile").val().length === 0) { if ($("input#alignfile").val().length === 0) {
$("label.file-align").addClass("error"); $("label.file-align").addClass("error");
dgenies.run.add_error("Alignment file is required!"); dgenies.run.add_error("Alignment file is required!");
......
...@@ -5,5 +5,5 @@ $(`button#button-${ftype}`).click(function(){$(`input.file-${ftype}`).trigger("c ...@@ -5,5 +5,5 @@ $(`button#button-${ftype}`).click(function(){$(`input.file-${ftype}`).trigger("c
if($("input#id_job").val().length===0){$("label.id-job").addClass("error");dgenies.run.add_error("Name of your job is required!");has_errors=true}// Check mail: if($("input#id_job").val().length===0){$("label.id-job").addClass("error");dgenies.run.add_error("Name of your job is required!");has_errors=true}// Check mail:
if(dgenies.mode==="webserver"){let email=$("input#email").val();let mail_re=/^.+@.+\..+$/;if(email.match(mail_re)===null){$("label.email").addClass("error");if(email==="")dgenies.run.add_error("Email is required!");else dgenies.run.add_error("Email is not correct!");has_errors=true}}let tab=$("#tabs .tab.active").attr("id");/* TAB 1 */if(tab==="tab1"){//Check input target: if(dgenies.mode==="webserver"){let email=$("input#email").val();let mail_re=/^.+@.+\..+$/;if(email.match(mail_re)===null){$("label.email").addClass("error");if(email==="")dgenies.run.add_error("Email is required!");else dgenies.run.add_error("Email is not correct!");has_errors=true}}let tab=$("#tabs .tab.active").attr("id");/* TAB 1 */if(tab==="tab1"){//Check input target:
if($("input#target").val().length===0){$("label.file-target").addClass("error");dgenies.run.add_error("Target fasta is required!");has_errors=true}//Check input query: if($("input#target").val().length===0){$("label.file-target").addClass("error");dgenies.run.add_error("Target fasta is required!");has_errors=true}//Check input query:
let tool=$("input[name=tool]:checked").val();if(!dgenies.run.tool_has_ava[tool]&&$("input#query").val().length===0){$("label.file-query").addClass("error");dgenies.run.add_error("Query fasta is required!");has_errors=true}}/* TAB 2 */else{if($("input#targetidx").val().length===0){$("label.file-targetidx").addClass("error");dgenies.run.add_error("Target file is required!");has_errors=true}if($("input#queryidx").val().length===0){$("label.file-queryidx").addClass("error");dgenies.run.add_error("Query file is required!");has_errors=true}if($("input#alignfile").val().length===0){$("label.file-align").addClass("error");dgenies.run.add_error("Alignment file is required!");has_errors=true}}// Returns let tool=$("input[name=tool]:checked").val();if(!dgenies.run.tool_has_ava[tool]&&$("input#query").val().length===0){$("label.file-query").addClass("error");dgenies.run.add_error("Query fasta is required!");has_errors=true}}/* TAB 2 */else{if($("input#targetidx").val().length===0){$("label.file-targetidx").addClass("error");dgenies.run.add_error("Target file is required!");has_errors=true}if($("input#alignfile").val().length===0){$("label.file-align").addClass("error");dgenies.run.add_error("Alignment file is required!");has_errors=true}}// Returns
return!has_errors};dgenies.run.show_loading=function(fasta){$(".loading-file."+fasta).show()};dgenies.run.hide_loading=function(fasta){$(".loading-file."+fasta).hide()};dgenies.run.show_success=function(fasta){$(".upload-success."+fasta).show()};dgenies.run.hide_success=function(fasta){$(".upload-success."+fasta).hide()};dgenies.run.reset_errors=function(){$("label").removeClass("error");$("div.errors-submit ul.flashes").find("li").remove()};dgenies.run.ask_for_upload=function(){console.log("Ask for upload...");dgenies.post("/ask-upload",{"s_id":dgenies.run.s_id},function(data,status){if(data["success"]){let allow_upload=data["allowed"];if(allow_upload){$("div#uploading-loading").html("Uploading files...");dgenies.run.ping_interval=window.setInterval(dgenies.run.ping_upload,15000);dgenies.run.upload_next()}else{window.setTimeout(dgenies.run.ask_for_upload,15000)}}else{dgenies.notify("message"in data?data["message"]:"An error has occurred. Please contact the support","danger",3000)}},undefined,false)};dgenies.run.ping_upload=function(){dgenies.post("/ping-upload",{"s_id":dgenies.run.s_id},function(data,status){})};dgenies.run.check_url=function(url){return url.startsWith("http://")||url.startsWith("https://")||url.startsWith("ftp://")||url.startsWith("example://")};dgenies.run.reset_other_tab=function(tab){if(tab==="tab1"){$("input#alignfile").val("");dgenies.run.files[2]=undefined;$("input#targetidx").val("");dgenies.run.files[3]=undefined;$("input#queryidx").val("");dgenies.run.files[4]=undefined}};dgenies.run._start_upload=function(ftype,fname){let has_uploads=false;let fasta_type=parseInt($(`select.${ftype}`).val());let fasta_val=$(`input#${ftype}`).val();if(fasta_type===0&&fasta_val.length>0){$(`button#button-${ftype}`).hide();dgenies.run.show_loading(ftype);has_uploads=true}else{dgenies.run.files[0]=undefined;if(fasta_val!==""&&!dgenies.run.check_url(fasta_val)){dgenies.run.add_error(`${fname} file: invalid URL`,"error");dgenies.run.enable_form();return false}}return has_uploads};dgenies.run.start_uploads=function(){let has_uploads=false;let tab=$("#tabs .tab.active").attr("id");let inputs=[];if(tab==="tab1"){dgenies.run.reset_file_form("tab2");inputs=[["query","Query"],["target","Target"]]}else{dgenies.run.reset_file_form("tab1");inputs=[["queryidx","Query"],["targetidx","Target"],["alignfile","Alignment"]]}for(let i in inputs){let input=inputs[i];let test_has_uploads=dgenies.run._start_upload(input[0],input[1]);has_uploads=has_uploads||test_has_uploads}if(has_uploads){$("div#uploading-loading").html("Asking for upload...");dgenies.run.ask_for_upload()}else{dgenies.run.upload_next()}};dgenies.run.show_global_loading=function(){$("button#submit").hide();$("button#example").hide();$("div#uploading-loading").show()};dgenies.run.submit=function(){dgenies.run.reset_errors();if(dgenies.run.valid_form()){dgenies.run.disable_form();dgenies.run.show_global_loading();dgenies.run.start_uploads()}}; return!has_errors};dgenies.run.show_loading=function(fasta){$(".loading-file."+fasta).show()};dgenies.run.hide_loading=function(fasta){$(".loading-file."+fasta).hide()};dgenies.run.show_success=function(fasta){$(".upload-success."+fasta).show()};dgenies.run.hide_success=function(fasta){$(".upload-success."+fasta).hide()};dgenies.run.reset_errors=function(){$("label").removeClass("error");$("div.errors-submit ul.flashes").find("li").remove()};dgenies.run.ask_for_upload=function(){console.log("Ask for upload...");dgenies.post("/ask-upload",{"s_id":dgenies.run.s_id},function(data,status){if(data["success"]){let allow_upload=data["allowed"];if(allow_upload){$("div#uploading-loading").html("Uploading files...");dgenies.run.ping_interval=window.setInterval(dgenies.run.ping_upload,15000);dgenies.run.upload_next()}else{window.setTimeout(dgenies.run.ask_for_upload,15000)}}else{dgenies.notify("message"in data?data["message"]:"An error has occurred. Please contact the support","danger",3000)}},undefined,false)};dgenies.run.ping_upload=function(){dgenies.post("/ping-upload",{"s_id":dgenies.run.s_id},function(data,status){})};dgenies.run.check_url=function(url){return url.startsWith("http://")||url.startsWith("https://")||url.startsWith("ftp://")||url.startsWith("example://")};dgenies.run.reset_other_tab=function(tab){if(tab==="tab1"){$("input#alignfile").val("");dgenies.run.files[2]=undefined;$("input#targetidx").val("");dgenies.run.files[3]=undefined;$("input#queryidx").val("");dgenies.run.files[4]=undefined}};dgenies.run._start_upload=function(ftype,fname){let has_uploads=false;let fasta_type=parseInt($(`select.${ftype}`).val());let fasta_val=$(`input#${ftype}`).val();if(fasta_type===0&&fasta_val.length>0){$(`button#button-${ftype}`).hide();dgenies.run.show_loading(ftype);has_uploads=true}else{dgenies.run.files[0]=undefined;if(fasta_val!==""&&!dgenies.run.check_url(fasta_val)){dgenies.run.add_error(`${fname} file: invalid URL`,"error");dgenies.run.enable_form();return false}}return has_uploads};dgenies.run.start_uploads=function(){let has_uploads=false;let tab=$("#tabs .tab.active").attr("id");let inputs=[];if(tab==="tab1"){dgenies.run.reset_file_form("tab2");inputs=[["query","Query"],["target","Target"]]}else{dgenies.run.reset_file_form("tab1");inputs=[["queryidx","Query"],["targetidx","Target"],["alignfile","Alignment"]]}for(let i in inputs){let input=inputs[i];let test_has_uploads=dgenies.run._start_upload(input[0],input[1]);has_uploads=has_uploads||test_has_uploads}if(has_uploads){$("div#uploading-loading").html("Asking for upload...");dgenies.run.ask_for_upload()}else{dgenies.run.upload_next()}};dgenies.run.show_global_loading=function(){$("button#submit").hide();$("button#example").hide();$("div#uploading-loading").show()};dgenies.run.submit=function(){dgenies.run.reset_errors();if(dgenies.run.valid_form()){dgenies.run.disable_form();dgenies.run.show_global_loading();dgenies.run.start_uploads()}};
Supports Markdown
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