You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/10/09 15:59:01 UTC

[GitHub] [incubator-streampark] wolfboys opened a new pull request, #1792: [Feature] the team related front-end improve

wolfboys opened a new pull request, #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792

   [Feature] the team related front-end improve
   
   
   ## What problem does this PR solve?
   
   Issue Number: close #1753 
   
   Problem Summary:
   
   ## What is changed and how it works?
   
   Proposal: [xxx](url) <!-- REMOVE this line if not applicable -->
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/streampark/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1274106907

   hi 1996fanrui:
   
   Thanks you for the review, Most of the problems are solved. Two issue about the front-end:
   1) the same browser, while opening multiple pages, switch team, will affect all other pages, the correct should be isolated from each other, do not affect each other
   2) team select box should show the name, not id
   
   Front-end developers will be invited to fix these two issues later.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1273334326

   > 1. When open multi page, and select different team for each page. The team id of each page should be right.
   
   Hi @wolfboys , does this bug still exist?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991339084


##########
streampark-console/streampark-console-webapp/src/views/system/member/MemberAdd.vue:
##########
@@ -119,10 +117,7 @@ export default {
       this.form.validateFields((err, member) => {
         if (!err && this.validateStatus === 'success') {
           this.loading = true
-          post({
-            ...member,

Review Comment:
   You can test in your local. The teamId is changed, but front-end doesn't call backend after the teamId is changed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1274110708

   > hi 1996fanrui:
   > 
   > Thanks for the review, Most of the issue are solved. Two issue about the front-end have not been solved:
   > 
   > 1. the same browser, while opening multiple pages, switch team, will affect all other pages, the correct should be isolated from each other, do not affect each other
   > 2. team select box should show the name, not id
   > 
   > Front-end developers will be invited to fix these two issues later.
   
   Hi @wolfboys, thanks for your hard work. 
   
   LGTM.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] lvshaokang commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
lvshaokang commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1274125520

   +1, LGTM. Merging to dev.
   Thank you, @wolfboys 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991231832


##########
streampark-console/streampark-console-service/src/assembly/script/schema/mysql-schema.sql:
##########
@@ -375,6 +375,7 @@ create table `t_user` (
   `password` varchar(128) collate utf8mb4_general_ci not null comment 'password',
   `email` varchar(128) collate utf8mb4_general_ci default null comment 'email',
   `user_type` int  not null comment 'user type 1:admin 2:user',
+  `team_id` bigint default null comment 'latest team id',

Review Comment:
   Rename `team_id` to `latest_team_id` may be more clear.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java:
##########
@@ -98,16 +98,8 @@ public class User implements Serializable {
     private String nickName;
 
     /**
-     * shiro-redis v3.1.0 must have getAuthCacheKey() or getId() function # Principal id field name.
-     * The field which you can get unique id to identify this principal. # For example, if you use UserInfo as
-     * Principal class, the id field maybe userId, userName, email, etc. # Remember to add getter to
-     * this id field. For example, getUserId(), getUserName(), getEmail(), etc. # Default value is
-     * authCacheKey or id, that means your principal object has a method called "getAuthCacheKey()" or
-     * "getId()"
-     *
-     * @return userId as Principal id field name
+     * The last set teamId
      */
-    public Long getAuthCacheKey() {
-        return userId;
-    }
+    private Long teamId;

Review Comment:
   This `teamId` also should be renamed to `latestTeamId`



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java:
##########
@@ -106,4 +106,8 @@ public interface UserService extends IService<User> {
     Set<String> getPermissions(String username);
 
     List<User> getNoTokenUser();
+
+    void setLatestTeam(Long teamId, Long userId);
+
+    void checkTeam(User user);

Review Comment:
   How about `fillInTeam`?
   
   This method not just check team.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java:
##########
@@ -99,4 +100,9 @@ public List<Team> findUserTeams(Long userId) {
         }
         return baseMapper.findUserTeams(userId);
     }
+
+    @Override
+    public Team getDefaultTeam() {
+        return getById(Constant.DEFAULT_TEAM_ID);
+    }

Review Comment:
   This file too.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java:
##########
@@ -177,12 +184,35 @@ public List<User> getNoTokenUser() {
         return users;
     }
 
+    @Override
+    public void setLatestTeam(Long teamId, Long userId) {
+        User user = getById(userId);
+        AssertUtils.checkArgument(user != null);
+        user.setTeamId(teamId);
+        this.baseMapper.updateById(user);
+    }
+
+    @Override
+    public void checkTeam(User user) {
+        if (user.getTeamId() == null) {
+            List<Team> teams = memberService.findUserTeams(user.getUserId());
+            if (CollectionUtils.isEmpty(teams)) {
+                throw new ApiException("There is no team to assign, please contact the administrator!");

Review Comment:
   I create a new user, and doesn't belong to any team. When the user login the platform, the front-end just show `No permission, please contact the administrator`.
   
   So I guess this alert doesn't take affect.



##########
streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml:
##########
@@ -33,6 +33,7 @@
         <result column="sex" jdbcType="CHAR" property="sex"/>
         <result column="avatar" jdbcType="VARCHAR" property="avatar"/>
         <result column="description" jdbcType="VARCHAR" property="description"/>
+        <result column="team_id" jdbcType="BIGINT" property="teamId"/>

Review Comment:
   This too.



##########
streampark-console/streampark-console-webapp/src/views/system/member/MemberAdd.vue:
##########
@@ -119,10 +117,7 @@ export default {
       this.form.validateFields((err, member) => {
         if (!err && this.validateStatus === 'success') {
           this.loading = true
-          post({
-            ...member,

Review Comment:
   The member page cann't be refresh when I switch the team. It may be missed case.



##########
streampark-console/streampark-console-webapp/src/views/user/SignIn.vue:
##########
@@ -161,25 +215,57 @@ export default {
         if (!err) {
           const loginParams = {...values}
           SignIn(loginParams)
-            .then(resp => {
-              if (resp.code != null) {
-                const message = 'SignIn failed,' + (resp.code === 0 ? ' authentication error' : ' current User is locked.')
-                this.$message.error(message)
-              } else {
-                this.$router.push({path: '/flink/app'})
+            .then(() => {
+              this.$router.push({path: '/flink/app'})
+            }).catch(resp => {
+              const code = resp.code
+              if (code != null && code != undefined) {
+                if (code == 0 || code == 1) {
+                  const message = 'SignIn failed,' + (resp.code === 0 ? ' authentication error' : ' current User is locked.')
+                  this.$message.error(message)
+                } else if (resp.code == 403) {
+                  this.loginInfo = values
+                  this.teamVisible = true
+                  this.userId = resp.data
+                  teams({
+                    userId: this.userId
+                  }).then((r) => {
+                    this.teamList = r.data
+                  })
+                } else {
+                  console.log(resp)
+                }
               }
-            })
-            .catch(err => console.log(err))
-            .finally(() => {
+          }).finally(() => {
               state.loginBtn = false
-            })
+          })
         } else {
           setTimeout(() => {
             state.loginBtn = false
           }, 600)
         }
       })
-    }
+    },
+

Review Comment:
   When the user login the platform, the team show the teamId, it should show the teamName



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/Constant.java:
##########
@@ -33,4 +33,6 @@ public class Constant {
     public static final String APP_MENU_ID = "100015";
     public static final String APP_DETAIL_MENU_ID = "100018";
 
+    public static final String DEFAULT_TEAM_ID = "100000";
+

Review Comment:
   ```suggestion
   ```
   
   This code isn't used, it can be deleted.



##########
streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml:
##########
@@ -47,8 +47,8 @@
 
     <select id="findUserTeams" resultType="team" parameterType="team">
         select t.* from t_team t
-        join t_user_role ur
-        on t.id = ur.team_id
+        join t_member m
+        on t.id = m.team_id
         where ur.user_id = #{userId}

Review Comment:
   `ur`should be changed to `m`. It's a bug, the `test_user3` cannot login platform.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/exception/DetailException.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.console.base.exception;
+
+/**
+ * api business exceptions, as different from internal errors, need to return a friendly exception message
+ */
+public class DetailException extends RuntimeException {

Review Comment:
   The `DetailException` isn't clear, it doesn't has specific information. How about `ApiBusinessException`?



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java:
##########
@@ -39,4 +39,5 @@ public interface TeamService extends IService<Team> {
 
     List<Team> findUserTeams(Long userId);
 
+    Team getDefaultTeam();

Review Comment:
   The code can be removed as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991324115


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/exception/DetailException.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.console.base.exception;
+
+/**
+ * api business exceptions, as different from internal errors, need to return a friendly exception message
+ */
+public class DetailException extends RuntimeException {

Review Comment:
   > The `DetailException` isn't clear, it doesn't has specific information. How about `ApiBusinessException`?
   
   
   `DetailException` and `ApiException` are both top-level exceptions that need to be presented to the front-end, No specific business exceptions are involved, the difference is: `ApiException` is a clear and simple error message, e.g:
   <img width="555" alt="image" src="https://user-images.githubusercontent.com/13284744/194882198-d5bc681c-9dcc-47df-a6e4-0addaf4f217c.png">
    
   `DetailException` is the specific exception information that needs to be presented to the user, such as the stackTrace info, often accompanied by a large number of exception logs, e.g:
   <img width="963" alt="image" src="https://user-images.githubusercontent.com/13284744/194883323-8cb882f3-5b5f-4ff9-adac-4d1278be62e8.png">
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991337130


##########
streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml:
##########
@@ -47,8 +47,8 @@
 
     <select id="findUserTeams" resultType="team" parameterType="team">
         select t.* from t_team t
-        join t_user_role ur
-        on t.id = ur.team_id
+        join t_member m
+        on t.id = m.team_id
         where ur.user_id = #{userId}

Review Comment:
   > `ur`should be changed to `m`. It's a bug, the `test_user3` cannot login platform.
   
   There is actually no problem here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1272894947

   > Offline discuss with @wolfboys, there are some logic need to be improved.
   > 
   > 1. When open multi page, and select different team for each page. The team id of each page should be right.
   > 2. When user login the platform first time. There are 3 cases:
   >    
   >    * When the user isn't bound any team, don't allow login, and tell him : please contact admin bind team first.
   >    * When the user only belongs to one team, StreamPark can help the user select the team by default.
   >    * When the user belongs to multi teams. User must choose one first.
   > 3. Last team is just used ehen choose team and cannot be used in other interfere.
   
   Thanks for your feedback, all done. PTAL
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991328791


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java:
##########
@@ -177,12 +184,35 @@ public List<User> getNoTokenUser() {
         return users;
     }
 
+    @Override
+    public void setLatestTeam(Long teamId, Long userId) {
+        User user = getById(userId);
+        AssertUtils.checkArgument(user != null);
+        user.setTeamId(teamId);
+        this.baseMapper.updateById(user);
+    }
+
+    @Override
+    public void checkTeam(User user) {
+        if (user.getTeamId() == null) {
+            List<Team> teams = memberService.findUserTeams(user.getUserId());
+            if (CollectionUtils.isEmpty(teams)) {
+                throw new ApiException("There is no team to assign, please contact the administrator!");

Review Comment:
   > I create a new user, and doesn't belong to any team. When the user login the platform, the front-end just show `No permission, please contact the administrator`.
   > 
   > So I guess this alert doesn't take affect.
   
   I have dealt with it uniformly. The front-end does not need to write code, the message will be presented to the user on the front-end:
   <img width="555" alt="image" src="https://user-images.githubusercontent.com/13284744/194882198-d5bc681c-9dcc-47df-a6e4-0addaf4f217c.png">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991338817


##########
streampark-console/streampark-console-webapp/src/views/user/SignIn.vue:
##########
@@ -161,25 +215,57 @@ export default {
         if (!err) {
           const loginParams = {...values}
           SignIn(loginParams)
-            .then(resp => {
-              if (resp.code != null) {
-                const message = 'SignIn failed,' + (resp.code === 0 ? ' authentication error' : ' current User is locked.')
-                this.$message.error(message)
-              } else {
-                this.$router.push({path: '/flink/app'})
+            .then(() => {
+              this.$router.push({path: '/flink/app'})
+            }).catch(resp => {
+              const code = resp.code
+              if (code != null && code != undefined) {
+                if (code == 0 || code == 1) {
+                  const message = 'SignIn failed,' + (resp.code === 0 ? ' authentication error' : ' current User is locked.')
+                  this.$message.error(message)
+                } else if (resp.code == 403) {
+                  this.loginInfo = values
+                  this.teamVisible = true
+                  this.userId = resp.data
+                  teams({
+                    userId: this.userId
+                  }).then((r) => {
+                    this.teamList = r.data
+                  })
+                } else {
+                  console.log(resp)
+                }
               }
-            })
-            .catch(err => console.log(err))
-            .finally(() => {
+          }).finally(() => {
               state.loginBtn = false
-            })
+          })
         } else {
           setTimeout(() => {
             state.loginBtn = false
           }, 600)
         }
       })
-    }
+    },
+

Review Comment:
   > When the user login the platform, the team show the teamId, it should show the teamName
   
   This problem does exist, and it's a front-end problem that's been bugging me for a long time.😭



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991332496


##########
streampark-console/streampark-console-webapp/src/views/system/member/MemberAdd.vue:
##########
@@ -119,10 +117,7 @@ export default {
       this.form.validateFields((err, member) => {
         if (!err && this.validateStatus === 'success') {
           this.loading = true
-          post({
-            ...member,

Review Comment:
   > The member page cann't be refresh when I switch the team. It may be missed case.
   
   The teamId will be passed to the backend in all requests .
   see  request.js line 80. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991824664


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java:
##########
@@ -39,4 +39,5 @@ public interface TeamService extends IService<Team> {
 
     List<Team> findUserTeams(Long userId);
 
+    Team getDefaultTeam();

Review Comment:
   > The code can be removed as well.
   
   done.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java:
##########
@@ -99,4 +100,9 @@ public List<Team> findUserTeams(Long userId) {
         }
         return baseMapper.findUserTeams(userId);
     }
+
+    @Override
+    public Team getDefaultTeam() {
+        return getById(Constant.DEFAULT_TEAM_ID);
+    }

Review Comment:
   > This file too.
   
   done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on pull request #1792: [Feature][WIP] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1272588019

   Offline discuss with @wolfboys, there are some logic need to be improved.
   
   1. When open multi page, and select different team for each page. The team id of each team should be right. 
   2. When user login the platform first time. There are 3 cases:
       - When the user isn't bound any team, don't allow login, and tell him : please contact admin bind team first.
       - When the user only belongs to one team, StreamPark can help the user select the team by default.
       - When the user belongs to multi teams. User must choose one first.
   3. Last team is just used ehen choose team and cannot be used in other interfere.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991324953


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/Constant.java:
##########
@@ -33,4 +33,6 @@ public class Constant {
     public static final String APP_MENU_ID = "100015";
     public static final String APP_DETAIL_MENU_ID = "100018";
 
+    public static final String DEFAULT_TEAM_ID = "100000";
+

Review Comment:
   > This code isn't used, it can be deleted.
   
   ok.👌



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991347657


##########
streampark-console/streampark-console-service/src/assembly/script/schema/mysql-schema.sql:
##########
@@ -375,6 +375,7 @@ create table `t_user` (
   `password` varchar(128) collate utf8mb4_general_ci not null comment 'password',
   `email` varchar(128) collate utf8mb4_general_ci default null comment 'email',
   `user_type` int  not null comment 'user type 1:admin 2:user',
+  `team_id` bigint default null comment 'latest team id',

Review Comment:
   It's easy for the cooperation between the front and back ends.
   
   But from this table side, it's not clear. For other developers, they will think the user belong to the teamId.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] lvshaokang merged pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
lvshaokang merged PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] macksonmu commented on pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
macksonmu commented on PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#issuecomment-1272921949

   @wolfboys What is the third meaning and the background?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991821804


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/exception/DetailException.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.console.base.exception;
+
+/**
+ * api business exceptions, as different from internal errors, need to return a friendly exception message
+ */
+public class DetailException extends RuntimeException {

Review Comment:
   Checked, it's done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991821489


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java:
##########
@@ -177,12 +184,35 @@ public List<User> getNoTokenUser() {
         return users;
     }
 
+    @Override
+    public void setLatestTeam(Long teamId, Long userId) {
+        User user = getById(userId);
+        AssertUtils.checkArgument(user != null);
+        user.setTeamId(teamId);
+        this.baseMapper.updateById(user);
+    }
+
+    @Override
+    public void checkTeam(User user) {
+        if (user.getTeamId() == null) {
+            List<Team> teams = memberService.findUserTeams(user.getUserId());
+            if (CollectionUtils.isEmpty(teams)) {
+                throw new ApiException("There is no team to assign, please contact the administrator!");

Review Comment:
   Checked, it's done.



##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java:
##########
@@ -106,4 +106,8 @@ public interface UserService extends IService<User> {
     Set<String> getPermissions(String username);
 
     List<User> getNoTokenUser();
+
+    void setLatestTeam(Long teamId, Long userId);
+
+    void checkTeam(User user);

Review Comment:
   Checked, it's done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] 1996fanrui commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
1996fanrui commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991821344


##########
streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml:
##########
@@ -47,8 +47,8 @@
 
     <select id="findUserTeams" resultType="team" parameterType="team">
         select t.* from t_team t
-        join t_user_role ur
-        on t.id = ur.team_id
+        join t_member m
+        on t.id = m.team_id
         where ur.user_id = #{userId}

Review Comment:
   Checked, it's done.



##########
streampark-console/streampark-console-webapp/src/views/system/member/MemberAdd.vue:
##########
@@ -119,10 +117,7 @@ export default {
       this.form.validateFields((err, member) => {
         if (!err && this.validateStatus === 'success') {
           this.loading = true
-          post({
-            ...member,

Review Comment:
   Checked, it's done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991335591


##########
streampark-console/streampark-console-service/src/assembly/script/schema/mysql-schema.sql:
##########
@@ -375,6 +375,7 @@ create table `t_user` (
   `password` varchar(128) collate utf8mb4_general_ci not null comment 'password',
   `email` varchar(128) collate utf8mb4_general_ci default null comment 'email',
   `user_type` int  not null comment 'user type 1:admin 2:user',
+  `team_id` bigint default null comment 'latest team id',

Review Comment:
   > Rename `team_id` to `latest_team_id` may be more clear.
   
   Considering the uniformity of the fields, and the cooperation between the front and back ends,  I think teamid is better
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1792: [Feature] the team related front-end improve

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1792:
URL: https://github.com/apache/incubator-streampark/pull/1792#discussion_r991340283


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java:
##########
@@ -106,4 +106,8 @@ public interface UserService extends IService<User> {
     Set<String> getPermissions(String username);
 
     List<User> getNoTokenUser();
+
+    void setLatestTeam(Long teamId, Long userId);
+
+    void checkTeam(User user);

Review Comment:
   > How about `fillInTeam`?
   > 
   > This method not just check team.
   
   fillInTeam , nice ~



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org