You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/01/13 08:34:04 UTC

[GitHub] [incubator-dolphinscheduler] zt-1997 commented on a change in pull request #4437: After the workflow editing page is submitted, the user chooses whether to go online or not. 0 means not to go online, 1 means online.

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



##########
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:
       This will go twice network IO, relatively slow
   




----------------------------------------------------------------
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:
users@infra.apache.org