瀏覽代碼

HUE-7 [metastore] Add support for creating manually a table

Romain Rigaux 9 年之前
父節點
當前提交
b3cab65188

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

@@ -570,7 +570,7 @@ ${ components.menubar() }
       % if is_embeddable:
         <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, click: function () { onePageViewModel.currentApp('importer') }" title="${_('Create a new table')}"><i class="fa fa-plus"></i></a>
       % elif ENABLE_NEW_CREATE_TABLE.get():
-        <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, attr: { 'href': '${ url('indexer:importer_prefill', source_type='table', target_type='table') }' + database().name }" title="${_('Create a new table')}"><i class="fa fa-plus"></i></a>
+        <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, attr: { 'href': '${ url('indexer:importer_prefill', source_type='file', target_type='table') }' + database().name }" title="${_('Create a new table')}"><i class="fa fa-plus"></i></a>
       % else:
         <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, attr: { 'href': '/beeswax/create/import_wizard/' + database().name }" title="${_('Create a new table from a file')}"><span class="fa-stack fa-fw" style="width: 1.28571429em"><i class="fa fa-file-o fa-stack-1x"></i><i class="fa fa-plus-circle fa-stack-1x" style="font-size: 14px; margin-left: 5px; margin-top: 6px;"></i></span></a>
         <a class="inactive-action margin-left-10" data-bind="tooltip: { placement: 'bottom', delay: 750 }, attr: { 'href': '/beeswax/create/create_table/' + database().name }" title="${_('Create a new table manually')}"><i class="fa fa-plus"></i></a>

+ 3 - 0
desktop/libs/indexer/src/indexer/api3.py

@@ -244,6 +244,9 @@ def _create_table_from_a_file(request, source, destination):
   extra_create_properties = ''
   sql = ''
 
+  if source['inputFormat'] == 'manual':
+    load_data = False
+
   if table_format == 'json':
     row_format = 'serde'
     serde_name = 'org.apache.hadoop.hive.serde2.OpenCSVSerde'

+ 4 - 0
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -482,6 +482,10 @@ ${ assist.assistPanel() }
             <div data-bind="template: { name: 'index-field-template', data: $data }" class="margin-top-10 field"></div>
           <!-- /ko -->
         </form>
+
+        <!-- ko if: $parent.createWizard.source.inputFormat() == 'manual' && ouputFormat() == 'table' -->
+          <a data-bind="click: function() { columns.push($root.loadField({operations: [], nested: [], name: '', level: 0, type: '', showProperties: false, isPartition: true})); }" class="pointer margin-left-20" title="${_('Add Operation')}"><i class="fa fa-plus"></i> ${_('Add Field')}</a>
+        <!-- /ko -->
         <!-- /ko -->
 
         <!-- ko if: ouputFormat() == 'database' -->