Skip to content

Commit

Permalink
Don't ask for compression on standalone mode + fix bug on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
florealcab committed Feb 21, 2018
1 parent b946b9f commit c6d4f0a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 45 deletions.
4 changes: 2 additions & 2 deletions src/dgenies/lib/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def send_fasta_ready(mailer, job_name, sample_name, compressed=False, path="fast


@staticmethod
def sort_fasta(job_name, fasta_file, index_file, lock_file, compress=False, mailer=None):
def sort_fasta(job_name, fasta_file, index_file, lock_file, compress=False, mailer=None, mode="webserver"):
index, sample_name = Functions.read_index(index_file)
is_compressed = fasta_file.endswith(".gz")
if is_compressed:
Expand All @@ -185,7 +185,7 @@ def sort_fasta(job_name, fasta_file, index_file, lock_file, compress=False, mail
if compress:
Functions.compress(fasta_file_o)
os.remove(lock_file)
if mailer is not None and not os.path.exists(lock_file + ".pending"):
if mode == "webserver" and mailer is not None and not os.path.exists(lock_file + ".pending"):
Functions.send_fasta_ready(mailer, job_name, sample_name, compress)

@staticmethod
Expand Down
63 changes: 34 additions & 29 deletions src/dgenies/static/js/dgenies.result.export.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,41 @@ dgenies.result.export.export_fasta = function(compress=false) {
};

dgenies.result.export.ask_export_fasta = function () {
let dialog = $("<div>")
.attr("id", "dialog-confirm")
.attr("title", "Gzip?");
let icon = $("<span>")
.attr("class", "ui-icon ui-icon-help")
.css("float", "left")
.css("margin", "12px 12px 20px 0");
let body = $("<p>");
body.append(icon);
body.append("Compression is recommanded on slow connections. Download Gzip file?");
dialog.append(body);
dialog.dialog({
resizable: false,
height: "auto",
width: 500,
modal: true,
buttons: {
"Use default": function() {
$( this ).dialog( "close" );
dgenies.result.export.export_fasta(false);
},
"Use Gzip": function () {
$( this ).dialog( "close" );
dgenies.result.export.export_fasta(true);
},
Cancel: function () {
$( this ).dialog( "close" );
if (dgenies.mode === "webserver") {
let dialog = $("<div>")
.attr("id", "dialog-confirm")
.attr("title", "Gzip?");
let icon = $("<span>")
.attr("class", "ui-icon ui-icon-help")
.css("float", "left")
.css("margin", "12px 12px 20px 0");
let body = $("<p>");
body.append(icon);
body.append("Compression is recommanded on slow connections. Download Gzip file?");
dialog.append(body);
dialog.dialog({
resizable: false,
height: "auto",
width: 500,
modal: true,
buttons: {
"Use default": function () {
$(this).dialog("close");
dgenies.result.export.export_fasta(false);
},
"Use Gzip": function () {
$(this).dialog("close");
dgenies.result.export.export_fasta(true);
},
Cancel: function () {
$(this).dialog("close");
}
}
}
});
});
}
else {
dgenies.result.export.export_fasta(false);
}
};

dgenies.result.export.export_association_table = function () {
Expand Down
Loading

0 comments on commit c6d4f0a

Please sign in to comment.