瀏覽代碼

HUE-7000 [assist] HBase assist does not load the table the second time

Enrico Berti 8 年之前
父節點
當前提交
33a59db
共有 2 個文件被更改,包括 35 次插入5 次删除
  1. 6 1
      apps/hbase/src/hbase/templates/app.mako
  2. 29 4
      desktop/core/src/desktop/templates/assist.mako

+ 6 - 1
apps/hbase/src/hbase/templates/app.mako

@@ -285,7 +285,11 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
     ${smartview('views.tabledata')}
 
     <br/><br/><br/><br/>
-    <div class="subnav navbar-fixed-bottom well-small">
+    <div class="subnav
+    %if not is_embeddable:
+    navbar-fixed-bottom
+    %endif
+    well-small">
         <div class="hbase-subnav">
           <div class="footer-slider">
             <span data-bind="visible: !hbaseApp.views.tabledata.isLoading()">
@@ -2404,6 +2408,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
           routed = false;
         }
       });
+      huePubSub.publish('hbase.app.loaded');
     });
 
 

+ 29 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -1432,13 +1432,38 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, get_ord
           self.reload();
         });
 
+        var delayChangeHash = function (hash) {
+          window.setTimeout(function () {
+            window.location.hash = hash;
+          }, 0);
+        }
+
+        self.lastClickeHBaseEntry = null;
+        self.HBaseLoaded = false;
+
+        huePubSub.subscribeOnce('hbase.app.loaded', function() {
+          delayChangeHash(self.selectedHBaseEntry().definition.name + '/' + self.lastClickeHBaseEntry.definition.name);
+          self.HBaseLoaded = true;
+        });
+
         huePubSub.subscribe('assist.dblClickHBaseItem', function (entry) {
-          var link = '/hbase/#' + self.selectedHBaseEntry().definition.name + '/' + entry.definition.name;
-          if (IS_HUE_4){
-            huePubSub.publish('open.link', link);
+          var hash = self.selectedHBaseEntry().definition.name + '/' + entry.definition.name;
+          if (IS_HUE_4) {
+            if (window.location.pathname.startsWith('/hue/hbase')) {
+              window.location.hash = hash;
+            }
+            else {
+              self.lastClickeHBaseEntry = entry;
+              huePubSub.subscribeOnce('app.gained.focus', function (app) {
+                if (app === 'hbase' && self.HBaseLoaded) {
+                  delayChangeHash(hash);
+                }
+              });
+              huePubSub.publish('open.link', '/hbase');
+            }
           }
           else {
-            window.open(link);
+            window.open('/hbase/#' + hash);
           }
         });