Skip to content

Commit

Permalink
Sorted out dodgy import UI behaviour when typing an existing DB's name
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemSempere committed Jan 9, 2025
1 parent a8208cc commit 9ee5289
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/webapp/js/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,23 @@ function isGenotypingDataFormValid(showAlerts) {

if ($("#moduleExistingG").val() != '- new database -')
$("#moduleToImport").val($("#moduleExistingG").val());
else if ($("#moduleExistingG option").filter(function(index) { return $(this).text() === $("#moduleToImport").val(); }).length > 0) {
$("#moduleExistingG").val($("#moduleToImport").val())
$("#moduleExistingG").selectpicker('refresh');
$("#moduleExistingG").change();
}

if ($("#projectExisting").val() != null && $("#projectExisting").val() != '- new project -')
$("#projectToImport").val($("#projectExisting").val());
if ($("#runExisting").val() != '- new run -')
$("#runToImport").val($("#runExisting").val());

if (!isValidNewName($("#moduleToImport").val()) || !isValidNewName($("#projectToImport").val()) || !isValidNewName($("#runToImport").val())) {
alert("Database, project and run names must only consist in digits, accentless letters, dashes and hyphens!");
alert("Database, project and run names must only consist in digits, unaccented letters, dashes and hyphens!");
$('#progress').modal('hide');
return false;
}
if (!isAdmin && $("#moduleToImport").val() == "")
if (!isAdmin && !hasDbCreatorRole && $("#moduleToImport").val() == "")
$("#moduleToImport").val(hashCode(token).toString(16) + "O" + hashCode(Date.now()).toString(16));

if (importDropzoneG.getRejectedFiles().length > 0) {
Expand Down

0 comments on commit 9ee5289

Please sign in to comment.