zhongjiajie commented on code in PR #10873:
URL: https://github.com/apache/dolphinscheduler/pull/10873#discussion_r917565201
##########
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:
and why we should call this method final in frontend, it is because when
user makes some batch change in workflow, like add five tasks and remove one
task, which the remove task is used in other workflows. And dolphinschelduler
will raise error when users try to save this workflow(expect behavior) but the
bad side is the five new adding tasks will not add to database too, I think is
not user friendly for users, so maybe we should verify task can delete firstly
--
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]