Pārlūkot izejas kodu

[tablebrowser] Fix the link in left assist popover to the table in table browser when Knox enabled (#2111)

Ying Chen 4 gadi atpakaļ
vecāks
revīzija
1722e3cb69

+ 10 - 2
desktop/core/src/desktop/js/apps/tableBrowser/metastoreViewModel.js

@@ -180,7 +180,10 @@ class MetastoreViewModel {
     });
 
     huePubSub.subscribe('metastore.url.change', () => {
-      const prefix = '/hue/metastore/';
+      const prefix =
+        window.HUE_BASE_URL && window.HUE_BASE_URL.length
+          ? window.HUE_BASE_URL + '/metastore/'
+          : '/hue/metastore/';
       if (this.source() && this.source().namespace()) {
         const params = {
           source_type: this.source().type
@@ -351,11 +354,16 @@ class MetastoreViewModel {
   }
 
   loadUrl() {
-    const path = window.location.pathname.substr(4) || '/metastore/tables';
+    const path = window.location.pathname.startsWith(window.HUE_BASE_URL)
+      ? window.location.pathname.substr(window.HUE_BASE_URL.length)
+      : window.location.pathname.substr(4) || '/metastore/tables';
     const pathParts = path.split('/');
     if (pathParts[0] === '') {
       pathParts.shift();
     }
+    while (pathParts[0] === 'hue') {
+      pathParts.shift();
+    }
     if (pathParts[0] === 'metastore') {
       pathParts.shift();
     }