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


##########
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:
   Currently, it should not, this method only needs to call in frontend when we 
close #10878. When the user selects single in the frontend and try to delete 
it, have to call `verifyTaskCanDelete` to determine task can be deleted or not. 
   
![image](https://user-images.githubusercontent.com/15820530/178197131-4e69c8dd-3baf-4403-af3b-c2293db04ee9.png)
   



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