Преглед изворни кода

HUE-3177 [metastore] Automatic scroll to top when opening a table or database

Johan Ahlen пре 9 година
родитељ
комит
b88ddb9

+ 2 - 0
apps/metastore/src/metastore/static/metastore/js/metastore.ko.js

@@ -126,6 +126,7 @@
 
   MetastoreDatabase.prototype.setTable = function (metastoreTable, callback) {
     var self = this;
+    huePubSub.publish('metastore.scroll.to.top');
     self.table(metastoreTable);
     if (!metastoreTable.loaded()) {
       metastoreTable.load();
@@ -648,6 +649,7 @@
 
   MetastoreViewModel.prototype.setDatabase = function (metastoreDatabase, callback) {
     var self = this;
+    huePubSub.publish('metastore.scroll.to.top');
     self.database(metastoreDatabase);
 
     if (!metastoreDatabase.loaded()) {

+ 5 - 0
apps/metastore/src/metastore/templates/metastore.mako

@@ -800,6 +800,11 @@ ${ assist.assistPanel() }
 
       var viewModel = new MetastoreViewModel(options);
 
+      huePubSub.subscribe('metastore.scroll.to.top', function () {
+        $(".right-panel").scrollTop(0);
+        $('.right-panel').perfectScrollbar('update');
+      });
+
       ko.applyBindings(viewModel);
 
       if (location.getParameter('refresh') === 'true') {