Skip to content

Commit

Permalink
Dynamically accounting for changes in custom output tool configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemSempere committed Sep 24, 2024
1 parent 5700f7c commit 74e4044
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main/webapp/ProgressWatch.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<c:if test="${param.exportedTsvMetadata eq true}">
fileExtensions.push("tsv");
</c:if>
showServerExportBox(fileExtensions, ${param.keepExportOnServ});
showServerExportBox(${param.keepExportOnServ}, fileExtensions);
}
</c:if>
</script>
Expand Down
14 changes: 2 additions & 12 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,12 +1857,6 @@ https://doi.org/10.1093/gigascience/giz051</pre>
var indToExport = $('#exportedIndividuals').val() == "choose" ? $('#exportedIndividuals').parent().parent().find("select.individualSelector").val() : ($('#exportedIndividuals').val() == "allGroups" ? getSelectedIndividuals() : ($('#exportedIndividuals').val() == "" ? [] : getSelectedIndividuals([parseInt($('#exportedIndividuals').val())])));
exportedIndividualCount = indToExport == null ? indOpt.length : indToExport.length;
var keepExportOnServer = $('#keepExportOnServ').prop('checked');
// if (!keepExportOnServer && $('#exportPanel div.individualRelated:visible').size() > 0) {
// if (exportedIndividualCount * count > 1000000000) {
// alert("The matrix you are about to export contains more than 1 billion genotypes and is too large to be downloaded directly. Please tick the 'Keep files on server' box.");
// return;
// }
// }
var supportedTypes = $('#exportFormat').children().filter(':selected').data('type');
if (supportedTypes != null) {
Expand Down Expand Up @@ -1921,12 +1915,8 @@ https://doi.org/10.1093/gigascience/giz051</pre>
});
displayProcessProgress(2, "export_" + token, null, function() {
if ($('#enableExportPush').prop('checked')) {
let fileExtensions = $("#exportFormat option:selected").data('ext').split(";");
if ($('#exportPanel input#exportedIndividualMetadataCheckBox').is(':checked') && "FLAPJACK" != $('#exportFormat').val() && "DARWIN" != $('#exportFormat').val() /* these two already have their own metadata file format*/)
fileExtensions.push("tsv");
showServerExportBox(fileExtensions, keepExportOnServer);
}
if ($('#enableExportPush').prop('checked'))
showServerExportBox(keepExportOnServer);
else {
var link = document.createElement('a');
link.href = downloadURL;
Expand Down
49 changes: 32 additions & 17 deletions src/main/webapp/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,21 @@ function grabNcbiTaxon(inputObj)
$(inputObj).val(taxonName);
}

function showGalaxyPushButton()
{
var galaxyInstanceUrl = $("#galaxyInstanceURL").val().trim();
if (galaxyInstanceUrl.startsWith("http")) {
var fileURLs = "";
for (key in archivedDataFiles)
fileURLs += (fileURLs == "" ? "" : " ,") + "'" + archivedDataFiles[key] + "'";
$('#galaxyPushButton').html('<div style="display:inline; width:70px; font-weight:bold; background-color:#333333; color:white; border-radius:3px; padding:7px;"><img alt="Galaxy" height="15" src="images/logo-galaxy.png" /> Galaxy</div>&nbsp;<input style="margin-bottom:20px;" type="button" value="Send exported data to ' + galaxyInstanceUrl + '" onclick="sendToGalaxy([' + fileURLs + ']);" />');
$("#galaxyPushButton").show();
}
else
$("#galaxyPushButton").hide();
}

function showServerExportBox(exportFormatExtensions, keepExportOnServer)
//function showGalaxyPushButton()
//{
// var galaxyInstanceUrl = $("#galaxyInstanceURL").val().trim();
// if (galaxyInstanceUrl.startsWith("http")) {
// var fileURLs = "";
// for (key in archivedDataFiles)
// fileURLs += (fileURLs == "" ? "" : " ,") + "'" + archivedDataFiles[key] + "'";
// $('#galaxyPushButton').html('<div style="display:inline; width:70px; font-weight:bold; background-color:#333333; color:white; border-radius:3px; padding:7px;"><img alt="Galaxy" height="15" src="images/logo-galaxy.png" /> Galaxy</div>&nbsp;<input style="margin-bottom:20px;" type="button" value="Send exported data to ' + galaxyInstanceUrl + '" onclick="sendToGalaxy([' + fileURLs + ']);" /><br/>');
// $("#galaxyPushButton").show();
// }
// else
// $("#galaxyPushButton").hide();
//}

function showServerExportBox(keepExportOnServer, exportFormatExtensions)
{
$("div#exportPanel").hide();
$("a#exportBoxToggleButton").removeClass("active");
Expand All @@ -346,10 +346,25 @@ function showServerExportBox(exportFormatExtensions, keepExportOnServer)
$('#serverExportBox').append("<div id='galaxyPushButton' />");

archivedDataFiles = new Array();

if (exportFormatExtensions == null) {
exportFormatExtensions = $("#exportFormat option:selected").data('ext').split(";");
if ($('#exportPanel input#exportedIndividualMetadataCheckBox').is(':checked') && "FLAPJACK" != $('#exportFormat').val() && "DARWIN" != $('#exportFormat').val() /* these two already have their own metadata file format*/)
exportFormatExtensions.push("tsv");
}
for (var key in exportFormatExtensions)
archivedDataFiles[exportFormatExtensions[key]] = location.origin + downloadURL.replace(new RegExp(/\.[^.]*$/), '.' + exportFormatExtensions[key]);

showGalaxyPushButton();
var galaxyInstanceUrl = $("#galaxyInstanceURL").val().trim();
if (galaxyInstanceUrl.startsWith("http")) {
var fileURLs = "";
for (key in archivedDataFiles)
fileURLs += (fileURLs == "" ? "" : " ,") + "'" + archivedDataFiles[key] + "'";
$('#galaxyPushButton').html('<div style="display:inline; width:70px; font-weight:bold; background-color:#333333; color:white; border-radius:3px; padding:7px;"><img alt="Galaxy" height="15" src="images/logo-galaxy.png" /> Galaxy</div>&nbsp;<input style="margin-bottom:20px;" type="button" value="Send exported data to ' + galaxyInstanceUrl + '" onclick="sendToGalaxy([' + fileURLs + ']);" /><br/>');
$("#galaxyPushButton").show();
}
else
$("#galaxyPushButton").hide();

if (onlineOutputTools != null)
for (var toolName in onlineOutputTools) {
Expand Down Expand Up @@ -381,7 +396,7 @@ function showServerExportBox(exportFormatExtensions, keepExportOnServer)
}

if (formatsForThisButton != "")
$('#serverExportBox').append('<input style="margin-bottom:20px;" type="button" value="Send ' + formatsForThisButton + ' file(s) to ' + toolName + '" onclick="window.open(\'' + urlForThisButton + '\');" />&nbsp;')
$('#serverExportBox').append('<input style="margin-bottom:20px;" type="button" value="Send ' + formatsForThisButton + ' file(s) to ' + toolName + '" onclick="window.open(\'' + urlForThisButton + '\');" /><br/>');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ function applyOutputToolConfig() {
$("#galaxyPushButton input").val("Send exported data to " + $("input#galaxyInstanceURL").val());
}

showGalaxyPushButton();
showServerExportBox($('#keepExportOnServ').prop('checked'));

$("#applyOutputToolConfig").prop("disabled", "disabled");
}
Expand Down

0 comments on commit 74e4044

Please sign in to comment.