Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
b8e6a44c
Unverified
Commit
b8e6a44c
authored
Dec 16, 2023
by
Zzm0809
Committed by
GitHub
Dec 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor push ds (#2662)
* refactor push ds * Spotless Apply --------- Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
106d1b53
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1231 additions
and
294 deletions
+1231
-294
SchedulerController.java
...c/main/java/org/dinky/controller/SchedulerController.java
+27
-232
SystemInit.java
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
+10
-11
SchedulerService.java
...min/src/main/java/org/dinky/service/SchedulerService.java
+64
-0
SchedulerServiceImpl.java
...ain/java/org/dinky/service/impl/SchedulerServiceImpl.java
+284
-0
BusException.java
.../src/main/java/org/dinky/data/exception/BusException.java
+7
-0
messages_en_US.properties
...-common/src/main/resources/i18n/messages_en_US.properties
+1
-1
messages_zh_CN.properties
...-common/src/main/resources/i18n/messages_zh_CN.properties
+1
-1
TaskClient.java
.../src/main/java/org/dinky/scheduler/client/TaskClient.java
+14
-12
DinkyTaskRequest.java
...main/java/org/dinky/scheduler/model/DinkyTaskRequest.java
+48
-0
TaskRequest.java
.../src/main/java/org/dinky/scheduler/model/TaskRequest.java
+4
-8
CustomIcons.tsx
dinky-web/src/components/Icons/CustomIcons.tsx
+28
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+27
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+24
-0
constants.tsx
...ages/DataStudio/HeaderContainer/PushDolphin/constants.tsx
+90
-0
function.tsx
...pages/DataStudio/HeaderContainer/PushDolphin/function.tsx
+53
-0
index.tsx
...rc/pages/DataStudio/HeaderContainer/PushDolphin/index.tsx
+303
-0
function.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx
+13
-0
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+94
-23
model.ts
dinky-web/src/pages/SettingCenter/GlobalSetting/model.ts
+26
-5
data.d.ts
dinky-web/src/types/Studio/data.d.ts
+80
-0
init.d.ts
dinky-web/src/types/Studio/init.d.ts
+33
-1
No files found.
dinky-admin/src/main/java/org/dinky/controller/SchedulerController.java
View file @
b8e6a44c
...
@@ -20,44 +20,24 @@
...
@@ -20,44 +20,24 @@
package
org
.
dinky
.
controller
;
package
org
.
dinky
.
controller
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.model.Catalogue
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
import
org.dinky.init.SystemInit
;
import
org.dinky.scheduler.model.DinkyTaskRequest
;
import
org.dinky.scheduler.client.ProcessClient
;
import
org.dinky.scheduler.client.TaskClient
;
import
org.dinky.scheduler.enums.ReleaseState
;
import
org.dinky.scheduler.exception.SchedulerException
;
import
org.dinky.scheduler.model.DagData
;
import
org.dinky.scheduler.model.DinkyTaskParams
;
import
org.dinky.scheduler.model.ProcessDefinition
;
import
org.dinky.scheduler.model.Project
;
import
org.dinky.scheduler.model.TaskDefinition
;
import
org.dinky.scheduler.model.TaskDefinition
;
import
org.dinky.scheduler.model.TaskMainInfo
;
import
org.dinky.scheduler.model.TaskMainInfo
;
import
org.dinky.scheduler.model.TaskRequest
;
import
org.dinky.service.SchedulerService
;
import
org.dinky.service.CatalogueService
;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.Valid
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.base.Strings
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -68,13 +48,12 @@ import lombok.RequiredArgsConstructor;
...
@@ -68,13 +48,12 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
SchedulerController
{
public
class
SchedulerController
{
public
static
final
String
TASK_TYPE
=
"DINKY"
;
private
final
SchedulerService
schedulerService
;
private
final
ProcessClient
processClient
;
private
final
TaskClient
taskClient
;
private
final
CatalogueService
catalogueService
;
/** 获取任务定义 */
/**
@GetMapping
(
"/task"
)
* get task definition
*/
@GetMapping
(
"/queryTaskDefinition"
)
@ApiOperation
(
"Get Task Definition"
)
@ApiOperation
(
"Get Task Definition"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"dinkyTaskId"
,
name
=
"dinkyTaskId"
,
...
@@ -84,37 +63,17 @@ public class SchedulerController {
...
@@ -84,37 +63,17 @@ public class SchedulerController {
paramType
=
"query"
,
paramType
=
"query"
,
example
=
"1"
)
example
=
"1"
)
public
Result
<
TaskDefinition
>
getTaskDefinition
(
@ApiParam
(
value
=
"dinky任务id"
)
@RequestParam
Long
dinkyTaskId
)
{
public
Result
<
TaskDefinition
>
getTaskDefinition
(
@ApiParam
(
value
=
"dinky任务id"
)
@RequestParam
Long
dinkyTaskId
)
{
Catalogue
catalogue
=
TaskDefinition
taskDefinitionInfo
=
schedulerService
.
getTaskDefinitionInfo
(
dinkyTaskId
);
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskId
));
if
(
taskDefinitionInfo
==
null
)
{
if
(
catalogue
==
null
)
{
return
Result
.
failed
(
Status
.
DS_TASK_NOT_EXIST
);
return
Result
.
failed
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
Project
dinkyProject
=
SystemInit
.
getProject
();
long
projectCode
=
dinkyProject
.
getCode
();
String
processName
=
getDinkyNames
(
catalogue
,
0
);
String
taskName
=
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
();
TaskMainInfo
taskMainInfo
=
taskClient
.
getTaskMainInfo
(
projectCode
,
processName
,
taskName
);
TaskDefinition
taskDefinition
=
null
;
if
(
taskMainInfo
==
null
)
{
return
Result
.
succeed
(
taskDefinition
);
}
taskDefinition
=
taskClient
.
getTaskDefinition
(
projectCode
,
taskMainInfo
.
getTaskCode
());
if
(
taskDefinition
==
null
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_NOT_SAVE
);
}
}
return
Result
.
succeed
(
taskDefinitionInfo
);
taskDefinition
.
setProcessDefinitionCode
(
taskMainInfo
.
getProcessDefinitionCode
());
taskDefinition
.
setProcessDefinitionName
(
taskMainInfo
.
getProcessDefinitionName
());
taskDefinition
.
setProcessDefinitionVersion
(
taskMainInfo
.
getProcessDefinitionVersion
());
taskDefinition
.
setUpstreamTaskMap
(
taskMainInfo
.
getUpstreamTaskMap
());
return
Result
.
succeed
(
taskDefinition
);
}
}
/** 获取前置任务定义集合 */
/**
@GetMapping
(
"/upstream/tasks"
)
* query upstream task
*/
@GetMapping
(
"/queryUpstreamTasks"
)
@ApiOperation
(
"Get Upstream Task Definition"
)
@ApiOperation
(
"Get Upstream Task Definition"
)
@ApiImplicitParam
(
@ApiImplicitParam
(
name
=
"dinkyTaskId"
,
name
=
"dinkyTaskId"
,
...
@@ -124,186 +83,22 @@ public class SchedulerController {
...
@@ -124,186 +83,22 @@ public class SchedulerController {
paramType
=
"query"
,
paramType
=
"query"
,
example
=
"1"
)
example
=
"1"
)
public
Result
<
List
<
TaskMainInfo
>>
getTaskMainInfos
(
@ApiParam
(
value
=
"dinky任务id"
)
@RequestParam
Long
dinkyTaskId
)
{
public
Result
<
List
<
TaskMainInfo
>>
getTaskMainInfos
(
@ApiParam
(
value
=
"dinky任务id"
)
@RequestParam
Long
dinkyTaskId
)
{
Catalogue
catalogue
=
List
<
TaskMainInfo
>
taskMainInfos
=
schedulerService
.
getTaskMainInfos
(
dinkyTaskId
);
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskId
));
if
(
CollUtil
.
isEmpty
(
taskMainInfos
))
{
if
(
catalogue
==
null
)
{
return
Result
.
failed
();
return
Result
.
failed
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
}
long
projectCode
=
SystemInit
.
getProject
().
getCode
();
String
processName
=
getDinkyNames
(
catalogue
,
0
);
List
<
TaskMainInfo
>
taskMainInfos
=
taskClient
.
getTaskMainInfos
(
projectCode
,
processName
,
""
);
// 去掉本身
taskMainInfos
.
removeIf
(
taskMainInfo
->
(
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
()).
equalsIgnoreCase
(
taskMainInfo
.
getTaskName
()));
return
Result
.
succeed
(
taskMainInfos
);
return
Result
.
succeed
(
taskMainInfos
);
}
}
/** 创建任务定义 */
/**
@PostMapping
(
"/task"
)
* create or update
@ApiOperation
(
"Create Task Definition"
)
*/
@ApiImplicitParams
({
@PostMapping
(
"/createOrUpdateTaskDefinition"
)
@ApiImplicitParam
(
@ApiOperation
(
"Create or Update Task Definition"
)
name
=
"dinkyTaskId"
,
public
Result
<
String
>
createOrUpdateTaskDefinition
(
@RequestBody
DinkyTaskRequest
dinkyTaskRequest
)
{
value
=
"Dinky Task id"
,
if
(
schedulerService
.
pushAddTask
(
dinkyTaskRequest
))
{
required
=
true
,
dataType
=
"Long"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"upstreamCodes"
,
value
=
"Upstream Task Codes"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
,
example
=
"1,2,3"
),
@ApiImplicitParam
(
name
=
"taskRequest"
,
value
=
"Task Request"
,
required
=
true
,
dataType
=
"TaskRequest"
,
paramType
=
"body"
),
})
public
Result
<
String
>
createTaskDefinition
(
@ApiParam
(
value
=
"前置任务编号 逗号隔开"
)
@RequestParam
(
required
=
false
)
String
upstreamCodes
,
@ApiParam
(
value
=
"dinky任务id"
)
@RequestParam
Long
dinkyTaskId
,
@Valid
@RequestBody
TaskRequest
taskRequest
)
{
DinkyTaskParams
dinkyTaskParams
=
new
DinkyTaskParams
();
dinkyTaskParams
.
setTaskId
(
dinkyTaskId
.
toString
());
dinkyTaskParams
.
setAddress
(
SystemConfiguration
.
getInstances
().
getDinkyAddr
().
getValue
());
taskRequest
.
setTaskParams
(
JSONUtil
.
parseObj
(
dinkyTaskParams
).
toString
());
taskRequest
.
setTaskType
(
TASK_TYPE
);
Catalogue
catalogue
=
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskId
));
if
(
catalogue
==
null
)
{
return
Result
.
failed
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
String
processName
=
getDinkyNames
(
catalogue
,
0
);
long
projectCode
=
SystemInit
.
getProject
().
getCode
();
ProcessDefinition
process
=
processClient
.
getProcessDefinitionInfo
(
projectCode
,
processName
);
String
taskName
=
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
();
taskRequest
.
setName
(
taskName
);
if
(
process
==
null
)
{
Long
taskCode
=
taskClient
.
genTaskCode
(
projectCode
);
taskRequest
.
setCode
(
taskCode
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
taskRequest
);
JSONArray
array
=
new
JSONArray
();
array
.
set
(
jsonObject
);
processClient
.
createProcessDefinition
(
projectCode
,
processName
,
taskCode
,
array
.
toString
());
return
Result
.
succeed
(
Status
.
DS_ADD_WORK_FLOW_DEFINITION_SUCCESS
);
}
if
(
process
.
getReleaseState
()
==
ReleaseState
.
ONLINE
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_DEFINITION_ONLINE
,
(
Object
)
processName
);
}
TaskMainInfo
taskDefinitionInfo
=
taskClient
.
getTaskMainInfo
(
projectCode
,
processName
,
taskName
);
if
(
taskDefinitionInfo
!=
null
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_DEFINITION_TASK_NAME_EXIST
,
processName
,
taskName
);
}
Long
taskCode
=
taskClient
.
genTaskCode
(
projectCode
);
taskRequest
.
setCode
(
taskCode
);
String
taskDefinitionJsonObj
=
JSONUtil
.
toJsonStr
(
taskRequest
);
taskClient
.
createTaskDefinition
(
projectCode
,
process
.
getCode
(),
upstreamCodes
,
taskDefinitionJsonObj
);
return
Result
.
succeed
(
Status
.
DS_ADD_TASK_DEFINITION_SUCCESS
);
return
Result
.
succeed
(
Status
.
DS_ADD_TASK_DEFINITION_SUCCESS
);
}
}
return
Result
.
succeed
(
Status
.
DS_ADD_TASK_DEFINITION_SUCCESS
);
/** 更新任务定义 */
@PutMapping
(
"/task"
)
@ApiOperation
(
"Update Task Definition"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"projectCode"
,
value
=
"Project Code"
,
required
=
true
,
dataType
=
"Long"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"processCode"
,
value
=
"Process Code"
,
required
=
true
,
dataType
=
"Long"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"taskCode"
,
value
=
"Task Code"
,
required
=
true
,
dataType
=
"Long"
,
paramType
=
"query"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"upstreamCodes"
,
value
=
"Upstream Task Codes"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
,
example
=
"1,2,3"
)
})
public
Result
<
String
>
updateTaskDefinition
(
@ApiParam
(
value
=
"项目编号"
)
@RequestParam
long
projectCode
,
@ApiParam
(
value
=
"工作流定义编号"
)
@RequestParam
long
processCode
,
@ApiParam
(
value
=
"任务定义编号"
)
@RequestParam
long
taskCode
,
@ApiParam
(
value
=
"前置任务编号 逗号隔开"
)
@RequestParam
(
required
=
false
)
String
upstreamCodes
,
@Valid
@RequestBody
TaskRequest
taskRequest
)
{
TaskDefinition
taskDefinition
=
taskClient
.
getTaskDefinition
(
projectCode
,
taskCode
);
if
(
taskDefinition
==
null
)
{
return
Result
.
failed
(
Status
.
DS_TASK_NOT_EXIST
);
}
if
(!
TASK_TYPE
.
equals
(
taskDefinition
.
getTaskType
()))
{
return
Result
.
failed
(
Status
.
DS_TASK_TYPE_NOT_SUPPORT
,
(
Object
)
taskDefinition
.
getTaskType
());
}
DagData
dagData
=
processClient
.
getProcessDefinitionInfo
(
projectCode
,
processCode
);
if
(
dagData
==
null
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
);
}
ProcessDefinition
process
=
dagData
.
getProcessDefinition
();
if
(
process
==
null
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
);
}
if
(
process
.
getReleaseState
()
==
ReleaseState
.
ONLINE
)
{
return
Result
.
failed
(
Status
.
DS_WORK_FLOW_DEFINITION_ONLINE
,
(
Object
)
process
.
getName
());
}
taskRequest
.
setName
(
taskDefinition
.
getName
());
taskRequest
.
setTaskParams
(
taskDefinition
.
getTaskParams
());
taskRequest
.
setTaskType
(
TASK_TYPE
);
String
taskDefinitionJsonObj
=
JSONUtil
.
toJsonStr
(
taskRequest
);
taskClient
.
updateTaskDefinition
(
projectCode
,
taskCode
,
upstreamCodes
,
taskDefinitionJsonObj
);
return
Result
.
succeed
(
Status
.
MODIFY_SUCCESS
);
}
private
String
getDinkyNames
(
Catalogue
catalogue
,
int
i
)
{
if
(
i
==
3
||
catalogue
.
getParentId
().
equals
(
0
))
{
return
""
;
}
catalogue
=
catalogueService
.
getById
(
catalogue
.
getParentId
());
if
(
catalogue
==
null
)
{
throw
new
SchedulerException
(
"Get Node List Error"
);
}
String
name
=
i
==
0
?
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
()
:
catalogue
.
getName
();
String
next
=
getDinkyNames
(
catalogue
,
++
i
);
if
(
Strings
.
isNullOrEmpty
(
next
))
{
return
name
;
}
return
name
+
"_"
+
next
;
}
}
}
}
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
View file @
b8e6a44c
...
@@ -225,18 +225,18 @@ public class SystemInit implements ApplicationRunner {
...
@@ -225,18 +225,18 @@ public class SystemInit implements ApplicationRunner {
* init DolphinScheduler
* init DolphinScheduler
*/
*/
private
void
initDolphinScheduler
()
{
private
void
initDolphinScheduler
()
{
systemConfiguration
List
<
Configuration
<?>>
configurationList
=
.
getAllConfiguration
()
systemConfiguration
.
getAllConfiguration
().
get
(
"dolphinscheduler"
);
.
get
(
"dolphinscheduler"
)
configurationList
.
forEach
(
c
->
c
.
addParameterCheck
(
this
::
aboutDolphinSchedulerInitOperation
));
.
forEach
(
c
->
c
.
addParameterCheck
(
v
->
{
// init call for once
if
(
Boolean
.
TRUE
.
equals
(
aboutDolphinSchedulerInitOperation
(
"init"
);
systemConfiguration
.
getDolphinschedulerEnable
().
getValue
()))
{
}
private
void
aboutDolphinSchedulerInitOperation
(
Object
v
)
{
if
(
Boolean
.
TRUE
.
equals
(
systemConfiguration
.
getDolphinschedulerEnable
().
getValue
()))
{
if
(
StrUtil
.
isEmpty
(
Convert
.
toStr
(
v
)))
{
if
(
StrUtil
.
isEmpty
(
Convert
.
toStr
(
v
)))
{
sysConfigService
.
updateSysConfigByKv
(
sysConfigService
.
updateSysConfigByKv
(
systemConfiguration
systemConfiguration
.
getDolphinschedulerEnable
().
getKey
(),
"false"
);
.
getDolphinschedulerEnable
()
.
getKey
(),
"false"
);
throw
new
DinkyException
(
"Before starting DolphinScheduler"
throw
new
DinkyException
(
"Before starting DolphinScheduler"
+
" docking, please fill in the"
+
" docking, please fill in the"
+
" relevant configuration"
);
+
" relevant configuration"
);
...
@@ -251,7 +251,6 @@ public class SystemInit implements ApplicationRunner {
...
@@ -251,7 +251,6 @@ public class SystemInit implements ApplicationRunner {
throw
new
DinkyException
(
e
);
throw
new
DinkyException
(
e
);
}
}
}
}
}));
}
}
/**
/**
...
...
dinky-admin/src/main/java/org/dinky/service/SchedulerService.java
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
service
;
import
org.dinky.scheduler.model.DinkyTaskRequest
;
import
org.dinky.scheduler.model.TaskDefinition
;
import
org.dinky.scheduler.model.TaskMainInfo
;
import
java.util.List
;
public
interface
SchedulerService
{
/**
* Pushes the specified DinkyTaskRequest to the task queue.
*
* @param dinkyTaskRequest the DinkyTaskRequest to be added to the task queue
* @return true if the task was successfully added, false otherwise
*/
boolean
pushAddTask
(
DinkyTaskRequest
dinkyTaskRequest
);
/**
* A description of the entire Java function.
*
* @param projectCode description of parameter
* @param processCode description of parameter
* @param taskCode description of parameter
* @param dinkyTaskRequest description of parameter
* @return description of return value
*/
boolean
pushUpdateTask
(
long
projectCode
,
long
processCode
,
long
taskCode
,
DinkyTaskRequest
dinkyTaskRequest
);
/**
* Retrieves a list of TaskMainInfo objects based on the provided dinkyTaskId.
*
* @param dinkyTaskId the ID of the task
* @return a list of TaskMainInfo objects
*/
List
<
TaskMainInfo
>
getTaskMainInfos
(
long
dinkyTaskId
);
/**
* Retrieves the task definition information for a given dinky task ID.
*
* @param dinkyTaskId the ID of the dinky task
* @return the task definition information
*/
TaskDefinition
getTaskDefinitionInfo
(
long
dinkyTaskId
);
}
dinky-admin/src/main/java/org/dinky/service/impl/SchedulerServiceImpl.java
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
service
.
impl
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.exception.BusException
;
import
org.dinky.data.model.Catalogue
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.init.SystemInit
;
import
org.dinky.scheduler.client.ProcessClient
;
import
org.dinky.scheduler.client.TaskClient
;
import
org.dinky.scheduler.enums.ReleaseState
;
import
org.dinky.scheduler.exception.SchedulerException
;
import
org.dinky.scheduler.model.DagData
;
import
org.dinky.scheduler.model.DinkyTaskParams
;
import
org.dinky.scheduler.model.DinkyTaskRequest
;
import
org.dinky.scheduler.model.ProcessDefinition
;
import
org.dinky.scheduler.model.Project
;
import
org.dinky.scheduler.model.TaskDefinition
;
import
org.dinky.scheduler.model.TaskMainInfo
;
import
org.dinky.scheduler.model.TaskRequest
;
import
org.dinky.service.CatalogueService
;
import
org.dinky.service.SchedulerService
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.google.common.base.Strings
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Slf4j
@RequiredArgsConstructor
public
class
SchedulerServiceImpl
implements
SchedulerService
{
public
static
final
String
TASK_TYPE
=
"DINKY"
;
private
final
ProcessClient
processClient
;
private
final
TaskClient
taskClient
;
private
final
CatalogueService
catalogueService
;
/**
* Pushes the specified DinkyTaskRequest to the task queue.
*
* @param dinkyTaskRequest the DinkyTaskRequest to be added to the task queue
* @return true if the task was successfully added, false otherwise
*/
@Override
public
boolean
pushAddTask
(
DinkyTaskRequest
dinkyTaskRequest
)
{
DinkyTaskParams
dinkyTaskParams
=
new
DinkyTaskParams
();
dinkyTaskParams
.
setTaskId
(
dinkyTaskRequest
.
getTaskId
());
dinkyTaskParams
.
setAddress
(
SystemConfiguration
.
getInstances
().
getDinkyAddr
().
getValue
());
dinkyTaskRequest
.
setTaskParams
(
JSONUtil
.
parseObj
(
dinkyTaskParams
).
toString
());
dinkyTaskRequest
.
setTaskType
(
TASK_TYPE
);
Catalogue
catalogue
=
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskRequest
.
getTaskId
()));
if
(
catalogue
==
null
)
{
log
.
error
(
Status
.
DS_GET_NODE_LIST_ERROR
.
getMessage
());
throw
new
BusException
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
String
processName
=
getDinkyNames
(
catalogue
,
0
);
long
projectCode
=
SystemInit
.
getProject
().
getCode
();
ProcessDefinition
process
=
processClient
.
getProcessDefinitionInfo
(
projectCode
,
processName
);
String
taskName
=
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
();
dinkyTaskRequest
.
setName
(
taskName
);
TaskRequest
taskRequest
=
new
TaskRequest
();
if
(
process
==
null
)
{
Long
taskCode
=
taskClient
.
genTaskCode
(
projectCode
);
dinkyTaskRequest
.
setCode
(
taskCode
);
BeanUtil
.
copyProperties
(
dinkyTaskRequest
,
taskRequest
);
taskRequest
.
setTimeoutFlag
(
dinkyTaskRequest
.
getTimeoutFlag
());
taskRequest
.
setFlag
(
dinkyTaskRequest
.
getFlag
());
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
taskRequest
);
JSONArray
array
=
new
JSONArray
();
array
.
set
(
jsonObject
);
processClient
.
createProcessDefinition
(
projectCode
,
processName
,
taskCode
,
array
.
toString
());
log
.
info
(
Status
.
DS_ADD_WORK_FLOW_DEFINITION_SUCCESS
.
getMessage
());
}
if
(
process
!=
null
&&
process
.
getReleaseState
()
==
ReleaseState
.
ONLINE
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_DEFINITION_ONLINE
.
getMessage
(),
processName
);
}
TaskMainInfo
taskMainInfo
=
taskClient
.
getTaskMainInfo
(
projectCode
,
processName
,
taskName
,
"DINKY"
);
if
(
taskMainInfo
!=
null
)
{
// if task name exist, update task definition
log
.
warn
(
Status
.
DS_WORK_FLOW_DEFINITION_TASK_NAME_EXIST
.
getMessage
(),
processName
,
taskName
);
return
pushUpdateTask
(
projectCode
,
taskMainInfo
.
getProcessDefinitionCode
(),
taskMainInfo
.
getTaskCode
(),
dinkyTaskRequest
);
}
Long
taskCode
=
taskClient
.
genTaskCode
(
projectCode
);
dinkyTaskRequest
.
setCode
(
taskCode
);
BeanUtil
.
copyProperties
(
dinkyTaskRequest
,
taskRequest
);
taskRequest
.
setTimeoutFlag
(
dinkyTaskRequest
.
getTimeoutFlag
());
taskRequest
.
setFlag
(
dinkyTaskRequest
.
getFlag
());
String
taskDefinitionJsonObj
=
JSONUtil
.
toJsonStr
(
taskRequest
);
if
(
process
!=
null
)
{
taskClient
.
createTaskDefinition
(
projectCode
,
process
.
getCode
(),
dinkyTaskRequest
.
getUpstreamCodes
(),
taskDefinitionJsonObj
);
log
.
info
(
Status
.
DS_ADD_TASK_DEFINITION_SUCCESS
.
getMessage
());
return
true
;
}
return
false
;
}
/**
* Pushes an update task to the API.
*
* @param projectCode the project code
* @param processCode the process code
* @param taskCode the task code
* @param dinkyTaskRequest the DinkyTaskRequest object containing task details
* @return true if the task is successfully updated, false otherwise
*/
@Override
public
boolean
pushUpdateTask
(
long
projectCode
,
long
processCode
,
long
taskCode
,
DinkyTaskRequest
dinkyTaskRequest
)
{
TaskDefinition
taskDefinition
=
taskClient
.
getTaskDefinition
(
projectCode
,
taskCode
);
if
(
taskDefinition
==
null
)
{
log
.
error
(
Status
.
DS_TASK_NOT_EXIST
.
getMessage
());
throw
new
BusException
(
Status
.
DS_TASK_NOT_EXIST
);
}
if
(!
TASK_TYPE
.
equals
(
taskDefinition
.
getTaskType
()))
{
log
.
error
(
Status
.
DS_TASK_TYPE_NOT_SUPPORT
.
getMessage
(),
taskDefinition
.
getTaskType
());
throw
new
BusException
(
Status
.
DS_TASK_TYPE_NOT_SUPPORT
,
taskDefinition
.
getTaskType
());
}
DagData
dagData
=
processClient
.
getProcessDefinitionInfo
(
projectCode
,
processCode
);
if
(
dagData
==
null
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
.
getMessage
());
throw
new
BusException
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
);
}
ProcessDefinition
process
=
dagData
.
getProcessDefinition
();
if
(
process
==
null
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
.
getMessage
());
throw
new
BusException
(
Status
.
DS_WORK_FLOW_DEFINITION_NOT_EXIST
);
}
if
(
process
.
getReleaseState
()
==
ReleaseState
.
ONLINE
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_DEFINITION_ONLINE
.
getMessage
(),
process
.
getName
());
throw
new
BusException
(
Status
.
DS_WORK_FLOW_DEFINITION_ONLINE
,
process
.
getName
());
}
TaskRequest
taskRequest
=
new
TaskRequest
();
dinkyTaskRequest
.
setName
(
taskDefinition
.
getName
());
dinkyTaskRequest
.
setTaskParams
(
taskDefinition
.
getTaskParams
());
dinkyTaskRequest
.
setTaskType
(
TASK_TYPE
);
BeanUtil
.
copyProperties
(
dinkyTaskRequest
,
taskRequest
);
taskRequest
.
setTimeoutFlag
(
dinkyTaskRequest
.
getTimeoutFlag
());
taskRequest
.
setFlag
(
dinkyTaskRequest
.
getFlag
());
String
taskDefinitionJsonObj
=
JSONUtil
.
toJsonStr
(
taskRequest
);
Long
updatedTaskDefinition
=
taskClient
.
updateTaskDefinition
(
projectCode
,
taskCode
,
dinkyTaskRequest
.
getUpstreamCodes
(),
taskDefinitionJsonObj
);
if
(
updatedTaskDefinition
!=
null
&&
updatedTaskDefinition
>
0
)
{
log
.
info
(
Status
.
MODIFY_SUCCESS
.
getMessage
());
return
true
;
}
log
.
error
(
Status
.
MODIFY_FAILED
.
getMessage
());
return
false
;
}
/**
* Retrieves the list of TaskMainInfo objects for a given dinkyTaskId.
*
* @param dinkyTaskId the id of the dinky task
* @return the list of TaskMainInfo objects
*/
@Override
public
List
<
TaskMainInfo
>
getTaskMainInfos
(
long
dinkyTaskId
)
{
Catalogue
catalogue
=
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskId
));
if
(
catalogue
==
null
)
{
log
.
error
(
Status
.
DS_GET_NODE_LIST_ERROR
.
getMessage
());
throw
new
BusException
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
long
projectCode
=
SystemInit
.
getProject
().
getCode
();
List
<
TaskMainInfo
>
taskMainInfos
=
taskClient
.
getTaskMainInfos
(
projectCode
,
""
,
""
,
""
);
// 去掉本身
taskMainInfos
.
removeIf
(
taskMainInfo
->
(
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
()).
equalsIgnoreCase
(
taskMainInfo
.
getTaskName
()));
return
taskMainInfos
;
}
/**
* Retrieves the task definition information for a given dinkyTaskId.
*
* @param dinkyTaskId the ID of the dinky task
* @return the task definition information
*/
@Override
public
TaskDefinition
getTaskDefinitionInfo
(
long
dinkyTaskId
)
{
Catalogue
catalogue
=
catalogueService
.
getOne
(
new
LambdaQueryWrapper
<
Catalogue
>().
eq
(
Catalogue:
:
getTaskId
,
dinkyTaskId
));
if
(
catalogue
==
null
)
{
log
.
error
(
Status
.
DS_GET_NODE_LIST_ERROR
.
getMessage
());
throw
new
BusException
(
Status
.
DS_GET_NODE_LIST_ERROR
);
}
Project
dinkyProject
=
SystemInit
.
getProject
();
long
projectCode
=
dinkyProject
.
getCode
();
String
processName
=
getDinkyNames
(
catalogue
,
0
);
String
taskName
=
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
();
TaskMainInfo
taskMainInfo
=
taskClient
.
getTaskMainInfo
(
projectCode
,
processName
,
taskName
,
"DINKY"
);
TaskDefinition
taskDefinition
=
null
;
if
(
taskMainInfo
==
null
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_DEFINITION_TASK_NAME_EXIST
.
getMessage
(),
processName
,
taskName
);
throw
new
BusException
(
Status
.
DS_WORK_FLOW_DEFINITION_TASK_NAME_EXIST
,
processName
,
taskName
);
}
taskDefinition
=
taskClient
.
getTaskDefinition
(
projectCode
,
taskMainInfo
.
getTaskCode
());
if
(
taskDefinition
==
null
)
{
log
.
error
(
Status
.
DS_WORK_FLOW_NOT_SAVE
.
getMessage
());
throw
new
BusException
(
Status
.
DS_WORK_FLOW_NOT_SAVE
);
}
taskDefinition
.
setProcessDefinitionCode
(
taskMainInfo
.
getProcessDefinitionCode
());
taskDefinition
.
setProcessDefinitionName
(
taskMainInfo
.
getProcessDefinitionName
());
taskDefinition
.
setProcessDefinitionVersion
(
taskMainInfo
.
getProcessDefinitionVersion
());
taskDefinition
.
setUpstreamTaskMap
(
taskMainInfo
.
getUpstreamTaskMap
());
return
taskDefinition
;
}
/**
* Retrieves the dinky names from the given catalogue and index.
*
* @param catalogue the catalogue object to retrieve the names from
* @param i the index to start retrieving the names from
* @return the dinky names retrieved from the catalogue
*/
private
String
getDinkyNames
(
Catalogue
catalogue
,
int
i
)
{
if
(
i
==
3
||
catalogue
.
getParentId
().
equals
(
0
))
{
return
""
;
}
catalogue
=
catalogueService
.
getById
(
catalogue
.
getParentId
());
if
(
catalogue
==
null
)
{
throw
new
SchedulerException
(
"Get Node List Error"
);
}
String
name
=
i
==
0
?
catalogue
.
getName
()
+
":"
+
catalogue
.
getId
()
:
catalogue
.
getName
();
String
next
=
getDinkyNames
(
catalogue
,
++
i
);
if
(
Strings
.
isNullOrEmpty
(
next
))
{
return
name
;
}
return
name
+
"_"
+
next
;
}
}
dinky-common/src/main/java/org/dinky/data/exception/BusException.java
View file @
b8e6a44c
...
@@ -22,6 +22,7 @@ package org.dinky.data.exception;
...
@@ -22,6 +22,7 @@ package org.dinky.data.exception;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
cn.hutool.core.exceptions.ExceptionUtil
;
import
cn.hutool.core.exceptions.ExceptionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -58,6 +59,12 @@ public class BusException extends RuntimeException {
...
@@ -58,6 +59,12 @@ public class BusException extends RuntimeException {
setMsg
(
status
.
getMessage
());
setMsg
(
status
.
getMessage
());
}
}
public
BusException
(
Status
status
,
Object
...
errorArgs
)
{
super
(
status
.
getMessage
());
setCode
(
String
.
valueOf
(
status
.
getCode
()));
setMsg
(
StrUtil
.
format
(
status
.
getMessage
(),
errorArgs
));
}
public
BusException
(
String
message
,
Object
...
args
)
{
public
BusException
(
String
message
,
Object
...
args
)
{
super
();
super
();
setCode
(
message
);
setCode
(
message
);
...
...
dinky-common/src/main/resources/i18n/messages_en_US.properties
View file @
b8e6a44c
...
@@ -109,7 +109,7 @@ success=Successfully
...
@@ -109,7 +109,7 @@ success=Successfully
tenant.not.exist
=
Tenant Not Exist
tenant.not.exist
=
Tenant Not Exist
user.already.exists
=
User Already Exists
user.already.exists
=
User Already Exists
git.building
=
Git Building
git.building
=
Git Building
ds.work.flow.definition.task.name.exist
=
Add Failed, Workflow Definition [{}] Already Exists Task Definition [{}] Please Refresh
ds.work.flow.definition.task.name.exist
=
Workflow Definition [{}] Already Exists Task Definition [{}] , Will Update Operation
role.already.exists
=
Role Already Exists
role.already.exists
=
Role Already Exists
internal.server.error.args
=
Internal Server Error: {0}
internal.server.error.args
=
Internal Server Error: {0}
kick.out
=
token has been kicked offline
kick.out
=
token has been kicked offline
...
...
dinky-common/src/main/resources/i18n/messages_zh_CN.properties
View file @
b8e6a44c
...
@@ -109,7 +109,7 @@ success=获取成功
...
@@ -109,7 +109,7 @@ success=获取成功
tenant.not.exist
=
租户不存在
tenant.not.exist
=
租户不存在
user.already.exists
=
用户名已存在
user.already.exists
=
用户名已存在
git.building
=
此任务正在构建
git.building
=
此任务正在构建
ds.work.flow.definition.task.name.exist
=
添加失败,工作流定义 [{}] 已存在任务定义 [{}] 请刷新
ds.work.flow.definition.task.name.exist
=
工作流定义 [{}] 已存在任务定义 [{}] , 将执行更新操作
role.already.exists
=
角色已存在
role.already.exists
=
角色已存在
internal.server.error.args
=
服务端异常: {0}
internal.server.error.args
=
服务端异常: {0}
kick.out
=
token 已被踢下线
kick.out
=
token 已被踢下线
...
...
dinky-scheduler/src/main/java/org/dinky/scheduler/client/TaskClient.java
View file @
b8e6a44c
...
@@ -41,10 +41,12 @@ import org.slf4j.Logger;
...
@@ -41,10 +41,12 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.core.lang.TypeReference
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
/** 任务定义 */
/** 任务定义 */
@Component
@Component
...
@@ -60,8 +62,8 @@ public class TaskClient {
...
@@ -60,8 +62,8 @@ public class TaskClient {
* @param taskName 任务定义名称
* @param taskName 任务定义名称
* @return {@link TaskMainInfo}
* @return {@link TaskMainInfo}
*/
*/
public
TaskMainInfo
getTaskMainInfo
(
Long
projectCode
,
String
processName
,
String
taskName
)
{
public
TaskMainInfo
getTaskMainInfo
(
Long
projectCode
,
String
processName
,
String
taskName
,
String
taskType
)
{
List
<
TaskMainInfo
>
lists
=
getTaskMainInfos
(
projectCode
,
processName
,
taskName
);
List
<
TaskMainInfo
>
lists
=
getTaskMainInfos
(
projectCode
,
processName
,
taskName
,
taskType
);
for
(
TaskMainInfo
list
:
lists
)
{
for
(
TaskMainInfo
list
:
lists
)
{
if
(
list
.
getTaskName
().
equalsIgnoreCase
(
taskName
))
{
if
(
list
.
getTaskName
().
equalsIgnoreCase
(
taskName
))
{
return
list
;
return
list
;
...
@@ -78,7 +80,7 @@ public class TaskClient {
...
@@ -78,7 +80,7 @@ public class TaskClient {
* @param taskName 任务定义名称
* @param taskName 任务定义名称
* @return {@link List<TaskMainInfo>}
* @return {@link List<TaskMainInfo>}
*/
*/
public
List
<
TaskMainInfo
>
getTaskMainInfos
(
Long
projectCode
,
String
processName
,
String
taskName
)
{
public
List
<
TaskMainInfo
>
getTaskMainInfos
(
Long
projectCode
,
String
processName
,
String
taskName
,
String
taskType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"projectCode"
,
projectCode
);
map
.
put
(
"projectCode"
,
projectCode
);
String
format
=
StrUtil
.
format
(
String
format
=
StrUtil
.
format
(
...
@@ -89,7 +91,7 @@ public class TaskClient {
...
@@ -89,7 +91,7 @@ public class TaskClient {
Map
<
String
,
Object
>
pageParams
=
ParamUtil
.
getPageParams
();
Map
<
String
,
Object
>
pageParams
=
ParamUtil
.
getPageParams
();
pageParams
.
put
(
"searchTaskName"
,
taskName
);
pageParams
.
put
(
"searchTaskName"
,
taskName
);
pageParams
.
put
(
"searchWorkflowName"
,
processName
);
pageParams
.
put
(
"searchWorkflowName"
,
processName
);
pageParams
.
put
(
"taskType"
,
"DINKY"
);
pageParams
.
put
(
"taskType"
,
taskType
);
String
content
=
HttpRequest
.
get
(
format
)
String
content
=
HttpRequest
.
get
(
format
)
.
header
(
.
header
(
...
@@ -109,9 +111,7 @@ public class TaskClient {
...
@@ -109,9 +111,7 @@ public class TaskClient {
}
}
for
(
JSONObject
jsonObject
:
data
.
getTotalList
())
{
for
(
JSONObject
jsonObject
:
data
.
getTotalList
())
{
if
(
processName
.
equalsIgnoreCase
(
jsonObject
.
getStr
(
"processDefinitionName"
)))
{
lists
.
add
(
JSONUtil
.
toBean
(
jsonObject
,
TaskMainInfo
.
class
));
lists
.
add
(
MyJSONUtil
.
toBean
(
jsonObject
,
TaskMainInfo
.
class
));
}
}
}
return
lists
;
return
lists
;
}
}
...
@@ -153,7 +153,7 @@ public class TaskClient {
...
@@ -153,7 +153,7 @@ public class TaskClient {
* @return {@link TaskDefinitionLog}
* @return {@link TaskDefinitionLog}
*/
*/
public
TaskDefinitionLog
createTaskDefinition
(
public
TaskDefinitionLog
createTaskDefinition
(
Long
projectCode
,
Long
processCode
,
String
upstreamCodes
,
String
taskDefinitionJsonObj
)
{
Long
projectCode
,
Long
processCode
,
List
<
String
>
upstreamCodes
,
String
taskDefinitionJsonObj
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"projectCode"
,
projectCode
);
map
.
put
(
"projectCode"
,
projectCode
);
String
format
=
StrUtil
.
format
(
String
format
=
StrUtil
.
format
(
...
@@ -163,8 +163,8 @@ public class TaskClient {
...
@@ -163,8 +163,8 @@ public class TaskClient {
Map
<
String
,
Object
>
pageParams
=
new
HashMap
<>();
Map
<
String
,
Object
>
pageParams
=
new
HashMap
<>();
pageParams
.
put
(
"processDefinitionCode"
,
processCode
);
pageParams
.
put
(
"processDefinitionCode"
,
processCode
);
if
(
StringUtils
.
isNotBlank
(
upstreamCodes
))
{
if
(
CollUtil
.
isNotEmpty
(
upstreamCodes
))
{
pageParams
.
put
(
"upstreamCodes"
,
upstreamCodes
);
pageParams
.
put
(
"upstreamCodes"
,
StringUtils
.
join
(
upstreamCodes
,
","
)
);
}
}
pageParams
.
put
(
"taskDefinitionJsonObj"
,
taskDefinitionJsonObj
);
pageParams
.
put
(
"taskDefinitionJsonObj"
,
taskDefinitionJsonObj
);
...
@@ -192,7 +192,7 @@ public class TaskClient {
...
@@ -192,7 +192,7 @@ public class TaskClient {
* @return {@link Long}
* @return {@link Long}
*/
*/
public
Long
updateTaskDefinition
(
public
Long
updateTaskDefinition
(
long
projectCode
,
long
taskCode
,
String
upstreamCodes
,
String
taskDefinitionJsonObj
)
{
long
projectCode
,
long
taskCode
,
List
<
String
>
upstreamCodes
,
String
taskDefinitionJsonObj
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"projectCode"
,
projectCode
);
map
.
put
(
"projectCode"
,
projectCode
);
map
.
put
(
"code"
,
taskCode
);
map
.
put
(
"code"
,
taskCode
);
...
@@ -202,7 +202,9 @@ public class TaskClient {
...
@@ -202,7 +202,9 @@ public class TaskClient {
map
);
map
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"upstreamCodes"
,
upstreamCodes
);
if
(
CollUtil
.
isNotEmpty
(
upstreamCodes
))
{
params
.
put
(
"upstreamCodes"
,
StringUtils
.
join
(
upstreamCodes
,
","
));
}
params
.
put
(
"taskDefinitionJsonObj"
,
taskDefinitionJsonObj
);
params
.
put
(
"taskDefinitionJsonObj"
,
taskDefinitionJsonObj
);
String
content
=
HttpRequest
.
put
(
format
)
String
content
=
HttpRequest
.
put
(
format
)
...
...
dinky-scheduler/src/main/java/org/dinky/scheduler/model/DinkyTaskRequest.java
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
scheduler
.
model
;
import
org.dinky.data.model.SystemConfiguration
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
DinkyTaskRequest
extends
TaskRequest
{
@ApiModelProperty
(
value
=
"自定义参数"
)
private
List
<
Property
>
localParams
;
@ApiModelProperty
(
value
=
"dinky地址"
)
@NotNull
private
String
address
=
SystemConfiguration
.
getInstances
().
getDinkyAddr
().
getValue
();
@ApiModelProperty
(
value
=
"上游任务编号"
)
List
<
String
>
upstreamCodes
=
Arrays
.
asList
();
@ApiModelProperty
(
value
=
"dinky任务id"
,
required
=
true
)
@NotNull
private
String
taskId
;
}
dinky-scheduler/src/main/java/org/dinky/scheduler/model/TaskRequest.java
View file @
b8e6a44c
...
@@ -19,11 +19,7 @@
...
@@ -19,11 +19,7 @@
package
org
.
dinky
.
scheduler
.
model
;
package
org
.
dinky
.
scheduler
.
model
;
import
org.dinky.scheduler.enums.Flag
;
import
org.dinky.scheduler.enums.Priority
;
import
org.dinky.scheduler.enums.TaskExecuteType
;
import
org.dinky.scheduler.enums.TaskExecuteType
;
import
org.dinky.scheduler.enums.TaskTimeoutStrategy
;
import
org.dinky.scheduler.enums.TimeoutFlag
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
...
@@ -55,14 +51,14 @@ public class TaskRequest {
...
@@ -55,14 +51,14 @@ public class TaskRequest {
private
Integer
failRetryTimes
;
private
Integer
failRetryTimes
;
@ApiModelProperty
(
value
=
"运行标志 yes 正常/no 禁止执行"
)
@ApiModelProperty
(
value
=
"运行标志 yes 正常/no 禁止执行"
)
private
Fla
g
flag
;
private
Strin
g
flag
;
@ApiModelProperty
(
value
=
"任务参数 默认DINKY参数"
)
@ApiModelProperty
(
value
=
"任务参数 默认DINKY参数"
)
private
String
taskParams
;
private
String
taskParams
;
@NotNull
@NotNull
@ApiModelProperty
(
value
=
"优先级"
)
@ApiModelProperty
(
value
=
"优先级"
)
private
Priority
taskPriority
;
private
String
taskPriority
;
@ApiModelProperty
(
value
=
"任务类型 默认DINKY"
)
@ApiModelProperty
(
value
=
"任务类型 默认DINKY"
)
private
String
taskType
=
"DINKY"
;
private
String
taskType
=
"DINKY"
;
...
@@ -71,10 +67,10 @@ public class TaskRequest {
...
@@ -71,10 +67,10 @@ public class TaskRequest {
private
Integer
timeout
;
private
Integer
timeout
;
@ApiModelProperty
(
value
=
"超时告警"
)
@ApiModelProperty
(
value
=
"超时告警"
)
private
TimeoutFla
g
timeoutFlag
;
private
Strin
g
timeoutFlag
;
@ApiModelProperty
(
value
=
"超时通知策略"
)
@ApiModelProperty
(
value
=
"超时通知策略"
)
private
TaskTimeoutStrategy
timeoutNotifyStrategy
;
private
String
timeoutNotifyStrategy
;
@ApiModelProperty
(
value
=
"worker分组 默认default"
)
@ApiModelProperty
(
value
=
"worker分组 默认default"
)
private
String
workerGroup
=
"default"
;
private
String
workerGroup
=
"default"
;
...
...
dinky-web/src/components/Icons/CustomIcons.tsx
View file @
b8e6a44c
...
@@ -36,6 +36,34 @@ export const DangerDeleteIcon = (props: any) => {
...
@@ -36,6 +36,34 @@ export const DangerDeleteIcon = (props: any) => {
);
);
};
};
export
const
PushpinIcon
=
(
props
:
any
)
=>
{
return
(
<>
<
Icon
{
...
props
}
style=
{
{
...
IconStyle
}
}
component=
{
()
=>
(
<
svg
className=
'icon'
viewBox=
'0 0 1293 1024'
version=
'1.1'
xmlns=
'http://www.w3.org/2000/svg'
>
<
path
d=
'M304.061663 1024l-10.075639-558.583565 673.072886-298.727501 37.527055 84.565975-616.984683 273.834748 4.307805 239.256659 131.89401-166.298629 199.358866 217.963381L1116.921383 123.047108 189.774722 276.899361l105.06419 107.911966-66.293943 64.5448L0 214.595197 1293.252283 0l-552.497706 972.320793-211.935344-231.710773-224.75757 283.38998z'
fill=
'#1262B3'
></
path
>
<
path
d=
'M304.061663 1024l-10.075639-558.583565 673.072886-298.727501 37.527055 84.565975-616.984683 273.834748 4.307805 239.256659 98.154354-123.769894 72.480992 57.490407-258.48277 325.933171z'
fill=
'#FF584D'
></
path
>
</
svg
>
)
}
/>
</>
);
};
/**
/**
* This is a custom icon that is used to indicate a show log action.
* This is a custom icon that is used to indicate a show log action.
* @constructor
* @constructor
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
b8e6a44c
...
@@ -87,6 +87,33 @@ export default {
...
@@ -87,6 +87,33 @@ export default {
'datastudio.middle.qg.gitprojects'
:
'Git Projects'
,
'datastudio.middle.qg.gitprojects'
:
'Git Projects'
,
'datastudio.middle.qg.resource'
:
'Resource'
,
'datastudio.middle.qg.resource'
:
'Resource'
,
'datastudio.middle.qg.udf'
:
'UDF'
,
'datastudio.middle.qg.udf'
:
'UDF'
,
'datastudio.header.pushdolphin.title'
:
'Push task [ {name} ] to DolphinScheduler'
,
'datastudio.header.pushdolphin.taskId'
:
'Dinky task encoding'
,
'datastudio.header.pushdolphin.taskName'
:
'Task name: {name}'
,
'datastudio.header.pushdolphin.taskNameExt'
:
'Task type: {type} Process definition: {processDefinitionName}'
,
'datastudio.header.pushdolphin.upstreamCodes'
:
'pre-task'
,
'datastudio.header.pushdolphin.upstreamCodesTip'
:
'After selecting the pre-task, the task will not be executed until the pre-task is successfully executed. Please choose wisely to avoid task circular dependencies. This platform does not do dependency checking'
,
'datastudio.header.pushdolphin.taskPriority'
:
'Task Priority'
,
'datastudio.header.pushdolphin.failRetryTimes'
:
'Number of retries'
,
'datastudio.header.pushdolphin.failRetryInterval'
:
'Failure retry interval (minutes)'
,
'datastudio.header.pushdolphin.failRetryIntervalPlaceholder'
:
'Please enter the failure retry interval (minutes)'
,
'datastudio.header.pushdolphin.delayTime'
:
'Delayed execution time (minutes)'
,
'datastudio.header.pushdolphin.delayTimePlaceholder'
:
'Please enter the delay execution time (minutes)'
,
'datastudio.header.pushdolphin.timeoutFlag'
:
'Timeout alarm'
,
'datastudio.header.pushdolphin.timeoutFlag.warn'
:
'Timeout warning'
,
'datastudio.header.pushdolphin.timeoutFlag.failed'
:
'Timeout failed'
,
'datastudio.header.pushdolphin.timeoutFlagTip'
:
'Please select a timeout warning'
,
'datastudio.header.pushdolphin.flag'
:
'Run flag'
,
'datastudio.header.pushdolphin.flagTip'
:
'Please select the run flag'
,
'datastudio.header.pushdolphin.timeoutNotifyStrategy'
:
'Timeout notification strategy'
,
'datastudio.header.pushdolphin.timeoutNotifyStrategyTip'
:
'Please select a timeout notification strategy'
,
'datastudio.header.pushdolphin.timeout'
:
'Timeout (minutes)'
,
'datastudio.header.pushdolphin.timeoutPlaceholder'
:
'Please enter the timeout time (minutes)'
,
'datastudio.project.create.folder.name'
:
'Folder Name'
,
'datastudio.project.create.folder.name'
:
'Folder Name'
,
'datastudio.project.create.folder.name.placeholder'
:
'Please enter the folder name'
,
'datastudio.project.create.folder.name.placeholder'
:
'Please enter the folder name'
,
'datastudio.project.create.folder.tip'
:
'datastudio.project.create.folder.tip'
:
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
b8e6a44c
...
@@ -82,6 +82,30 @@ export default {
...
@@ -82,6 +82,30 @@ export default {
'datastudio.middle.qg.gitprojects'
:
'Git 项目'
,
'datastudio.middle.qg.gitprojects'
:
'Git 项目'
,
'datastudio.middle.qg.resource'
:
'资源'
,
'datastudio.middle.qg.resource'
:
'资源'
,
'datastudio.middle.qg.udf'
:
'UDF'
,
'datastudio.middle.qg.udf'
:
'UDF'
,
'datastudio.header.pushdolphin.title'
:
'将任务 [ {name} ]推送至 DolphinScheduler'
,
'datastudio.header.pushdolphin.taskId'
:
'Dinky任务编码'
,
'datastudio.header.pushdolphin.taskName'
:
'Task名称: {name}'
,
'datastudio.header.pushdolphin.taskNameExt'
:
'Task类型: {type} 所属进程定义: {processDefinitionName}'
,
'datastudio.header.pushdolphin.upstreamCodes'
:
'前置任务'
,
'datastudio.header.pushdolphin.upstreamCodesTip'
:
'选择前置任务后,任务将会在前置任务执行成功后才会执行,请合理选择,避免任务循环依赖,本平台不做依赖检查'
,
'datastudio.header.pushdolphin.taskPriority'
:
'任务优先级'
,
'datastudio.header.pushdolphin.failRetryTimes'
:
'重试次数'
,
'datastudio.header.pushdolphin.failRetryInterval'
:
'失败重试间隔(分钟)'
,
'datastudio.header.pushdolphin.failRetryIntervalPlaceholder'
:
'请输入失败重试间隔(分钟)'
,
'datastudio.header.pushdolphin.delayTime'
:
'延时执行时间(分钟)'
,
'datastudio.header.pushdolphin.delayTimePlaceholder'
:
'请输入延时执行时间(分钟)'
,
'datastudio.header.pushdolphin.timeoutFlag'
:
'超时告警'
,
'datastudio.header.pushdolphin.timeoutFlag.warn'
:
'超时告警'
,
'datastudio.header.pushdolphin.timeoutFlag.failed'
:
'超时失败'
,
'datastudio.header.pushdolphin.timeoutFlagTip'
:
'请选择超时警告'
,
'datastudio.header.pushdolphin.flag'
:
'运行标志'
,
'datastudio.header.pushdolphin.flagTip'
:
'请选择运行标志'
,
'datastudio.header.pushdolphin.timeoutNotifyStrategy'
:
'超时通知策略'
,
'datastudio.header.pushdolphin.timeoutNotifyStrategyTip'
:
'请选择超时通知策略'
,
'datastudio.header.pushdolphin.timeout'
:
'超时时间(分钟)'
,
'datastudio.header.pushdolphin.timeoutPlaceholder'
:
'请输入超时时间(分钟)'
,
'datastudio.project.create.folder.name'
:
'目录名称'
,
'datastudio.project.create.folder.name'
:
'目录名称'
,
'datastudio.project.create.folder.name.placeholder'
:
'请输入目录名称'
,
'datastudio.project.create.folder.name.placeholder'
:
'请输入目录名称'
,
'datastudio.project.create.folder.tip'
:
'暂无作业,请点击左上角新建目录'
,
'datastudio.project.create.folder.tip'
:
'暂无作业,请点击左上角新建目录'
,
...
...
dinky-web/src/pages/DataStudio/HeaderContainer/PushDolphin/constants.tsx
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
l
}
from
'@/utils/intl'
;
import
{
Badge
,
Space
}
from
'antd'
;
import
{
CheckboxOptionType
}
from
'antd/es/checkbox/Group'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
/**
* priority list for select | 优先级列表
*/
export
const
PriorityList
:
DefaultOptionType
[]
=
[
{
label
:
(
<
Space
>
<
Badge
color=
{
'red'
}
/>
Highest
</
Space
>
),
value
:
'HIGHEST'
,
key
:
'HIGHEST'
},
{
label
:
(
<
Space
>
<
Badge
color=
{
'orange'
}
/>
High
</
Space
>
),
value
:
'HIGH'
,
key
:
'HIGH'
},
{
label
:
(
<
Space
>
<
Badge
color=
{
'blue'
}
/>
Medium
</
Space
>
),
value
:
'MEDIUM'
,
key
:
'MEDIUM'
},
{
label
:
(
<
Space
>
<
Badge
color=
{
'cyan'
}
/>
Low
</
Space
>
),
value
:
'LOW'
,
key
:
'LOW'
},
{
label
:
(
<
Space
>
<
Badge
color=
{
'purple'
}
/>
Lowest
</
Space
>
),
value
:
'LOWEST'
,
key
:
'LOWEST'
}
];
export
const
TimeoutNotifyStrategy
:
CheckboxOptionType
[]
=
[
{
label
:
l
(
'datastudio.header.pushdolphin.timeoutFlag.warn'
),
value
:
'WARN'
},
{
label
:
l
(
'datastudio.header.pushdolphin.timeoutFlag.failed'
),
value
:
'FAILED'
}
];
dinky-web/src/pages/DataStudio/HeaderContainer/PushDolphin/function.tsx
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
DolphinTaskDefinition
,
PushDolphinParams
}
from
'@/types/Studio/data.d'
;
export
const
transformPushDolphinParams
=
(
dolphinTaskDefinition
:
DolphinTaskDefinition
,
pushDolphinParams
:
PushDolphinParams
,
toFormValues
:
boolean
)
=>
{
if
(
toFormValues
&&
dolphinTaskDefinition
)
{
const
transformValue
:
PushDolphinParams
=
{
...
pushDolphinParams
,
description
:
dolphinTaskDefinition
.
description
,
timeoutFlag
:
dolphinTaskDefinition
.
timeoutFlag
===
'OPEN'
,
flag
:
dolphinTaskDefinition
.
flag
===
'YES'
,
upstreamCodes
:
dolphinTaskDefinition
.
upstreamTaskMap
?
Object
.
keys
(
dolphinTaskDefinition
.
upstreamTaskMap
)
:
[],
timeoutNotifyStrategy
:
dolphinTaskDefinition
.
timeoutNotifyStrategy
===
'WARNFAILED'
?
[
'WARN'
,
'FAILED'
]
:
[
dolphinTaskDefinition
.
timeoutNotifyStrategy
]
};
return
transformValue
;
}
else
{
const
falseTransformValue
:
DolphinTaskDefinition
=
{
...
dolphinTaskDefinition
,
...
pushDolphinParams
,
description
:
pushDolphinParams
.
description
,
timeoutFlag
:
pushDolphinParams
.
timeoutFlag
?
'OPEN'
:
'CLOSE'
,
flag
:
pushDolphinParams
.
flag
?
'YES'
:
'NO'
,
timeoutNotifyStrategy
:
(
pushDolphinParams
.
timeoutNotifyStrategy
as
string
[]).
join
(
''
)
};
return
falseTransformValue
;
}
};
dinky-web/src/pages/DataStudio/HeaderContainer/PushDolphin/index.tsx
0 → 100644
View file @
b8e6a44c
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
FormContextValue
}
from
'@/components/Context/FormContext'
;
import
{
NORMAL_MODAL_OPTIONS
,
SWITCH_OPTIONS
}
from
'@/services/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ModalForm
,
ProFormCheckbox
,
ProFormDigit
,
ProFormGroup
,
ProFormSelect
,
ProFormSwitch
,
ProFormText
,
ProFormTextArea
}
from
'@ant-design/pro-components'
;
import
{
PriorityList
,
TimeoutNotifyStrategy
}
from
'@/pages/DataStudio/HeaderContainer/PushDolphin/constants'
;
import
{
transformPushDolphinParams
}
from
'@/pages/DataStudio/HeaderContainer/PushDolphin/function'
;
import
{
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
DolphinTaskDefinition
,
DolphinTaskMinInfo
,
PushDolphinParams
}
from
'@/types/Studio/data.d'
;
import
{
InitPushDolphinParams
}
from
'@/types/Studio/init.d'
;
import
{
Button
,
Form
,
Tag
}
from
'antd'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
import
React
from
'react'
;
type
PushDolphinProps
=
{
onCancel
:
()
=>
void
;
dolphinTaskList
:
DolphinTaskMinInfo
[];
dolphinDefinitionTask
:
Partial
<
DolphinTaskDefinition
>
;
modalVisible
:
boolean
;
currentDinkyTaskValue
:
Partial
<
TaskDataType
>
;
loading
:
boolean
;
onSubmit
:
(
values
:
DolphinTaskDefinition
)
=>
void
;
};
export
const
PushDolphin
:
React
.
FC
<
PushDolphinProps
>
=
(
props
)
=>
{
const
{
onCancel
,
onSubmit
,
modalVisible
,
dolphinTaskList
,
dolphinDefinitionTask
,
currentDinkyTaskValue
,
loading
}
=
props
;
const
[
formValues
,
setFormValues
]
=
React
.
useState
<
PushDolphinParams
>
(
transformPushDolphinParams
(
dolphinDefinitionTask
as
DolphinTaskDefinition
,
{
...
InitPushDolphinParams
,
taskId
:
currentDinkyTaskValue
?.
id
??
''
},
true
)
as
PushDolphinParams
);
/**
* init form
*/
const
[
form
]
=
Form
.
useForm
<
PushDolphinParams
>
();
/**
* init form context
*/
const
formContext
=
React
.
useMemo
<
FormContextValue
>
(
()
=>
({
resetForm
:
()
=>
form
.
resetFields
()
// 定义 resetForm 方法
}),
[
form
]
);
/**
* cancel choose
*/
const
handleCancel
=
()
=>
{
onCancel
();
formContext
.
resetForm
();
};
const
handlePushDolphinSubmit
=
async
()
=>
{
const
values
=
form
.
validateFields
();
if
(
!
values
)
{
return
;
}
const
transformPushDolphinParamsValue
:
DolphinTaskDefinition
=
transformPushDolphinParams
(
dolphinDefinitionTask
as
DolphinTaskDefinition
,
formValues
,
false
)
as
DolphinTaskDefinition
;
onSubmit
(
transformPushDolphinParamsValue
);
console
.
log
(
'transformPushDolphinParamsValue'
,
transformPushDolphinParamsValue
);
};
const
renderFooter
=
()
=>
{
return
[
<
Button
key=
{
'pushCancel'
}
onClick=
{
handleCancel
}
>
{
l
(
'button.cancel'
)
}
</
Button
>,
<
Button
key=
{
'push'
}
type=
'primary'
htmlType=
{
'submit'
}
loading=
{
loading
}
onClick=
{
()
=>
handlePushDolphinSubmit
()
}
>
{
l
(
'button.finish'
)
}
</
Button
>
];
};
const
buildUpstreamTaskOptions
=
(
data
:
DolphinTaskMinInfo
[]
|
undefined
):
DefaultOptionType
[]
=>
{
if
(
data
&&
data
.
length
>
0
)
{
return
data
.
map
((
item
)
=>
{
const
label
=
(
<>
<
Tag
color=
{
'purple'
}
>
{
l
(
'datastudio.header.pushdolphin.taskName'
,
''
,
{
name
:
item
.
taskName
})
}
</
Tag
>
<
span
style=
{
{
color
:
'#8a8a8a'
}
}
>
{
l
(
'datastudio.header.pushdolphin.taskNameExt'
,
''
,
{
type
:
item
.
taskType
,
processDefinitionName
:
item
.
processDefinitionName
})
}
</
span
>
</>
);
return
{
label
:
label
,
value
:
item
.
taskCode
.
toString
(),
key
:
item
.
taskCode
};
});
}
return
[];
};
const
handleValueChange
=
(
changedValues
:
any
,
allValues
:
any
)
=>
{
if
(
allValues
)
{
setFormValues
({
...
formValues
,
...
allValues
});
}
};
const
pushDolphinForm
=
()
=>
{
return
(
<>
<
ProFormText
name=
{
'taskId'
}
label=
{
l
(
'datastudio.header.pushdolphin.taskId'
)
}
disabled
/>
<
ProFormSelect
label=
{
l
(
'datastudio.header.pushdolphin.upstreamCodes'
)
}
name=
{
'upstreamCodes'
}
showSearch
mode=
{
'multiple'
}
extra=
{
l
(
'datastudio.header.pushdolphin.upstreamCodesTip'
)
}
options=
{
buildUpstreamTaskOptions
(
dolphinTaskList
)
}
/>
<
ProFormGroup
>
<
ProFormSelect
label=
{
l
(
'datastudio.header.pushdolphin.taskPriority'
)
}
name=
{
'taskPriority'
}
width=
{
'sm'
}
options=
{
PriorityList
}
/>
<
ProFormDigit
label=
{
l
(
'datastudio.header.pushdolphin.failRetryTimes'
)
}
name=
{
'failRetryTimes'
}
initialValue=
{
formValues
.
failRetryTimes
}
width=
{
'sm'
}
min=
{
0
}
max=
{
99
}
fieldProps=
{
{
precision
:
0
}
}
/>
<
ProFormDigit
label=
{
l
(
'datastudio.header.pushdolphin.failRetryInterval'
)
}
name=
{
'failRetryInterval'
}
width=
{
'sm'
}
rules=
{
[
{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.failRetryIntervalPlaceholder'
)
}
]
}
min=
{
0
}
fieldProps=
{
{
precision
:
0
}
}
/>
<
ProFormDigit
label=
{
l
(
'datastudio.header.pushdolphin.delayTime'
)
}
name=
{
'delayTime'
}
width=
{
'sm'
}
rules=
{
[
{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.delayTimePlaceholder'
)
}
]
}
min=
{
0
}
fieldProps=
{
{
precision
:
0
}
}
/>
<
ProFormSwitch
label=
{
l
(
'datastudio.header.pushdolphin.timeoutFlag'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.timeoutFlagTip'
)
}]
}
{
...
SWITCH_OPTIONS
()}
name=
{
'timeoutFlag'
}
/>
<
ProFormSwitch
label=
{
l
(
'datastudio.header.pushdolphin.flag'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.flagTip'
)
}]
}
{
...
SWITCH_OPTIONS
()}
name=
{
'flag'
}
/>
</
ProFormGroup
>
{
/*如果是失败告警,则需要设置告警策略*/
}
{
formValues
.
timeoutFlag
&&
(
<>
<
ProFormGroup
>
<
ProFormCheckbox
.
Group
label=
{
l
(
'datastudio.header.pushdolphin.timeoutNotifyStrategy'
)
}
name=
{
'timeoutNotifyStrategy'
}
rules=
{
[
{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.timeoutNotifyStrategyTip'
)
}
]
}
width=
{
'sm'
}
options=
{
TimeoutNotifyStrategy
}
/>
<
ProFormDigit
label=
{
l
(
'datastudio.header.pushdolphin.timeout'
)
}
name=
{
'timeout'
}
width=
{
'sm'
}
rules=
{
[
{
required
:
true
,
message
:
l
(
'datastudio.header.pushdolphin.timeoutPlaceholder'
)
}
]
}
min=
{
0
}
max=
{
30
}
fieldProps=
{
{
precision
:
0
}
}
/>
</
ProFormGroup
>
</>
)
}
<
ProFormTextArea
label=
{
l
(
'global.table.note'
)
}
name=
{
'description'
}
/>
</>
);
};
return
(
<
ModalForm
<
PushDolphinParams
>
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
l
(
'datastudio.header.pushdolphin.title'
,
''
,
{
name
:
currentDinkyTaskValue
?.
name
??
''
})
}
open=
{
modalVisible
}
form=
{
form
}
initialValues=
{
formValues
}
modalProps=
{
{
onCancel
:
handleCancel
,
destroyOnClose
:
true
}
}
submitter=
{
{
render
:
()
=>
[...
renderFooter
()]
}
}
onValuesChange=
{
handleValueChange
}
loading=
{
loading
}
>
{
pushDolphinForm
()
}
</
ModalForm
>
);
};
export
default
PushDolphin
;
dinky-web/src/pages/DataStudio/HeaderContainer/function.tsx
View file @
b8e6a44c
...
@@ -17,8 +17,10 @@
...
@@ -17,8 +17,10 @@
*
*
*/
*/
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
TabsPageType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsPageType
,
TaskDataType
}
from
'@/pages/DataStudio/model'
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
;
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
;
/**
/**
...
@@ -46,3 +48,14 @@ export const isOnline = (data: TaskDataType | undefined) => {
...
@@ -46,3 +48,14 @@ export const isOnline = (data: TaskDataType | undefined) => {
export
const
isRunning
=
(
data
:
TaskDataType
|
undefined
)
=>
{
export
const
isRunning
=
(
data
:
TaskDataType
|
undefined
)
=>
{
return
data
?
JOB_STATUS
.
RUNNING
==
data
.
status
:
false
;
return
data
?
JOB_STATUS
.
RUNNING
==
data
.
status
:
false
;
};
};
export
const
isCanPushDolphin
=
(
data
:
TaskDataType
|
undefined
)
=>
{
return
data
?
JOB_LIFE_CYCLE
.
PUBLISH
===
data
.
step
&&
!
isSql
(
data
?.
dialect
)
&&
data
?.
dialect
?.
toLowerCase
()
!==
DIALECT
.
FLINKSQLENV
&&
data
?.
dialect
?.
toLowerCase
()
!==
DIALECT
.
SCALA
&&
data
?.
dialect
?.
toLowerCase
()
!==
DIALECT
.
JAVA
&&
data
?.
dialect
?.
toLowerCase
()
!==
DIALECT
.
PYTHON_LONG
:
false
;
};
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
b8e6a44c
...
@@ -18,16 +18,19 @@
...
@@ -18,16 +18,19 @@
*/
*/
import
{
LoadingBtn
}
from
'@/components/CallBackButton/LoadingBtn'
;
import
{
LoadingBtn
}
from
'@/components/CallBackButton/LoadingBtn'
;
import
{
PushpinIcon
}
from
'@/components/Icons/CustomIcons'
;
import
{
FlexCenterDiv
}
from
'@/components/StyledComponents'
;
import
{
FlexCenterDiv
}
from
'@/components/StyledComponents'
;
import
{
getCurrentData
,
getCurrentTab
,
mapDispatchToProps
}
from
'@/pages/DataStudio/function'
;
import
{
getCurrentData
,
getCurrentTab
,
mapDispatchToProps
}
from
'@/pages/DataStudio/function'
;
import
Explain
from
'@/pages/DataStudio/HeaderContainer/Explain'
;
import
Explain
from
'@/pages/DataStudio/HeaderContainer/Explain'
;
import
FlinkGraph
from
'@/pages/DataStudio/HeaderContainer/FlinkGraph'
;
import
FlinkGraph
from
'@/pages/DataStudio/HeaderContainer/FlinkGraph'
;
import
{
import
{
buildBreadcrumbItems
,
buildBreadcrumbItems
,
isCanPushDolphin
,
isOnline
,
isOnline
,
isRunning
,
isRunning
,
projectCommonShow
projectCommonShow
}
from
'@/pages/DataStudio/HeaderContainer/function'
;
}
from
'@/pages/DataStudio/HeaderContainer/function'
;
import
PushDolphin
from
'@/pages/DataStudio/HeaderContainer/PushDolphin'
;
import
{
import
{
cancelTask
,
cancelTask
,
changeTaskLife
,
changeTaskLife
,
...
@@ -36,16 +39,21 @@ import {
...
@@ -36,16 +39,21 @@ import {
getJobPlan
,
getJobPlan
,
isSql
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
DataStudioTabsItemType
,
StateType
,
TabsPageType
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
DataStudioTabsItemType
,
StateType
,
TabsPageType
,
TaskDataType
,
VIEW
}
from
'@/pages/DataStudio/model'
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
JOB_LIFE_CYCLE
,
JOB_STATUS
}
from
'@/pages/DevOps/constants'
;
import
{
ConfigStateType
}
from
'@/pages/SettingCenter/GlobalSetting/model'
;
import
{
Sys
ConfigStateType
}
from
'@/pages/SettingCenter/GlobalSetting/model'
;
import
{
SettingConfigKeyEnum
}
from
'@/pages/SettingCenter/GlobalSetting/SettingOverView/constants'
;
import
{
SettingConfigKeyEnum
}
from
'@/pages/SettingCenter/GlobalSetting/SettingOverView/constants'
;
import
{
handle
PutDataJson
}
from
'@/services/BusinessCrud'
;
import
{
handle
Option
,
handlePutDataJson
,
queryDataByParams
}
from
'@/services/BusinessCrud'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
BaseConfigProperties
}
from
'@/types/SettingCenter/data
'
;
import
{
DolphinTaskDefinition
,
DolphinTaskMinInfo
}
from
'@/types/Studio/data.d
'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
SuccessMessageAsync
}
from
'@/utils/messages'
;
import
{
SuccessMessageAsync
}
from
'@/utils/messages'
;
import
{
connect
}
from
'@@/exports'
;
import
{
import
{
ApartmentOutlined
,
ApartmentOutlined
,
BugOutlined
,
BugOutlined
,
...
@@ -57,9 +65,9 @@ import {
...
@@ -57,9 +65,9 @@ import {
PauseOutlined
,
PauseOutlined
,
RotateRightOutlined
,
RotateRightOutlined
,
SaveOutlined
,
SaveOutlined
,
ScheduleOutlined
,
ScheduleOutlined
SendOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Breadcrumb
,
Descriptions
,
Modal
,
Space
}
from
'antd'
;
import
{
Breadcrumb
,
Descriptions
,
Modal
,
Space
}
from
'antd'
;
import
{
ButtonProps
}
from
'antd/es/button/button'
;
import
{
ButtonProps
}
from
'antd/es/button/button'
;
import
React
,
{
memo
,
useEffect
,
useState
}
from
'react'
;
import
React
,
{
memo
,
useEffect
,
useState
}
from
'react'
;
...
@@ -84,7 +92,7 @@ type ButtonRoute = {
...
@@ -84,7 +92,7 @@ type ButtonRoute = {
props
?:
ButtonProps
;
props
?:
ButtonProps
;
};
};
const
HeaderContainer
=
(
props
:
any
)
=>
{
const
HeaderContainer
=
(
props
:
connect
)
=>
{
const
{
const
{
size
,
size
,
activeBreadcrumbTitle
,
activeBreadcrumbTitle
,
...
@@ -92,26 +100,66 @@ const HeaderContainer = (props: any) => {
...
@@ -92,26 +100,66 @@ const HeaderContainer = (props: any) => {
saveTabs
,
saveTabs
,
updateJobRunningMsg
,
updateJobRunningMsg
,
queryDsConfig
,
queryDsConfig
,
dsConfig
enabledDs
}
=
props
;
}
=
props
;
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
// 检查是否开启 ds 配置 & 如果
const
[
pushDolphinState
,
setPushDolphinState
]
=
useState
<
{
const
[
enableDs
]
=
useState
<
boolean
>
(
modalVisible
:
boolean
;
dsConfig
.
some
(
buttonLoading
:
boolean
;
(
item
:
BaseConfigProperties
)
=>
confirmLoading
:
boolean
;
item
.
key
===
'dolphinscheduler.settings.enable'
&&
item
.
value
===
'true'
dolphinTaskList
:
DolphinTaskMinInfo
[];
)
dolphinDefinitionTask
:
Partial
<
DolphinTaskDefinition
>
;
);
currentDinkyTaskValue
:
Partial
<
TaskDataType
>
;
}
>
({
const
currentData
=
getCurrentData
(
panes
,
activeKey
);
modalVisible
:
false
,
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
)
as
DataStudioTabsItemType
;
buttonLoading
:
false
,
confirmLoading
:
false
,
dolphinTaskList
:
[],
dolphinDefinitionTask
:
{},
currentDinkyTaskValue
:
{}
});
useEffect
(()
=>
{
useEffect
(()
=>
{
queryDsConfig
(
SettingConfigKeyEnum
.
DOLPHIN_SCHEDULER
.
toLowerCase
());
queryDsConfig
(
SettingConfigKeyEnum
.
DOLPHIN_SCHEDULER
.
toLowerCase
());
},
[]);
},
[]);
const
currentData
=
getCurrentData
(
panes
,
activeKey
);
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
)
as
DataStudioTabsItemType
;
const
handlePushDolphinOpen
=
async
()
=>
{
const
dinkyTaskId
=
currentData
?.
id
;
const
dolphinTaskList
:
DolphinTaskMinInfo
[]
|
undefined
=
await
queryDataByParams
<
DolphinTaskMinInfo
[]
>
(
'/api/scheduler/queryUpstreamTasks'
,
{
dinkyTaskId
});
const
dolphinTaskDefinition
:
DolphinTaskDefinition
|
undefined
=
await
queryDataByParams
<
DolphinTaskDefinition
>
(
'/api/scheduler/queryTaskDefinition'
,
{
dinkyTaskId
});
setPushDolphinState
((
prevState
)
=>
({
...
prevState
,
buttonLoading
:
true
,
confirmLoading
:
false
,
modalVisible
:
true
,
dolphinTaskList
:
dolphinTaskList
??
[],
dolphinDefinitionTask
:
dolphinTaskDefinition
??
{},
currentDinkyTaskValue
:
currentData
as
TaskDataType
}));
};
const
handlePushDolphinCancel
=
async
()
=>
{
setPushDolphinState
((
prevState
)
=>
({
...
prevState
,
modalVisible
:
false
,
buttonLoading
:
false
,
dolphinTaskList
:
[],
confirmLoading
:
false
,
dolphinDefinitionTask
:
{},
currentDinkyTaskValue
:
{}
}));
};
const
handleSave
=
async
()
=>
{
const
handleSave
=
async
()
=>
{
const
saved
=
await
handlePutDataJson
(
'/api/task'
,
currentData
);
const
saved
=
await
handlePutDataJson
(
'/api/task'
,
currentData
);
saveTabs
({
...
props
.
tabs
});
saveTabs
({
...
props
.
tabs
});
...
@@ -271,10 +319,11 @@ const HeaderContainer = (props: any) => {
...
@@ -271,10 +319,11 @@ const HeaderContainer = (props: any) => {
},
},
{
{
// 推送海豚, 此处需要将系统设置中的 ds 的配置拿出来做判断 启用才展示
// 推送海豚, 此处需要将系统设置中的 ds 的配置拿出来做判断 启用才展示
icon
:
<
SendOutlined
className=
{
'blue-icon'
}
/>,
icon
:
<
PushpinIcon
loading=
{
pushDolphinState
.
buttonLoading
}
className=
{
'blue-icon'
}
/>,
title
:
l
(
'button.push'
),
title
:
l
(
'button.push'
),
hotKey
:
(
e
:
KeyboardEvent
)
=>
e
.
ctrlKey
&&
e
.
key
===
's'
,
hotKey
:
(
e
:
KeyboardEvent
)
=>
e
.
ctrlKey
&&
e
.
key
===
's'
,
isShow
:
enableDs
isShow
:
enabledDs
&&
isCanPushDolphin
(
currentData
),
click
:
()
=>
handlePushDolphinOpen
()
},
},
{
{
// 发布按钮
// 发布按钮
...
@@ -417,6 +466,16 @@ const HeaderContainer = (props: any) => {
...
@@ -417,6 +466,16 @@ const HeaderContainer = (props: any) => {
);
);
};
};
const handlePushDolphinSubmit = async (value: DolphinTaskDefinition) => {
setPushDolphinState((prevState) => ({ ...prevState, loading: true }));
await handleOption(
'/api/scheduler/createOrUpdateTaskDefinition',
`
推送任务
[
$
{
currentData
?.
name
}]
至
DolphinScheduler
`,
value
);
await handlePushDolphinCancel();
};
/**
/**
* render
* render
*/
*/
...
@@ -425,15 +484,27 @@ const HeaderContainer = (props: any) => {
...
@@ -425,15 +484,27 @@ const HeaderContainer = (props: any) => {
<Descriptions.Item>{renderBreadcrumbItems()}</Descriptions.Item>
<Descriptions.Item>{renderBreadcrumbItems()}</Descriptions.Item>
<Descriptions.Item contentStyle={{ display: 'flex', flexDirection: 'row-reverse' }}>
<Descriptions.Item contentStyle={{ display: 'flex', flexDirection: 'row-reverse' }}>
{renderRightButtons()}
{renderRightButtons()}
{pushDolphinState.modalVisible && (
<PushDolphin
onCancel={() => handlePushDolphinCancel()}
currentDinkyTaskValue={pushDolphinState.currentDinkyTaskValue}
modalVisible={pushDolphinState.modalVisible}
loading={pushDolphinState.confirmLoading}
dolphinDefinitionTask={pushDolphinState.dolphinDefinitionTask}
dolphinTaskList={pushDolphinState.dolphinTaskList}
onSubmit={(values) => handlePushDolphinSubmit(values)}
/>
)}
</Descriptions.Item>
</Descriptions.Item>
</Descriptions>
</Descriptions>
);
);
};
};
export default connect(
export default connect(
({ Studio,
Config }: { Studio: StateType; Config:
ConfigStateType }) => ({
({ Studio,
SysConfig }: { Studio: StateType; SysConfig: Sys
ConfigStateType }) => ({
tabs: Studio.tabs,
tabs: Studio.tabs,
dsConfig: Config.dsConfig
dsConfig: SysConfig.dsConfig,
enabledDs: SysConfig.enabledDs
}),
}),
mapDispatchToProps
mapDispatchToProps
)(memo(HeaderContainer));
)(memo(HeaderContainer));
dinky-web/src/pages/SettingCenter/GlobalSetting/model.ts
View file @
b8e6a44c
...
@@ -23,25 +23,30 @@ import { createModelTypes } from '@/utils/modelUtils';
...
@@ -23,25 +23,30 @@ import { createModelTypes } from '@/utils/modelUtils';
import
{
Effect
}
from
'@@/plugin-dva/types'
;
import
{
Effect
}
from
'@@/plugin-dva/types'
;
import
{
Reducer
}
from
'umi'
;
import
{
Reducer
}
from
'umi'
;
export
type
ConfigStateType
=
{
const
SYS_CONFIG
=
'SysConfig'
;
export
type
SysConfigStateType
=
{
dsConfig
:
BaseConfigProperties
[];
dsConfig
:
BaseConfigProperties
[];
enabledDs
:
boolean
;
};
};
export
type
ConfigModelType
=
{
export
type
ConfigModelType
=
{
namespace
:
string
;
namespace
:
string
;
state
:
ConfigStateType
;
state
:
Sys
ConfigStateType
;
effects
:
{
effects
:
{
queryDsConfig
:
Effect
;
queryDsConfig
:
Effect
;
};
};
reducers
:
{
reducers
:
{
saveDsConfig
:
Reducer
<
ConfigStateType
>
;
saveDsConfig
:
Reducer
<
SysConfigStateType
>
;
updateEnabledDs
:
Reducer
<
SysConfigStateType
>
;
};
};
};
};
const
ConfigModel
:
ConfigModelType
=
{
const
ConfigModel
:
ConfigModelType
=
{
namespace
:
'Config'
,
namespace
:
SYS_CONFIG
,
state
:
{
state
:
{
dsConfig
:
[]
dsConfig
:
[],
enabledDs
:
false
},
},
effects
:
{
effects
:
{
...
@@ -51,6 +56,16 @@ const ConfigModel: ConfigModelType = {
...
@@ -51,6 +56,16 @@ const ConfigModel: ConfigModelType = {
type
:
'saveDsConfig'
,
type
:
'saveDsConfig'
,
payload
:
response
||
[]
payload
:
response
||
[]
});
});
if
(
response
&&
response
.
length
>
0
)
{
const
enabledDs
=
response
.
some
(
(
item
:
BaseConfigProperties
)
=>
item
.
key
===
'sys.dolphinscheduler.settings.enable'
&&
item
.
value
===
true
);
yield
put
({
type
:
'updateEnabledDs'
,
payload
:
enabledDs
});
}
}
}
},
},
...
@@ -60,6 +75,12 @@ const ConfigModel: ConfigModelType = {
...
@@ -60,6 +75,12 @@ const ConfigModel: ConfigModelType = {
...
state
,
...
state
,
dsConfig
:
payload
dsConfig
:
payload
};
};
},
updateEnabledDs
(
state
,
{
payload
})
{
return
{
...
state
,
enabledDs
:
payload
};
}
}
}
}
};
};
...
...
dinky-web/src/types/Studio/data.d.ts
View file @
b8e6a44c
...
@@ -228,3 +228,83 @@ export enum JobStatus {
...
@@ -228,3 +228,83 @@ export enum JobStatus {
RECONNECTING
=
'RECONNECTING'
,
RECONNECTING
=
'RECONNECTING'
,
UNKNOWN
=
'UNKNOWN'
UNKNOWN
=
'UNKNOWN'
}
}
/**
* DolphinTaskMinInfo
*/
export
interface
DolphinTaskMinInfo
{
id
:
number
;
taskName
:
string
;
taskCode
:
number
;
taskVersion
:
number
;
taskType
:
string
;
taskCreateTime
:
Date
;
taskUpdateTime
:
Date
;
processDefinitionCode
:
number
;
processDefinitionVersion
:
number
;
processDefinitionName
:
string
;
processReleaseState
:
string
;
upstreamTaskMap
:
Map
<
number
,
string
>
;
upstreamTaskCode
:
number
;
upstreamTaskName
:
string
;
}
export
interface
TaskParamProperty
{
prop
:
string
;
direct
:
string
;
type
:
string
;
value
:
string
;
}
export
interface
DolphinTaskDefinition
{
id
:
number
;
code
:
number
;
name
:
string
;
version
:
number
;
description
:
string
;
projectCode
:
number
;
userId
:
number
;
taskType
:
string
;
taskParams
:
Map
<
string
,
string
>
;
taskParamList
:
TaskParamProperty
[];
taskParamMap
:
Map
<
string
,
string
>
;
flag
:
string
;
// 0 no 1 yes
taskPriority
:
string
;
// 0 highest 1 high 2 medium 3 low 4 lowest
userName
:
string
;
projectName
:
string
;
workerGroup
:
string
;
environmentCode
:
number
;
failRetryTimes
:
number
;
failRetryInterval
:
number
;
timeoutFlag
:
string
;
// 0 close 1 open
timeoutNotifyStrategy
:
string
;
// 0 warning 1 failure 2 warning and failure
timeout
:
number
;
delayTime
:
number
;
resourceIds
:
string
;
createTime
:
Date
;
updateTime
:
Date
;
modifyBy
:
string
;
taskGroupId
:
number
;
taskGroupPriority
:
number
;
cpuQuota
:
number
;
memoryMax
:
number
;
taskExecuteType
:
number
;
// 0 batch 1 stream
processDefinitionCode
:
number
;
processDefinitionVersion
:
number
;
processDefinitionName
:
string
;
upstreamTaskMap
:
Map
<
number
,
string
>
;
}
export
interface
PushDolphinParams
{
taskId
:
number
|
string
;
upstreamCodes
:
string
[];
taskPriority
:
string
;
failRetryTimes
:
number
;
failRetryInterval
:
number
;
delayTime
:
number
;
timeout
:
number
;
timeoutFlag
:
boolean
|
string
;
flag
:
boolean
|
string
;
timeoutNotifyStrategy
:
string
[]
|
string
;
description
:
string
;
}
dinky-web/src/types/Studio/init.d.ts
View file @
b8e6a44c
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
*/
*/
import
{
InitContextMenuPosition
}
from
'@/types/Public/state.d'
;
import
{
InitContextMenuPosition
}
from
'@/types/Public/state.d'
;
import
{
ProjectState
}
from
'@/types/Studio/state.d'
;
import
{
PushDolphinParams
}
from
'@/types/Studio/data'
;
import
{
CateLogState
,
ProjectState
}
from
'@/types/Studio/state.d'
;
export
const
InitProjectState
:
ProjectState
=
{
export
const
InitProjectState
:
ProjectState
=
{
rightActiveKey
:
''
,
rightActiveKey
:
''
,
...
@@ -36,3 +37,34 @@ export const InitProjectState: ProjectState = {
...
@@ -36,3 +37,34 @@ export const InitProjectState: ProjectState = {
isCut
:
false
,
isCut
:
false
,
value
:
{}
value
:
{}
};
};
export
const
InitPushDolphinParams
:
PushDolphinParams
=
{
taskId
:
''
,
upstreamCodes
:
[],
taskPriority
:
'MEDIUM'
,
failRetryTimes
:
0
,
failRetryInterval
:
0
,
delayTime
:
0
,
timeout
:
30
,
timeoutFlag
:
false
,
flag
:
false
,
timeoutNotifyStrategy
:
[
'WARN'
],
description
:
''
};
export
const
InitCateLogState
:
CateLogState
=
{
catalog
:
''
,
catalogSelect
:
[],
databaseName
:
''
,
databaseId
:
-
1
,
tableName
:
''
,
dialect
:
''
,
fragment
:
true
,
envId
:
-
1
,
engine
:
'Flink'
,
treeData
:
[],
modalVisit
:
false
,
rowData
:
{},
loading
:
false
,
columnData
:
[]
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment