Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
08f0cd24
提交
08f0cd24
authored
5月 10, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: kettle 未运行时,禁用抽取数据
上级
1eb4d7f2
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
96 行增加
和
21 行删除
+96
-21
DataSetGroupController.java
...o/dataease/controller/dataset/DataSetGroupController.java
+8
-1
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+34
-0
dataset.js
frontend/src/api/dataset/dataset.js
+8
-0
zh.js
frontend/src/lang/zh.js
+2
-1
AddDB.vue
frontend/src/views/dataset/add/AddDB.vue
+6
-2
AddSQL.vue
frontend/src/views/dataset/add/AddSQL.vue
+5
-1
DatasetGroupSelector.vue
frontend/src/views/dataset/common/DatasetGroupSelector.vue
+23
-8
Group.vue
frontend/src/views/dataset/group/Group.vue
+10
-8
没有找到文件。
backend/src/main/java/io/dataease/controller/dataset/DataSetGroupController.java
浏览文件 @
08f0cd24
...
...
@@ -4,6 +4,7 @@ import io.dataease.base.domain.DatasetGroup;
import
io.dataease.controller.request.dataset.DataSetGroupRequest
;
import
io.dataease.dto.dataset.DataSetGroupDTO
;
import
io.dataease.service.dataset.DataSetGroupService
;
import
io.dataease.service.dataset.ExtractDataService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -18,7 +19,8 @@ import java.util.List;
public
class
DataSetGroupController
{
@Resource
private
DataSetGroupService
dataSetGroupService
;
@Resource
private
ExtractDataService
extractDataService
;
@PostMapping
(
"/save"
)
public
DataSetGroupDTO
save
(
@RequestBody
DatasetGroup
datasetGroup
)
{
return
dataSetGroupService
.
save
(
datasetGroup
);
...
...
@@ -38,4 +40,9 @@ public class DataSetGroupController {
public
DatasetGroup
getScene
(
@PathVariable
String
id
)
{
return
dataSetGroupService
.
getScene
(
id
);
}
@PostMapping
(
"/isKettleRunning"
)
public
boolean
isKettleRunning
(){
return
extractDataService
.
isKettleRunning
();
}
}
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
08f0cd24
...
...
@@ -23,9 +23,15 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.methods.HttpGet
;
import
org.pentaho.di.cluster.SlaveServer
;
import
org.pentaho.di.core.database.DatabaseMeta
;
import
org.pentaho.di.core.row.ValueMetaInterface
;
import
org.pentaho.di.core.util.HttpClientManager
;
import
org.pentaho.di.core.util.Utils
;
import
org.pentaho.di.job.Job
;
import
org.pentaho.di.job.JobExecutionConfiguration
;
import
org.pentaho.di.job.JobHopMeta
;
...
...
@@ -54,7 +60,10 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.naming.AuthenticationException
;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
java.net.InetAddress
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.ExecutorService
;
...
...
@@ -529,6 +538,31 @@ public class ExtractDataService {
return
userDefinedJavaClassStep
;
}
public
boolean
isKettleRunning
(){
try
{
if
(
InetAddress
.
getByName
(
carte
).
isReachable
(
1000
))
{
HttpClient
httpClient
;
HttpGet
getMethod
=
new
HttpGet
(
"http://"
+
carte
+
":"
+
port
);
HttpClientManager
.
HttpClientBuilderFacade
clientBuilder
=
HttpClientManager
.
getInstance
().
createBuilder
();
clientBuilder
.
setConnectionTimeout
(
1
);
clientBuilder
.
setCredentials
(
user
,
passwd
);
httpClient
=
clientBuilder
.
build
();
HttpResponse
httpResponse
=
httpClient
.
execute
(
getMethod
);
int
statusCode
=
httpResponse
.
getStatusLine
().
getStatusCode
();
if
(
statusCode
!=
-
1
)
{
if
(
statusCode
==
HttpStatus
.
SC_UNAUTHORIZED
)
{
return
false
;
}
}
}
else
{
return
false
;
}
}
catch
(
Exception
e
){
return
false
;
}
return
false
;
}
private
static
String
code
=
"import org.pentaho.di.core.row.ValueMetaInterface;\n"
+
"import java.util.List;\n"
+
"import java.io.File;\n"
+
...
...
frontend/src/api/dataset/dataset.js
浏览文件 @
08f0cd24
...
...
@@ -119,4 +119,12 @@ export function fieldValues(fieldId) {
})
}
export
function
isKettleRunning
()
{
return
request
({
url
:
'/dataset/group/isKettleRunning'
,
method
:
'post'
,
loading
:
true
})
}
export
default
{
loadTable
,
getScene
,
addGroup
,
delGroup
,
addTable
,
delTable
,
groupTree
}
frontend/src/lang/zh.js
浏览文件 @
08f0cd24
...
...
@@ -811,7 +811,8 @@ export default {
target_table
:
'被关联表'
,
target_field
:
'被关联字段'
,
union_relation
:
'关联关系'
,
pls_setting_union_success
:
'请正确设置关联关系'
pls_setting_union_success
:
'请正确设置关联关系'
,
invalid_dataset
:
'Kettle未运行,无效数据集'
},
datasource
:
{
datasource
:
'数据源'
,
...
...
frontend/src/views/dataset/add/AddDB.vue
浏览文件 @
08f0cd24
...
...
@@ -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"
/>
<el-option
:label=
"$t('dataset.direct_connect')"
value=
"0"
/>
<el-option
:label=
"$t('dataset.sync_data')"
value=
"1"
:disabled=
"!isKettleRunning"
/>
</el-select>
</el-form-item>
<el-form-item
class=
"form-item"
style=
"float: right;"
>
...
...
@@ -66,6 +66,10 @@ export default {
param
:
{
type
:
Object
,
default
:
null
},
isKettleRunning
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
...
...
frontend/src/views/dataset/add/AddSQL.vue
浏览文件 @
08f0cd24
...
...
@@ -33,7 +33,7 @@
<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"
/>
<el-option
:label=
"$t('dataset.sync_data')"
value=
"1"
:disabled=
"!isKettleRunning"
/>
</el-select>
</el-form-item>
</el-form>
...
...
@@ -121,6 +121,10 @@ export default {
param
:
{
type
:
Object
,
required
:
true
},
isKettleRunning
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
...
...
frontend/src/views/dataset/common/DatasetGroupSelector.vue
浏览文件 @
08f0cd24
...
...
@@ -103,12 +103,13 @@
</
template
>
<
script
>
import
{
post
}
from
'@/api/dataset/dataset'
import
{
isKettleRunning
,
post
}
from
'@/api/dataset/dataset'
export
default
{
name
:
'DatasetGroupSelector'
,
data
()
{
return
{
isKettleRunning
:
false
,
sceneMode
:
false
,
search
:
''
,
data
:
[],
...
...
@@ -132,10 +133,6 @@ export default {
},
computed
:
{},
watch
:
{
// search(val){
// this.groupForm.name = val;
// this.tree(this.groupForm);
// }
search
(
val
)
{
if
(
val
&&
val
!==
''
)
{
this
.
tableData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tables
.
filter
(
ele
=>
{
return
ele
.
name
.
includes
(
val
)
})))
...
...
@@ -152,7 +149,15 @@ export default {
this
.
tree
(
this
.
groupForm
)
this
.
tableTree
()
},
created
(){
this
.
kettleRunning
()
},
methods
:
{
kettleRunning
(){
isKettleRunning
().
then
(
res
=>
{
this
.
isKettleRunning
=
res
.
data
})
},
close
()
{
this
.
editGroup
=
false
this
.
groupForm
=
{
...
...
@@ -186,14 +191,17 @@ export default {
sceneId
:
this
.
currGroup
.
id
}).
then
(
response
=>
{
this
.
tables
=
response
.
data
for
(
let
i
=
0
;
i
<
this
.
tables
.
length
;
i
++
)
{
if
(
this
.
tables
[
i
].
mode
===
1
&&
this
.
isKettleRunning
===
false
){
this
.
$set
(
this
.
tables
[
i
],
"disabled"
,
true
)
}
}
this
.
tableData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tables
))
})
}
},
nodeClick
(
data
,
node
)
{
// console.log(data);
// console.log(node);
if
(
data
.
type
===
'scene'
)
{
this
.
sceneMode
=
true
this
.
currGroup
=
data
...
...
@@ -215,7 +223,14 @@ export default {
},
sceneClick
(
data
,
node
)
{
// console.log(data);
if
(
data
.
disabled
){
this
.
$message
({
type
:
'warning'
,
message
:
this
.
$t
(
'dataset.invalid_dataset'
),
showClose
:
true
})
return
}
this
.
$emit
(
'getTable'
,
data
)
}
}
...
...
frontend/src/views/dataset/group/Group.vue
浏览文件 @
08f0cd24
...
...
@@ -242,7 +242,7 @@
</
template
>
<
script
>
import
{
loadTable
,
getScene
,
addGroup
,
delGroup
,
addTable
,
delTable
,
groupTree
}
from
'@/api/dataset/dataset'
import
{
loadTable
,
getScene
,
addGroup
,
delGroup
,
addTable
,
delTable
,
groupTree
,
isKettleRunning
}
from
'@/api/dataset/dataset'
export
default
{
name
:
'Group'
,
...
...
@@ -288,16 +288,11 @@ export default {
},
computed
:
{
sceneData
:
function
()
{
console
.
log
(
this
.
$store
.
state
.
dataset
.
sceneData
+
' do post'
)
this
.
tableTree
()
return
this
.
$store
.
state
.
dataset
.
sceneData
}
},
watch
:
{
// search(val){
// this.groupForm.name = val;
// this.tree(this.groupForm);
// }
search
(
val
)
{
if
(
val
&&
val
!==
''
)
{
this
.
tableData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tables
.
filter
(
ele
=>
{
return
ele
.
name
.
includes
(
val
)
})))
...
...
@@ -310,9 +305,16 @@ export default {
this
.
tree
(
this
.
groupForm
)
this
.
refresh
()
this
.
tableTree
()
// this.$router.push('/dataset');
},
created
(){
this
.
kettleRunning
()
},
methods
:
{
kettleRunning
(){
isKettleRunning
().
then
(
res
=>
{
this
.
isKettleRunning
=
res
.
data
})
},
clickAdd
(
param
)
{
// console.log(param);
this
.
add
(
param
.
type
)
...
...
@@ -552,7 +554,7 @@ export default {
},
addData
(
name
)
{
this
.
$emit
(
'switchComponent'
,
{
name
:
name
,
param
:
this
.
currGroup
})
this
.
$emit
(
'switchComponent'
,
{
name
:
name
,
param
:
this
.
currGroup
,
isKettleRunning
:
this
.
isKettleRunning
})
},
sceneClick
(
data
,
node
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论