zhongjiajie commented on code in PR #10873:
URL: https://github.com/apache/dolphinscheduler/pull/10873#discussion_r917562478


##########
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:
   we can not add this method in frontend now because the dependent tasks can 
be dependent in the same workflow(this check only check task-dependent in 
others' workflow), and it will raise an error when we call this method, which 
will make task can never be deleted



-- 
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]

Reply via email to