From cfdbdb7fa31dff1f934921042b67216ac07bd63c Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 17 Dec 2020 16:59:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/common/head/HeaderOrgWs.vue | 12 ++++++------ .../business/components/common/head/SearchList.vue | 13 ++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index 5b8a565245..dce8deb518 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -108,9 +108,9 @@ import { if (response.data.workspaceId) { localStorage.setItem("workspace_id", response.data.workspaceId); } - localStorage.removeItem(PROJECT_ID) - this.$router.push('/'); - window.location.reload(); + this.$router.push('/').then(() => { + window.location.reload(); + }).catch(err => err); }); }, changeWs(data) { @@ -121,9 +121,9 @@ import { this.$post("/user/switch/source/ws/" + workspaceId, {}, response => { saveLocalStorage(response); localStorage.setItem("workspace_id", workspaceId); - localStorage.removeItem(PROJECT_ID) - this.$router.push('/'); - window.location.reload(); + this.$router.push('/').then(() => { + window.location.reload(); + }).catch(err => err); }) } } diff --git a/frontend/src/business/components/common/head/SearchList.vue b/frontend/src/business/components/common/head/SearchList.vue index 4b861ec45a..afc70864c9 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -68,10 +68,17 @@ export default { this.result = this.$get("/project/listAll", response => { this.items = response.data; this.searchArray = response.data; - if (!getCurrentProjectID() && this.items.length > 0) { - this.change(this.items[0].id); - } let projectId = getCurrentProjectID(); + if (projectId) { + // 保存的 projectId 是否存在; 切换工作空间后 + if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(projectId) === -1) { + this.change(this.items[0].id); + } + } else { + if (this.items.length > 0) { + this.change(this.items[0].id); + } + } this.changeProjectName(projectId); }) } From d7f2494f84fcfaed75cc9b59be8ec357ea3187c3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 17 Dec 2020 17:52:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/head/HeaderOrgWs.vue | 2 ++ .../business/components/common/head/SearchList.vue | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index dce8deb518..35bdad37be 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -108,6 +108,7 @@ import { if (response.data.workspaceId) { localStorage.setItem("workspace_id", response.data.workspaceId); } + localStorage.removeItem(PROJECT_ID); this.$router.push('/').then(() => { window.location.reload(); }).catch(err => err); @@ -121,6 +122,7 @@ import { this.$post("/user/switch/source/ws/" + workspaceId, {}, response => { saveLocalStorage(response); localStorage.setItem("workspace_id", workspaceId); + localStorage.removeItem(PROJECT_ID); this.$router.push('/').then(() => { window.location.reload(); }).catch(err => err); diff --git a/frontend/src/business/components/common/head/SearchList.vue b/frontend/src/business/components/common/head/SearchList.vue index afc70864c9..1cc176fd5e 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -36,11 +36,6 @@ export default { currentProject: String }, created() { - if (getCurrentUser().lastProjectId) { - localStorage.setItem(PROJECT_ID, getCurrentUser().lastProjectId); - } - }, - mounted() { this.init(); }, computed: { @@ -68,9 +63,16 @@ export default { this.result = this.$get("/project/listAll", response => { this.items = response.data; this.searchArray = response.data; + let userLastProjectId = getCurrentUser().lastProjectId; + if (userLastProjectId) { + // id 是否存在 + if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(userLastProjectId) !== -1) { + localStorage.setItem(PROJECT_ID, userLastProjectId); + } + } let projectId = getCurrentProjectID(); if (projectId) { - // 保存的 projectId 是否存在; 切换工作空间后 + // 保存的 projectId 在当前项目列表是否存在; 切换工作空间后 if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(projectId) === -1) { this.change(this.items[0].id); } From fa269fde93da19a7b9a2cf46c76f8abe56e240e4 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 17 Dec 2020 18:01:41 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20k8s=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/metersphere/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 61397c1672..2f4f76c93a 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 61397c16728a63493507679f7e0940d9099f337f +Subproject commit 2f4f76c93afa7b62b1d73fa90e73eec948a6ef3f From f30493a88198b833792fc9bd591ab422f779c9c2 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 17 Dec 2020 18:08:37 +0800 Subject: [PATCH 4/4] chore: Sync --- frontend/src/business/components/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index a22a3005d9..d39dafaf84 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a +Subproject commit d39dafaf84b9c7a56cb51f2caf67dd7dfde5938c