You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/08/19 04:11:28 UTC

[inlong] branch master updated: [INLONG-5582][Manager][Dashboard] Fix error in client API (#5586)

This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 07534f082 [INLONG-5582][Manager][Dashboard] Fix error in client API (#5586)
07534f082 is described below

commit 07534f082cd0677c213d02ca5c6da519d2b8d7d0
Author: haifxu <xh...@gmail.com>
AuthorDate: Fri Aug 19 12:11:23 2022 +0800

    [INLONG-5582][Manager][Dashboard] Fix error in client API (#5586)
---
 inlong-dashboard/src/components/StaffSelect/index.tsx        |  3 ++-
 inlong-dashboard/src/pages/UserManagement/index.tsx          |  3 ++-
 .../inlong/manager/client/api/inner/client/UserClient.java   |  5 +++++
 .../inlong/manager/client/api/service/InlongStreamApi.java   | 12 ++++++------
 .../apache/inlong/manager/client/api/service/UserApi.java    |  4 ++--
 .../apache/inlong/manager/web/controller/UserController.java |  4 ++--
 6 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/inlong-dashboard/src/components/StaffSelect/index.tsx b/inlong-dashboard/src/components/StaffSelect/index.tsx
index 81c5d08c0..e25294bcc 100644
--- a/inlong-dashboard/src/components/StaffSelect/index.tsx
+++ b/inlong-dashboard/src/components/StaffSelect/index.tsx
@@ -107,7 +107,8 @@ const StaffSelect: React.FC<StaffSelectProps> = ({
   const { data: staffList, loading, run: getStaffList } = useRequest(
     (username = '') => ({
       url: '/user/listAll',
-      params: {
+      method: 'POST',
+      data: {
         username,
       },
     }),
diff --git a/inlong-dashboard/src/pages/UserManagement/index.tsx b/inlong-dashboard/src/pages/UserManagement/index.tsx
index cfccfe74b..846301b9f 100644
--- a/inlong-dashboard/src/pages/UserManagement/index.tsx
+++ b/inlong-dashboard/src/pages/UserManagement/index.tsx
@@ -44,7 +44,8 @@ const Comp: React.FC = () => {
   const { data, loading, run: getList } = useRequest(
     {
       url: '/user/listAll',
-      params: options,
+      method: 'POST',
+      data: options,
     },
     {
       refreshDeps: [options],
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/UserClient.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/UserClient.java
index c7c666b0c..4e177802c 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/UserClient.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/client/UserClient.java
@@ -57,6 +57,7 @@ public class UserClient {
     public Integer register(UserRequest userInfo) {
         Preconditions.checkNotEmpty(userInfo.getName(), "username cannot be empty");
         Preconditions.checkNotEmpty(userInfo.getPassword(), "password cannot be empty");
+
         Response<Integer> response = ClientUtils.executeHttpCall(userApi.register(userInfo));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
@@ -70,6 +71,7 @@ public class UserClient {
      */
     public UserInfo getById(Integer id) {
         Preconditions.checkNotNull(id, "user id cannot be null");
+
         Response<UserInfo> response = ClientUtils.executeHttpCall(userApi.getById(id));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
@@ -83,6 +85,7 @@ public class UserClient {
      */
     public PageInfo<UserInfo> list(UserRequest request) {
         Preconditions.checkNotNull(request, "request cannot be null");
+
         Response<PageInfo<UserInfo>> response = ClientUtils.executeHttpCall(userApi.list(request));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
@@ -97,6 +100,7 @@ public class UserClient {
     public Integer update(UserRequest userInfo) {
         Preconditions.checkNotNull(userInfo, "userinfo cannot be null");
         Preconditions.checkNotNull(userInfo.getId(), "user id cannot be null");
+
         Response<Integer> response = ClientUtils.executeHttpCall(userApi.update(userInfo));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
@@ -110,6 +114,7 @@ public class UserClient {
      */
     public Boolean delete(Integer id) {
         Preconditions.checkNotNull(id, "user id cannot be null");
+
         Response<Boolean> response = ClientUtils.executeHttpCall(userApi.delete(id));
         ClientUtils.assertRespSuccess(response);
         return response.getData();
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java
index 83ab31759..679dd3aae 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/InlongStreamApi.java
@@ -45,24 +45,24 @@ public interface InlongStreamApi {
     Call<Response<InlongStreamInfo>> getStream(@Query("groupId") String groupId,
             @Query("streamId") String streamId);
 
-    @POST("/stream/list")
+    @POST("stream/list")
     Call<Response<PageInfo<InlongStreamBriefInfo>>> listByCondition(@Body InlongStreamPageRequest request);
 
     @POST("stream/listAll")
     Call<Response<PageInfo<InlongStreamInfo>>> listStream(@Body InlongStreamPageRequest request);
 
-    @POST("/stream/startProcess/{groupId}/{streamId}")
+    @POST("stream/startProcess/{groupId}/{streamId}")
     Call<Response<Boolean>> startProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
 
-    @POST("/stream/suspendProcess/{groupId}/{streamId}")
+    @POST("stream/suspendProcess/{groupId}/{streamId}")
     Call<Response<Boolean>> suspendProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
 
-    @POST("/stream/restartProcess/{groupId}/{streamId}")
+    @POST("stream/restartProcess/{groupId}/{streamId}")
     Call<Response<Boolean>> restartProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
 
-    @POST("/stream/deleteProcess/{groupId}/{streamId}")
+    @POST("stream/deleteProcess/{groupId}/{streamId}")
     Call<Response<Boolean>> deleteProcess(@Path("groupId") String groupId, @Path("streamId") String streamId);
 
-    @DELETE("/stream/delete")
+    @DELETE("stream/delete")
     Call<Response<Boolean>> delete(@Path("groupId") String groupId, @Path("streamId") String streamId);
 }
diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/UserApi.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/UserApi.java
index cd6708769..0f91ab3cc 100644
--- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/UserApi.java
+++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/service/UserApi.java
@@ -40,8 +40,8 @@ public interface UserApi {
     @GET("user/get/{id}")
     Call<Response<UserInfo>> getById(@Path("id") Integer id);
 
-    @GET("user/listAll")
-    Call<Response<PageInfo<UserInfo>>> list(UserRequest request);
+    @POST("user/listAll")
+    Call<Response<PageInfo<UserInfo>>> list(@Body UserRequest request);
 
     @POST("user/update")
     Call<Response<Integer>> update(@Body UserRequest userInfo);
diff --git a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/UserController.java b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/UserController.java
index 6c1bd16b0..cc54953ae 100644
--- a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/UserController.java
+++ b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/UserController.java
@@ -71,9 +71,9 @@ public class UserController {
         return Response.success(userService.getById(id, currentUser));
     }
 
-    @GetMapping("/user/listAll")
+    @PostMapping("/user/listAll")
     @ApiOperation(value = "List all users")
-    public Response<PageInfo<UserInfo>> list(UserRequest request) {
+    public Response<PageInfo<UserInfo>> list(@RequestBody UserRequest request) {
         return Response.success(userService.list(request));
     }