ソースを参照

HUE-7901 [editor] Query History search make the scrolling jumps back to the top

Enrico Berti 7 年 前
コミット
934883c

+ 2 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2104,6 +2104,7 @@ var EditorViewModel = (function() {
       }
     });
     self.loadingHistory = ko.observable(self.history().length == 0);
+    self.historyInitialHeight = ko.observable(0);
     self.historyCurrentPage = ko.observable(vm.selectedNotebook() ? vm.selectedNotebook().historyCurrentPage() : 1);
     self.historyCurrentPage.subscribe(function(val) {
       self.fetchHistory();
@@ -2715,6 +2716,7 @@ var EditorViewModel = (function() {
       }
       if (vm.editorMode() && self.history().length == 0) {
         self.fetchHistory(function() {
+          self.historyInitialHeight((self.history().length * 32) + 80); // add pagination too
           self.updateHistory(['starting', 'running'], 30000);
           self.updateHistory(['available'], 60000 * 5);
         });

+ 1 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -704,7 +704,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
         <!-- /ko -->
       </ul>
       <div class="tab-content" style="border: none; overflow-x: hidden">
-        <div class="tab-pane" id="queryHistory" data-bind="css: {'active': currentQueryTab() == 'queryHistory'}">
+        <div class="tab-pane" id="queryHistory" data-bind="css: {'active': currentQueryTab() == 'queryHistory'}, style: { 'height' : $parent.historyInitialHeight() + 'px' }">
           <!-- ko if: $parent.loadingHistory -->
           <div style="padding: 20px">
             <i class="fa fa-spinner fa-spin muted"></i>