Sfoglia il codice sorgente

HUE-5403 [editor] Download results modal sometimes doesn't close on IE11 or Edge

Enrico Berti 9 anni fa
parent
commit
d5d573dfbb

+ 1 - 1
apps/beeswax/src/beeswax/data_export.py

@@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__)
 
 
 FETCH_SIZE = 1000
-DOWNLOAD_COOKIE_AGE = 5
+DOWNLOAD_COOKIE_AGE = 10
 
 
 def download(handle, format, db, id=None, file_name='query_result'):

+ 5 - 3
desktop/libs/notebook/src/notebook/templates/notebook_ko_components.mako

@@ -322,6 +322,8 @@ except ImportError, e:
         self.downloadTruncated = ko.observable(false);
         self.downloadCounter = ko.observable(0);
 
+        self.checkDownloadInterval = -1;
+
         self.isPathEmpty = ko.pureComputed(function () {
           return self.savePath() === '';
         });
@@ -361,6 +363,7 @@ except ImportError, e:
         self.cancelDownload = function() {
           console.log('Cancel download');
           self.isDownloading(false);
+          window.clearInterval(self.checkDownloadInterval);
           $('#downloadProgressModal').modal('hide');
         };
       };
@@ -380,15 +383,14 @@ except ImportError, e:
         self.downloadCounter(0);
 
         var timesChecked = 0;
-        var checkDownloadInterval = -1;
-        checkDownloadInterval = window.setInterval(function () {
+        self.checkDownloadInterval = window.setInterval(function () {
           if ($.cookie('download-' + self.snippet.id()) === null || typeof $.cookie('download-' + self.snippet.id()) === 'undefined') {
             if (timesChecked == 10) {
               $('#downloadProgressModal').modal('show');
             }
           }
           else {
-            window.clearInterval(checkDownloadInterval);
+            window.clearInterval(self.checkDownloadInterval);
             try {
               var cookieContent = $.cookie('download-' + self.snippet.id());
               var result = JSON.parse(cookieContent.substr(1, cookieContent.length - 2).replace(/\\"/g, '"').replace(/\\054/g, ','));