This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new fc57f1bf8 [Feature] Improve the team related front-end part2 #1807
(#1812)
fc57f1bf8 is described below
commit fc57f1bf840462fa969085e5a8614025482b49eb
Author: benjobs <[email protected]>
AuthorDate: Wed Oct 12 08:52:59 2022 +0800
[Feature] Improve the team related front-end part2 #1807 (#1812)
---
.../src/components/tools/UserMenu.vue | 21 ++++++++++++---------
.../src/store/modules/user.js | 4 ++--
.../streampark-console-webapp/src/utils/request.js | 3 ++-
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git
a/streampark-console/streampark-console-webapp/src/components/tools/UserMenu.vue
b/streampark-console/streampark-console-webapp/src/components/tools/UserMenu.vue
index 0c9151dad..5d304df9c 100644
---
a/streampark-console/streampark-console-webapp/src/components/tools/UserMenu.vue
+++
b/streampark-console/streampark-console-webapp/src/components/tools/UserMenu.vue
@@ -68,17 +68,16 @@
<a> Team : </a>
<a-select
+ v-model="teamId"
mode="single"
- :allow-clear="false"
style="min-width: 100px; margin-right: 10px"
@change="handleChangeTeam"
- class="team-select"
- v-model="teamId">
+ class="team-select">
<a-select-option
- v-for="t in teamList"
- :value="t.id"
- :key="`team_`.concat(t.id)">
- {{ t.teamName }}
+ v-for="team in teamList"
+ :key="team.id"
+ :value="team.id">
+ {{ team.teamName }}
</a-select-option>
</a-select>
@@ -318,8 +317,12 @@ export default {
},
handlePrepareTeam() {
- const teamId = storage.get(TEAM_ID) || []
- this.teamId = teamId
+ let id = sessionStorage.getItem(TEAM_ID)
+ if (id == null) {
+ id = storage.get(TEAM_ID)
+ sessionStorage.setItem(TEAM_ID, id)
+ }
+ this.teamId = id.toString()
},
handleChangeTeam(teamId) {
diff --git
a/streampark-console/streampark-console-webapp/src/store/modules/user.js
b/streampark-console/streampark-console-webapp/src/store/modules/user.js
index b97a33eda..648645576 100644
--- a/streampark-console/streampark-console-webapp/src/store/modules/user.js
+++ b/streampark-console/streampark-console-webapp/src/store/modules/user.js
@@ -26,10 +26,10 @@ const user = {
expire: storage.get(EXPIRE),
token: storage.get(TOKEN),
info: storage.get(USER_INFO),
- teamId: storage.get(TEAM_ID),
roles: storage.get(ROLES),
permissions: storage.get(PERMISSIONS),
routers: storage.get(USER_ROUTER),
+ teamId: storage.get(USER_ROUTER),
name: '',
welcome: '',
avatar: ''
@@ -45,6 +45,7 @@ const user = {
state.token = token
},
SET_TEAM: (state, teamId) => {
+ sessionStorage.setItem(TEAM_ID, teamId)
storage.set(TEAM_ID, teamId)
state.teamId = teamId
},
@@ -73,7 +74,6 @@ const user = {
state.roles = null
state.permissions = null
state.name = null
- state.teamId = null
state.welcome = null
state.avatar = null
storage.rm(USER_INFO)
diff --git a/streampark-console/streampark-console-webapp/src/utils/request.js
b/streampark-console/streampark-console-webapp/src/utils/request.js
index 3bb159f7b..7e8f5d3fe 100644
--- a/streampark-console/streampark-console-webapp/src/utils/request.js
+++ b/streampark-console/streampark-console-webapp/src/utils/request.js
@@ -67,6 +67,7 @@ http.interceptors.request.use(config => {
config.headers['Authorization'] = token
}
config.transformRequest = [function (data) {
+
// Format the data parameter before the request
if (config.method === 'get' || config.method === 'post') {
if (data.sortField && data.sortOrder) {
@@ -76,7 +77,7 @@ http.interceptors.request.use(config => {
delete data.sortOrder
}
}
- const teamId = storage.get(TEAM_ID)
+ const teamId = sessionStorage.getItem(TEAM_ID)
if (teamId) {
data['teamId'] = teamId
}