From d510a13f22df6ba128b48e876ef75bb2b29253aa Mon Sep 17 00:00:00 2001 From: Junjie Ma <72343214+manmandm@users.noreply.github.com> Date: Mon, 6 Sep 2021 17:29:08 +0800 Subject: [PATCH] [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 --- .../api/controller/AccessTokenController.java | 18 ++++++----- .../api/controller/AlertGroupController.java | 19 +++++++----- .../AlertPluginInstanceController.java | 31 ++++++++++--------- .../api/controller/DataSourceController.java | 29 ++++++++++------- .../src/js/conf/home/store/dag/actions.js | 2 +- .../js/conf/home/store/datasource/actions.js | 10 +++--- .../js/conf/home/store/security/actions.js | 26 ++++++++-------- .../src/js/conf/home/store/user/actions.js | 10 +++--- 8 files changed, 81 insertions(+), 64 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java index f0777d83e3..01bb22d9ae 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java +++ b/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.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; @@ -49,12 +52,13 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; + /** * access token controller */ @Api(tags = "ACCESS_TOKEN_TAG") @RestController -@RequestMapping("/access-token") +@RequestMapping("/access-tokens") public class AccessTokenController extends BaseController { @Autowired @@ -70,7 +74,7 @@ public class AccessTokenController extends BaseController { * @return create result state code */ @ApiIgnore - @PostMapping(value = "/create") + @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ACCESS_TOKEN_ERROR) @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 = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) - @GetMapping(value = "/list-paging") + @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -144,12 +148,12 @@ public class AccessTokenController extends BaseController { * @return delete result code */ @ApiIgnore - @PostMapping(value = "/delete") + @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "id") int id) { + @PathVariable(value = "id") int id) { Map result = accessTokenService.delAccessTokenById(loginUser, id); return returnDataList(result); } @@ -166,12 +170,12 @@ public class AccessTokenController extends BaseController { * @return update result code */ @ApiIgnore - @PostMapping(value = "/update") + @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "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 = "expireTime") String expireTime, @RequestParam(value = "token") String token) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java index cb1b206fea..a31a423b85 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java +++ b/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.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; @@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore; */ @Api(tags = "ALERT_GROUP_TAG") @RestController -@RequestMapping("alert-group") +@RequestMapping("/alert-groups") public class AlertGroupController extends BaseController { 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 = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") }) - @PostMapping(value = "/create") + @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ALERT_GROUP_ERROR) @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 = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) - @GetMapping(value = "/list-paging") + @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(LIST_PAGING_ALERT_GROUP_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -156,12 +159,12 @@ public class AlertGroupController extends BaseController { @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") }) - @PostMapping(value = "/update") + @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ALERT_GROUP_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "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 = "description", required = false) String description, @RequestParam(value = "alertInstanceIds") String alertInstanceIds) { @@ -181,12 +184,12 @@ public class AlertGroupController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100") }) - @PostMapping(value = "/delete") + @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ALERT_GROUP_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result delAlertgroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "id") int id) { + @PathVariable(value = "id") int id) { Map result = alertGroupService.delAlertgroupById(loginUser, id); return returnDataList(result); } @@ -203,7 +206,7 @@ public class AlertGroupController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), }) - @GetMapping(value = "/verify-group-name") + @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java index c5eefcefaa..2e241a50c6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java +++ b/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.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; @@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore; */ @Api(tags = "ALERT_PLUGIN_INSTANCE_TAG") @RestController -@RequestMapping("alert-plugin-instance") +@RequestMapping("alert-plugin-instances") public class AlertPluginInstanceController extends BaseController { 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 = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) - @PostMapping(value = "/create") + @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -97,7 +100,7 @@ public class AlertPluginInstanceController extends BaseController { * updateAlertPluginInstance * * @param loginUser login user - * @param alertPluginInstanceId alert plugin instance id + * @param id alert plugin instance id * @param instanceName instance name * @param pluginInstanceParams instance params * @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 = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) - @PostMapping(value = "/update") + @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "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 = "pluginInstanceParams") String pluginInstanceParams) { - Map result = alertPluginInstanceService.update(loginUser, alertPluginInstanceId, instanceName, pluginInstanceParams); + Map result = alertPluginInstanceService.update(loginUser, id, instanceName, pluginInstanceParams); return returnDataList(result); } @@ -131,12 +134,12 @@ public class AlertPluginInstanceController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") }) - @GetMapping(value = "/delete") + @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "id") int id) { + @PathVariable(value = "id") int id) { Map result = alertPluginInstanceService.delete(loginUser, id); return returnDataList(result); @@ -150,12 +153,12 @@ public class AlertPluginInstanceController extends BaseController { * @return result */ @ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES") - @PostMapping(value = "/get") + @GetMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "id") int id) { + @PathVariable(value = "id") int id) { Map result = alertPluginInstanceService.get(loginUser, id); return returnDataList(result); } @@ -166,8 +169,8 @@ public class AlertPluginInstanceController extends BaseController { * @param loginUser login user * @return result */ - @ApiOperation(value = "queryAllAlertPluginInstance", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES") - @PostMapping(value = "/queryAll") + @ApiOperation(value = "queryAlertPluginInstanceList", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES") + @GetMapping(value = "/list") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -187,7 +190,7 @@ public class AlertPluginInstanceController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), }) - @GetMapping(value = "/verify-alert-instance-name") + @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @AccessLogAnnotation(ignoreRequestArgs = "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 = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) - @GetMapping(value = "/list-paging") + @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java index dc8e17186d..eb1ddd560a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java +++ b/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.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.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -81,7 +84,7 @@ public class DataSourceController extends BaseController { * @return create result code */ @ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES") - @PostMapping(value = "/create") + @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_DATASOURCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -96,19 +99,23 @@ public class DataSourceController extends BaseController { * updateProcessInstance data source * * @param loginUser login user + * @param id datasource id * @param dataSourceParam datasource param * @return update result code */ @ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES") @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Integer"), @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), }) - @PostMapping(value = "/update") + @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_DATASOURCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @PathVariable(value = "id") Integer id, @RequestBody BaseDataSourceParamDTO dataSourceParam) { + dataSourceParam.setId(id); 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") }) - @PostMapping(value = "/update-ui") + @GetMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_DATASOURCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("id") int id) { + @PathVariable("id") int id) { Map result = dataSourceService.queryDataSource(id); 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 = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) - @GetMapping(value = "/list-paging") + @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_DATASOURCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -220,12 +227,12 @@ public class DataSourceController extends BaseController { @ApiImplicitParams({ @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) @ApiException(CONNECTION_TEST_FAILURE) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("id") int id) { + @PathVariable("id") int id) { return dataSourceService.connectionTest(id); } @@ -240,12 +247,12 @@ public class DataSourceController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") }) - @GetMapping(value = "/delete") + @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_DATA_SOURCE_FAILURE) @AccessLogAnnotation(ignoreRequestArgs = "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); } @@ -282,7 +289,7 @@ public class DataSourceController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) - @GetMapping(value = "/unauth-datasource") + @GetMapping(value = "/unauth") @ResponseStatus(HttpStatus.OK) @ApiException(UNAUTHORIZED_DATASOURCE) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") @@ -305,7 +312,7 @@ public class DataSourceController extends BaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) - @GetMapping(value = "/authed-datasource") + @GetMapping(value = "/authed") @ResponseStatus(HttpStatus.OK) @ApiException(AUTHORIZED_DATA_SOURCE) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js index 9ac787d521..166d522ce5 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -481,7 +481,7 @@ export default { */ getNotifyGroupList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('alert-group/list', res => { + io.get('alert-groups/list', res => { state.notifyGroupListS = _.map(res.data, v => { return { id: v.id, diff --git a/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js index 7b60fc3e8b..754eb66dd8 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js @@ -27,7 +27,7 @@ export default { */ createDatasources ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('datasources/create', payload, res => { + io.post('datasources', payload, res => { resolve(res) }, () => { // do nothing @@ -72,7 +72,7 @@ export default { */ getDatasourcesListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('datasources/list-paging', payload, res => { + io.get('datasources', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -84,7 +84,7 @@ export default { */ deleteDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('datasources/delete', payload, res => { + io.delete(`datasources/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -96,7 +96,7 @@ export default { */ updateDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('datasources/update', payload, res => { + io.put(`datasources/${payload.id}`, payload, res => { resolve(res) }, () => { // do nothing @@ -107,7 +107,7 @@ export default { }, getEditDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('datasources/update-ui', payload, res => { + io.get(`datasources/${payload.id}`, payload, res => { resolve(res.data) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js index eda5d02e10..507d9f28f3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js @@ -42,13 +42,13 @@ export default { param: { groupName: payload.groupName }, - api: 'alert-group/verify-group-name' + api: 'alert-groups/verify-name' }, alarmInstance: { param: { 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) { return new Promise((resolve, reject) => { - io.get('alert-group/list-paging', payload, res => { + io.get('alert-groups', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -362,7 +362,7 @@ export default { */ queryAlertPluginInstanceListPaging ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('alert-plugin-instance/list-paging', payload, res => { + io.get('alert-plugin-instances', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -398,7 +398,7 @@ export default { */ queryAllAlertPluginInstance ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-plugin-instance/queryAll', payload, res => { + io.get('alert-plugin-instance/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -410,7 +410,7 @@ export default { */ getAlertgroup ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('alert-group/list', payload, res => { + io.get('alert-groups/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -422,7 +422,7 @@ export default { */ createAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-group/create', payload, res => { + io.post('alert-groups', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -434,7 +434,7 @@ export default { */ createAlertPluginInstance ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-plugin-instance/create', payload, res => { + io.post('alert-plugin-instances', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -446,7 +446,7 @@ export default { */ updateAlertPluginInstance ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-plugin-instance/update', payload, res => { + io.put(`alert-plugin-instances/${payload.alertPluginInstanceId}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -458,7 +458,7 @@ export default { */ updateAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-group/update', payload, res => { + io.put(`alert-groups/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -470,7 +470,7 @@ export default { */ deleteAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('alert-group/delete', payload, res => { + io.delete(`alert-groups/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -482,7 +482,7 @@ export default { */ deletAelertPluginInstance ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('alert-plugin-instance/delete', payload, res => { + io.delete(`alert-plugin-instance/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -605,7 +605,7 @@ export default { */ getAlarmGroupsAll ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('alert-group/list', payload, res => { + io.get('alert-groups/list', payload, res => { state.alarmGroupsListAll = res.data resolve(res) }).catch(e => { diff --git a/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js index 57b4641e1d..e2d8c9a5bb 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js @@ -52,7 +52,7 @@ export default { */ getTokenListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get('access-token/list-paging', payload, res => { + io.get('access-tokens', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -68,7 +68,7 @@ export default { */ createToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('access-token/create', payload, res => { + io.post('access-tokens', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -84,7 +84,7 @@ export default { */ updateToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('access-token/update', payload, res => { + io.put(`access-tokens/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e) @@ -99,7 +99,7 @@ export default { */ generateToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('access-token/generate', payload, res => { + io.post('access-tokens/generate', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -113,7 +113,7 @@ export default { */ deleteToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post('access-token/delete', payload, res => { + io.delete(`access-token/${payload.id}`, payload, res => { resolve(res) }).catch(e => { reject(e)