Browse Source

HUE-8330 [cluster] Add namespace name to compute if it has one

Romain Rigaux 7 years ago
parent
commit
42ff5f92b5

+ 3 - 2
desktop/core/src/desktop/api2.py

@@ -120,7 +120,7 @@ def get_context_computes(request, interface):
     computes.extend([{
         'id': cluster['id'],
         'name': cluster['name'],
-        'namespace': cluster['id'], # Dummy
+        'namespace': cluster['id'],
         'interface': interface,
         'type': cluster['type']
       } for cluster in clusters
@@ -132,7 +132,7 @@ def get_context_computes(request, interface):
           'id': cluster.get('crn', 'None'),
           'name': cluster.get('clusterName', 'Unknown'),
           'status': cluster.get('status'),
-          # namespaceCrn
+          'namespace': cluster.get('namespaceCrn'),
           # environmentType
           # secured
           # cdhVersion
@@ -148,6 +148,7 @@ def get_context_computes(request, interface):
           'status': cluster.get('status'),
           'environmentType': cluster.get('environmentType'),
           'serviceType': cluster.get('serviceType'),
+          'namespace': cluster.get('namespaceCrn'),
           'type': 'altus-de'
         } for cluster in DataEngApi(request.user).list_clusters()['clusters']]
       )

+ 1 - 1
desktop/libs/notebook/src/notebook/connectors/base.py

@@ -282,7 +282,7 @@ def get_api(request, snippet):
   cluster = json.loads(request.POST.get('cluster', '""'))
   if cluster == 'undefined':
     cluster = None
-  if cluster and 'altus' in cluster:
+  if cluster and 'crn:altus:analyticdb:' in cluster:
     interface = 'altus-adb'
   print cluster