Эх сурвалжийг харах

HUE-7117 [importer] Use Impala or Hive accordingly when creating a table from assist

From main menu, still uses the prefered SQL editor.
Romain Rigaux 8 жил өмнө
parent
commit
bb8fdba11e

+ 2 - 2
desktop/core/src/desktop/templates/assist.mako

@@ -773,12 +773,12 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, get_ord
       % if ENABLE_NEW_CREATE_TABLE.get():
         <!-- ko if: sourceType === 'hive' || sourceType === 'impala' -->
         <!-- ko if: typeof databaseName !== 'undefined' -->
-          <a class="inactive-action" data-bind="hueLink: '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + databaseName" title="${_('Create table')}" href="javascript:void(0)">
+          <a class="inactive-action" data-bind="hueLink: '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + databaseName + '?sourceType=' + sourceType" title="${_('Create table')}" href="javascript:void(0)">
             <i class="pointer fa fa-plus" title="${_('Create table')}"></i>
           </a>
         <!-- /ko -->
         <!-- ko if: typeof databases !== 'undefined' -->
-          <a class="inactive-action" data-bind="hueLink: '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }'" href="javascript:void(0)">
+          <a class="inactive-action" data-bind="hueLink: '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }' + '?sourceType=' + sourceType" href="javascript:void(0)">
             <i class="pointer fa fa-plus" title="${ _('Create database') }"></i>
           </a>
         <!-- /ko -->

+ 6 - 6
desktop/libs/indexer/src/indexer/views.py

@@ -100,15 +100,15 @@ def importer_prefill(request, source_type, target_type, target_path=None):
 
 
 def _importer(request, prefill):
-  source_type = get_cluster_config(request.user)['default_sql_interpreter']
+  source_type = request.GET.get('sourceType') or get_cluster_config(request.user)['default_sql_interpreter']
 
   return render('importer.mako', request, {
       'is_embeddable': request.GET.get('is_embeddable', False),
-      'fields_json' : json.dumps({'solr': [field.name for field in FIELD_TYPES], 'hive': HIVE_TYPES, 'hivePrimitive': HIVE_PRIMITIVE_TYPES}),
-      'operators_json' : json.dumps([operator.to_dict() for operator in OPERATORS]),
-      'file_types_json' : json.dumps([format_.format_info() for format_ in get_file_indexable_format_types()]),
-      'default_field_type' : json.dumps(Field().to_dict()),
-      'prefill' : json.dumps(prefill),
+      'fields_json': json.dumps({'solr': [field.name for field in FIELD_TYPES], 'hive': HIVE_TYPES, 'hivePrimitive': HIVE_PRIMITIVE_TYPES}),
+      'operators_json': json.dumps([operator.to_dict() for operator in OPERATORS]),
+      'file_types_json': json.dumps([format_.format_info() for format_ in get_file_indexable_format_types()]),
+      'default_field_type': json.dumps(Field().to_dict()),
+      'prefill': json.dumps(prefill),
       'source_type': source_type
   })