提交 a1e0bf91 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/v1.8' into v1.8

......@@ -12,13 +12,14 @@ public class MongodbConfiguration extends JdbcConfiguration {
private String connectionType;
private String extraParams = "rebuildschema=true";
public String getJdbc() {
if(StringUtils.isEmpty(extraParams.trim())){
public String getJdbc(String dsId) {
if(StringUtils.isEmpty(extraParams.trim()) && StringUtils.isEmpty(dsId)){
return "jdbc:mongodb://HOSTNAME:PORT/DATABASE"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim());
}else {
this.extraParams = StringUtils.isEmpty(dsId) ? getExtraParams().trim() : getExtraParams().trim() + "&schema=" + dsId +".xml";
return "jdbc:mongodb://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
......
......@@ -99,11 +99,18 @@ public class EsProvider extends DatasourceProvider {
@Override
public List<TableField> getTableFileds(DatasourceRequest datasourceRequest) throws Exception {
QueryProvider qp = ProviderFactory.getQueryProvider(datasourceRequest.getDatasource().getType());
datasourceRequest.setQuery(qp.convertTableToSql(datasourceRequest.getTable(), datasourceRequest.getDatasource()));
return fetchResultField(datasourceRequest);
datasourceRequest.setQuery("desc " + datasourceRequest.getTable());
List<TableField> tableFields = new ArrayList<>();
try {
String response = exexQuery(datasourceRequest, datasourceRequest.getQuery(), "?format=json");
tableFields = fetchResultField4Table(response);
} catch (Exception e) {
DataEaseException.throwException(e);
}
return tableFields;
}
private List<String[]> fetchResult(String response) throws Exception {
EsReponse esReponse = new Gson().fromJson(response, EsReponse.class);
return fetchResult(esReponse);
......@@ -166,6 +173,26 @@ public class EsProvider extends DatasourceProvider {
return fieldList;
}
private List<TableField> fetchResultField4Table(String response) throws Exception {
List<TableField> fieldList = new ArrayList<>();
EsReponse esReponse = new Gson().fromJson(response, EsReponse.class);
if (esReponse.getError() != null) {
throw new Exception(esReponse.getError().getReason());
}
for (String[] row : esReponse.getRows()) {
if(!row[1].equalsIgnoreCase("STRUCT")){
TableField field = new TableField();
field.setFieldName(row[0]);
field.setRemarks(row[0]);
field.setFieldType(row[2]);
field.setFieldSize(EsQueryProvider.transFieldTypeSize(row[2]));
fieldList.add(field);
}
}
return fieldList;
}
@Override
public Map<String, List> fetchResultAndField(DatasourceRequest datasourceRequest) throws Exception {
Map<String, List> result = new HashMap<>();
......
......@@ -403,6 +403,9 @@ public class JdbcProvider extends DatasourceProvider {
}
private Connection getConnectionFromPool(DatasourceRequest datasourceRequest) throws Exception {
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mongo.name())){
return getConnection(datasourceRequest);
}
DruidDataSource dataSource = jdbcConnection.get(datasourceRequest.getDatasource().getId());
if (dataSource == null) {
handleDatasource(datasourceRequest, "add");
......@@ -464,7 +467,7 @@ public class JdbcProvider extends DatasourceProvider {
username = mongodbConfiguration.getUsername();
password = mongodbConfiguration.getPassword();
driver = mongodbConfiguration.getDriver();
jdbcurl = mongodbConfiguration.getJdbc();
jdbcurl = mongodbConfiguration.getJdbc(datasourceRequest.getDatasource().getId());
break;
case redshift:
RedshiftConfigration redshiftConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), RedshiftConfigration.class);
......@@ -563,7 +566,7 @@ public class JdbcProvider extends DatasourceProvider {
case mongo:
MongodbConfiguration mongodbConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MongodbConfiguration.class);
dataSource.setDriverClassName(mongodbConfiguration.getDriver());
dataSource.setUrl(mongodbConfiguration.getJdbc());
dataSource.setUrl(mongodbConfiguration.getJdbc(datasourceRequest.getDatasource().getId()));
jdbcConfiguration = mongodbConfiguration;
break;
case redshift:
......
......@@ -1629,7 +1629,7 @@ public class DataSetTableService {
datasetTableField.setDeExtractType(transFieldType(filed.getFieldType()));
} else {
Integer fieldType = qp.transFieldType(filed.getFieldType());
datasetTableField.setDeType(fieldType == 4 ? 2 : fieldType);
datasetTableField.setDeType(fieldType == 4 ? 2 : (fieldType == 6 ? 0 : fieldType));
datasetTableField.setDeExtractType(fieldType);
}
datasetTableField.setSize(filed.getFieldSize());
......@@ -1637,7 +1637,7 @@ public class DataSetTableService {
datasetTableField.setColumnIndex(i);
datasetTableField.setLastSyncTime(syncTime);
datasetTableField.setExtField(0);
datasetTableField.setGroupType(datasetTableField.getDeType() < 2 ? "d" : "q");
datasetTableField.setGroupType((datasetTableField.getDeType() < 2 || datasetTableField.getDeType() == 6) ? "d" : "q");
}
dataSetTableFieldsService.save(datasetTableField);
}
......
......@@ -1952,13 +1952,17 @@ export default {
}
}
},
dragMoveDuplicate(list, e) {
const that = this
const dup = list.filter(function(m) {
return m.id === that.moveId
})
if (dup && dup.length > 1) {
dragMoveDuplicate(list, e, mode) {
if (mode === 'ds') {
list.splice(e.newDraggableIndex, 1)
} else {
const that = this
const dup = list.filter(function(m) {
return m.id === that.moveId
})
if (dup && dup.length > 1) {
list.splice(e.newDraggableIndex, 1)
}
}
},
addXaxis(e) {
......@@ -1998,13 +2002,11 @@ export default {
this.calcData(true)
},
moveToDimension(e) {
this.dragCheckType(this.dimensionData, 'd')
this.dragMoveDuplicate(this.dimensionData, e)
this.dragMoveDuplicate(this.dimensionData, e, 'ds')
this.calcData(true)
},
moveToQuota(e) {
this.dragCheckType(this.quotaData, 'q')
this.dragMoveDuplicate(this.quotaData, e)
this.dragMoveDuplicate(this.quotaData, e, 'ds')
this.calcData(true)
},
addCustomFilter(e) {
......
......@@ -72,8 +72,8 @@
</el-option>
</el-select>
<span style="margin-left: 8px;">
<span v-if="scope.row.deType === 0">
<svg-icon v-if="scope.row.deType === 0" icon-class="field_text" class="field-icon-text" />
<span v-if="scope.row.deType === 0 || scope.row.deType === 6">
<svg-icon v-if="scope.row.deType === 0 || scope.row.deType === 6" icon-class="field_text" class="field-icon-text" />
<span class="field-class">{{ $t('dataset.text') }}</span>
</span>
<span v-if="scope.row.deType === 1">
......@@ -95,8 +95,8 @@
<el-table-column property="deExtractType" :label="$t('dataset.origin_field_type')" width="100">
<template slot-scope="scope">
<span v-if="scope.row.extField === 0">
<span v-if="scope.row.deExtractType === 0">
<svg-icon v-if="scope.row.deExtractType === 0" icon-class="field_text" class="field-icon-text" />
<span v-if="scope.row.deExtractType === 0 || scope.row.deExtractType === 6">
<svg-icon v-if="scope.row.deExtractType === 0 || scope.row.deExtractType === 6" icon-class="field_text" class="field-icon-text" />
<span class="field-class">{{ $t('dataset.text') }}</span>
</span>
<span v-if="scope.row.deExtractType === 1">
......
......@@ -253,7 +253,7 @@
</el-select>
</el-form-item>
<el-collapse v-if="form.configuration.dataSourceType=='jdbc' && form.type !== 'api'">
<el-collapse v-if="form.configuration.dataSourceType=='jdbc' && form.type !== 'api' && form.type !== 'mongo'">
<el-collapse-item :title="$t('datasource.priority')" name="1">
<el-form-item :label="$t('datasource.initial_pool_size')" prop="configuration.initialPoolSize">
<el-input v-model="form.configuration.initialPoolSize" autocomplete="off" type="number" min="0"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论