Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
e83510f4
提交
e83510f4
authored
8月 24, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 数据源校验
上级
461f5135
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
11 行删除
+22
-11
DatasourceController.java
.../dataease/datasource/controller/DatasourceController.java
+2
-2
DatasourceService.java
...ava/io/dataease/datasource/service/DatasourceService.java
+15
-6
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+3
-1
form.vue
frontend/src/views/system/datasource/form.vue
+2
-2
没有找到文件。
backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java
浏览文件 @
e83510f4
...
...
@@ -38,8 +38,8 @@ public class DatasourceController {
@ApiOperation
(
"验证数据源"
)
@PostMapping
(
"/validate"
)
public
void
validate
(
@RequestBody
Datasource
datasource
)
throws
Exception
{
datasourceService
.
validate
(
datasource
);
public
ResultHolder
validate
(
@RequestBody
Datasource
datasource
)
throws
Exception
{
return
datasourceService
.
validate
(
datasource
);
}
@ApiOperation
(
"验证数据源"
)
...
...
backend/src/main/java/io/dataease/datasource/service/DatasourceService.java
浏览文件 @
e83510f4
...
...
@@ -120,11 +120,17 @@ public class DatasourceService {
checkAndUpdateDatasourceStatus
(
datasource
);
}
public
void
validate
(
Datasource
datasource
)
throws
Exception
{
DatasourceProvider
datasourceProvider
=
ProviderFactory
.
getProvider
(
datasource
.
getType
());
DatasourceRequest
datasourceRequest
=
new
DatasourceRequest
();
datasourceRequest
.
setDatasource
(
datasource
);
datasourceProvider
.
checkStatus
(
datasourceRequest
);
public
ResultHolder
validate
(
Datasource
datasource
)
throws
Exception
{
try
{
DatasourceProvider
datasourceProvider
=
ProviderFactory
.
getProvider
(
datasource
.
getType
());
DatasourceRequest
datasourceRequest
=
new
DatasourceRequest
();
datasourceRequest
.
setDatasource
(
datasource
);
datasourceProvider
.
checkStatus
(
datasourceRequest
);
return
ResultHolder
.
success
(
"Success"
);
}
catch
(
Exception
e
){
return
ResultHolder
.
error
(
"Datasource is invalid: "
+
e
.
getMessage
());
}
}
public
ResultHolder
validate
(
String
datasourceId
)
{
...
...
@@ -133,7 +139,10 @@ public class DatasourceService {
return
ResultHolder
.
error
(
"Can not find datasource: "
+
datasourceId
);
}
try
{
validate
(
datasource
);
DatasourceProvider
datasourceProvider
=
ProviderFactory
.
getProvider
(
datasource
.
getType
());
DatasourceRequest
datasourceRequest
=
new
DatasourceRequest
();
datasourceRequest
.
setDatasource
(
datasource
);
datasourceProvider
.
checkStatus
(
datasourceRequest
);
datasource
.
setStatus
(
"Success"
);
return
ResultHolder
.
success
(
"Success"
);
}
catch
(
Exception
e
){
...
...
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
e83510f4
...
...
@@ -572,7 +572,9 @@ public class ExtractDataService {
}
private
void
extractData
(
DatasetTable
datasetTable
,
String
extractType
)
throws
Exception
{
datasourceService
.
validate
(
datasetTable
.
getDataSourceId
());
if
(
StringUtils
.
isNotEmpty
(
datasetTable
.
getDataSourceId
())){
datasourceService
.
validate
(
datasetTable
.
getDataSourceId
());
}
KettleFileRepository
repository
=
CommonBeanFactory
.
getBean
(
KettleFileRepository
.
class
);
RepositoryDirectoryInterface
repositoryDirectoryInterface
=
repository
.
loadRepositoryDirectoryTree
();
TransMeta
transMeta
=
null
;
...
...
frontend/src/views/system/datasource/form.vue
浏览文件 @
e83510f4
...
...
@@ -278,7 +278,7 @@ export default {
data
.
configuration
=
JSON
.
stringify
(
data
.
configuration
)
if
(
data
.
showModel
===
'show'
&&
!
this
.
canEdit
){
validateDsById
(
data
.
id
).
then
(
res
=>
{
if
(
res
.
success
===
'true'
){
if
(
res
.
success
){
this
.
$success
(
this
.
$t
(
'datasource.validate_success'
))
}
else
{
this
.
$error
(
this
.
$t
(
res
.
message
))
...
...
@@ -290,7 +290,7 @@ export default {
}
else
{
validateDs
(
data
).
then
(
res
=>
{
if
(
res
.
success
===
'true'
){
if
(
res
.
success
){
this
.
$success
(
this
.
$t
(
'datasource.validate_success'
))
}
else
{
this
.
$error
(
this
.
$t
(
res
.
message
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论