caishunfeng commented on code in PR #10873:
URL: https://github.com/apache/dolphinscheduler/pull/10873#discussion_r917518433
##########
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapper.xml:
##########
@@ -161,4 +161,58 @@
</if>
AND a.task_type = 'DEPENDENT'
</select>
+
+ <select id="queryTaskDepOnProcess"
resultType="org.apache.dolphinscheduler.dao.entity.TaskMainInfo">
+ select td.id
+ , td.name as taskName
+ , td.code as taskCode
+ , td.version as taskVersion
+ , td.task_type as taskType
+ , ptr.process_definition_code as processDefinitionCode
+ , pd.name as processDefinitionName
+ , pd.version as processDefinitionVersion
+ , pd.release_state as processReleaseState
+ from t_ds_task_definition td
+ join t_ds_process_task_relation ptr on ptr.post_task_code = td.code
and td.version = ptr.post_task_version
+ join t_ds_process_definition pd on pd.code =
ptr.process_definition_code and pd.version = ptr.process_definition_version
+ <where>
+ <if test="projectCode != 0">
+ and ptr.project_code = #{projectCode}
+ </if>
+ <if test="processDefinitionCode != 0">
+ and ptr.process_definition_code != #{processDefinitionCode}
+ and (
+ td.task_params like concat('%"definitionCode":',
#{processDefinitionCode}, '%')
Review Comment:
:crying_cat_face: why we had two ways....
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java:
##########
@@ -106,4 +115,36 @@ public Result<Map<String, Object>>
queryWorkFlowLineage(@ApiIgnore @RequestAttri
return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(),
QUERY_WORKFLOW_LINEAGE_ERROR.getMsg());
}
}
+
+ /**
+ * Whether task can be deleted or not, avoiding task depend on other task
of process definition delete by accident.
+ *
+ * @param loginUser login user
+ * @param projectCode project codes which taskCode belong
+ * @param processDefinitionCode project code which taskCode belong
+ * @param taskCode task definition code
+ * @return Result of task can be delete or not
+ */
+ @ApiOperation(value = "verifyTaskCanDelete", notes =
"VERIFY_TASK_CAN_DELETE")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "projectCode", value =
"PROCESS_DEFINITION_NAME", required = true, type = "Long"),
+ @ApiImplicitParam(name = "processDefinitionCode", value =
"PROCESS_DEFINITION_CODE", required = true, type = "processDefinitionCode"),
+ @ApiImplicitParam(name = "taskCode", value = "TASK_DEFINITION_CODE",
required = true, dataType = "Long", example = "123456789"),
+ })
+ @PostMapping(value = "/tasks/verify-delete")
+ @ResponseStatus(HttpStatus.OK)
+ @ApiException(TASK_WITH_DEPENDENT_ERROR)
+ @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
+ public Result verifyTaskCanDelete(@ApiIgnore @RequestAttribute(value =
Constants.SESSION_USER) User loginUser,
Review Comment:
Does it need to modify UI?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]