瀏覽代碼

HUE-8841 [metadata] Only show tags when Navigator is configured

Johan Ahlen 6 年之前
父節點
當前提交
c66259f8d4

+ 1 - 1
apps/metastore/src/metastore/templates/metastore.mako

@@ -452,7 +452,7 @@ ${ components.menubar(is_embeddable) }
 </script>
 
 <script type="text/html" id="metastore-nav-tags">
-  <!-- ko if: $root.navigatorEnabled()  -->
+  <!-- ko if: window.HAS_CATALOG_TAGS && $root.navigatorEnabled()  -->
   <div class="metastore-nav-tags" data-bind="component: { name: 'nav-tags', params: { catalogEntry: catalogEntry }}"></div>
   <!-- /ko -->
 </script>

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js

@@ -404,7 +404,7 @@ const SUPPORT_TEMPLATES = `
           <!-- /ko -->
   
           <!-- ko ifnot: $parent.commentExpanded -->
-              <!-- ko if: window.HAS_CATALOG && !isTemporary && (getSourceType() === 'hive' || getSourceType() === 'impala') -->
+              <!-- ko if: window.HAS_CATALOG && window.HAS_CATALOG_TAGS && !isTemporary && (getSourceType() === 'hive' || getSourceType() === 'impala') -->
               <div data-bind="component: { name: 'nav-tags', params: { catalogEntry: $data, overflowEllipsis: true } }"></div>
               <!-- /ko -->
   

+ 3 - 1
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -24,7 +24,7 @@
   from beeswax.conf import LIST_PARTITIONS_LIMIT
   from dashboard.conf import HAS_SQL_ENABLED
   from indexer.conf import ENABLE_NEW_INDEXER
-  from metadata.conf import has_catalog, has_optimizer, has_workload_analytics, OPTIMIZER
+  from metadata.conf import has_catalog, has_catalog_tags, has_readonly_catalog, has_optimizer, has_workload_analytics, OPTIMIZER
   from notebook.conf import ENABLE_NOTEBOOK_2, ENABLE_QUERY_ANALYSIS, ENABLE_QUERY_SCHEDULING
 %>
 
@@ -63,6 +63,8 @@
   window.ENABLE_SQL_SYNTAX_CHECK = '${ conf.ENABLE_SQL_SYNTAX_CHECK.get() }' === 'True';
 
   window.HAS_CATALOG = '${ has_catalog(request.user) }' === 'True';
+  window.HAS_CATALOG_TAGS = '${ has_catalog_tags(request.user) }' === 'True';
+  window.HAS_READ_ONLY_CATALOG = '${ has_readonly_catalog(request.user) }' === 'True';
 
   window.HAS_OPTIMIZER = '${ has_optimizer() }' === 'True';
 

+ 6 - 0
desktop/libs/metadata/src/metadata/conf.py

@@ -232,6 +232,12 @@ def has_catalog(user):
   return ((bool(get_catalog_url() and get_catalog_auth_password())) or has_navigator(user)) \
       and (is_admin(user) or user.has_hue_permission(action="access", app=DJANGO_APPS[0]))
 
+def has_catalog_tags(user):
+  return has_catalog(user) and has_navigator(user)
+
+def has_readonly_catalog(user):
+  return has_catalog(user) and not has_navigator(user)
+
 def get_catalog_auth_password():
   '''Get the password to authenticate with.'''
   global CATALOG_AUTH_PASSWORD