You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/12/14 02:15:24 UTC
[dolphinscheduler] branch 3.1.3-prepare updated: [Bug] [dolphinscheduler-api] in the task define list, when edit task, should show pre node list (#12695)
This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch 3.1.3-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/3.1.3-prepare by this push:
new f71b864eee [Bug] [dolphinscheduler-api] in the task define list, when edit task, should show pre node list (#12695)
f71b864eee is described below
commit f71b864eee0231e4874c79644b49d4c2ba1c35c0
Author: jackfanwan <61...@users.noreply.github.com>
AuthorDate: Tue Nov 8 13:31:20 2022 +0800
[Bug] [dolphinscheduler-api] in the task define list, when edit task, should show pre node list (#12695)
* backend : add pre node list
* resolve workflow error
Co-authored-by: fanwanlong <fa...@kezaihui.com>
---
.../service/impl/TaskDefinitionServiceImpl.java | 11 ++-
.../dolphinscheduler/api/vo/TaskDefinitionVo.java | 82 ++++++++++++++++++++++
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
index e6e57151dd..420dbd9c60 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
@@ -31,6 +31,7 @@ import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
+import org.apache.dolphinscheduler.api.vo.TaskDefinitionVo;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ConditionType;
@@ -784,7 +785,15 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode));
} else {
- result.put(Constants.DATA_LIST, taskDefinition);
+ List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper
+ .queryByCode(projectCode, 0, 0, taskCode);
+ if (CollectionUtils.isNotEmpty(taskRelationList)) {
+ taskRelationList = taskRelationList.stream()
+ .filter(v -> v.getPreTaskCode() != 0).collect(Collectors.toList());
+ }
+ TaskDefinitionVo taskDefinitionVo = TaskDefinitionVo.fromTaskDefinition(taskDefinition);
+ taskDefinitionVo.setProcessTaskRelationList(taskRelationList);
+ result.put(Constants.DATA_LIST, taskDefinitionVo);
putMsg(result, Status.SUCCESS);
}
return result;
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java
new file mode 100644
index 0000000000..0562b92da2
--- /dev/null
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java
@@ -0,0 +1,82 @@
+/*
+ * 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.apache.dolphinscheduler.api.vo;
+
+import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
+import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
+
+import java.util.List;
+
+import lombok.Data;
+
+/**
+ * @author fanwanlong
+ */
+@Data
+public class TaskDefinitionVo extends TaskDefinition {
+
+ /**
+ * process task related list
+ */
+ private List<ProcessTaskRelation> processTaskRelationList;
+
+ public TaskDefinitionVo() {
+ }
+
+ public TaskDefinitionVo(List<ProcessTaskRelation> processTaskRelationList) {
+ this.processTaskRelationList = processTaskRelationList;
+ }
+
+ public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) {
+ TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo();
+ taskDefinitionVo.setId(taskDefinition.getId());
+ taskDefinitionVo.setCode(taskDefinition.getCode());
+ taskDefinitionVo.setName(taskDefinition.getName());
+ taskDefinitionVo.setVersion(taskDefinition.getVersion());
+ taskDefinitionVo.setDescription(taskDefinition.getDescription());
+ taskDefinitionVo.setProjectCode(taskDefinition.getProjectCode());
+ taskDefinitionVo.setUserId(taskDefinition.getUserId());
+ taskDefinitionVo.setTaskType(taskDefinition.getTaskType());
+ taskDefinitionVo.setTaskParams(taskDefinition.getTaskParams());
+ taskDefinitionVo.setTaskParamList(taskDefinition.getTaskParamList());
+ taskDefinitionVo.setTaskParamMap(taskDefinition.getTaskParamMap());
+ taskDefinitionVo.setFlag(taskDefinition.getFlag());
+ taskDefinitionVo.setTaskPriority(taskDefinition.getTaskPriority());
+ taskDefinitionVo.setUserName(taskDefinition.getUserName());
+ taskDefinitionVo.setProjectName(taskDefinition.getProjectName());
+ taskDefinitionVo.setWorkerGroup(taskDefinition.getWorkerGroup());
+ taskDefinitionVo.setEnvironmentCode(taskDefinition.getEnvironmentCode());
+ taskDefinitionVo.setFailRetryTimes(taskDefinition.getFailRetryTimes());
+ taskDefinitionVo.setFailRetryInterval(taskDefinition.getFailRetryInterval());
+ taskDefinitionVo.setTimeoutFlag(taskDefinition.getTimeoutFlag());
+ taskDefinitionVo.setTimeoutNotifyStrategy(taskDefinition.getTimeoutNotifyStrategy());
+ taskDefinitionVo.setTimeout(taskDefinition.getTimeout());
+ taskDefinitionVo.setDelayTime(taskDefinition.getDelayTime());
+ taskDefinitionVo.setResourceIds(taskDefinition.getResourceIds());
+ taskDefinitionVo.setCreateTime(taskDefinition.getCreateTime());
+ taskDefinitionVo.setUpdateTime(taskDefinition.getUpdateTime());
+ taskDefinitionVo.setModifyBy(taskDefinition.getModifyBy());
+ taskDefinitionVo.setTaskGroupId(taskDefinition.getTaskGroupId());
+ taskDefinitionVo.setTaskGroupPriority(taskDefinition.getTaskGroupPriority());
+ taskDefinitionVo.setCpuQuota(taskDefinition.getCpuQuota());
+ taskDefinitionVo.setMemoryMax(taskDefinition.getMemoryMax());
+ taskDefinitionVo.setTaskExecuteType(taskDefinition.getTaskExecuteType());
+ return taskDefinitionVo;
+ }
+
+}