소스 검색

[assist] Fine-tune inner panel resizing and fit

This takes care of some jerky positioning when resizing panels close to their height limits. I've also adjusted the panel min heights to at least fit one entry in each.
Johan Ahlen 9 년 전
부모
커밋
50b689a
2개의 변경된 파일13개의 추가작업 그리고 6개의 파일을 삭제
  1. 10 3
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js
  2. 3 3
      desktop/core/src/desktop/templates/assist.mako

+ 10 - 3
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1207,10 +1207,10 @@
 
       // Resizes all containers according to the set ratios
       var resizeByRatio = function () {
-        $allPanels = $container.children('.assist-inner-panel');
         if (totalHeight == $container.innerHeight()) {
           return;
         }
+        $allPanels = $container.children('.assist-inner-panel');
         totalHeight = $container.innerHeight();
         containerTop = $container.offset().top;
 
@@ -1251,6 +1251,8 @@
 
       resizeByRatio();
       $(window).resize(resizeByRatio);
+
+      window.setTimeout(resizeByRatio, 1000);
       huePubSub.subscribe('assist.forceRender', function () {
         window.setTimeout(resizeByRatio, 200);
       });
@@ -1314,16 +1316,21 @@
         $panelsAfter.each(function (idx, panel) {
           requiredSpaceAfter += $(panel).data('minHeight');
         });
+        var limitAfter = totalHeight - requiredSpaceAfter;
 
         $resizer.draggable({
           axis: "y",
           drag: function (event, ui) {
-            var limitAfter = totalHeight - requiredSpaceAfter;
-
             var position = ui.offset.top - containerTop;
             if (position > limitBefore && position < limitAfter) {
               fitPanelHeights($panelsBefore, position - extrasBeforeHeight);
               fitPanelHeights($panelsAfter, totalHeight - extrasAfterHeight - position);
+            } else if (position > limitAfter) {
+              fitPanelHeights($panelsBefore, limitAfter - extrasBeforeHeight);
+              fitPanelHeights($panelsAfter, totalHeight - extrasAfterHeight - limitAfter);
+            } else if (position < limitBefore) {
+              fitPanelHeights($panelsBefore, limitBefore - extrasBeforeHeight);
+              fitPanelHeights($panelsAfter, totalHeight - extrasAfterHeight - limitBefore);
             }
 
             ui.offset.top = 0;

+ 3 - 3
desktop/core/src/desktop/templates/assist.mako

@@ -1017,7 +1017,7 @@ from desktop.views import _ko
             name: '${ _("SQL") }',
             type: 'db',
             icon: 'fa-database',
-            minHeight: 55,
+            minHeight: 75,
             visible: params.visibleAssistPanels && params.visibleAssistPanels.indexOf('sql') !== -1
           })
         ];
@@ -1031,7 +1031,7 @@ from desktop.views import _ko
             name: '${ _("HDFS") }',
             type: 'hdfs',
             icon: 'fa-folder-o',
-            minHeight: 40,
+            minHeight: 50,
             visible: params.visibleAssistPanels && params.visibleAssistPanels.indexOf('hdfs') !== -1
           }));
           self.availablePanels.push(new AssistInnerPanel({
@@ -1043,7 +1043,7 @@ from desktop.views import _ko
             name: '${ _("Documents") }',
             type: 'documents',
             icon: 'fa-files-o',
-            minHeight: 40,
+            minHeight: 50,
             visible: params.visibleAssistPanels && params.visibleAssistPanels.indexOf('documents') !== -1
           }));
         }