浏览代码

HUE-7707 [assist] Show in assist should scroll just the left assist

Enrico Berti 8 年之前
父节点
当前提交
034f173

+ 16 - 14
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -5413,21 +5413,23 @@
 
       };
 
-      huePubSubs.push(huePubSub.subscribe('assist.db.scrollTo', function (targetEntry) {
-        var foundIndex = -1;
-        $.each(allEntries, function (idx, entry) {
-          if (targetEntry === entry) {
-            foundIndex = idx;
-            return false;
-          }
-        });
-        if (foundIndex !== -1) {
-          var offset = depth > 0 ? $parentFVOwnerElement.position().top : 0;
-          scrollToIndex(foundIndex, offset, false, function () {
-            huePubSub.publish('assist.db.scrollToComplete', targetEntry);
+      if (!options.skipScrollEvent) {
+        huePubSubs.push(huePubSub.subscribe('assist.db.scrollTo', function (targetEntry) {
+          var foundIndex = -1;
+          $.each(allEntries, function (idx, entry) {
+            if (targetEntry === entry) {
+              foundIndex = idx;
+              return false;
+            }
           });
-        }
-      }));
+          if (foundIndex !== -1) {
+            var offset = depth > 0 ? $parentFVOwnerElement.position().top : 0;
+            scrollToIndex(foundIndex, offset, false, function () {
+              huePubSub.publish('assist.db.scrollToComplete', targetEntry);
+            });
+          }
+        }));
+      }
 
       if (ko.isObservable(viewModel.foreachVisible)) {
         viewModel.foreachVisible({

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

@@ -269,7 +269,7 @@ from desktop.views import _ko
     </ul>
     <!-- /ko -->
     <!-- ko if: ! hasErrors() && hasEntries() && ! loading() && filteredEntries().length > 0 -->
-    <ul class="database-tree" data-bind="foreachVisible: { data: filteredEntries, minHeight: navigationSettings.rightAssist ? 22 : 23, container: '.assist-db-scrollable' }, css: { 'assist-tables': definition.isDatabase }">
+    <ul class="database-tree" data-bind="foreachVisible: { data: filteredEntries, minHeight: navigationSettings.rightAssist ? 22 : 23, container: '.assist-db-scrollable', skipScrollEvent: navigationSettings.rightAssist }, css: { 'assist-tables': definition.isDatabase }">
       <!-- ko template: { if: definition.isTable || definition.isView, name: 'assist-table-entry' } --><!-- /ko -->
       <!-- ko if: navigationSettings.rightAssist -->
         <!-- ko template: { ifnot: definition.isTable || definition.isView, name: 'assist-column-entry-assistant' } --><!-- /ko -->
@@ -861,7 +861,7 @@ from desktop.views import _ko
         <li class="assist-entry no-entries">${_('No results found')}</li>
       </ul>
       <!-- /ko -->
-      <ul class="assist-tables" data-bind="foreachVisible: {data: filteredEntries, minHeight: 23, container: '.assist-db-scrollable' }">
+      <ul class="assist-tables" data-bind="foreachVisible: {data: filteredEntries, minHeight: 23, container: '.assist-db-scrollable', skipScrollEvent: navigationSettings.rightAssist }">
         <!-- ko template: { name: 'assist-database-entry' } --><!-- /ko -->
       </ul>
     </div>
@@ -2289,7 +2289,7 @@ from desktop.views import _ko
           <div class="assist-no-entries">${ _('No entries found.') }</div>
           <!-- /ko -->
           <!-- ko if: filteredTables().length > 0 -->
-          <ul class="database-tree assist-tables" data-bind="foreachVisible: { data: filteredTables, minHeight: 22, container: '.assist-db-scrollable' }">
+          <ul class="database-tree assist-tables" data-bind="foreachVisible: { data: filteredTables, minHeight: 22, container: '.assist-db-scrollable', skipScrollEvent: true }">
             <!-- ko if: hasErrors -->
             <li class="assist-table hue-warning" data-bind="attr: { 'title': $parent.isSolr() ? '${ _ko('Error loading collection details.') }' : '${ _ko('Error loading table details.') }'}">
               <span class="assist-entry">