zhuangchong commented on a change in pull request #4437:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/4437#discussion_r556331293



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
##########
@@ -249,31 +250,41 @@ public Result updateProcessDefinition(@ApiIgnore 
@RequestAttribute(value = Const
                                           @RequestParam(value = 
"processDefinitionJson", required = true) String processDefinitionJson,
                                           @RequestParam(value = "locations", 
required = false) String locations,
                                           @RequestParam(value = "connects", 
required = false) String connects,
-                                          @RequestParam(value = "description", 
required = false) String description) {
+                                          @RequestParam(value = "description", 
required = false) String description,
+                                          @RequestParam(value = 
"releaseState", required = false, defaultValue = "0") int releaseState) {
 
         logger.info("login user {}, update process define, project name: {}, 
process define name: {}, "
-                        + "process_definition_json: {}, desc: {}, 
locations:{}, connects:{}",
-                loginUser.getUserName(), projectName, name, 
processDefinitionJson, description, locations, connects);
+                + "process_definition_json: {}, desc: {}, locations:{}, 
connects:{}",
+            loginUser.getUserName(), projectName, name, processDefinitionJson, 
description, locations, connects);
         Map<String, Object> result = 
processDefinitionService.updateProcessDefinition(loginUser, projectName, id, 
name,
-                processDefinitionJson, description, locations, connects);
+            processDefinitionJson, description, locations, connects);
+        //  If the update fails, the result will be returned directly
+        Status status = (Status) result.get("status");
+        if (status.getCode() != 0) {
+            return returnDataList(result);
+        }
+        //  Judge whether to go online after editing,0 means offline, 1 means 
online
+        if (releaseState == 1) {
+            result = 
processDefinitionService.releaseProcessDefinition(loginUser, projectName, id, 
releaseState);
+        }

Review comment:
       One question about this change? Wouldn't it be better to have control on 
the front end to call the two methods on the back end, updateProcessDefinition 
and ReleaseProcessDefinition respectively, without changing the code on the 
back end?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to