mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
feat: 支持直连模式(ch)
This commit is contained in:
parent
a68b7d28c0
commit
e1b32c6895
@ -342,11 +342,11 @@
|
||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>ru.yandex.clickhouse</groupId>
|
||||
<artifactId>clickhouse-jdbc</artifactId>
|
||||
<version>0.3.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,29 +1,28 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Datasource implements Serializable {
|
||||
@ApiModelProperty("ID")
|
||||
private String id;
|
||||
@ApiModelProperty("名称")
|
||||
|
||||
private String name;
|
||||
@ApiModelProperty("描述")
|
||||
|
||||
private String desc;
|
||||
@ApiModelProperty("类型")
|
||||
|
||||
private String type;
|
||||
@ApiModelProperty("创建时间")
|
||||
|
||||
private Long createTime;
|
||||
@ApiModelProperty("更新时间")
|
||||
|
||||
private Long updateTime;
|
||||
@ApiModelProperty("创建者")
|
||||
|
||||
private String createBy;
|
||||
@ApiModelProperty("状态")
|
||||
|
||||
private String status;
|
||||
@ApiModelProperty("配置")
|
||||
|
||||
private String computeType;
|
||||
|
||||
private String configuration;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -643,6 +643,76 @@ public class DatasourceExample {
|
||||
addCriterion("`status` not between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeIsNull() {
|
||||
addCriterion("compute_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeIsNotNull() {
|
||||
addCriterion("compute_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeEqualTo(String value) {
|
||||
addCriterion("compute_type =", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeNotEqualTo(String value) {
|
||||
addCriterion("compute_type <>", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeGreaterThan(String value) {
|
||||
addCriterion("compute_type >", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("compute_type >=", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeLessThan(String value) {
|
||||
addCriterion("compute_type <", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("compute_type <=", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeLike(String value) {
|
||||
addCriterion("compute_type like", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeNotLike(String value) {
|
||||
addCriterion("compute_type not like", value, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeIn(List<String> values) {
|
||||
addCriterion("compute_type in", values, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeNotIn(List<String> values) {
|
||||
addCriterion("compute_type not in", values, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeBetween(String value1, String value2) {
|
||||
addCriterion("compute_type between", value1, value2, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andComputeTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("compute_type not between", value1, value2, "computeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -10,6 +10,7 @@
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="compute_type" jdbcType="VARCHAR" property="computeType" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.Datasource">
|
||||
<result column="configuration" jdbcType="LONGVARCHAR" property="configuration" />
|
||||
@ -73,7 +74,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, `desc`, `type`, create_time, update_time, create_by, `status`
|
||||
id, `name`, `desc`, `type`, create_time, update_time, create_by, `status`, compute_type
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
configuration
|
||||
@ -129,12 +130,12 @@
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.Datasource">
|
||||
insert into datasource (id, `name`, `desc`,
|
||||
`type`, create_time, update_time,
|
||||
create_by, `status`, configuration
|
||||
)
|
||||
create_by, `status`, compute_type,
|
||||
configuration)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{createBy,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{configuration,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
#{createBy,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{computeType,jdbcType=VARCHAR},
|
||||
#{configuration,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.Datasource">
|
||||
insert into datasource
|
||||
@ -163,6 +164,9 @@
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
<if test="computeType != null">
|
||||
compute_type,
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
configuration,
|
||||
</if>
|
||||
@ -192,6 +196,9 @@
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="computeType != null">
|
||||
#{computeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
#{configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -230,6 +237,9 @@
|
||||
<if test="record.status != null">
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.computeType != null">
|
||||
compute_type = #{record.computeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.configuration != null">
|
||||
configuration = #{record.configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -248,6 +258,7 @@
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
create_by = #{record.createBy,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
compute_type = #{record.computeType,jdbcType=VARCHAR},
|
||||
configuration = #{record.configuration,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -262,7 +273,8 @@
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
create_by = #{record.createBy,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR}
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
compute_type = #{record.computeType,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -291,6 +303,9 @@
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="computeType != null">
|
||||
compute_type = #{computeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
configuration = #{configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -306,6 +321,7 @@
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
compute_type = #{computeType,jdbcType=VARCHAR},
|
||||
configuration = #{configuration,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
@ -317,7 +333,8 @@
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR}
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
compute_type = #{computeType,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
@ -8,7 +8,7 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="query" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="BaseResultMapDTO">
|
||||
select id , name , `desc` ,`type` , configuration ,create_time ,update_time,
|
||||
select datasource.*,
|
||||
authInfo.privileges as `privileges`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{extendCondition}, 'link') cids) t,datasource
|
||||
left join (
|
||||
@ -55,7 +55,7 @@
|
||||
</select>
|
||||
|
||||
<select id="queryUnion" resultMap="BaseResultMapDTO">
|
||||
select id , name , `desc` ,`type` , configuration ,create_time ,update_time, status,
|
||||
select datasource.*,
|
||||
authInfo.privileges as `privileges`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'link') cids) t,datasource
|
||||
left join (
|
||||
|
@ -7,6 +7,7 @@ public enum DatasourceTypes {
|
||||
sqlServer("sqlServer", "sqlServer", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "\"", "\"", "\"", "\""),
|
||||
doris("doris", "doris", "com.mysql.jdbc.Driver", "`", "`", "", ""),
|
||||
oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""),
|
||||
ch("ch", "ch", "ru.yandex.clickhouse.ClickHouseDriver", "`", "`", "'", "'"),
|
||||
es("es", "es", "", "\"", "\"", "\"", "\"");
|
||||
|
||||
private String feature;
|
||||
|
@ -0,0 +1,19 @@
|
||||
package io.dataease.datasource.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CHConfigration extends JdbcDTO {
|
||||
|
||||
private String driver = "ru.yandex.clickhouse.ClickHouseDriver";
|
||||
|
||||
public String getJdbc() {
|
||||
// 连接参数先写死,后边要把编码、时区等参数放到数据源的设置中
|
||||
return "jdbc:clickhouse://HOSTNAME:PORT/DATABASE"
|
||||
.replace("HOSTNAME", getHost().trim())
|
||||
.replace("PORT", getPort().toString().trim())
|
||||
.replace("DATABASE", getDataBase().trim());
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
List<String[]> list = new LinkedList<>();
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = getConnectionFromPool(dsr);
|
||||
connection = getConnection(dsr);
|
||||
Statement stat = connection.createStatement();
|
||||
ResultSet rs = stat.executeQuery(dsr.getQuery());
|
||||
list = fetchResult(rs);
|
||||
@ -196,7 +196,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
String queryStr = getTablesSql(datasourceRequest);
|
||||
Connection con = null;
|
||||
try {
|
||||
con = getConnectionFromPool(datasourceRequest);
|
||||
con = getConnection(datasourceRequest);
|
||||
Statement statement = con.createStatement();
|
||||
ResultSet resultSet = statement.executeQuery(queryStr);
|
||||
while (resultSet.next()) {
|
||||
@ -250,7 +250,12 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
ResultSet resultSet = databaseMetaData.getColumns(null, "%", datasourceRequest.getTable(), "%");
|
||||
while (resultSet.next()) {
|
||||
String tableName = resultSet.getString("TABLE_NAME");
|
||||
String database = resultSet.getString("TABLE_CAT");
|
||||
String database = null;
|
||||
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase("ch")){
|
||||
database = resultSet.getString("TABLE_SCHEM");
|
||||
}else {
|
||||
database = resultSet.getString("TABLE_CAT");
|
||||
}
|
||||
if(database != null){
|
||||
if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDatabase(datasourceRequest))) {
|
||||
TableFiled tableFiled = getTableFiled(resultSet);
|
||||
@ -436,6 +441,14 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
password = pgConfigration.getPassword();
|
||||
driver = pgConfigration.getDriver();
|
||||
jdbcurl = pgConfigration.getJdbc();
|
||||
break;
|
||||
case ch:
|
||||
CHConfigration chConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), CHConfigration.class);
|
||||
username = chConfigration.getUsername();
|
||||
password = chConfigration.getPassword();
|
||||
driver = chConfigration.getDriver();
|
||||
jdbcurl = chConfigration.getJdbc();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -493,6 +506,14 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
dataSource.setJdbcUrl(pgConfigration.getJdbc());
|
||||
jdbcDTO = pgConfigration;
|
||||
break;
|
||||
case ch:
|
||||
CHConfigration chConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), CHConfigration.class);
|
||||
dataSource.setUser(chConfigration.getUsername());
|
||||
dataSource.setDriverClass(chConfigration.getDriver());
|
||||
dataSource.setPassword(chConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(chConfigration.getJdbc());
|
||||
jdbcDTO = chConfigration;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -515,7 +536,8 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
PgConfigration pgConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), PgConfigration.class);
|
||||
return pgConfigration.getDataBase();
|
||||
default:
|
||||
return null;
|
||||
JdbcDTO jdbcDTO = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), JdbcDTO.class);
|
||||
return jdbcDTO.getDataBase();
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,6 +568,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception(Translator.get("i18n_schema_is_empty"));
|
||||
}
|
||||
return "SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg%' AND tablename NOT LIKE 'sql_%' AND schemaname='SCHEMA' ;".replace("SCHEMA", pgConfigration.getSchema());
|
||||
case ch:
|
||||
CHConfigration chConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), CHConfigration.class);
|
||||
return "SELECT name FROM system.tables where database='DATABASE';".replace("DATABASE", chConfigration.getDataBase());
|
||||
default:
|
||||
return "show tables;";
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public class ProviderFactory implements ApplicationContextAware {
|
||||
return context.getBean("oracleQuery", QueryProvider.class);
|
||||
case es:
|
||||
return context.getBean("esQuery", QueryProvider.class);
|
||||
case ch:
|
||||
return context.getBean("chQuery", QueryProvider.class);
|
||||
default:
|
||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package io.dataease.provider.ch;
|
||||
|
||||
import io.dataease.provider.SQLConstants;
|
||||
|
||||
import static io.dataease.datasource.constants.DatasourceTypes.ch;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/7/8 7:22 下午
|
||||
*/
|
||||
public class CHConstants extends SQLConstants {
|
||||
public static final String KEYWORD_TABLE = ch.getKeywordPrefix() + "%s" + ch.getKeywordSuffix();
|
||||
|
||||
public static final String KEYWORD_FIX = "%s." + ch.getKeywordPrefix() + "%s" + ch.getKeywordSuffix();
|
||||
|
||||
public static final String toInt32 = "toInt32(%s)";
|
||||
|
||||
public static final String toDateTime = "toDateTime(%s)";
|
||||
|
||||
public static final String toInt64 = "toInt64(%s)";
|
||||
|
||||
public static final String toFloat64 = "toFloat64(%s)";
|
||||
|
||||
public static final String formatDateTime = "formatDateTime(%s,'%s')";
|
||||
|
||||
public static final String toDecimal = "toDecimal64(%s,2)";
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%M:%S";
|
||||
|
||||
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)";
|
||||
}
|
1002
backend/src/main/java/io/dataease/provider/ch/CHQueryProvider.java
Normal file
1002
backend/src/main/java/io/dataease/provider/ch/CHQueryProvider.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -29,3 +29,5 @@ ALTER TABLE `sys_user` ADD COLUMN `from` int(4) NOT NULL COMMENT '来源' AFTER
|
||||
|
||||
INSERT INTO `sys_menu` VALUES (60, 1, 0, 1, '导入LDAP用户', 'system-user-import', 'system/user/imp-ldap', 11, NULL, 'user-ldap', b'0', b'0', b'1', 'user:import', NULL, NULL, NULL, NULL);
|
||||
|
||||
ALTER TABLE `datasource` ADD COLUMN `compute_type` VARCHAR(45) NULL DEFAULT 'ALL' COMMENT '数据计算模式' AFTER `status`;
|
||||
update datasource set compute_type='ALL';
|
||||
|
@ -65,7 +65,7 @@
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
|
||||
<table tableName="chart_view"/>
|
||||
<table tableName="datasource"/>
|
||||
|
||||
<!-- <table tableName="sys_dict_item"/>-->
|
||||
<!-- <table tableName="dataset_table_field"/>-->
|
||||
|
@ -1048,6 +1048,8 @@ export default {
|
||||
password: 'Password',
|
||||
host: 'Host name / IP address',
|
||||
port: 'Port',
|
||||
datasource_url: 'URL address',
|
||||
please_input_datasource_url: 'Please enter Elasticsearch 地址,e.g: http://es_host:es_port',
|
||||
please_input_data_base: 'Please enter the database name',
|
||||
please_input_user_name: 'Please enter user name',
|
||||
please_input_password: 'Please enter Password',
|
||||
|
@ -1047,6 +1047,8 @@ export default {
|
||||
password: '密碼',
|
||||
host: '主機名/IP地址',
|
||||
port: '端口',
|
||||
datasource_url: '地址',
|
||||
please_input_datasource_url: '請輸入 Elasticsearch 地址,如: http://es_host:es_port',
|
||||
please_input_data_base: '請輸入數據庫名稱',
|
||||
please_input_user_name: '請輸入用戶名',
|
||||
please_input_password: '請輸入密碼',
|
||||
|
@ -1074,11 +1074,14 @@ export default {
|
||||
create: '新建数据源',
|
||||
type: '类型',
|
||||
please_choose_type: '请选择数据源类型',
|
||||
please_choose_data_type: '请选择计算模式',
|
||||
data_base: '数据库名称',
|
||||
user_name: '用户名',
|
||||
password: '密码',
|
||||
host: '主机名/IP地址',
|
||||
port: '端口',
|
||||
datasource_url: '地址',
|
||||
please_input_datasource_url: '请输入 Elasticsearch 地址,如: http://es_host:es_port',
|
||||
please_input_data_base: '请输入数据库名称',
|
||||
please_select_oracle_type: '选择连接类型',
|
||||
please_input_user_name: '请输入用户名',
|
||||
@ -1115,7 +1118,11 @@ export default {
|
||||
please_input_acquire_increment: '请输入增长数',
|
||||
please_input_connect_timeout: '请输入连接超时(秒)',
|
||||
no_less_then_0: '高级设置中的参数不能小于零',
|
||||
priority: '高级设置'
|
||||
priority: '高级设置',
|
||||
data_mode: '数据模式',
|
||||
direct: '直连模式',
|
||||
extract: '抽取模式',
|
||||
all_compute_mode: '直连、抽取模式'
|
||||
},
|
||||
pblink: {
|
||||
key_pwd: '请输入密码打开链接',
|
||||
|
@ -28,8 +28,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="mode" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
||||
<el-option :label="$t('dataset.direct_connect')" value="0" />
|
||||
<el-option :label="$t('dataset.sync_data')" value="1" :disabled="!kettleRunning" />
|
||||
<el-option :label="$t('dataset.direct_connect')" value="0" :disabled="selectedDatasource.computeType==='EXTRACT'"/>
|
||||
<el-option :label="$t('dataset.sync_data')" value="1" :disabled="!kettleRunning || selectedDatasource.computeType==='DIRECT'" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@ -86,7 +86,8 @@ export default {
|
||||
mode: '0',
|
||||
syncType: 'sync_now',
|
||||
tableData: [],
|
||||
kettleRunning: false
|
||||
kettleRunning: false,
|
||||
selectedDatasource: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -96,6 +97,11 @@ export default {
|
||||
this.tables = response.data
|
||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||
})
|
||||
for (let i = 0; i < this.options.length; i++) {
|
||||
if (this.options[i].id === val) {
|
||||
this.selectedDatasource = this.options[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
searchTable(val) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
<el-row>
|
||||
<el-form :inline="true">
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="dataSource" filterable :placeholder="$t('dataset.pls_slc_data_source')" size="mini">
|
||||
<el-select v-model="dataSource" filterable :placeholder="$t('dataset.pls_slc_data_source')" size="mini" @change="changeDatasource()">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
@ -32,8 +32,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!param.tableId" class="form-item">
|
||||
<el-select v-model="mode" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
||||
<el-option :label="$t('dataset.direct_connect')" value="0" />
|
||||
<el-option :label="$t('dataset.sync_data')" value="1" :disabled="!kettleRunning" />
|
||||
<el-option :label="$t('dataset.direct_connect')" value="0" :disabled="selectedDatasource.computeType==='EXTRACT'"/>
|
||||
<el-option :label="$t('dataset.sync_data')" value="1" :disabled="!kettleRunning || selectedDatasource.computeType==='DIRECT'" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@ -145,14 +145,15 @@ export default {
|
||||
theme: 'solarized',
|
||||
hintOptions: { // 自定义提示选项
|
||||
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
||||
}
|
||||
},
|
||||
},
|
||||
data: [],
|
||||
fields: [],
|
||||
mode: '0',
|
||||
syncType: 'sync_now',
|
||||
height: 500,
|
||||
kettleRunning: false
|
||||
kettleRunning: false,
|
||||
selectedDatasource: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -189,6 +190,13 @@ export default {
|
||||
this.kettleRunning = res.data
|
||||
})
|
||||
},
|
||||
changeDatasource() {
|
||||
for (let i = 0; i < this.options.length; i++) {
|
||||
if (this.options[i].id === this.form.dataSource) {
|
||||
this.selectedDatasource = this.options[i]
|
||||
}
|
||||
}
|
||||
},
|
||||
calHeight() {
|
||||
const that = this
|
||||
setTimeout(function() {
|
||||
|
@ -154,6 +154,10 @@ export default {
|
||||
return 'Oracle'
|
||||
} else if (type === 'pg') {
|
||||
return 'PostgreSQL'
|
||||
} else if (type === 'es') {
|
||||
return 'Elasticsearch'
|
||||
} else if (type === 'ch') {
|
||||
return 'ClickHouse'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -24,11 +24,22 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('datasource.data_mode')" prop="type">
|
||||
<el-select v-model="form.computeType" :placeholder="$t('datasource.please_choose_data_type')" class="select-width" :disabled="formType=='modify' || (formType==='add' && params && !!params.computeMode)">
|
||||
<el-option
|
||||
v-for="item in compute_mode"
|
||||
:key="item.type"
|
||||
:label="item.label"
|
||||
:value="item.type"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.host')" prop="configuration.host">
|
||||
<el-input v-model="form.configuration.host" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.url')" prop="configuration.url">
|
||||
<el-input v-model="form.configuration.url" placeholder="请输入 Elasticsearch 地址,如: http://es_host:es_port" autocomplete="off" />
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='es'" :label="$t('datasource.datasource_url')" prop="configuration.url">
|
||||
<el-input v-model="form.configuration.url" :placeholder="$t('datasource.please_input_datasource_url')" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.data_base')" prop="configuration.dataBase">
|
||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
||||
@ -147,12 +158,20 @@ export default {
|
||||
'configuration.acquireIncrement': [{ required: true, message: this.$t('datasource.please_input_acquire_increment'), trigger: 'change' }],
|
||||
'configuration.connectTimeout': [{ required: true, message: this.$t('datasource.please_input_connect_timeout'), trigger: 'change' }]
|
||||
},
|
||||
allTypes: [{ name: 'mysql', label: 'MySQL', type: 'jdbc' },
|
||||
allTypes: [
|
||||
{ name: 'mysql', label: 'MySQL', type: 'jdbc'},
|
||||
{ name: 'oracle', label: 'Oracle', type: 'jdbc' },
|
||||
{ name: 'sqlServer', label: 'SQL Server', type: 'jdbc' },
|
||||
{ name: 'pg', label: 'PostgreSQL', type: 'jdbc' },
|
||||
{ name: 'es', label: 'Elasticsearch', type: 'es' }],
|
||||
{ name: 'es', label: 'Elasticsearch', type: 'es' },
|
||||
{ name: 'ch', label: 'ClickHouse', type: 'jdbc' }
|
||||
],
|
||||
schemas: [],
|
||||
compute_mode: [
|
||||
{type: "DIRECT", label: this.$t('datasource.direct')},
|
||||
{type: "EXTRACT", label: this.$t('datasource.extract')},
|
||||
{type: "ALL", label: this.$t('datasource.all_compute_mode')}
|
||||
],
|
||||
canEdit: false,
|
||||
originConfiguration: {}
|
||||
}
|
||||
@ -293,6 +312,15 @@ export default {
|
||||
this.form.configuration.dataSourceType = this.allTypes[i].type
|
||||
}
|
||||
}
|
||||
if(this.form.type === 'es'){
|
||||
this.compute_mode = [{type: "DIRECT", label: this.$t('datasource.direct')}];
|
||||
}else {
|
||||
this.compute_mode = [
|
||||
{type: "DIRECT", label: this.$t('datasource.direct')},
|
||||
{type: "EXTRACT", label: this.$t('datasource.extract')},
|
||||
{type: "ALL", label: this.$t('datasource.all_compute_mode')}
|
||||
];
|
||||
}
|
||||
},
|
||||
backToList() {
|
||||
this.$emit('switch-component', { })
|
||||
|
Loading…
Reference in New Issue
Block a user