浏览代码

HUE-8638 [importer] Improve the query editor table name

Johan Ahlen 7 年之前
父节点
当前提交
d28c18f7d3
共有 1 个文件被更改,包括 20 次插入1 次删除
  1. 20 1
      desktop/libs/indexer/src/indexer/templates/importer.mako

+ 20 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -1619,6 +1619,25 @@ ${ assist.assistPanel() }
           while (sampleColSubDisposals.length) {
             sampleColSubDisposals.pop()();
           }
+          if (!self.sampleCols().length) {
+            return;
+          }
+
+          var tableName = 'input';
+          switch (self.inputFormat()) {
+            case 'stream':
+              if (self.streamSelection() === 'kafka' && self.kafkaSelectedTopics()) {
+                tableName = self.kafkaSelectedTopics();
+              }
+              break;
+            case 'file' :
+              tableName = self.path().split('/').pop();
+              break;
+            case 'table':
+            case 'rdbms':
+              tableName = self.tableName();
+          }
+
           var temporaryColumns = [];
           sampleCols.forEach(function (sampleCol) {
             var col = {
@@ -1641,7 +1660,7 @@ ${ assist.assistPanel() }
             sourceType: self.sourceType,
             namespace: self.namespace(),
             compute: self.compute(),
-            name: 'input',
+            name: tableName,
             columns: temporaryColumns
           });
           sampleColSubDisposals.push(function () {