Przeglądaj źródła

HUE-3733 [editor] Scrolling on the saved query tab scroll on the result tab

Enrico Berti 9 lat temu
rodzic
commit
177d780d3a

+ 14 - 12
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2157,18 +2157,20 @@ ${ hueIcons.symbols() }
     }
 
     scrollElement.on('scroll', function () {
-      var _lastScrollPosition = scrollElement.data("scrollPosition") != null ? scrollElement.data("scrollPosition") : 0;
-      window.clearTimeout(_scrollTimeout);
-      scrollElement.data("scrollPosition", scrollElement.scrollTop());
-      _scrollTimeout = window.setTimeout(function () {
-        if (vm.editorMode){
-          _lastScrollPosition--; //hack for forcing fetching
-        }
-        if (_lastScrollPosition != scrollElement.scrollTop() && scrollElement.scrollTop() + scrollElement.outerHeight() + 20 >= scrollElement[0].scrollHeight && _dt && snippet.result.hasMore()) {
-          dataTableEl.animate({opacity: '0.55'}, 200);
-          snippet.fetchResult(100, false);
-        }
-      }, 100);
+      if (!vm.editorMode || (vm.editorMode && snippet.currentQueryTab() === 'queryResults')) {
+        var _lastScrollPosition = scrollElement.data("scrollPosition") != null ? scrollElement.data("scrollPosition") : 0;
+        window.clearTimeout(_scrollTimeout);
+        scrollElement.data("scrollPosition", scrollElement.scrollTop());
+        _scrollTimeout = window.setTimeout(function () {
+          if (vm.editorMode) {
+            _lastScrollPosition--; //hack for forcing fetching
+          }
+          if (_lastScrollPosition != scrollElement.scrollTop() && scrollElement.scrollTop() + scrollElement.outerHeight() + 20 >= scrollElement[0].scrollHeight && _dt && snippet.result.hasMore()) {
+            dataTableEl.animate({opacity: '0.55'}, 200);
+            snippet.fetchResult(100, false);
+          }
+        }, 100);
+      }
     });
 
     return _dt;