feat(数据源): 支持 db2
This commit is contained in:
parent
c51a41da34
commit
ab7b7f541b
@ -12,6 +12,7 @@ public enum DatasourceTypes {
|
|||||||
oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""),
|
oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""),
|
||||||
mongo("mongo", "mongodb", "com.mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""),
|
mongo("mongo", "mongodb", "com.mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""),
|
||||||
ck("ch", "ch", "ru.yandex.clickhouse.ClickHouseDriver", "`", "`", "'", "'"),
|
ck("ch", "ch", "ru.yandex.clickhouse.ClickHouseDriver", "`", "`", "'", "'"),
|
||||||
|
db2("db2", "db2", "com.ibm.db2.jcc.DB2Driver", "\"", "\"", "\"", "\""),
|
||||||
es("es", "es", "", "\"", "\"", "\"", "\""),
|
es("es", "es", "", "\"", "\"", "\"", "\""),
|
||||||
redshift("redshift", "redshift", "org.postgresql.Driver", "\"", "\"", "\"", "\"");
|
redshift("redshift", "redshift", "org.postgresql.Driver", "\"", "\"", "\"", "\"");
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package io.dataease.dto.datasource;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Db2Configuration extends JdbcConfiguration {
|
||||||
|
|
||||||
|
private String driver = "com.ibm.db2.jcc.DB2Driver";
|
||||||
|
private String extraParams = "";
|
||||||
|
|
||||||
|
public String getJdbc() {
|
||||||
|
if(StringUtils.isEmpty(extraParams.trim())){
|
||||||
|
return "jdbc:db2://HOSTNAME:PORT/DATABASE"
|
||||||
|
.replace("HOSTNAME", getHost().trim())
|
||||||
|
.replace("PORT", getPort().toString().trim())
|
||||||
|
.replace("DATABASE", getDataBase().trim());
|
||||||
|
}else {
|
||||||
|
return "jdbc:hive2://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
|
||||||
|
.replace("HOSTNAME", getHost().trim())
|
||||||
|
.replace("PORT", getPort().toString().trim())
|
||||||
|
.replace("DATABASE", getDataBase().trim())
|
||||||
|
.replace("EXTRA_PARAMS", getExtraParams().trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,4 +26,6 @@ public class SQLObj {
|
|||||||
private String whereField;
|
private String whereField;
|
||||||
private String whereAlias;
|
private String whereAlias;
|
||||||
private String whereTermAndValue;
|
private String whereTermAndValue;
|
||||||
|
|
||||||
|
private String limitFiled;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,8 @@ public class ProviderFactory implements ApplicationContextAware {
|
|||||||
return context.getBean("redshiftQuery", QueryProvider.class);
|
return context.getBean("redshiftQuery", QueryProvider.class);
|
||||||
case hive:
|
case hive:
|
||||||
return context.getBean("hiveQuery", QueryProvider.class);
|
return context.getBean("hiveQuery", QueryProvider.class);
|
||||||
|
case db2:
|
||||||
|
return context.getBean("db2Query", QueryProvider.class);
|
||||||
default:
|
default:
|
||||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
|
|
||||||
list = fetchResult(rs);
|
list = fetchResult(rs);
|
||||||
|
|
||||||
if (dsr.isPageable() && dsr.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.sqlServer.name())) {
|
if (dsr.isPageable() && (dsr.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.sqlServer.name()) || dsr.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.db2.name()))) {
|
||||||
Integer realSize = dsr.getPage() * dsr.getPageSize() < list.size() ? dsr.getPage() * dsr.getPageSize() : list.size();
|
Integer realSize = dsr.getPage() * dsr.getPageSize() < list.size() ? dsr.getPage() * dsr.getPageSize() : list.size();
|
||||||
list = list.subList((dsr.getPage() - 1) * dsr.getPageSize(), realSize);
|
list = list.subList((dsr.getPage() - 1) * dsr.getPageSize(), realSize);
|
||||||
}
|
}
|
||||||
@ -245,10 +245,10 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
List<String[]> dataList;
|
List<String[]> dataList;
|
||||||
List<TableFiled> fieldList;
|
List<TableFiled> fieldList;
|
||||||
try (Connection connection = getConnectionFromPool(datasourceRequest); Statement stat = connection.createStatement(); ResultSet rs = stat.executeQuery(rebuildSqlWithFragment(datasourceRequest.getQuery()))) {
|
try (Connection connection = getConnectionFromPool(datasourceRequest); Statement stat = connection.createStatement(); ResultSet rs = stat.executeQuery(rebuildSqlWithFragment(datasourceRequest.getQuery()))) {
|
||||||
dataList = fetchResult(rs);
|
|
||||||
fieldList = fetchResultField(rs, datasourceRequest);
|
fieldList = fetchResultField(rs, datasourceRequest);
|
||||||
result.put("dataList", dataList);
|
|
||||||
result.put("fieldList", fieldList);
|
result.put("fieldList", fieldList);
|
||||||
|
dataList = fetchResult(rs);
|
||||||
|
result.put("dataList", dataList);
|
||||||
return result;
|
return result;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
DataEaseException.throwException(e);
|
DataEaseException.throwException(e);
|
||||||
@ -451,6 +451,13 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
driver = hiveConfiguration.getDriver();
|
driver = hiveConfiguration.getDriver();
|
||||||
jdbcurl = hiveConfiguration.getJdbc();
|
jdbcurl = hiveConfiguration.getJdbc();
|
||||||
break;
|
break;
|
||||||
|
case db2:
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), Db2Configuration.class);
|
||||||
|
username = db2Configuration.getUsername();
|
||||||
|
password = db2Configuration.getPassword();
|
||||||
|
driver = db2Configuration.getDriver();
|
||||||
|
jdbcurl = db2Configuration.getJdbc();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -543,6 +550,13 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
dataSource.setDriverClassName(hiveConfiguration.getDriver());
|
dataSource.setDriverClassName(hiveConfiguration.getDriver());
|
||||||
dataSource.setUrl(hiveConfiguration.getJdbc());
|
dataSource.setUrl(hiveConfiguration.getJdbc());
|
||||||
jdbcConfiguration = hiveConfiguration;
|
jdbcConfiguration = hiveConfiguration;
|
||||||
|
break;
|
||||||
|
case db2:
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), Db2Configuration.class);
|
||||||
|
dataSource.setPassword(db2Configuration.getPassword());
|
||||||
|
dataSource.setDriverClassName(db2Configuration.getDriver());
|
||||||
|
dataSource.setUrl(db2Configuration.getJdbc());
|
||||||
|
jdbcConfiguration = db2Configuration;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -592,6 +606,12 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
||||||
}
|
}
|
||||||
return "SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
|
return "SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
|
||||||
|
case db2:
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), Db2Configuration.class);
|
||||||
|
if (StringUtils.isEmpty(db2Configuration.getSchema())) {
|
||||||
|
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
||||||
|
}
|
||||||
|
return "select TABNAME from syscat.tables WHERE TABSCHEMA ='DE_SCHEMA' AND \"TYPE\" = 'T';".replace("DE_SCHEMA", db2Configuration.getSchema());
|
||||||
default:
|
default:
|
||||||
return "show tables;";
|
return "show tables;";
|
||||||
}
|
}
|
||||||
@ -632,6 +652,14 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
||||||
}
|
}
|
||||||
return "SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
|
return "SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
|
||||||
|
|
||||||
|
case db2:
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), Db2Configuration.class);
|
||||||
|
if (StringUtils.isEmpty(db2Configuration.getSchema())) {
|
||||||
|
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
||||||
|
}
|
||||||
|
return "select TABNAME from syscat.tables WHERE TABSCHEMA ='DE_SCHEMA' AND \"TYPE\" = 'V';".replace("DE_SCHEMA", db2Configuration.getSchema());
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -639,11 +667,14 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
|
|
||||||
private String getSchemaSql(DatasourceRequest datasourceRequest) {
|
private String getSchemaSql(DatasourceRequest datasourceRequest) {
|
||||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(datasourceRequest.getDatasource().getType());
|
DatasourceTypes datasourceType = DatasourceTypes.valueOf(datasourceRequest.getDatasource().getType());
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), Db2Configuration.class);
|
||||||
switch (datasourceType) {
|
switch (datasourceType) {
|
||||||
case oracle:
|
case oracle:
|
||||||
return "select * from all_users";
|
return "select * from all_users";
|
||||||
case sqlServer:
|
case sqlServer:
|
||||||
return "select name from sys.schemas;";
|
return "select name from sys.schemas;";
|
||||||
|
case db2:
|
||||||
|
return "select SCHEMANAME from syscat.SCHEMATA WHERE \"DEFINER\" ='USER';".replace("USER", db2Configuration.getUsername().toUpperCase()) ;
|
||||||
case pg:
|
case pg:
|
||||||
return "SELECT nspname FROM pg_namespace;";
|
return "SELECT nspname FROM pg_namespace;";
|
||||||
case redshift:
|
case redshift:
|
||||||
|
|||||||
@ -0,0 +1,39 @@
|
|||||||
|
package io.dataease.provider.query.db2;
|
||||||
|
|
||||||
|
import io.dataease.provider.query.SQLConstants;
|
||||||
|
|
||||||
|
import static io.dataease.commons.constants.DatasourceTypes.db2;
|
||||||
|
|
||||||
|
public class Db2Constants extends SQLConstants {
|
||||||
|
public static final String KEYWORD_TABLE = db2.getKeywordPrefix() + "%s" + db2.getKeywordSuffix();
|
||||||
|
|
||||||
|
public static final String KEYWORD_FIX = "%s." + db2.getKeywordPrefix() + "%s" + db2.getKeywordSuffix();
|
||||||
|
|
||||||
|
public static final String UNIX_TIMESTAMP = "BIGINT(TIMESTAMPDIFF(2,CHAR(%s -TIMESTAMP('1970-01-01 08:00:00'))))";
|
||||||
|
|
||||||
|
public static final String DATE_FORMAT = "TO_CHAR(TIMESTAMP(%s),'%s')";
|
||||||
|
|
||||||
|
public static final String FROM_UNIXTIME = "TO_CHAR(TIMESTAMP('1970-01-01 08:00:00') +(%s)SECONDS, '%s')";
|
||||||
|
|
||||||
|
public static final String STR_TO_DATE = "timestamp(trim(char(%s)))";
|
||||||
|
|
||||||
|
public static final String CAST = "CAST(%s AS %s)";
|
||||||
|
|
||||||
|
public static final String DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH24:MI:SS";
|
||||||
|
|
||||||
|
public static final String DEFAULT_INT_FORMAT = "BIGINT";
|
||||||
|
|
||||||
|
public static final String DEFAULT_FLOAT_FORMAT = "DECIMAL(20,2)";
|
||||||
|
|
||||||
|
public static final String WHERE_VALUE_NULL = "(NULL,'')";
|
||||||
|
|
||||||
|
public static final String WHERE_VALUE_VALUE = "'%s'";
|
||||||
|
|
||||||
|
public static final String AGG_COUNT = "COUNT(*)";
|
||||||
|
|
||||||
|
public static final String AGG_FIELD = "%s(%s)";
|
||||||
|
|
||||||
|
public static final String WHERE_BETWEEN = "'%s' AND '%s'";
|
||||||
|
|
||||||
|
public static final String BRACKETS = "(%s)";
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -769,6 +769,15 @@ public class ExtractDataService {
|
|||||||
inputStep = inputStep(transMeta, selectSQL);
|
inputStep = inputStep(transMeta, selectSQL);
|
||||||
udjcStep = udjc(datasetTableFields, DatasourceTypes.ck);
|
udjcStep = udjc(datasetTableFields, DatasourceTypes.ck);
|
||||||
break;
|
break;
|
||||||
|
case db2:
|
||||||
|
Db2Configuration db2Configuration = new Gson().fromJson(datasource.getConfiguration(), Db2Configuration.class);
|
||||||
|
dataMeta = new DatabaseMeta("db", "DB2", "Native", db2Configuration.getHost().trim(), db2Configuration.getDataBase().trim(), db2Configuration.getPort().toString(), db2Configuration.getUsername(), db2Configuration.getPassword());
|
||||||
|
dataMeta.setDatabaseType("DB2");
|
||||||
|
transMeta.addDatabase(dataMeta);
|
||||||
|
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
|
||||||
|
inputStep = inputStep(transMeta, selectSQL);
|
||||||
|
udjcStep = udjc(datasetTableFields, DatasourceTypes.db2);
|
||||||
|
break;
|
||||||
case excel:
|
case excel:
|
||||||
inputStep = excelInputStep(datasetTable.getInfo(), datasetTableFields);
|
inputStep = excelInputStep(datasetTable.getInfo(), datasetTableFields);
|
||||||
udjcStep = udjc(datasetTableFields, DatasourceTypes.excel);
|
udjcStep = udjc(datasetTableFields, DatasourceTypes.excel);
|
||||||
|
|||||||
BIN
drivers/jcc-11.5.6.0.jar
Normal file
BIN
drivers/jcc-11.5.6.0.jar
Normal file
Binary file not shown.
@ -198,6 +198,8 @@ export default {
|
|||||||
return 'AWS Redshift'
|
return 'AWS Redshift'
|
||||||
} else if (type === 'hive') {
|
} else if (type === 'hive') {
|
||||||
return 'Apache Hive'
|
return 'Apache Hive'
|
||||||
|
} else if (type === 'db2') {
|
||||||
|
return 'Db2'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<layout-content :header="formType=='add' ? $t('datasource.create') : $t('datasource.modify')">
|
<layout-content :header="formType=='add' ? $t('datasource.create') : $t('datasource.modify')">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<el-icon name="back" class="back-button" @click.native="backToList" />
|
<el-icon name="back" class="back-button" @click.native="backToList"/>
|
||||||
{{
|
{{
|
||||||
params && params.id && params.showModel && params.showModel === 'show' && !canEdit ? $t('datasource.show_info') : formType == 'add' ? $t('datasource.create') : $t('datasource.modify')
|
params && params.id && params.showModel && params.showModel === 'show' && !canEdit ? $t('datasource.show_info') : formType == 'add' ? $t('datasource.create') : $t('datasource.modify')
|
||||||
}}
|
}}
|
||||||
@ -18,10 +18,10 @@
|
|||||||
label-position="right"
|
label-position="right"
|
||||||
>
|
>
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
<el-input v-model="form.name" autocomplete="off" />
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.description')" prop="desc">
|
<el-form-item :label="$t('commons.description')" prop="desc">
|
||||||
<el-input v-model="form.desc" autocomplete="off" />
|
<el-input v-model="form.desc" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('datasource.type')" prop="type">
|
<el-form-item :label="$t('datasource.type')" prop="type">
|
||||||
<el-select
|
<el-select
|
||||||
@ -45,7 +45,7 @@
|
|||||||
:label="$t('datasource.host')"
|
:label="$t('datasource.host')"
|
||||||
prop="configuration.host"
|
prop="configuration.host"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.configuration.host" autocomplete="off" />
|
<el-input v-model="form.configuration.host" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.configuration.dataSourceType=='es'"
|
v-if="form.configuration.dataSourceType=='es'"
|
||||||
@ -63,7 +63,7 @@
|
|||||||
:label="$t('datasource.data_base')"
|
:label="$t('datasource.data_base')"
|
||||||
prop="configuration.dataBase"
|
prop="configuration.dataBase"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
<el-input v-model="form.configuration.dataBase" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -78,23 +78,23 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')">
|
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')">
|
||||||
<el-input v-model="form.configuration.username" autocomplete="off" />
|
<el-input v-model="form.configuration.username" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.password')">
|
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.password')">
|
||||||
<el-input v-model="form.configuration.password" autocomplete="off" show-password />
|
<el-input v-model="form.configuration.password" autocomplete="off" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.user_name')">
|
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.user_name')">
|
||||||
<el-input v-model="form.configuration.esUsername" autocomplete="off" />
|
<el-input v-model="form.configuration.esUsername" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.password')">
|
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.password')">
|
||||||
<el-input v-model="form.configuration.esPassword" autocomplete="off" show-password />
|
<el-input v-model="form.configuration.esPassword" autocomplete="off" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.configuration.dataSourceType=='jdbc' && form.type!=='oracle'"
|
v-if="form.configuration.dataSourceType=='jdbc' && form.type!=='oracle'"
|
||||||
:label="$t('datasource.extra_params')"
|
:label="$t('datasource.extra_params')"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.configuration.extraParams" autocomplete="off" />
|
<el-input v-model="form.configuration.extraParams" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -102,16 +102,16 @@
|
|||||||
:label="$t('datasource.port')"
|
:label="$t('datasource.port')"
|
||||||
prop="configuration.port"
|
prop="configuration.port"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.configuration.port" autocomplete="off" type="number" min="0" />
|
<el-input v-model="form.configuration.port" autocomplete="off" type="number" min="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift'">
|
<el-form-item v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'">
|
||||||
<el-button icon="el-icon-plus" size="mini" @click="getSchema()">
|
<el-button icon="el-icon-plus" size="mini" @click="getSchema()">
|
||||||
{{ $t('datasource.get_schema') }}
|
{{ $t('datasource.get_schema') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift'"
|
v-if="form.type=='oracle' || form.type=='sqlServer' || form.type=='pg' || form.type=='redshift' || form.type=='db2'"
|
||||||
:label="$t('datasource.schema')"
|
:label="$t('datasource.schema')"
|
||||||
>
|
>
|
||||||
<el-select
|
<el-select
|
||||||
@ -140,10 +140,10 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('datasource.min_pool_size')" prop="configuration.minPoolSize">
|
<el-form-item :label="$t('datasource.min_pool_size')" prop="configuration.minPoolSize">
|
||||||
<el-input v-model="form.configuration.minPoolSize" autocomplete="off" type="number" min="0" />
|
<el-input v-model="form.configuration.minPoolSize" autocomplete="off" type="number" min="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('datasource.max_pool_size')" prop="configuration.maxPoolSize">
|
<el-form-item :label="$t('datasource.max_pool_size')" prop="configuration.maxPoolSize">
|
||||||
<el-input v-model="form.configuration.maxPoolSize" autocomplete="off" type="number" min="0" />
|
<el-input v-model="form.configuration.maxPoolSize" autocomplete="off" type="number" min="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
@ -181,13 +181,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import LayoutContent from '@/components/business/LayoutContent'
|
import LayoutContent from '@/components/business/LayoutContent'
|
||||||
import { addDs, editDs, getSchema, validateDs, validateDsById } from '@/api/system/datasource'
|
import {addDs, editDs, getSchema, validateDs, validateDsById} from '@/api/system/datasource'
|
||||||
import { $confirm } from '@/utils/message'
|
import {$confirm} from '@/utils/message'
|
||||||
import i18n from '@/lang/index'
|
import i18n from '@/lang/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DsForm',
|
name: 'DsForm',
|
||||||
components: { LayoutContent },
|
components: {LayoutContent},
|
||||||
props: {
|
props: {
|
||||||
params: {
|
params: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -209,10 +209,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
rule: {
|
rule: {
|
||||||
name: [{ required: true, message: i18n.t('datasource.input_name'), trigger: 'blur' },
|
name: [{required: true, message: i18n.t('datasource.input_name'), trigger: 'blur'},
|
||||||
{ min: 2, max: 25, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur' }],
|
{min: 2, max: 25, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur'}],
|
||||||
desc: [{ min: 0, max: 50, message: i18n.t('datasource.input_limit_0_50'), trigger: 'blur' }],
|
desc: [{min: 0, max: 50, message: i18n.t('datasource.input_limit_0_50'), trigger: 'blur'}],
|
||||||
type: [{ required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'change' }],
|
type: [{required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'change'}],
|
||||||
'configuration.dataBase': [{
|
'configuration.dataBase': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: i18n.t('datasource.please_input_data_base'),
|
message: i18n.t('datasource.please_input_data_base'),
|
||||||
@ -233,9 +233,9 @@ export default {
|
|||||||
message: i18n.t('datasource.please_input_password'),
|
message: i18n.t('datasource.please_input_password'),
|
||||||
trigger: 'change'
|
trigger: 'change'
|
||||||
}],
|
}],
|
||||||
'configuration.host': [{ required: true, message: i18n.t('datasource.please_input_host'), trigger: 'change' }],
|
'configuration.host': [{required: true, message: i18n.t('datasource.please_input_host'), trigger: 'change'}],
|
||||||
'configuration.url': [{ required: true, message: i18n.t('datasource.please_input_url'), trigger: 'change' }],
|
'configuration.url': [{required: true, message: i18n.t('datasource.please_input_url'), trigger: 'change'}],
|
||||||
'configuration.port': [{ required: true, message: i18n.t('datasource.please_input_port'), trigger: 'change' }],
|
'configuration.port': [{required: true, message: i18n.t('datasource.please_input_port'), trigger: 'change'}],
|
||||||
'configuration.initialPoolSize': [{
|
'configuration.initialPoolSize': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: i18n.t('datasource.please_input_initial_pool_size'),
|
message: i18n.t('datasource.please_input_initial_pool_size'),
|
||||||
@ -268,32 +268,19 @@ export default {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
allTypes: [
|
allTypes: [
|
||||||
{
|
{name: 'mysql', label: 'MySQL', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
|
||||||
name: 'mysql',
|
|
||||||
label: 'MySQL',
|
|
||||||
type: 'jdbc',
|
|
||||||
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
|
|
||||||
},
|
},
|
||||||
{ name: 'hive', label: 'Apache Hive', type: 'jdbc', extraParams: '' },
|
{name: 'hive', label: 'Apache Hive', type: 'jdbc', extraParams: ''},
|
||||||
{ name: 'oracle', label: 'Oracle', type: 'jdbc' },
|
{name: 'oracle', label: 'Oracle', type: 'jdbc'},
|
||||||
{ name: 'sqlServer', label: 'SQL Server', type: 'jdbc', extraParams: '' },
|
{name: 'sqlServer', label: 'SQL Server', type: 'jdbc', extraParams: ''},
|
||||||
{ name: 'pg', label: 'PostgreSQL', type: 'jdbc', extraParams: '' },
|
{name: 'pg', label: 'PostgreSQL', type: 'jdbc', extraParams: ''},
|
||||||
{ name: 'es', label: 'Elasticsearch', type: 'es' },
|
{name: 'es', label: 'Elasticsearch', type: 'es'},
|
||||||
{
|
{name: 'mariadb', label: 'MariaDB', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
|
||||||
name: 'mariadb',
|
{name: 'ds_doris', label: 'Doris', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
|
||||||
label: 'MariaDB',
|
{name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: ''},
|
||||||
type: 'jdbc',
|
{name: 'redshift', label: 'AWS Redshift', type: 'jdbc'},
|
||||||
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
|
{name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: ''},
|
||||||
},
|
{name: 'db2', label: 'Db2', type: 'jdbc', extraParams: ''}
|
||||||
{
|
|
||||||
name: 'ds_doris',
|
|
||||||
label: 'Doris',
|
|
||||||
type: 'jdbc',
|
|
||||||
extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
|
|
||||||
},
|
|
||||||
{ name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: '' },
|
|
||||||
{ name: 'redshift', label: 'AWS Redshift', type: 'jdbc' },
|
|
||||||
{ name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: '' }
|
|
||||||
],
|
],
|
||||||
schemas: [],
|
schemas: [],
|
||||||
canEdit: false,
|
canEdit: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user