Browse Source

[Feature][JsonSplit-api] modify API to Restful-01 (#6016)

* 1. update ProcessDefinition API
2. update TaskDefinition API

* 1. update ProcessDefinition API
2. update TaskDefinition API

* Express batch copy in another way

* Update dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

* modify definition statement

* modify switch version statement

* modify definition statement

* Update ProcessDefinitionController.java

* Update ProcessDefinitionController.java

* Update TaskDefinitionController.java

* update process-definition, process-instances, task-definition, task-instances, project and their ui.

* modify ui error

* modify ui error

* 修改导包方式

* merge

* Delete TaskDefinitionService.java

merge

* merge

* Update TaskDefinitionService.java

merge

* Update TaskDefinitionService.java

* Update TaskDefinitionService.java

merge

* modify import

* modify import

* Update actions.js

Co-authored-by: 马浚杰 <manmxhn@163.com>
Co-authored-by: Wenjun Ruan <wenjun@apache.org>
2.0.7-release
Junjie Ma 3 years ago committed by GitHub
parent
commit
e3235098d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 70
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
  2. 77
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
  3. 45
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
  4. 40
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java
  5. 14
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java
  6. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
  7. 73
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
  8. 10
      dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js

70
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java

@ -58,9 +58,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -81,7 +83,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "PROCESS_DEFINITION_TAG")
@RestController
@RequestMapping("projects/{projectCode}/process")
@RequestMapping("projects/{projectCode}/process-definition")
public class ProcessDefinitionController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionController.class);
@ -110,7 +112,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String")
})
@PostMapping(value = "/save")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -138,12 +140,12 @@ public class ProcessDefinitionController extends BaseController {
* @param targetProjectCode target project code
* @return copy result code
*/
@ApiOperation(value = "copy", notes = "COPY_PROCESS_DEFINITION_NOTES")
@ApiOperation(value = "batchCopyByCodes", notes = "COPY_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123")
})
@PostMapping(value = "/copy")
@PostMapping(value = "/batch-copy")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_COPY_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -163,12 +165,12 @@ public class ProcessDefinitionController extends BaseController {
* @param targetProjectCode target project code
* @return move result code
*/
@ApiOperation(value = "moveProcessDefinition", notes = "MOVE_PROCESS_DEFINITION_NOTES")
@ApiOperation(value = "batchMoveByCodes", notes = "MOVE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123")
})
@PostMapping(value = "/move")
@PostMapping(value = "/batch-move")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_MOVE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -226,14 +228,14 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState")
})
@PostMapping(value = "/update")
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "code", required = true) long code,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@ -273,7 +275,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/versions")
@GetMapping(value = "/{code}/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_VERSIONS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -281,7 +283,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "code") long code) {
@PathVariable(value = "code") long code) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
@ -306,14 +308,14 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/version/switch")
@GetMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result switchProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@RequestParam(value = "version") int version) {
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = processDefinitionService.switchProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
@ -332,14 +334,14 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/version/delete")
@DeleteMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@RequestParam(value = "version") int version) {
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = processDefinitionService.deleteProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
@ -359,13 +361,13 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_RELEASE", required = true, dataType = "ReleaseState"),
})
@PostMapping(value = "/release")
@PostMapping(value = "/{code}/release")
@ResponseStatus(HttpStatus.OK)
@ApiException(RELEASE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result releaseProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code", required = true) long code,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "releaseState", required = true) ReleaseState releaseState) {
Map<String, Object> result = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, code, releaseState);
return returnDataList(result);
@ -383,13 +385,13 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789")
})
@GetMapping(value = "/select-by-code")
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code", required = true) long code) {
@PathVariable(value = "code", required = true) long code) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
@ -406,7 +408,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataType = "String")
})
@GetMapping(value = "/select-by-name")
@GetMapping(value = "/query-by-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -453,7 +455,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping(value = "/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -486,13 +488,13 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/view-tree")
@GetMapping(value = "/{code}/view-tree")
@ResponseStatus(HttpStatus.OK)
@ApiException(ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result viewTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("code") long code,
@PathVariable("code") long code,
@RequestParam("limit") Integer limit) {
Map<String, Object> result = processDefinitionService.viewTree(code, limit);
return returnDataList(result);
@ -506,16 +508,16 @@ public class ProcessDefinitionController extends BaseController {
* @param code process definition code
* @return task list
*/
@ApiOperation(value = "getNodeListByDefinitionCode", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES")
@ApiOperation(value = "getTasksByDefinitionCode", notes = "GET_TASK_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100")
})
@GetMapping(value = "gen-task-list")
@GetMapping(value = "/{code}/tasks")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("code") long code) {
@PathVariable("code") long code) {
Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, code);
return returnDataList(result);
}
@ -528,11 +530,11 @@ public class ProcessDefinitionController extends BaseController {
* @param codes process definition codes
* @return node list data
*/
@ApiOperation(value = "getNodeListByDefinitionCodes", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES")
@ApiOperation(value = "getTaskListByDefinitionCodes", notes = "GET_TASK_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, type = "String", example = "100,200,300")
})
@GetMapping(value = "gen-task-list-map")
@GetMapping(value = "/batch-query-tasks")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListMapByDefinitionCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ -554,13 +556,13 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", dataType = "Int", example = "100")
})
@GetMapping(value = "/delete")
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINE_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProcessDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("code") long code) {
@PathVariable("code") long code) {
Map<String, Object> result = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
@ -577,7 +579,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "String")
})
@GetMapping(value = "/batch-delete")
@PostMapping(value = "/batch-delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -622,7 +624,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "String")
})
@GetMapping(value = "/export")
@PostMapping(value = "/batch-export")
@ResponseBody
@AccessLogAnnotation(ignoreRequestArgs = {"loginUser", "response"})
public void batchExportProcessDefinitionByCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ -644,7 +646,7 @@ public class ProcessDefinitionController extends BaseController {
* @return process definition list
*/
@ApiOperation(value = "queryAllByProjectCode", notes = "QUERY_PROCESS_DEFINITION_All_BY_PROJECT_CODE_NOTES")
@GetMapping(value = "/queryAllByProjectCode")
@GetMapping(value = "/all")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

77
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java

@ -51,9 +51,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -72,7 +74,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "PROCESS_INSTANCE_TAG")
@RestController
@RequestMapping("projects/{projectCode}/instance")
@RequestMapping("projects/{projectCode}/process-instances")
public class ProcessInstanceController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProcessInstanceController.class);
@ -95,7 +97,7 @@ public class ProcessInstanceController extends BaseController {
* @param endTime end time
* @return process instance list
*/
@ApiOperation(value = "queryProcessInstanceList", notes = "QUERY_PROCESS_INSTANCE_LIST_NOTES")
@ApiOperation(value = "queryProcessInstanceListPaging", notes = "QUERY_PROCESS_INSTANCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefiniteCode", value = "PROCESS_DEFINITION_CODE", dataType = "Long", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"),
@ -107,7 +109,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping(value = "list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_INSTANCE_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -138,21 +140,21 @@ public class ProcessInstanceController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @param id process instance id
* @return task list for the process instance
*/
@ApiOperation(value = "queryTaskListByProcessId", notes = "QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/task-list-by-process-id")
@GetMapping(value = "/{id}/tasks")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskListByProcessId(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("processInstanceId") Integer processInstanceId) throws IOException {
Map<String, Object> result = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, processInstanceId);
@PathVariable("id") Integer id) throws IOException {
Map<String, Object> result = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, id);
return returnDataList(result);
}
@ -163,7 +165,7 @@ public class ProcessInstanceController extends BaseController {
* @param projectCode project code
* @param taskRelationJson process task relation json
* @param taskDefinitionJson taskDefinitionJson
* @param processInstanceId process instance id
* @param id process instance id
* @param scheduleTime schedule time
* @param syncDefine sync define
* @param locations locations
@ -174,7 +176,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "taskRelationJson", value = "TASK_RELATION_JSON", type = "String"),
@ApiImplicitParam(name = "taskDefinitionJson", value = "TASK_DEFINITION_JSON", type = "String"),
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"),
@ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", required = true, type = "Boolean"),
@ApiImplicitParam(name = "globalParams", value = "PROCESS_GLOBAL_PARAMS", type = "String"),
@ -182,7 +184,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParam(name = "timeout", value = "PROCESS_TIMEOUT", type = "String"),
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", type = "Int", example = "0")
})
@PostMapping(value = "/update")
@PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -190,14 +192,15 @@ public class ProcessInstanceController extends BaseController {
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson,
@RequestParam(value = "processInstanceId") Integer processInstanceId,
@PathVariable(value = "id") Integer id,
@RequestParam(value = "scheduleTime", required = false) String scheduleTime,
@RequestParam(value = "syncDefine", required = true) Boolean syncDefine,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode) {
Map<String, Object> result = processInstanceService.updateProcessInstance(loginUser, projectCode, processInstanceId,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "flag", required = false) Flag flag) {
Map<String, Object> result = processInstanceService.updateProcessInstance(loginUser, projectCode, id,
taskRelationJson, taskDefinitionJson, scheduleTime, syncDefine, globalParams, locations, timeout, tenantCode);
return returnDataList(result);
}
@ -207,21 +210,21 @@ public class ProcessInstanceController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @param id process instance id
* @return process instance detail
*/
@ApiOperation(value = "queryProcessInstanceById", notes = "QUERY_PROCESS_INSTANCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/select-by-id")
@GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_INSTANCE_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessInstanceById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("processInstanceId") Integer processInstanceId) {
Map<String, Object> result = processInstanceService.queryProcessInstanceById(loginUser, projectCode, processInstanceId);
@PathVariable("id") Integer id) {
Map<String, Object> result = processInstanceService.queryProcessInstanceById(loginUser, projectCode, id);
return returnDataList(result);
}
@ -260,21 +263,21 @@ public class ProcessInstanceController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @param id process instance id
* @return delete result code
*/
@ApiOperation(value = "deleteProcessInstanceById", notes = "DELETE_PROCESS_INSTANCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/delete")
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_INSTANCE_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<ProcessInstance> deleteProcessInstanceById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("processInstanceId") Integer processInstanceId) {
Map<String, Object> result = processInstanceService.deleteProcessInstanceById(loginUser, projectCode, processInstanceId);
@PathVariable("id") Integer id) {
Map<String, Object> result = processInstanceService.deleteProcessInstanceById(loginUser, projectCode, id);
return returnDataList(result);
}
@ -290,7 +293,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "taskCode", value = "TASK_CODE", required = true, dataType = "Long", example = "100")
})
@GetMapping(value = "/select-sub-process")
@GetMapping(value = "/query-sub-by-parent")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_SUB_PROCESS_INSTANCE_DETAIL_INFO_BY_TASK_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -313,7 +316,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "subId", value = "SUB_PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/select-parent-process")
@GetMapping(value = "/query-parent-by-sub")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PARENT_PROCESS_INSTANCE_DETAIL_INFO_BY_SUB_PROCESS_INSTANCE_ID_ERROR)
@AccessLogAnnotation
@ -328,20 +331,20 @@ public class ProcessInstanceController extends BaseController {
* query process instance global variables and local variables
*
* @param loginUser login user
* @param processInstanceId process instance id
* @param id process instance id
* @return variables data
*/
@ApiOperation(value = "viewVariables", notes = "QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/view-variables")
@GetMapping(value = "/{id}/view-variables")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_INSTANCE_ALL_VARIABLES_ERROR)
@AccessLogAnnotation
public Result viewVariables(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("processInstanceId") Integer processInstanceId) {
Map<String, Object> result = processInstanceService.viewVariables(processInstanceId);
@PathVariable("id") Integer id) {
Map<String, Object> result = processInstanceService.viewVariables(id);
return returnDataList(result);
}
@ -350,21 +353,21 @@ public class ProcessInstanceController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @param id process instance id
* @return gantt tree data
*/
@ApiOperation(value = "vieGanttTree", notes = "VIEW_GANTT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/view-gantt")
@GetMapping(value = "/{id}/view-gantt")
@ResponseStatus(HttpStatus.OK)
@ApiException(ENCAPSULATION_PROCESS_INSTANCE_GANTT_STRUCTURE_ERROR)
@AccessLogAnnotation
public Result viewTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("processInstanceId") Integer processInstanceId) throws Exception {
Map<String, Object> result = processInstanceService.viewGantt(processInstanceId);
@PathVariable("id") Integer id) throws Exception {
Map<String, Object> result = processInstanceService.viewGantt(id);
return returnDataList(result);
}
@ -382,7 +385,7 @@ public class ProcessInstanceController extends BaseController {
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "processInstanceIds", value = "PROCESS_INSTANCE_IDS", required = true, dataType = "String"),
})
@GetMapping(value = "/batch-delete")
@PostMapping(value = "/batch-delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR)
@AccessLogAnnotation

45
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java

@ -38,8 +38,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -76,7 +79,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String")
})
@PostMapping(value = "/create")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -91,28 +94,28 @@ public class ProjectController extends BaseController {
* update project
*
* @param loginUser login user
* @param projectCode project code
* @param code project code
* @param projectName project name
* @param description description
* @return update result code
*/
@ApiOperation(value = "update", notes = "UPDATE_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456"),
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456"),
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"),
})
@PostMapping(value = "/update")
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectCode") Long projectCode,
@PathVariable("code") Long code,
@RequestParam("projectName") String projectName,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "userName") String userName) {
Map<String, Object> result = projectService.update(loginUser, projectCode, projectName, description, userName);
Map<String, Object> result = projectService.update(loginUser, code, projectName, description, userName);
return returnDataList(result);
}
@ -120,20 +123,20 @@ public class ProjectController extends BaseController {
* query project details by code
*
* @param loginUser login user
* @param projectCode project code
* @param code project code
* @return project detail information
*/
@ApiOperation(value = "queryProjectByCode", notes = "QUERY_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456")
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
})
@GetMapping(value = "/query-by-code")
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROJECT_DETAILS_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProjectByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectCode") long projectCode) {
Map<String, Object> result = projectService.queryByCode(loginUser, projectCode);
@PathVariable("code") long code) {
Map<String, Object> result = projectService.queryByCode(loginUser, code);
return returnDataList(result);
}
@ -152,7 +155,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1")
})
@GetMapping(value = "/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -175,20 +178,20 @@ public class ProjectController extends BaseController {
* delete project by code
*
* @param loginUser login user
* @param projectCode project code
* @param code project code
* @return delete result code
*/
@ApiOperation(value = "delete", notes = "DELETE_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456")
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
})
@GetMapping(value = "/delete")
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectCode") Long projectCode) {
Map<String, Object> result = projectService.deleteProject(loginUser, projectCode);
@PathVariable("code") Long code) {
Map<String, Object> result = projectService.deleteProject(loginUser, code);
return returnDataList(result);
}
@ -203,7 +206,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/unauth-project")
@GetMapping(value = "/unauth")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_UNAUTHORIZED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -225,7 +228,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/authed-project")
@GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_PROJECT)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -242,7 +245,7 @@ public class ProjectController extends BaseController {
* @return projects which the user create and authorized
*/
@ApiOperation(value = "queryProjectCreatedAndAuthorizedByUser", notes = "QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES")
@GetMapping(value = "/created-and-authorized-project")
@GetMapping(value = "/created-and-authed")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -258,7 +261,7 @@ public class ProjectController extends BaseController {
* @return all project list
*/
@ApiOperation(value = "queryAllProjectList", notes = "QUERY_ALL_PROJECT_LIST_NOTES")
@GetMapping(value = "/query-project-list")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

40
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java

@ -39,9 +39,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -60,7 +62,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "TASK_DEFINITION_TAG")
@RestController
@RequestMapping("projects/{projectCode}/task")
@RequestMapping("projects/{projectCode}/task-definition")
public class TaskDefinitionController extends BaseController {
@Autowired
@ -79,7 +81,7 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, type = "Long"),
@ApiImplicitParam(name = "taskDefinitionJson", value = "TASK_DEFINITION_JSON", required = true, type = "String")
})
@PostMapping(value = "/save")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -105,13 +107,13 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "taskDefinitionJsonObj", value = "TASK_DEFINITION_JSON", required = true, type = "String")
})
@PostMapping(value = "/update")
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateTaskDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@PathVariable(value = "code") long code,
@RequestParam(value = "taskDefinitionJsonObj", required = true) String taskDefinitionJsonObj) {
Map<String, Object> result = taskDefinitionService.updateTaskDefinition(loginUser, projectCode, code, taskDefinitionJsonObj);
return returnDataList(result);
@ -134,13 +136,13 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping(value = "/versions")
@GetMapping(value = "/{code}/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_DEFINITION_VERSIONS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskDefinitionVersions(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@PathVariable(value = "code") long code,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize) {
Result result = checkPageParams(pageNo, pageSize);
@ -164,14 +166,14 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/version/switch")
@GetMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_TASK_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result switchTaskDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@RequestParam(value = "version") int version) {
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = taskDefinitionService.switchVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
@ -190,14 +192,14 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/version/delete")
@DeleteMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TASK_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTaskDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code,
@RequestParam(value = "version") int version) {
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = taskDefinitionService.deleteByCodeAndVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
@ -214,13 +216,13 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/delete")
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TASK_DEFINE_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTaskDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code) {
@PathVariable(value = "code") long code) {
Map<String, Object> result = taskDefinitionService.deleteTaskDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
@ -233,17 +235,17 @@ public class TaskDefinitionController extends BaseController {
* @param code the task definition code
* @return task definition detail
*/
@ApiOperation(value = "queryTaskDefinitionDetail", notes = "QUERY_TASK_DEFINITION_DETAIL_NOTES")
@ApiOperation(value = "queryTaskDefinitionByCode", notes = "QUERY_TASK_DEFINITION_DETAIL_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/select-by-code")
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskDefinitionDetail(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "code") long code) {
@PathVariable(value = "code") long code) {
Map<String, Object> result = taskDefinitionService.queryTaskDefinitionDetail(loginUser, projectCode, code);
return returnDataList(result);
}
@ -268,7 +270,7 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping(value = "/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_DEFINITION_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -299,7 +301,7 @@ public class TaskDefinitionController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "genNum", value = "GEN_NUM", required = true, dataType = "Int", example = "1")
})
@GetMapping(value = "/gen-task-code-list")
@GetMapping(value = "/gen-task-codes")
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

14
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java

@ -54,7 +54,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "TASK_INSTANCE_TAG")
@RestController
@RequestMapping("/projects/{projectCode}/task-instance")
@RequestMapping("/projects/{projectCode}/task-instances")
public class TaskInstanceController extends BaseController {
@Autowired
@ -90,7 +90,7 @@ public class TaskInstanceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
})
@GetMapping("/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -123,21 +123,21 @@ public class TaskInstanceController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param taskInstanceId task instance id
* @param id task instance id
* @return the result code and msg
*/
@ApiOperation(value = "force-success", notes = "FORCE_TASK_SUCCESS")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskInstanceId", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12")
@ApiImplicitParam(name = "id", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12")
})
@PostMapping(value = "/force-success")
@PostMapping(value = "/{id}/force-success")
@ResponseStatus(HttpStatus.OK)
@ApiException(FORCE_TASK_SUCCESS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<Object> forceTaskSuccess(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "taskInstanceId") Integer taskInstanceId) {
Map<String, Object> result = taskInstanceService.forceTaskSuccess(loginUser, projectCode, taskInstanceId);
@PathVariable(value = "id") Integer id) {
Map<String, Object> result = taskInstanceService.forceTaskSuccess(loginUser, projectCode, id);
return returnDataList(result);
}

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java

@ -157,5 +157,5 @@ public interface TaskDefinitionService {
*/
Map<String, Object> genTaskCodeList(User loginUser,
Integer genNum);
}
}

73
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@ -25,9 +25,7 @@ export default {
*/
getTaskState ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/task-list-by-process-id`, {
processInstanceId: payload
}, res => {
io.get(`projects/${state.projectCode}/process-instances/${payload}/tasks`, payload, res => {
const arr = _.map(res.data.taskList, v => {
return _.cloneDeep(_.assign(tasksState[v.state], {
name: v.name,
@ -50,8 +48,7 @@ export default {
*/
editProcessState ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process/release`, {
code: payload.code,
io.post(`projects/${state.projectCode}/process-definition/${payload.code}/release`, {
name: payload.name,
releaseState: payload.releaseState
}, res => {
@ -67,7 +64,7 @@ export default {
*/
getProcessDefinitionVersionsPage ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/versions`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/${payload.code}/versions`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -80,7 +77,7 @@ export default {
*/
switchProcessDefinitionVersion ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/version/switch`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/${payload.code}/versions/${payload.version}`, {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -93,7 +90,7 @@ export default {
*/
deleteProcessDefinitionVersion ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/version/delete`, payload, res => {
io.delete(`projects/${state.projectCode}/process-definition/${payload.code}/versiond/${payload.version}`, {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -121,7 +118,7 @@ export default {
*/
verifDAGName ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/verify-name`, {
io.get(`projects/${state.projectCode}/process-definition/verify-name`, {
name: payload
}, res => {
state.name = payload
@ -137,8 +134,7 @@ export default {
*/
getProcessDetails ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/select-by-code`, {
code: payload
io.get(`projects/${state.projectCode}/process-definition/${payload}`, {
}, res => {
// process definition code
state.code = res.data.processDefinition.code
@ -188,7 +184,7 @@ export default {
*/
copyProcess ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process/copy`, {
io.post(`projects/${state.projectCode}/process-definition/batch-copy`, {
processDefinitionIds: payload.processDefinitionIds,
targetProjectId: payload.targetProjectId
}, res => {
@ -204,7 +200,7 @@ export default {
*/
moveProcess ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.project}/process/move`, {
io.post(`projects/${state.projectCode}/process-definition/batch-move`, {
processDefinitionIds: payload.processDefinitionIds,
targetProjectId: payload.targetProjectId
}, res => {
@ -220,7 +216,7 @@ export default {
*/
getAllItems ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('projects/created-and-authorized-project', {}, res => {
io.get('projects/created-and-authed', {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -233,8 +229,7 @@ export default {
*/
getInstancedetail ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/select-by-id`, {
processInstanceId: payload
io.get(`projects/${state.projectCode}/process-instances/${payload}`, {
}, res => {
const { processDefinition, processTaskRelationList, taskDefinitionList } = res.data.dagData
// code
@ -288,7 +283,7 @@ export default {
*/
saveDAGchart ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process/save`, {
io.post(`projects/${state.projectCode}/process-definition`, {
locations: JSON.stringify(state.locations),
name: _.trim(state.name),
taskDefinitionJson: JSON.stringify(state.tasks),
@ -309,7 +304,7 @@ export default {
*/
updateDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/process/update`, {
io.put(`projects/${state.projectCode}/process-definition/${payload}`, {
locations: JSON.stringify(state.locations),
name: _.trim(state.name),
taskDefinitionJson: JSON.stringify(state.tasks),
@ -318,8 +313,7 @@ export default {
description: _.trim(state.description),
globalParams: JSON.stringify(state.globalParams),
timeout: state.timeout,
releaseState: state.releaseState,
code: payload
releaseState: state.releaseState
}, res => {
resolve(res)
state.isEditDag = false
@ -339,11 +333,10 @@ export default {
tenantId: state.tenantId,
timeout: state.timeout
}
io.post(`projects/${state.projectCode}/instance/update`, {
io.put(`projects/${state.projectCode}/process-instances/${payload}`, {
processInstanceJson: JSON.stringify(data),
locations: JSON.stringify(state.locations),
connects: JSON.stringify(state.connects),
processInstanceId: payload,
syncDefine: state.syncDefine
}, res => {
resolve(res)
@ -362,7 +355,7 @@ export default {
resolve()
return
}
io.get(`projects/${state.projectCode}/process/list`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/list`, payload, res => {
state.processListS = res.data
resolve(res.data)
}).catch(res => {
@ -375,7 +368,7 @@ export default {
*/
getProcessListP ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/list-paging`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition`, payload, res => {
resolve(res.data)
}).catch(res => {
reject(res)
@ -391,7 +384,7 @@ export default {
resolve()
return
}
io.get('projects/query-project-list', payload, res => {
io.get('projects/list', payload, res => {
state.projectListS = res.data
resolve(res.data)
}).catch(res => {
@ -404,7 +397,7 @@ export default {
*/
getProcessByProjectId ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/queryProcessDefinitionAllByProjectId`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/all`, payload, res => {
resolve(res.data)
}).catch(res => {
reject(res)
@ -468,7 +461,7 @@ export default {
*/
getProcessInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/list-paging`, payload, res => {
io.get(`projects/${state.projectCode}/process-instances`, payload, res => {
state.instanceListS = res.data.totalList
resolve(res.data)
}).catch(res => {
@ -525,7 +518,7 @@ export default {
*/
getSubProcessId ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/select-sub-process`, payload, res => {
io.get(`projects/${state.projectCode}/process-instances/query-sub-by-parent`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -622,7 +615,7 @@ export default {
*/
deleteInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/delete`, payload, res => {
io.delete(`projects/${state.projectCode}/process-instances/${payload.code}`, {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -634,7 +627,7 @@ export default {
*/
batchDeleteInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/batch-delete`, payload, res => {
io.post(`projects/${state.projectCode}/process-instances/batch-delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -646,7 +639,7 @@ export default {
*/
deleteDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/delete`, payload, res => {
io.delete(`projects/${state.projectCode}/process-definition/${payload.code}`, {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -658,7 +651,7 @@ export default {
*/
batchDeleteDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/batch-delete`, payload, res => {
io.post(`projects/${state.projectCode}/process-definition/batch-delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -690,7 +683,7 @@ export default {
}
}
io.get(`projects/${state.projectCode}/process/export`, { processDefinitionIds: payload.processDefinitionIds }, res => {
io.post(`projects/${state.projectCode}/process-definition/batch-export`, { processDefinitionIds: payload.processDefinitionIds }, res => {
downloadBlob(res, payload.fileName)
}, e => {
@ -704,7 +697,7 @@ export default {
*/
getViewvariables ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/view-variables`, payload, res => {
io.get(`projects/${state.projectCode}/process-instances/${payload.code}/view-variables`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -728,7 +721,7 @@ export default {
*/
getTaskInstanceList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/task-instance/list-paging`, payload, res => {
io.get(`projects/${state.projectCode}/task-instances`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -740,7 +733,7 @@ export default {
*/
forceTaskSuccess ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/task-instance/force-success`, payload, res => {
io.post(`projects/${state.projectCode}/task-instances/${payload.code}/force-success`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -776,7 +769,7 @@ export default {
*/
getViewTree ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/view-tree`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/${payload.code}/view-tree`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -788,7 +781,7 @@ export default {
*/
getViewGantt ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/instance/view-gantt`, payload, res => {
io.get(`projects/${state.projectCode}/process-instances/${payload.code}/view-gantt`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -800,7 +793,7 @@ export default {
*/
getProcessTasksList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/gen-task-list`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/${payload.code}/tasks`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -809,7 +802,7 @@ export default {
},
getTaskListDefIdAll ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/process/get-task-list`, payload, res => {
io.get(`projects/${state.projectCode}/process-definition/tatch-query-tasks`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)

10
dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js

@ -23,7 +23,7 @@ export default {
*/
getProjectsList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('projects/list-paging', payload, res => {
io.get('projects', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -35,7 +35,7 @@ export default {
*/
getProjectById ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('projects/query-by-id', payload, res => {
io.get(`projects/${payload}`, {}, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -47,7 +47,7 @@ export default {
*/
createProjects ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('projects/create', payload, res => {
io.post('projects', payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -59,7 +59,7 @@ export default {
*/
deleteProjects ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('projects/delete', payload, res => {
io.delete(`projects/${payload}`, {}, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -71,7 +71,7 @@ export default {
*/
updateProjects ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('projects/update', payload, res => {
io.put(`projects/${payload.projectId}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)

Loading…
Cancel
Save