mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 12:03:05 +08:00
fix: 增加接口校验
This commit is contained in:
parent
252f88bbba
commit
fc1a92d04e
@ -9,11 +9,11 @@ import lombok.Data;
|
|||||||
public class Datasource implements Serializable {
|
public class Datasource implements Serializable {
|
||||||
@ApiModelProperty("ID")
|
@ApiModelProperty("ID")
|
||||||
private String id;
|
private String id;
|
||||||
@ApiModelProperty("名称")
|
@ApiModelProperty(value = "名称",required = true)
|
||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty("描述")
|
@ApiModelProperty("描述")
|
||||||
private String desc;
|
private String desc;
|
||||||
@ApiModelProperty("类型")
|
@ApiModelProperty(value = "类型", required = true)
|
||||||
private String type;
|
private String type;
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
@ -23,7 +23,7 @@ public class Datasource implements Serializable {
|
|||||||
private String createBy;
|
private String createBy;
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
private String status;
|
private String status;
|
||||||
@ApiModelProperty("配置详情")
|
@ApiModelProperty(value = "配置详情", required = true)
|
||||||
private String configuration;
|
private String configuration;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package io.dataease.base.domain;
|
package io.dataease.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -21,6 +23,7 @@ public class DeEngine implements Serializable {
|
|||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "详细信息", required = true)
|
||||||
private String configuration;
|
private String configuration;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -7,6 +7,7 @@ import io.dataease.commons.constants.DePermissionType;
|
|||||||
import io.dataease.commons.constants.ResourceAuthLevel;
|
import io.dataease.commons.constants.ResourceAuthLevel;
|
||||||
import io.dataease.commons.utils.AuthUtils;
|
import io.dataease.commons.utils.AuthUtils;
|
||||||
import io.dataease.controller.ResultHolder;
|
import io.dataease.controller.ResultHolder;
|
||||||
|
import io.dataease.controller.datasource.request.UpdataDsRequest;
|
||||||
import io.dataease.controller.request.DatasourceUnionRequest;
|
import io.dataease.controller.request.DatasourceUnionRequest;
|
||||||
import io.dataease.controller.request.datasource.ApiDefinition;
|
import io.dataease.controller.request.datasource.ApiDefinition;
|
||||||
import io.dataease.dto.datasource.DBTableDTO;
|
import io.dataease.dto.datasource.DBTableDTO;
|
||||||
@ -39,8 +40,7 @@ public class DatasourceController {
|
|||||||
return datasourceService.addDatasource(datasource);
|
return datasourceService.addDatasource(datasource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("datasource:read")
|
@ApiIgnore
|
||||||
@ApiOperation("验证数据源")
|
|
||||||
@PostMapping("/validate")
|
@PostMapping("/validate")
|
||||||
public ResultHolder validate(@RequestBody DatasourceDTO datasource) throws Exception {
|
public ResultHolder validate(@RequestBody DatasourceDTO datasource) throws Exception {
|
||||||
return datasourceService.validate(datasource);
|
return datasourceService.validate(datasource);
|
||||||
@ -80,15 +80,15 @@ public class DatasourceController {
|
|||||||
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE)
|
@DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE)
|
||||||
@ApiOperation("更新数据源")
|
@ApiOperation("更新数据源")
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public void updateDatasource(@RequestBody Datasource Datasource) {
|
public void updateDatasource(@RequestBody UpdataDsRequest dsRequest) throws Exception{
|
||||||
datasourceService.updateDatasource(Datasource);
|
datasourceService.updateDatasource(dsRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DePermission(type = DePermissionType.DATASOURCE, value = "id")
|
@DePermission(type = DePermissionType.DATASOURCE)
|
||||||
@ApiOperation("查询数据源下属所有表")
|
@ApiOperation("查询数据源下属所有表")
|
||||||
@PostMapping("/getTables")
|
@PostMapping("/getTables/{id}")
|
||||||
public List<DBTableDTO> getTables(@RequestBody Datasource datasource) throws Exception {
|
public List<DBTableDTO> getTables(@PathVariable String id) throws Exception {
|
||||||
return datasourceService.getTables(datasource);
|
return datasourceService.getTables(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
|
@ -4,6 +4,8 @@ import io.dataease.base.domain.DeEngine;
|
|||||||
import io.dataease.controller.ResultHolder;
|
import io.dataease.controller.ResultHolder;
|
||||||
import io.dataease.dto.DatasourceDTO;
|
import io.dataease.dto.DatasourceDTO;
|
||||||
import io.dataease.service.engine.EngineService;
|
import io.dataease.service.engine.EngineService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
@ -23,7 +25,8 @@ public class EngineController {
|
|||||||
return engineService.mode();
|
return engineService.mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("引擎信息")
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
public DeEngine info() throws Exception{
|
public DeEngine info() throws Exception{
|
||||||
return engineService.info();
|
return engineService.info();
|
||||||
@ -36,7 +39,8 @@ public class EngineController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiIgnore
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("新增/编辑")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public ResultHolder save(@RequestBody DeEngine engine) throws Exception {
|
public ResultHolder save(@RequestBody DeEngine engine) throws Exception {
|
||||||
return engineService.save(engine);
|
return engineService.save(engine);
|
||||||
|
@ -18,6 +18,7 @@ import io.dataease.plugins.xpack.auth.dto.request.DataSetColumnPermissionsDTO;
|
|||||||
import io.dataease.plugins.xpack.auth.service.ColumnPermissionService;
|
import io.dataease.plugins.xpack.auth.service.ColumnPermissionService;
|
||||||
import io.dataease.service.kettle.KettleService;
|
import io.dataease.service.kettle.KettleService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
@ -33,32 +34,36 @@ public class KettleController {
|
|||||||
@Resource
|
@Resource
|
||||||
private KettleService kettleService;
|
private KettleService kettleService;
|
||||||
|
|
||||||
@ApiIgnore
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("新增/编辑")
|
||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
public ResultHolder save(@RequestBody DeEngine engine) throws Exception{
|
public ResultHolder save(@RequestBody DeEngine engine) throws Exception{
|
||||||
return kettleService.save(engine);
|
return kettleService.save(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@PostMapping("validate")
|
@PostMapping("validate")
|
||||||
public void validate(@RequestBody KettleDTO kettleDTO) throws Exception{
|
public void validate(@RequestBody KettleDTO kettleDTO) throws Exception{
|
||||||
kettleService.validate(kettleDTO);
|
kettleService.validate(kettleDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("校验")
|
||||||
@PostMapping("validate/{id}")
|
@PostMapping("validate/{id}")
|
||||||
public ResultHolder validate(@PathVariable String id) throws Exception{
|
public ResultHolder validate(@PathVariable String id) throws Exception{
|
||||||
return kettleService.validate(id);
|
return kettleService.validate(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("查询")
|
||||||
@PostMapping("/pageList/{goPage}/{pageSize}")
|
@PostMapping("/pageList/{goPage}/{pageSize}")
|
||||||
public Pager<List<DeEngine>> pageList( @PathVariable int goPage, @PathVariable int pageSize) {
|
public Pager<List<DeEngine>> pageList( @PathVariable int goPage, @PathVariable int pageSize) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, kettleService.pageList());
|
return PageUtils.setPageInfo(page, kettleService.pageList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ApiOperation("删除")
|
||||||
@DeleteMapping("delete/{id}")
|
@DeleteMapping("delete/{id}")
|
||||||
public void delete(@PathVariable String id) throws Exception{
|
public void delete(@PathVariable String id) throws Exception{
|
||||||
kettleService.delete(id);
|
kettleService.delete(id);
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
package io.dataease.dto;
|
package io.dataease.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class KettleDTO {
|
public class KettleDTO {
|
||||||
|
@ApiModelProperty(value = "Kettle 地址", required = true)
|
||||||
private String carte;
|
private String carte;
|
||||||
|
@ApiModelProperty(value = "Kettle 端口", required = true)
|
||||||
private String port;
|
private String port;
|
||||||
|
@ApiModelProperty(value = "Kettle 用户名", required = true)
|
||||||
private String user;
|
private String user;
|
||||||
|
@ApiModelProperty(value = "Kettle 密码", required = true)
|
||||||
private String passwd;
|
private String passwd;
|
||||||
}
|
}
|
||||||
|
@ -853,6 +853,9 @@ public class DataSetTableService {
|
|||||||
|
|
||||||
public Map<String, Object> getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
|
public Map<String, Object> getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||||
|
if(ds == null){
|
||||||
|
throw new Exception(Translator.get("i18n_invalid_ds"));
|
||||||
|
}
|
||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(ds);
|
datasourceRequest.setDatasource(ds);
|
||||||
|
@ -17,6 +17,7 @@ import io.dataease.commons.utils.AuthUtils;
|
|||||||
import io.dataease.commons.utils.CommonThreadPool;
|
import io.dataease.commons.utils.CommonThreadPool;
|
||||||
import io.dataease.commons.utils.LogUtil;
|
import io.dataease.commons.utils.LogUtil;
|
||||||
import io.dataease.controller.ResultHolder;
|
import io.dataease.controller.ResultHolder;
|
||||||
|
import io.dataease.controller.datasource.request.UpdataDsRequest;
|
||||||
import io.dataease.controller.request.DatasourceUnionRequest;
|
import io.dataease.controller.request.DatasourceUnionRequest;
|
||||||
import io.dataease.controller.request.datasource.ApiDefinition;
|
import io.dataease.controller.request.datasource.ApiDefinition;
|
||||||
import io.dataease.controller.request.datasource.DatasourceRequest;
|
import io.dataease.controller.request.datasource.DatasourceRequest;
|
||||||
@ -56,15 +57,14 @@ public class DatasourceService {
|
|||||||
private DataSetGroupService dataSetGroupService;
|
private DataSetGroupService dataSetGroupService;
|
||||||
@Resource
|
@Resource
|
||||||
private CommonThreadPool commonThreadPool;
|
private CommonThreadPool commonThreadPool;
|
||||||
|
private static List<String> dsTypes = Arrays.asList("excel", "mysql", "hive", "impala", "mariadb", "ds_doris", "pg", "sqlServer", "oracle", "mongo", "ck", "db2", "es", "redshift", "api");
|
||||||
|
|
||||||
@DeCleaner(DePermissionType.DATASOURCE)
|
@DeCleaner(DePermissionType.DATASOURCE)
|
||||||
public Datasource addDatasource(Datasource datasource) throws Exception{
|
public Datasource addDatasource(Datasource datasource) throws Exception{
|
||||||
try{
|
if(!dsTypes.contains(datasource.getType())){
|
||||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(datasource.getType());
|
throw new Exception("Datasource type not supported.");
|
||||||
}catch (Exception e){
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
checkName(datasource);
|
checkName(datasource.getName(),datasource.getType(), datasource.getId());
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
datasource.setId(UUID.randomUUID().toString());
|
datasource.setId(UUID.randomUUID().toString());
|
||||||
datasource.setUpdateTime(currentTimeMillis);
|
datasource.setUpdateTime(currentTimeMillis);
|
||||||
@ -181,12 +181,21 @@ public class DatasourceService {
|
|||||||
return ResultHolder.success("success");
|
return ResultHolder.success("success");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDatasource(Datasource datasource) {
|
public void updateDatasource(UpdataDsRequest updataDsRequest)throws Exception{
|
||||||
checkName(datasource);
|
if(!dsTypes.contains(updataDsRequest.getType())){
|
||||||
|
throw new Exception("Datasource type not supported.");
|
||||||
|
}
|
||||||
|
checkName(updataDsRequest.getName(),updataDsRequest.getType(),updataDsRequest.getId());
|
||||||
|
Datasource datasource = new Datasource();
|
||||||
|
datasource.setName(updataDsRequest.getName());
|
||||||
|
datasource.setDesc(updataDsRequest.getDesc());
|
||||||
|
datasource.setConfiguration(updataDsRequest.getConfiguration());
|
||||||
datasource.setCreateTime(null);
|
datasource.setCreateTime(null);
|
||||||
datasource.setUpdateTime(System.currentTimeMillis());
|
datasource.setUpdateTime(System.currentTimeMillis());
|
||||||
checkAndUpdateDatasourceStatus(datasource);
|
checkAndUpdateDatasourceStatus(datasource);
|
||||||
datasourceMapper.updateByPrimaryKeySelective(datasource);
|
DatasourceExample example = new DatasourceExample();
|
||||||
|
example.createCriteria().andIdEqualTo(updataDsRequest.getId());
|
||||||
|
datasourceMapper.updateByExampleSelective(datasource, example);
|
||||||
handleConnectionPool(datasource, "edit");
|
handleConnectionPool(datasource, "edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,8 +285,8 @@ public class DatasourceService {
|
|||||||
return datasourceProvider.getSchema(datasourceRequest);
|
return datasourceProvider.getSchema(datasourceRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DBTableDTO> getTables(Datasource datasource) throws Exception {
|
public List<DBTableDTO> getTables(String id) throws Exception {
|
||||||
Datasource ds = datasourceMapper.selectByPrimaryKey(datasource.getId());
|
Datasource ds = datasourceMapper.selectByPrimaryKey(id);
|
||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(ds);
|
datasourceRequest.setDatasource(ds);
|
||||||
@ -337,13 +346,13 @@ public class DatasourceService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkName(Datasource datasource) {
|
private void checkName(String datasourceName, String type, String id) {
|
||||||
DatasourceExample example = new DatasourceExample();
|
DatasourceExample example = new DatasourceExample();
|
||||||
DatasourceExample.Criteria criteria = example.createCriteria();
|
DatasourceExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andNameEqualTo(datasource.getName());
|
criteria.andNameEqualTo(datasourceName);
|
||||||
criteria.andTypeEqualTo(datasource.getType());
|
criteria.andTypeEqualTo(type);
|
||||||
if (StringUtils.isNotEmpty(datasource.getId())) {
|
if (StringUtils.isNotEmpty(id)) {
|
||||||
criteria.andIdNotEqualTo(datasource.getId());
|
criteria.andIdNotEqualTo(id);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
|
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
|
||||||
DEException.throwException(Translator.get("i18n_ds_name_exists"));
|
DEException.throwException(Translator.get("i18n_ds_name_exists"));
|
||||||
|
@ -15,6 +15,7 @@ import io.dataease.controller.ResultHolder;
|
|||||||
import io.dataease.controller.request.datasource.DatasourceRequest;
|
import io.dataease.controller.request.datasource.DatasourceRequest;
|
||||||
import io.dataease.dto.DatasourceDTO;
|
import io.dataease.dto.DatasourceDTO;
|
||||||
import io.dataease.dto.datasource.DorisConfiguration;
|
import io.dataease.dto.datasource.DorisConfiguration;
|
||||||
|
import io.dataease.dto.datasource.MysqlConfiguration;
|
||||||
import io.dataease.listener.util.CacheUtils;
|
import io.dataease.listener.util.CacheUtils;
|
||||||
import io.dataease.provider.ProviderFactory;
|
import io.dataease.provider.ProviderFactory;
|
||||||
import io.dataease.provider.datasource.DatasourceProvider;
|
import io.dataease.provider.datasource.DatasourceProvider;
|
||||||
@ -26,10 +27,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Base64;
|
import java.sql.Array;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -41,6 +40,10 @@ public class EngineService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DatasourceService datasource;
|
private DatasourceService datasource;
|
||||||
|
|
||||||
|
static private List<String>simple_engine = Arrays.asList("engine_mysql");
|
||||||
|
|
||||||
|
static private List<String>cluster_engine = Arrays.asList("engine_doris");
|
||||||
|
|
||||||
public Boolean isLocalMode() {
|
public Boolean isLocalMode() {
|
||||||
return env.getProperty("engine_mode", "local").equalsIgnoreCase("local");
|
return env.getProperty("engine_mode", "local").equalsIgnoreCase("local");
|
||||||
}
|
}
|
||||||
@ -71,7 +74,7 @@ public class EngineService {
|
|||||||
return deEngines.get(0);
|
return deEngines.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultHolder validate(DatasourceDTO datasource) throws Exception {
|
public ResultHolder validate(Datasource datasource) throws Exception {
|
||||||
if (StringUtils.isEmpty(datasource.getType()) || StringUtils.isEmpty(datasource.getConfiguration())) {
|
if (StringUtils.isEmpty(datasource.getType()) || StringUtils.isEmpty(datasource.getConfiguration())) {
|
||||||
throw new Exception("未完整设置数据引擎");
|
throw new Exception("未完整设置数据引擎");
|
||||||
}
|
}
|
||||||
@ -119,6 +122,7 @@ public class EngineService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultHolder save(DeEngine engine) throws Exception {
|
public ResultHolder save(DeEngine engine) throws Exception {
|
||||||
|
checkValid(engine);
|
||||||
if (StringUtils.isEmpty(engine.getId())) {
|
if (StringUtils.isEmpty(engine.getId())) {
|
||||||
engine.setId(UUID.randomUUID().toString());
|
engine.setId(UUID.randomUUID().toString());
|
||||||
deEngineMapper.insert(engine);
|
deEngineMapper.insert(engine);
|
||||||
@ -131,6 +135,22 @@ public class EngineService {
|
|||||||
return ResultHolder.success(engine);
|
return ResultHolder.success(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkValid(DeEngine engine)throws Exception{
|
||||||
|
if(isLocalMode()){
|
||||||
|
throw new Exception("Setting engine is not supported.");
|
||||||
|
}
|
||||||
|
if(isSimpleMode()){
|
||||||
|
if(!simple_engine.contains(engine.getType())){
|
||||||
|
throw new Exception("Engine type not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isClusterMode()){
|
||||||
|
if(!cluster_engine.contains(engine.getType())){
|
||||||
|
throw new Exception("Engine type not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setDs(DeEngine engine) {
|
private void setDs(DeEngine engine) {
|
||||||
Datasource datasource = new Datasource();
|
Datasource datasource = new Datasource();
|
||||||
BeanUtils.copyBean(datasource, engine);
|
BeanUtils.copyBean(datasource, engine);
|
||||||
|
@ -94,7 +94,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
dataSource(val) {
|
dataSource(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
post('/datasource/getTables', { id: val }).then(response => {
|
post('/datasource/getTables/' + val, {}).then(response => {
|
||||||
this.tables = response.data
|
this.tables = response.data
|
||||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||||
})
|
})
|
||||||
|
@ -100,7 +100,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
dataSource(val) {
|
dataSource(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
post('/datasource/getTables', {id: val}).then(response => {
|
post('/datasource/getTables/' + val, {}).then(response => {
|
||||||
this.tables = response.data
|
this.tables = response.data
|
||||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user