浏览代码

HUE-8758 [connectors] Plugged-in the HDFS files icons to the left menu

Romain 6 年之前
父节点
当前提交
f8b7722aea
共有 2 个文件被更改,包括 15 次插入5 次删除
  1. 1 1
      apps/beeswax/src/beeswax/server/dbms.py
  2. 14 4
      desktop/core/src/desktop/models.py

+ 1 - 1
apps/beeswax/src/beeswax/server/dbms.py

@@ -215,7 +215,7 @@ def get_query_server_config_via_connector(connector):
       'auth_password': AUTH_PASSWORD.get(),
 
       'impersonation_enabled': False, # TODO, Impala only, to add to connector class
-      'use_sasl': connector['dialect'] != 'impala',
+      'use_sasl': connector['dialect'] in ('impala', 'hive'),
       'SESSION_TIMEOUT_S': 15 * 60,
       'querycache_rows': 1000,
       'QUERY_TIMEOUT_S': 15 * 60,

+ 14 - 4
desktop/core/src/desktop/models.py

@@ -46,8 +46,10 @@ from notebook.conf import SHOW_NOTEBOOKS, get_ordered_interpreters
 
 from desktop import appmanager
 from desktop.auth.backend import is_admin
-from desktop.conf import ENABLE_ORGANIZATIONS, get_clusters, CLUSTER_ID, IS_MULTICLUSTER_ONLY
+from desktop.conf import get_clusters, CLUSTER_ID, IS_MULTICLUSTER_ONLY, IS_K8S_ONLY, ENABLE_ORGANIZATIONS, ENABLE_PROMETHEUS,\
+    has_connectors
 from desktop.lib import fsmanager
+from desktop.lib.connectors.api import _get_installed_connectors
 from desktop.lib.i18n import force_unicode
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.paths import get_run_root, SAFE_CHARACTERS_URI_COMPONENTS
@@ -1768,12 +1770,20 @@ class ClusterConfig(object):
   def _get_browser(self):
     interpreters = []
 
-    if 'filebrowser' in self.apps and fsmanager.is_enabled_and_has_access('hdfs', self.user):
+    hdfs_connectors = []
+    if has_connectors():
+      hdfs_connectors = [
+        connector['nice_name'] for connector in _get_installed_connectors(category='browsers', dialect='hdfs', interface='rest')
+      ]
+    elif 'filebrowser' in self.apps and fsmanager.is_enabled_and_has_access('hdfs', self.user):
+      hdfs_connectors.append(_('Files'))
+
+    for hdfs_connector in hdfs_connectors:
       interpreters.append({
         'type': 'hdfs',
-        'displayName': _('Files'),
+        'displayName': hdfs_connector,
         'buttonName': _('Browse'),
-        'tooltip': _('Files'),
+        'tooltip': hdfs_connector,
         'page': '/filebrowser/' + (not self.user.is_anonymous() and 'view=' + urllib_quote(self.user.get_home_directory().encode('utf-8'), safe=SAFE_CHARACTERS_URI_COMPONENTS) or '')
       })