فهرست منبع

HUE-7996 [editor] Fix height calculation of the history panel on reloading a saved query

Enrico Berti 7 سال پیش
والد
کامیت
92ad84c
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

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

@@ -3006,6 +3006,12 @@ function togglePresentation(value) {};
       if (tab !== 'queryResults') {
         $('.hue-datatable-search').hide();
       }
+      if (tab === 'queryHistory') {
+        hueUtils.waitForRendered($('#queryHistory .history-table'), function(el) { return el.is(':visible') }, function() {
+          viewModel.selectedNotebook().forceHistoryInitialHeight(true);
+          huePubSub.publish('editor.calculate.history.height');
+        });
+      }
     }, HUE_PUB_SUB_EDITOR_ID);
 
     huePubSub.subscribe('detach.scrolls', function (snippet) {
@@ -3020,7 +3026,11 @@ function togglePresentation(value) {};
 
     huePubSub.subscribe('editor.calculate.history.height', function () {
       if (viewModel.editorMode() && (viewModel.selectedNotebook().historyInitialHeight() === 0 || viewModel.selectedNotebook().forceHistoryInitialHeight())) {
-        viewModel.selectedNotebook().historyInitialHeight($('.history-table').height() + 80); // add pagination too
+        var h = $('#queryHistory .history-table').height();
+        if (h === 0) {
+          h = viewModel.selectedNotebook().history().length * 32;
+        }
+        viewModel.selectedNotebook().historyInitialHeight(h + 80); // add pagination too
         viewModel.selectedNotebook().forceHistoryInitialHeight(false);
       }
     }, HUE_PUB_SUB_EDITOR_ID);