Ver código fonte

[beeswax] Fix assist panel rendering

Enrico Berti 10 anos atrás
pai
commit
c20aad26d7

+ 1 - 1
apps/beeswax/src/beeswax/templates/execute.mako

@@ -832,7 +832,7 @@ ${ commonshare() | n,unicode }
 <script src="${ static('desktop/ext/select2/select2.min.js') }" type="text/javascript" charset="utf-8"></script>
 
 
-${ assist.assistPanel() }
+${ assist.assistPanel('.table-container') }
 ${ tableStats.tableStats() }
 
 <style type="text/css">

+ 11 - 4
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -946,14 +946,20 @@
 
       var lastParentHeight = -1;
       var lastTop = -1;
-      window.setInterval(function () {
-        if (lastParentHeight !== $parent.innerHeight() || lastTop !== $element.position().top) {
+
+      function stretch(force) {
+        if (lastParentHeight !== $parent.innerHeight() || lastTop !== $element.position().top || force) {
           lastParentHeight = $parent.innerHeight();
           lastTop = $element.position().top;
           $element.height(lastParentHeight - lastTop - ($element.outerHeight(true) - $element.innerHeight()));
           huePubSub.publish('assist.stretchDown', $element);
         }
-      }, 200);
+      }
+
+      window.setInterval(stretch, 200);
+      huePubSub.subscribe('assist.forceStretchDown', function(){
+        stretch(true);
+      });
     }
   };
 
@@ -1002,7 +1008,7 @@
         var adjustHeightSingle = function () {
           $allPanels.height($container.innerHeight() - allExtrasHeight);
         }
-        adjustHeightSingle();
+        window.setTimeout(adjustHeightSingle, 200);
         $(window).resize(adjustHeightSingle);
         $allExtras.show();
         $allPanels.show();
@@ -2792,6 +2798,7 @@
       }
 
       $parent.parents(scrollable).on('scroll', render);
+
       if ($parent.parents('.hueach').length > 0){
         window.setTimeout(render, 100);
       }

+ 9 - 5
desktop/core/src/desktop/templates/assist.mako

@@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
 from desktop.views import _ko
 %>
 
-<%def name="assistPanel()">
+<%def name="assistPanel(scrollable='.assist-stretchable-list')">
   <style>
 
     .assist-icon {
@@ -76,6 +76,10 @@ from desktop.views import _ko
       font-weight: bold;
       margin-top: 0
     }
+    
+    .nav.nav-no-margin {
+      margin-bottom: 0;
+    }
 
     .assist-stretchable-list {
       position:relative;
@@ -296,7 +300,7 @@ from desktop.views import _ko
       <li class="assist-entry no-entries">${_('No results found')}</li>
     </ul>
     <!-- /ko -->
-    <ul data-bind="hueach: {data: filteredEntries, itemHeight: 22, scrollable: '.assist-stretchable-list', considerStretching: true}, css: { 'assist-tables': definition.isDatabase }">
+    <ul data-bind="hueach: {data: filteredEntries, itemHeight: 25, scrollable: '${scrollable}', considerStretching: true}, css: { 'assist-tables': definition.isDatabase }">
       <!-- ko template: { if: definition.isTable, name: 'assist-table-entry' } --><!-- /ko -->
       <!-- ko ifnot: definition.isTable -->
       <li data-bind="visible: ! hasErrors(), visibleOnHover: { override: statsVisible, selector: definition.isView ? '.table-actions' : '.column-actions' }, css: { 'assist-table': definition.isView, 'assist-column': definition.isColumn }">
@@ -485,7 +489,7 @@ from desktop.views import _ko
   </script>
 
   <script type="text/html" id="assist-sources-template">
-    <ul class="nav">
+    <ul class="nav nav-no-margin">
       <li class="assist-inner-header">
         ${_('Sources')}
       </li>
@@ -510,7 +514,7 @@ from desktop.views import _ko
   </script>
 
   <script type="text/html" id="assist-databases-template">
-    <ul class="nav" data-bind="visibleOnHover: { selector: '.hover-actions', override: isSearchVisible() || loading() }" >
+    <ul class="nav nav-no-margin" data-bind="visibleOnHover: { selector: '.hover-actions', override: isSearchVisible() || loading() }" >
       <li class="assist-inner-header">
         ${_('Databases')}
         <!-- ko template: 'assist-db-header-actions' --><!-- /ko -->
@@ -544,7 +548,7 @@ from desktop.views import _ko
   </script>
 
   <script type="text/html" id="assist-tables-template">
-    <ul class="nav" data-bind="visibleOnHover: { selector: '.hover-actions', override: $parent.reloading() || isSearchVisible() }">
+    <ul class="nav nav-no-margin" data-bind="visibleOnHover: { selector: '.hover-actions', override: $parent.reloading() || isSearchVisible() }">
       <li class="assist-inner-header" data-bind="visible: !$parent.loading() && !$parent.hasErrors()">
         ${_('Tables')}
         <!-- ko template: 'assist-db-header-actions' --><!-- /ko -->