commit/galaxy-central: natefoo: Warn users against navigating away from Galaxy while uploads are in progress, to prevent interrupting uploads.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/12a3c47995d6/ changeset: 12a3c47995d6 user: natefoo date: 2012-04-03 20:49:28 summary: Warn users against navigating away from Galaxy while uploads are in progress, to prevent interrupting uploads. affected #: 1 file diff -r e7420c93edfab1766ec32a0002adee1dec8d30b3 -r 12a3c47995d6269f49b4695fb9acc5c7fbf630a9 templates/base_panels.mako --- a/templates/base_panels.mako +++ b/templates/base_panels.mako @@ -84,6 +84,7 @@ $("iframe#galaxy_main").contents().find("body").find("div[class='errormessage']").text( msg ); } } + var uploads_in_progress = 0; jQuery( function() { $("iframe#galaxy_main").load( function() { $(this).contents().find("form").each( function() { @@ -134,7 +135,16 @@ $(this).append("<input type='hidden' name='ajax_upload' value='true'>"); } // iframe submit is required for nginx (otherwise the encoding is wrong) - $(this).ajaxSubmit( { iframe: true } ); + $(this).ajaxSubmit( { iframe: true, + complete: function (xhr, stat) { + uploads_in_progress--; + if (uploads_in_progress == 0) { + window.onbeforeunload = null; + } + } + } ); + uploads_in_progress++; + window.onbeforeunload = function() { return "Navigating away from the Galaxy analysis interface will interrupt the file upload(s) currently in progress. Do you really want to do this?"; } if ( $(this).find("input[name='folder_id']").val() != undefined ) { var library_id = $(this).find("input[name='library_id']").val(); var show_deleted = $(this).find("input[name='show_deleted']").val(); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket