This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new e53bd98 [fix-3843][api] When update workflow definition,if name
already exists, the prompt is not friendly
new 4425968 Merge pull request #3923 from lgcareer/dev-fix
e53bd98 is described below
commit e53bd984225f5018a59b4307fc9b15c232c62840
Author: lgcareer <[email protected]>
AuthorDate: Fri Oct 16 11:02:41 2020 +0800
[fix-3843][api] When update workflow definition,if name already exists, the
prompt is not friendly
---
.../org/apache/dolphinscheduler/api/enums/Status.java | 2 +-
.../api/service/impl/ProcessDefinitionServiceImpl.java | 16 ++++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
index 4fda99c..6544787 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
@@ -133,7 +133,7 @@ public enum Status {
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error",
"查询任务实例日志错误"),
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log
file error", "下载任务日志文件错误"),
CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"),
- VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process
definition name unique error", "工作流名称已存在"),
+ VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process
definition name unique error", "工作流定义名称已存在"),
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error",
"更新工作流定义错误"),
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition
error", "上线工作流错误"),
QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process
definition error", "查询工作流详细信息错误"),
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
index 8193093..b7ab24b 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@@ -366,16 +366,24 @@ public class ProcessDefinitionServiceImpl extends
BaseService implements
return checkProcessJson;
}
ProcessDefinition processDefine =
processService.findProcessDefineById(id);
+ // check process definition exists
if (processDefine == null) {
- // check process definition exists
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id);
return result;
- } else if (processDefine.getReleaseState() == ReleaseState.ONLINE) {
+ }
+ if (processDefine.getReleaseState() == ReleaseState.ONLINE) {
// online can not permit edit
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT,
processDefine.getName());
return result;
- } else {
- putMsg(result, Status.SUCCESS);
+ }
+
+ if (!name.equals(processDefine.getName())) {
+ // check whether the new process define name exist
+ ProcessDefinition definition =
processDefineMapper.verifyByDefineName(project.getId(), name);
+ if (definition != null) {
+ putMsg(result,
Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, name);
+ return result;
+ }
}
Date now = new Date();