Browse Source

[Feature][JsonSplit-api] modify API to Restful-02 (#6090)

* update AccessToken
update AlertGroup
update AlertPluginInstance
update Datasource

* update AccessToken
update AlertGroup
update AlertPluginInstance
update Datasource

* merge

Co-authored-by: Junjie Ma <manmxhn@163.com>
2.0.7-release
Junjie Ma 3 years ago committed by GitHub
parent
commit
d510a13f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java
  2. 19
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java
  3. 31
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java
  4. 29
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java
  5. 2
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
  6. 10
      dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js
  7. 26
      dolphinscheduler-ui/src/js/conf/home/store/security/actions.js
  8. 10
      dolphinscheduler-ui/src/js/conf/home/store/user/actions.js

18
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java

@ -35,8 +35,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -49,12 +52,13 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
/** /**
* access token controller * access token controller
*/ */
@Api(tags = "ACCESS_TOKEN_TAG") @Api(tags = "ACCESS_TOKEN_TAG")
@RestController @RestController
@RequestMapping("/access-token") @RequestMapping("/access-tokens")
public class AccessTokenController extends BaseController { public class AccessTokenController extends BaseController {
@Autowired @Autowired
@ -70,7 +74,7 @@ public class AccessTokenController extends BaseController {
* @return create result state code * @return create result state code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ACCESS_TOKEN_ERROR) @ApiException(CREATE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -118,7 +122,7 @@ public class AccessTokenController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -144,12 +148,12 @@ public class AccessTokenController extends BaseController {
* @return delete result code * @return delete result code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ACCESS_TOKEN_ERROR) @ApiException(DELETE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
@ -166,12 +170,12 @@ public class AccessTokenController extends BaseController {
* @return update result code * @return update result code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ACCESS_TOKEN_ERROR) @ApiException(UPDATE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "userId") int userId, @RequestParam(value = "userId") int userId,
@RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "expireTime") String expireTime,
@RequestParam(value = "token") String token) { @RequestParam(value = "token") String token) {

19
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java

@ -38,8 +38,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "ALERT_GROUP_TAG") @Api(tags = "ALERT_GROUP_TAG")
@RestController @RestController
@RequestMapping("alert-group") @RequestMapping("/alert-groups")
public class AlertGroupController extends BaseController { public class AlertGroupController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AlertGroupController.class); private static final Logger logger = LoggerFactory.getLogger(AlertGroupController.class);
@ -80,7 +83,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"),
@ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ALERT_GROUP_ERROR) @ApiException(CREATE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -124,7 +127,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_PAGING_ALERT_GROUP_ERROR) @ApiException(LIST_PAGING_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -156,12 +159,12 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"),
@ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ALERT_GROUP_ERROR) @ApiException(UPDATE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateAlertgroup(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateAlertgroup(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "groupName") String groupName, @RequestParam(value = "groupName") String groupName,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "alertInstanceIds") String alertInstanceIds) { @RequestParam(value = "alertInstanceIds") String alertInstanceIds) {
@ -181,12 +184,12 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ALERT_GROUP_ERROR) @ApiException(DELETE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delAlertgroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delAlertgroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertGroupService.delAlertgroupById(loginUser, id); Map<String, Object> result = alertGroupService.delAlertgroupById(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
@ -203,7 +206,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"),
}) })
@GetMapping(value = "/verify-group-name") @GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,

31
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java

@ -38,8 +38,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "ALERT_PLUGIN_INSTANCE_TAG") @Api(tags = "ALERT_PLUGIN_INSTANCE_TAG")
@RestController @RestController
@RequestMapping("alert-plugin-instance") @RequestMapping("alert-plugin-instances")
public class AlertPluginInstanceController extends BaseController { public class AlertPluginInstanceController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AlertPluginInstanceController.class); private static final Logger logger = LoggerFactory.getLogger(AlertPluginInstanceController.class);
@ -81,7 +84,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"),
@ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -97,7 +100,7 @@ public class AlertPluginInstanceController extends BaseController {
* updateAlertPluginInstance * updateAlertPluginInstance
* *
* @param loginUser login user * @param loginUser login user
* @param alertPluginInstanceId alert plugin instance id * @param id alert plugin instance id
* @param instanceName instance name * @param instanceName instance name
* @param pluginInstanceParams instance params * @param pluginInstanceParams instance params
* @return result * @return result
@ -108,15 +111,15 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"),
@ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "alertPluginInstanceId") int alertPluginInstanceId, @PathVariable(value = "id") int id,
@RequestParam(value = "instanceName") String instanceName, @RequestParam(value = "instanceName") String instanceName,
@RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) { @RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) {
Map<String, Object> result = alertPluginInstanceService.update(loginUser, alertPluginInstanceId, instanceName, pluginInstanceParams); Map<String, Object> result = alertPluginInstanceService.update(loginUser, id, instanceName, pluginInstanceParams);
return returnDataList(result); return returnDataList(result);
} }
@ -131,12 +134,12 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertPluginInstanceService.delete(loginUser, id); Map<String, Object> result = alertPluginInstanceService.delete(loginUser, id);
return returnDataList(result); return returnDataList(result);
@ -150,12 +153,12 @@ public class AlertPluginInstanceController extends BaseController {
* @return result * @return result
*/ */
@ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES") @ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES")
@PostMapping(value = "/get") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertPluginInstanceService.get(loginUser, id); Map<String, Object> result = alertPluginInstanceService.get(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
@ -166,8 +169,8 @@ public class AlertPluginInstanceController extends BaseController {
* @param loginUser login user * @param loginUser login user
* @return result * @return result
*/ */
@ApiOperation(value = "queryAllAlertPluginInstance", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES") @ApiOperation(value = "queryAlertPluginInstanceList", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES")
@PostMapping(value = "/queryAll") @GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -187,7 +190,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"),
}) })
@GetMapping(value = "/verify-alert-instance-name") @GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ -219,7 +222,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")

29
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java

@ -46,8 +46,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -81,7 +84,7 @@ public class DataSourceController extends BaseController {
* @return create result code * @return create result code
*/ */
@ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES") @ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES")
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_DATASOURCE_ERROR) @ApiException(CREATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -96,19 +99,23 @@ public class DataSourceController extends BaseController {
* updateProcessInstance data source * updateProcessInstance data source
* *
* @param loginUser login user * @param loginUser login user
* @param id datasource id
* @param dataSourceParam datasource param * @param dataSourceParam datasource param
* @return update result code * @return update result code
*/ */
@ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES") @ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"),
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_DATASOURCE_ERROR) @ApiException(UPDATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable(value = "id") Integer id,
@RequestBody BaseDataSourceParamDTO dataSourceParam) { @RequestBody BaseDataSourceParamDTO dataSourceParam) {
dataSourceParam.setId(id);
return dataSourceService.updateDataSource(dataSourceParam.getId(), loginUser, dataSourceParam); return dataSourceService.updateDataSource(dataSourceParam.getId(), loginUser, dataSourceParam);
} }
@ -124,12 +131,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/update-ui") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR) @ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
Map<String, Object> result = dataSourceService.queryDataSource(id); Map<String, Object> result = dataSourceService.queryDataSource(id);
return returnDataList(result); return returnDataList(result);
@ -171,7 +178,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR) @ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -220,12 +227,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/connect-by-id") @GetMapping(value = "/{id}/connect-test")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(CONNECTION_TEST_FAILURE) @ApiException(CONNECTION_TEST_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
return dataSourceService.connectionTest(id); return dataSourceService.connectionTest(id);
} }
@ -240,12 +247,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_DATA_SOURCE_FAILURE) @ApiException(DELETE_DATA_SOURCE_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
return dataSourceService.delete(loginUser, id); return dataSourceService.delete(loginUser, id);
} }
@ -282,7 +289,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/unauth-datasource") @GetMapping(value = "/unauth")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UNAUTHORIZED_DATASOURCE) @ApiException(UNAUTHORIZED_DATASOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -305,7 +312,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/authed-datasource") @GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(AUTHORIZED_DATA_SOURCE) @ApiException(AUTHORIZED_DATA_SOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")

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

@ -481,7 +481,7 @@ export default {
*/ */
getNotifyGroupList ({ state }, payload) { getNotifyGroupList ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-group/list', res => { io.get('alert-groups/list', res => {
state.notifyGroupListS = _.map(res.data, v => { state.notifyGroupListS = _.map(res.data, v => {
return { return {
id: v.id, id: v.id,

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

@ -27,7 +27,7 @@ export default {
*/ */
createDatasources ({ state }, payload) { createDatasources ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('datasources/create', payload, res => { io.post('datasources', payload, res => {
resolve(res) resolve(res)
}, () => { }, () => {
// do nothing // do nothing
@ -72,7 +72,7 @@ export default {
*/ */
getDatasourcesListP ({ state }, payload) { getDatasourcesListP ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('datasources/list-paging', payload, res => { io.get('datasources', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -84,7 +84,7 @@ export default {
*/ */
deleteDatasource ({ state }, payload) { deleteDatasource ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('datasources/delete', payload, res => { io.delete(`datasources/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -96,7 +96,7 @@ export default {
*/ */
updateDatasource ({ state }, payload) { updateDatasource ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('datasources/update', payload, res => { io.put(`datasources/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}, () => { }, () => {
// do nothing // do nothing
@ -107,7 +107,7 @@ export default {
}, },
getEditDatasource ({ state }, payload) { getEditDatasource ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('datasources/update-ui', payload, res => { io.get(`datasources/${payload.id}`, payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)

26
dolphinscheduler-ui/src/js/conf/home/store/security/actions.js

@ -42,13 +42,13 @@ export default {
param: { param: {
groupName: payload.groupName groupName: payload.groupName
}, },
api: 'alert-group/verify-group-name' api: 'alert-groups/verify-name'
}, },
alarmInstance: { alarmInstance: {
param: { param: {
alertInstanceName: payload.instanceName alertInstanceName: payload.instanceName
}, },
api: 'alert-plugin-instance/verify-alert-instance-name' api: 'alert-plugin-instances/verify-name'
} }
} }
@ -350,7 +350,7 @@ export default {
*/ */
queryAlertGroupListPaging ({ state }, payload) { queryAlertGroupListPaging ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-group/list-paging', payload, res => { io.get('alert-groups', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -362,7 +362,7 @@ export default {
*/ */
queryAlertPluginInstanceListPaging ({ state }, payload) { queryAlertPluginInstanceListPaging ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-plugin-instance/list-paging', payload, res => { io.get('alert-plugin-instances', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -398,7 +398,7 @@ export default {
*/ */
queryAllAlertPluginInstance ({ state }, payload) { queryAllAlertPluginInstance ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-plugin-instance/queryAll', payload, res => { io.get('alert-plugin-instance/list', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -410,7 +410,7 @@ export default {
*/ */
getAlertgroup ({ state }, payload) { getAlertgroup ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-group/list', payload, res => { io.get('alert-groups/list', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -422,7 +422,7 @@ export default {
*/ */
createAlertgrou ({ state }, payload) { createAlertgrou ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-group/create', payload, res => { io.post('alert-groups', payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -434,7 +434,7 @@ export default {
*/ */
createAlertPluginInstance ({ state }, payload) { createAlertPluginInstance ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-plugin-instance/create', payload, res => { io.post('alert-plugin-instances', payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -446,7 +446,7 @@ export default {
*/ */
updateAlertPluginInstance ({ state }, payload) { updateAlertPluginInstance ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-plugin-instance/update', payload, res => { io.put(`alert-plugin-instances/${payload.alertPluginInstanceId}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -458,7 +458,7 @@ export default {
*/ */
updateAlertgrou ({ state }, payload) { updateAlertgrou ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-group/update', payload, res => { io.put(`alert-groups/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -470,7 +470,7 @@ export default {
*/ */
deleteAlertgrou ({ state }, payload) { deleteAlertgrou ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('alert-group/delete', payload, res => { io.delete(`alert-groups/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -482,7 +482,7 @@ export default {
*/ */
deletAelertPluginInstance ({ state }, payload) { deletAelertPluginInstance ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-plugin-instance/delete', payload, res => { io.delete(`alert-plugin-instance/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -605,7 +605,7 @@ export default {
*/ */
getAlarmGroupsAll ({ state }, payload) { getAlarmGroupsAll ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('alert-group/list', payload, res => { io.get('alert-groups/list', payload, res => {
state.alarmGroupsListAll = res.data state.alarmGroupsListAll = res.data
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {

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

@ -52,7 +52,7 @@ export default {
*/ */
getTokenListP ({ state }, payload) { getTokenListP ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.get('access-token/list-paging', payload, res => { io.get('access-tokens', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -68,7 +68,7 @@ export default {
*/ */
createToken ({ state }, payload) { createToken ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('access-token/create', payload, res => { io.post('access-tokens', payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -84,7 +84,7 @@ export default {
*/ */
updateToken ({ state }, payload) { updateToken ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('access-token/update', payload, res => { io.put(`access-tokens/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -99,7 +99,7 @@ export default {
*/ */
generateToken ({ state }, payload) { generateToken ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('access-token/generate', payload, res => { io.post('access-tokens/generate', payload, res => {
resolve(res.data) resolve(res.data)
}).catch(e => { }).catch(e => {
reject(e) reject(e)
@ -113,7 +113,7 @@ export default {
*/ */
deleteToken ({ state }, payload) { deleteToken ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('access-token/delete', payload, res => { io.delete(`access-token/${payload.id}`, payload, res => {
resolve(res) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)

Loading…
Cancel
Save