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

Minify css and js in production

parent 64ad52f6
#!/usr/bin/env bash
if [ ! $(which index.js) ] ; then
echo """
ERROR: minifier is not installed!
Install it through npm:
npm install minifier
Then, add it to the PATH:
export PATH=\$PATH:~/node_modules/minifier
"""
exit 1
fi
cd src/dgenies/static/css
index.js -o dgenies.min.css dgenies.css
\ No newline at end of file
#!/usr/bin/env bash
set -e
if [ ! $(which babel.js) ] ; then
echo """
ERROR: babel is not installed!
Install it through npm:
npm install --save-dev babel-cli
Then, add it to the PATH:
export PATH=\$PATH:~/node_modules/babel-cli/bin
"""
exit 1
fi
cd src/dgenies/static/js
babel.js -o dgenies.min.js --compact --minified dgenies.js dgenies.prototypes.js
babel.js -o dgenies.result.min.js --compact --minified dgenies.result.js dgenies.result.controls.js dgenies.result.export.js dgenies.result.summary.js d3.boxplot.js d3.boxplot.events.js d3.boxplot.mousetip.js d3.boxplot.zoom.js
babel.js -o jquery.fileupload.min.js --compact --minified jquery.fileupload.js jquery.fileupload-process.js jquery.fileupload-validate.js
babel.js -o dgenies.run.min.js --compact --minified dgenies.run.js
babel.js -o dgenies.status.min.js --compact --minified dgenies.status.js
\ No newline at end of file
body{font-size:14px;font-family:sans-serif;padding-top:50px}#body{max-width:850px}.navbar-brand{padding-left:45px;background:url(images/logo.svg) no-repeat 0 5px;background-size:40px 40px}#legend{width:100%;height:230px;border:none;margin-bottom:10px;margin-left:10px;margin-top:40px}label.input-checkbox-label input[type=checkbox]{position:relative;vertical-align:middle;bottom:1px}#main-bar-title{background-color:black;color:white;padding-left:10px;margin-bottom:5px}#main-bar-title h1{margin-top:0;margin-bottom:0;margin-left:10px;padding-top:10px;padding-bottom:10px}#main-bar-title h1,#main-bar-title img{display:inline-block;vertical-align:middle;width:auto}#legend .draw{width:100%;height:200px}#legend .title{width:60%;height:30px;text-align:center;font-size:12pt;font-weight:bold;font-family:sans-serif;text-decoration:underline}#legend .draw{width:60%}#draw,#sidebar{display:table-cell;vertical-align:top}#sidebar{min-width:120px;max-width:165px}#sidebar input[type=number]{width:100px}#sidebar label{font-weight:normal!important}#sidebar input[type=button],#sidebar input[type=range],#sidebar input[type=number],#sidebar label{width:100%!important}#supdraw{width:auto;height:auto;position:relative;margin-top:5px}#draw{width:850px}.mylabel{font-size:18pt;font-weight:bold;font-family:FreeSans,sans-serif;top:10pt;position:absolute}#restore-all{width:5%!important;height:5%!important;top:0;right:0;position:absolute;background:#fff url(images/reset.svg) no-repeat 6.5px 7.5px;background-size:65% 65%;cursor:pointer;border:solid 1px black;border-radius:0 15px 0 0}#restore-all:hover{background:#000 url(images/reset_hover.svg) no-repeat 6.5px 7.5px;background-size:65% 65%}#loading{position:absolute;left:calc(50% - 140px);top:calc(50% - 48px)}#loading .label{color:black;display:inline-block;padding-left:55px;padding-right:5px;margin-left:-30px;height:50px;width:180px;background:white;border:1px solid black;border-radius:25px;font-size:20pt;font-weight:bold;vertical-align:middle}.cssload-container{position:relative;display:inline-block;padding-top:-20px;vertical-align:middle}.cssload-whirlpool,.cssload-whirlpool::before,.cssload-whirlpool::after{position:absolute;top:50%;left:50%;border:1px solid rgb(204,204,204);border-left-color:rgb(0,0,0);border-radius:674px;-o-border-radius:674px;-ms-border-radius:674px;-webkit-border-radius:674px;-moz-border-radius:674px}.cssload-whirlpool{margin:-17px 0 0 -17px;height:34px;width:34px;animation:cssload-rotate 1150ms linear infinite;-o-animation:cssload-rotate 1150ms linear infinite;-ms-animation:cssload-rotate 1150ms linear infinite;-webkit-animation:cssload-rotate 1150ms linear infinite;-moz-animation:cssload-rotate 1150ms linear infinite}.cssload-whirlpool::before{content:"";margin:-16px 0 0 -16px;height:30px;width:30px;animation:cssload-rotate 1150ms linear infinite;-o-animation:cssload-rotate 1150ms linear infinite;-ms-animation:cssload-rotate 1150ms linear infinite;-webkit-animation:cssload-rotate 1150ms linear infinite;-moz-animation:cssload-rotate 1150ms linear infinite}.cssload-whirlpool::after{content:"";margin:-20px 0 0 -20px;height:38px;width:38px;animation:cssload-rotate 2300ms linear infinite;-o-animation:cssload-rotate 2300ms linear infinite;-ms-animation:cssload-rotate 2300ms linear infinite;-webkit-animation:cssload-rotate 2300ms linear infinite;-moz-animation:cssload-rotate 2300ms linear infinite}@keyframes cssload-rotate{100%{transform:rotate(360deg)}}@-o-keyframes cssload-rotate{100%{-o-transform:rotate(360deg)}}@-ms-keyframes cssload-rotate{100%{-ms-transform:rotate(360deg)}}@-webkit-keyframes cssload-rotate{100%{-webkit-transform:rotate(360deg)}}@-moz-keyframes cssload-rotate{100%{-moz-transform:rotate(360deg)}}@media screen and (-webkit-min-device-pixel-ratio:0){Body{font-size:16px}}.form-group,.form-group input{margin-bottom:5px!important}div.submit-form fieldset{margin-bottom:10px}h2.title-launch{margin-bottom:20px}.form-group input[type=text],.form-group input[type=email]{width:300px}#body{margin-left:15px;margin-top:10px}.errors-submit ul li{background-color:#ff756b;border:solid 2px #7c0000;margin-bottom:5px;padding:3px;list-style-type:none;font-weight:bold}.errors-submit ul{padding:0;width:460px}html,body{height:100%}#main-wrapper{position:relative;padding-bottom:55px;min-height:100%}footer{position:absolute;bottom:0;height:55px;background:white}footer hr{margin-top:0}.notifyjs-corner{top:50px!important}div.top-forms{position:relative;width:810px}form#select-zone{margin-bottom:5px;margin-left:40px}div.top-forms select,div.top-forms input{height:28px}form#select-zone div.chosen-widget,form#select-zone input[type=button]{display:inline-block;vertical-align:middle}form#select-zone input[type=button]{line-height:100%}div.chosen-container{width:200px!important}a.chosen-single{height:30px!important;line-height:30px!important;font-size:11pt!important}a.chosen-single div b{background-position-y:4px!important}form#form-parameters{margin-top:20px;margin-left:15px}form#export{position:absolute;top:0;right:0}span.tip{position:absolute;z-index:2;display:none;font-size:12pt;height:auto;padding:10px;border-radius:3px;box-shadow:0 1px 2px #666;background:#ededed}table.drawtooltip td.tt-label{padding-right:5px;vertical-align:middle;font-weight:bold}#body-container{max-width:100%!important}div.navbar{background-image:linear-gradient(to bottom,#2B3044 0,#141a30 100%)}div.submit-form table td{padding-bottom:8px;vertical-align:bottom}div.submit-form table td label{padding-right:20px}div.submit-form table input#id_job,div.submit-form table input#email{width:410px}.input-group{display:inline-block}.input-group .input-group-btn,.input-group input{display:inline-block!important;position:relative!important;float:none!important}.input-group button{padding-top:0}div.input-group{padding-left:15px!important}.upload-btn-wrapper{position:relative;height:30px;width:42px;overflow:hidden;display:inline-block}button.btn-file{height:30px;width:42px}div.in-label{position:relative;display:inline-block;width:300px;height:30px;vertical-align:middle}div.progress{width:300px;height:30px;position:absolute;top:0;left:0;z-index:5!important;background:white;margin-bottom:0!important;box-shadow:none}div.progress .bar{height:100%;background:#33b234;z-index:5!important}select.select-type-input,.input-group button,.input-group input{height:30px;line-height:30px}input.show-file{padding-left:2px;padding-right:2px;width:auto;z-index:10!important;background:none!important;color:black}div.hidden-input-files{display:none}label.error{color:red}div.loading-file{display:inline-block;vertical-align:middle;width:30px;height:30px;background:url(images/loading1.gif) no-repeat 0 0;background-size:30px 30px}div.upload-success{display:inline-block;vertical-align:middle;width:30px;height:30px;background:url(images/success.svg) no-repeat 0 0;background-size:30px 30px}div.file-size{display:inline-block;vertical-align:middle;margin-left:10px}div#uploading-loading{height:30px;line-height:30px;width:200px;font-size:14pt;font-weight:bold;text-align:center;color:black}div.progress,input.show-file{width:100%!important}div.in-label{width:300px}div.submit-form table input[type=text],div.submit-form table input[type=email]{border:1px solid #A9A9A9;border-image:none}div.submit-form table input,div.submit-form button,div.submit-form select{border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important;height:30px;outline:none!important}div.submit-form select:hover{border-radius:5px 5px 0 0!important;-moz-border-radius:5px 5px 0 0!important;-webkit-border-radius:5px 5px 0 0!important;outline:none!important}.beta-warning{height:30px;line-height:30px;text-align:center;color:white;background-color:#6e0000}.beta-warning a{color:white;font-weight:bold}h2.status{font-size:18pt;margin-bottom:15px;margin-top:10px}.status-body{margin-top:25px;margin-bottom:30px}.progress-status{position:relative;width:500px;height:30px;border:solid 1px black;margin-left:55px;margin-bottom:100px}.progress-status-bar .inner{background:linear-gradient(90deg,rgb(255,254,80) 0%,rgba(16,128,6,1) 100%);width:500px;height:100%}.progress-status-bar{position:absolute;width:0;height:28px;top:0;left:0;overflow:hidden}.progress-status-bar.getfiles,.progress-status-bar.getfiles-waiting{width:3.7%}.progress-status-bar.waiting{width:7%}.progress-status-bar.preparing,.progress-status-bar.prepare-scheduled,.progress-status-bar.preparing-cluster{width:10.7%}.progress-status-bar.prepared{width:20.4%}.progress-status-bar.scheduled{width:30.3%}.progress-status-bar.starting,.progress-status-bar.scheduled-cluster{width:35.2%}.progress-status-bar.started{width:40.3%}.progress-status-bar.merging{width:80.4%}.progress-status-bar.success,.progress-status-bar.fail,.progress-status-bar.no-match{width:100%}.progress-status-bar.fail .inner{background:rgb(195,16,18)}.progress-status .tick{position:absolute;top:29px;width:1px;height:10px;border:solid 1px black}.progress-status .tick p{transform:rotate(-45deg);margin-left:-70px;margin-top:35px;text-align:right;display:block;width:80px;overflow:hidden}.progress-status .tick.submitted{left:-1px}.progress-status .tick.prepared{left:20%}.progress-status .tick.scheduled{left:30%}.progress-status .tick.started{left:40%}.progress-status .tick.merging{left:80%}.progress-status .tick.success{right:-1px}h2.status,div.status-body{margin-left:55px}div#sidebar{position:relative}div#sidebar p.bottom{position:absolute;bottom:0;right:0;width:100px}div#sidebar p.bottom input#delete-job{background:#ffbba8!important}ul.nav ul.dropdown-menu{max-height:300px;overflow-y:auto}
\ No newline at end of file
dgenies={};dgenies.loading="#loading";dgenies.noise=true;dgenies.mode="webserver";dgenies.init=function(all_jobs,mode){dgenies.mode=mode;let cookies=$.cookie("results");if(mode==="webserver"){cookies=cookies!==undefined&&cookies.length>0?cookies.split("|"):[]}else{cookies=all_jobs;dgenies.save_cookies(cookies)}dgenies.update_results(cookies)};dgenies.save_cookies=function(cookies){$.cookie("results",cookies.join("|"),{path:"/"})};dgenies.update_results=function(results){let job_list_item=$("ul.nav li.result ul");job_list_item.html("");if(results.length>0){for(let i=0;i<results.length;i++){let result=results[i];job_list_item.append($("<li>").append($("<a>").attr("href",`/result/${result}`).text(result)))}}else{job_list_item.append($("<li>").append($("<a>").attr("href","/run").text("Please run a job!")))}};dgenies.notify=function(text,type="warning",delay=5000){$.notify({message:text},{type:type,placement:{from:"top",align:"center"},delay:delay,animate:{enter:"animated fadeInDown",exit:"animated fadeOutUp"},offset:55,newest_on_top:true})};dgenies.show_loading=function(message="Loading...",width=118){$("input,select").prop("disabled",true);d3.boxplot.all_disabled=true;$(dgenies.loading).find(".mylabel").html(message);$(dgenies.loading).find(".label").width(width);$(dgenies.loading).show();$(dgenies.loading).position({my:"center center",at:"center center",of:"#draw",collistion:"fit"})};dgenies.hide_loading=function(){$("input,select").prop("disabled",false);d3.boxplot.all_disabled=false;$(dgenies.loading).hide();dgenies.reset_loading_message()};dgenies.set_loading_message=function(message){$(dgenies.loading).find(".mylabel").html(message)};dgenies.reset_loading_message=function(){$(dgenies.loading).find(".mylabel").html("Loading...");$(dgenies.loading).find(".label").width(118)};dgenies.fill_select_zones=function(x_targets,y_contigs){let select_contig=$("select#select-contig");select_contig.find("option[value!='###NONE###']").remove();for(let i=0;i<y_contigs.length;i++){let label=y_contigs[i];let value=label;if(label.startsWith("###MIX###")){let parts=label.substr(10).split("###");label="Mix: "+parts.slice(0,3).join(", ");if(parts.length>3){label+=", ..."}}select_contig.append($("<option>",{value:value,text:label}))}select_contig.chosen({disable_search_threshold:10,search_contains:true});select_contig.trigger("chosen:updated");let select_target=$("select#select-target");select_target.find("option[value!='###NONE###']").remove();for(let i=0;i<x_targets.length;i++){let label=x_targets[i];let value=label;if(label.startsWith("###MIX###")){let parts=label.substr(10).split("###");label="Mix: "+parts.slice(0,3).join(", ");if(parts.length>3){label+=", ..."}}select_target.append($("<option>",{value:value,text:label}))}select_target.chosen({disable_search_threshold:10,search_contains:true});select_target.trigger("chosen:updated")};dgenies.numberWithCommas=function(x){return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")};dgenies.ajax=function(url,data,success,error,method="POST"){$.ajax(url,{method:method,data:data,success:success,error:error||function(){dgenies.hide_loading();dgenies.notify("An error occurred! Please contact us to report the bug","danger")}})};dgenies.post=function(url,data,success,error,async=true){dgenies.ajax({url:url,data:data,success:success,error:error,type:"POST",async:async})};dgenies.get=function(url,data,success,error){dgenies.ajax(url,data,success,error,"GET")};
String.prototype.rsplit=function(sep,maxsplit){let split=this.split(sep);return maxsplit?[split.slice(0,-maxsplit).join(sep)].concat(split.slice(-maxsplit)):split};
This diff is collapsed.
if(!dgenies){throw"dgenies wasn't included!"}dgenies.run={};// Init global variables:
dgenies.run.s_id=null;dgenies.run.allowed_ext=[];dgenies.run.max_upload_file_size=-1;dgenies.run.files=[undefined,undefined];dgenies.run.allow_upload=false;dgenies.run.ping_interval=null;dgenies.run.target_example="";dgenies.run.query_example="";dgenies.run.init=function(s_id,allowed_ext,max_upload_file_size=1073741824,target_example="",query_example=""){dgenies.run.s_id=s_id;dgenies.run.allowed_ext=allowed_ext;dgenies.run.max_upload_file_size=max_upload_file_size;dgenies.run.target_example=target_example;dgenies.run.query_example=query_example;dgenies.run.restore_form();dgenies.run.set_events();dgenies.run.init_fileuploads()};dgenies.run.restore_form=function(){dgenies.run.change_fasta_type("query",$("select.query").find(":selected").text().toLowerCase(),true);dgenies.run.change_fasta_type("target",$("select.target").find(":selected").text().toLowerCase(),true)};dgenies.run.upload_next=function(){let next=dgenies.run.files.pop();while(next===undefined&&dgenies.run.files.length>0){next=dgenies.run.files.pop()}if(next!==undefined){next.submit();return true}dgenies.run.do_submit();return false};dgenies.run.__upload_server_error=function(fasta,data){dgenies.notify("message"in data?data["message"]:`An error has occured when uploading <b>${fasta}</b> file. Please contact us to report the bug!`,"danger");dgenies.run.enable_form()};dgenies.run.allowed_file=function(filename){return filename.indexOf(".")!==-1&&(dgenies.run.allowed_ext.indexOf(filename.rsplit(".",1)[1].toLowerCase())!==-1||dgenies.run.allowed_ext.indexOf(filename.rsplit(".",2).splice(1).join(".").toLowerCase())!==-1)};dgenies.run.init_fileuploads=function(){$("input.file-query").fileupload({dataType:"json",formData:{"s_id":dgenies.run.s_id},add:function(e,data){let filename=data.files[0].name;if(dgenies.run.allowed_file(filename))dgenies.run.files[0]=data;else{$("input.file-query").trigger("change");// The value is null after fired
dgenies.notify(`File <b>${filename}</b> is not supported!`,"danger",3000)}},progressall:function(e,data){var progress=parseInt(data.loaded/data.total*100,10);$("#progress-query").find(".bar").css("width",progress+"%")},success:function(data,success){if(data["success"]!=="OK"){dgenies.run.__upload_server_error("query",data)}else if("error"in data["files"][0]){dgenies.run.add_error("Query file: "+data["files"][0]["error"],"error");dgenies.run.enable_form()}else{$("input#query").val(data["files"][0]["name"]);dgenies.run.hide_loading("query");dgenies.run.show_success("query");dgenies.run.upload_next()}},error:function(data,success){dgenies.run.__upload_server_error("query",data)}});$("input.file-target").fileupload({dataType:"json",formData:{"s_id":dgenies.run.s_id},add:function(e,data){let filename=data.files[0].name;if(dgenies.run.allowed_file(filename))dgenies.run.files[1]=data;else{$("input.file-target").trigger("change");// The value is null after fired
dgenies.notify(`File <b>${filename}</b> is not supported!`,"danger",3000)}},progressall:function(e,data){var progress=parseInt(data.loaded/data.total*100,10);$("#progress-target").find(".bar").css("width",progress+"%")},success:function(data,success){if(data["success"]!=="OK"){dgenies.run.__upload_server_error("target",data)}else if("error"in data["files"][0]){dgenies.run.add_error("Target file: "+data["files"][0]["error"],"error");dgenies.run.enable_form()}else{$("input#target").val(data["files"][0]["name"]);dgenies.run.hide_loading("target");dgenies.run.show_success("target");dgenies.run.upload_next()}},error:function(data,success){dgenies.run.__upload_server_error("target",data)}});//Trigger events on hidden file inputs:
$("button#button-query").click(function(){$("input.file-query").trigger("click")});$("button#button-target").click(function(){$("input.file-target").trigger("click")})};dgenies.run.get_file_size_str=function(size){if(size<1000){return size+" O"}else if(size<1000000){return Math.round(size/1024)+" Ko"}else if(size<1000000000){return Math.round(size/1048576)+" Mo"}return Math.round(size/1073741824)+" Go"};dgenies.run.fill_examples=function(){$("select.target").val("1").trigger("change");$("input#target").val("example://"+dgenies.run.target_example);if(dgenies.run.query_example!==""){$("select.query").val("1").trigger("change");$("input#query").val("example://"+dgenies.run.query_example)}};dgenies.run.set_events=function(){let max_file_size_txt=dgenies.run.get_file_size_str(dgenies.run.max_upload_file_size);$("input.file-query").change(function(){let file_size_query=$("div.file-size.query");if(this.files.length>0){if(this.files[0].size<=dgenies.run.max_upload_file_size){file_size_query.html(dgenies.run.get_file_size_str(this.files[0].size));dgenies.run.set_filename(this.files[0].name,"query")}else{$(this).val("");dgenies.run.set_filename("","query");dgenies.notify(`File exceed the size limit (${max_file_size_txt})`,"danger",2000);file_size_query.html("")}}else{dgenies.run.set_filename("","query");file_size_query.html("")}});$("input.file-target").change(function(){let file_size_target=$("div.file-size.target");if(this.files.length>0){if(this.files[0].size<=dgenies.run.max_upload_file_size){file_size_target.html(dgenies.run.get_file_size_str(this.files[0].size));dgenies.run.set_filename(this.files[0].name,"target")}else{$(this).val("");dgenies.run.set_filename("","target");dgenies.notify(`File exceed the size limit (${max_file_size_txt})`,"danger",2000);file_size_target.html("")}}else{dgenies.run.set_filename("","target");file_size_target.html("")}});$("button#submit").click(function(){dgenies.run.submit()});$("select.query").change(function(){dgenies.run.change_fasta_type("query",$("select.query").find(":selected").text().toLowerCase())});$("select.target").change(function(){dgenies.run.change_fasta_type("target",$("select.target").find(":selected").text().toLowerCase())});$("button#example").click(function(){dgenies.run.fill_examples()})};dgenies.run.change_fasta_type=function(fasta,type,keep_url=false){let button=$("button#button-"+fasta);let input=$("input#"+fasta);let container=$("div."+fasta+"-label");$("input.file-"+fasta).val("");if(type==="local"){button.show();input.prop("readonly",true);input.val("");container.width(300)}else{button.hide();input.prop("readonly",false);if(!keep_url)input.val("");container.width(348)}$("div.file-size."+fasta).html("")};dgenies.run.set_filename=function(name,fasta){$("input#"+fasta).val(name)};dgenies.run.disable_form=function(){$("input, select, button").prop("disabled",true)};dgenies.run.enable_form=function(){$(".progress").find(".bar").css("width","0%");$("input, select, button").prop("disabled",false);$("div#uploading-loading").hide();$("button#submit").show();dgenies.run.hide_loading("query");dgenies.run.hide_loading("target");dgenies.run.hide_success("query");dgenies.run.hide_success("target");dgenies.run.files=[undefined,undefined];dgenies.run.restore_form()};dgenies.run.do_submit=function(){$("div#uploading-loading").html("Submitting form...");dgenies.post("/launch_analysis",{"id_job":$("input#id_job").val(),"email":dgenies.mode==="webserver"?$("input#email").val():"","query":$("input#query").val(),"query_type":$("select.query").find(":selected").text().toLowerCase(),"target":$("input#target").val(),"target_type":$("select.target").find(":selected").text().toLowerCase(),"s_id":dgenies.run.s_id},function(data,status){if(data["success"]){window.location=data["redirect"]}else{if(dgenies.run.ping_interval!==null){clearInterval(dgenies.run.ping_interval);dgenies.run.ping_interval=null}if("errors"in data){for(let i=0;i<data["errors"].length;i++){dgenies.notify(data["errors"][i],"danger",3000)}}else{dgenies.notify("An error has occurred. Please contact the support","danger",3000)}dgenies.run.enable_form()}})};dgenies.run.add_error=function(error){$("div.errors-submit ul.flashes").append($("<li>").append(error))};dgenies.run.valid_form=function(){let has_errors=false;// Check name:
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}}//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}// 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.start_uploads=function(){let query_type=parseInt($("select.query").val());let has_uploads=false;let query_val=$("input#query").val();if(query_type===0&&query_val.length>0){$("button#button-query").hide();dgenies.run.show_loading("query");has_uploads=true}else{dgenies.run.files[0]=undefined;if(query_val!==""&&!dgenies.run.check_url(query_val)){dgenies.run.add_error("Query file: invalid URL","error");dgenies.run.enable_form();return false}}let target_type=parseInt($("select.target").val());let target_val=$("input#target").val();if(target_type===0&&target_val.length>0){$("button#button-target").hide();dgenies.run.show_loading("target");has_uploads=true}else{dgenies.run.files[1]=undefined;if(target_val!==""&&!dgenies.run.check_url(target_val)){dgenies.run.add_error("Target file: invalid URL","error");dgenies.run.enable_form();return false}}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()}};
if(!dgenies){throw"dgenies wasn't included!"}dgenies.status={};dgenies.status.mode="webserver";dgenies.status.init=function(status,mode){dgenies.status.mode=mode;if(status!=="success"&&status!=="done"&&status!=="no-match"&&status!=="fail"){dgenies.status.autoreload()}};dgenies.status.autoreload=function(){let get_p=new URLSearchParams(window.location.search);let refresh=get_p.get("refresh")!==null?parseInt(get_p.get("refresh")):1;let count=get_p.get("count")!==null?parseInt(get_p.get("count")):1;if(refresh<30){if(refresh%5===0){if(count>3){refresh+=1;count=1}else{count+=1}}else{refresh+=1}}setTimeout(function(){if(dgenies.status.mode==="webserver"){window.location.replace(`?refresh=${refresh}&count=${count}`)}else{window.location.replace(`?refresh=1&count=1`)}},refresh*1000)};
This diff is collapsed.
......@@ -10,14 +10,22 @@
<script src="{{ url_for('static', filename='js/bootstrap-notify.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/jquery-ui.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/jquery.cookie-1.4.1.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.prototypes.js') }}" type="text/JavaScript"></script>
{% if debug %}
<script src="{{ url_for('static', filename='js/dgenies.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.prototypes.js') }}" type="text/JavaScript"></script>
{% else %}
<script src="{{ url_for('static', filename='js/dgenies.min.js') }}" type="text/JavaScript"></script>
{% endif %}
{% endblock %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/animate.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-theme.min.css') }}" type="text/css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css">
{% if debug %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/dgenies.css') }}" type="text/css">
{% else %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/dgenies.min.css') }}" type="text/css">
{% endif %}
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
</head>
<body role="document" onload="{% block onload %}dgenies.init({{ all_jobs}}, '{{ mode }}');{% endblock %}">
......
......@@ -4,15 +4,19 @@
<script src="{{ url_for('static', filename='js/chosen.jquery.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/FileSaver.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/canvg.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.controls.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.export.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.summary.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.min.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.zoom.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.events.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.mousetip.js') }}" type="text/JavaScript"></script>
{% if debug %}
<script src="{{ url_for('static', filename='js/dgenies.result.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.controls.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.export.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/dgenies.result.summary.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.zoom.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.events.js') }}" type="text/JavaScript"></script>
<script src="{{ url_for('static', filename='js/d3.boxplot.mousetip.js') }}" type="text/JavaScript"></script>
{% else %}
<script src="{{ url_for('static', filename='js/dgenies.result.min.js') }}" type="text/JavaScript"></script>
{% endif %}
<script src="{{ url_for('static', filename='js/BootstrapMenu.min.js') }}" type="text/JavaScript"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/chosen.min.css') }}" type="text/css">
{% endblock %}
......
{% extends 'base.html' %}
{% block scripts %}
{{ super() }}
<!-- The basic File Upload plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload.js') }}"></script>
<!-- The File Upload processing plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload-process.js') }}"></script>
<!-- The File Upload validation plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload-validate.js') }}"></script>
<script src="{{ url_for('static', filename='js/dgenies.run.js') }}" type="text/JavaScript"></script>
{% if debug %}
<!-- The basic File Upload plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload.js') }}"></script>
<!-- The File Upload processing plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload-process.js') }}"></script>
<!-- The File Upload validation plugin -->
<script src="{{ url_for('static', filename='js/jquery.fileupload-validate.js') }}"></script>
<script src="{{ url_for('static', filename='js/dgenies.run.js') }}" type="text/JavaScript"></script>
{% else %}
<script src="{{ url_for('static', filename='js/jquery.fileupload.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/dgenies.run.min.js') }}" type="text/JavaScript"></script>
{% endif %}
{% endblock %}
{% block onload %}
{{ super() }}
......
{% extends 'base.html' %}
{% block scripts %}
{{ super() }}
{% if debug %}
<script src="{{ url_for('static', filename='js/dgenies.status.js') }}" type="text/JavaScript"></script>
{% else %}
<script src="{{ url_for('static', filename='js/dgenies.status.min.js') }}" type="text/JavaScript"></script>
{% endif %}
{% endblock %}
{% block onload %}
{{ super() }}
......
from dgenies import app, app_title, app_folder, config_reader, mailer, APP_DATA, MODE
from dgenies import app, app_title, app_folder, config_reader, mailer, APP_DATA, MODE, DEBUG
import os
import time
......@@ -25,7 +25,8 @@ def global_templates_variables():
return {
"title": app_title,
"mode": MODE,
"all_jobs": Functions.get_list_all_jobs(MODE)
"all_jobs": Functions.get_list_all_jobs(MODE),
"debug": DEBUG
}
......
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