Jelajahi Sumber

HUE-7046 [frontend] Fix open.link on Hue 3

Enrico Berti 8 tahun lalu
induk
melakukan
bd65589e4e
1 mengubah file dengan 13 tambahan dan 12 penghapusan
  1. 13 12
      desktop/core/src/desktop/templates/common_header.mako

+ 13 - 12
desktop/core/src/desktop/templates/common_header.mako

@@ -184,19 +184,20 @@ if USE_NEW_EDITOR.get():
   <script src="${ static('desktop/js/clusterConfig.js') }"></script>
 
   <script type="text/javascript">
-    huePubSub.subscribe('get.current.app.name', function () {
-      var appName = '';
-      if ('${ 'metastore' in apps }' === 'True' && location.href.indexOf('${"metastore" in apps and apps["metastore"].display_name}') !== -1) {
-        appName = 'metastore';
-      } else if (location.href.indexOf('editor') !== -1) {
-        appName = 'editor'
-      }
-      huePubSub.publish('set.current.app.name', appName);
-    });
+    $(document).ready(function () {
+      huePubSub.subscribe('get.current.app.name', function () {
+        var appName = '';
+        if ('${ 'metastore' in apps }' === 'True' && location.href.indexOf('${"metastore" in apps and apps["metastore"].display_name}') !== -1) {
+          appName = 'metastore';
+        } else if (location.href.indexOf('editor') !== -1) {
+          appName = 'editor'
+        }
+        huePubSub.publish('set.current.app.name', appName);
+      });
 
-    // catch leaking links
-    huePubSub.subscribe('open.link', function (href) {
-      location.href = href;
+      huePubSub.subscribe('open.link', function (href) {
+        location.href = href;
+      });
     });
   </script>