From 62b02eeb81c991b376dd95e92f26204132a879f0 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 16 Dec 2020 14:38:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectController.java | 5 ---- .../components/api/head/ApiHeaderMenus.vue | 30 ------------------- .../components/common/head/SearchList.vue | 7 ----- .../head/PerformanceHeaderMenus.vue | 14 --------- .../track/head/TrackHeaderMenus.vue | 22 -------------- 5 files changed, 78 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/ProjectController.java b/backend/src/main/java/io/metersphere/controller/ProjectController.java index 3750e8fd41..2ce466d0d9 100644 --- a/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -84,9 +84,4 @@ public class ProjectController { projectService.updateProject(Project); } - @PostMapping("/search") - public List searchProject(@RequestBody ProjectRequest projectRequest) { - projectRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return projectService.getProjectList(projectRequest); - } } diff --git a/frontend/src/business/components/api/head/ApiHeaderMenus.vue b/frontend/src/business/components/api/head/ApiHeaderMenus.vue index 73548443e6..10dae0f5fa 100644 --- a/frontend/src/business/components/api/head/ApiHeaderMenus.vue +++ b/frontend/src/business/components/api/head/ApiHeaderMenus.vue @@ -67,16 +67,6 @@ export default { components: {SearchList, MsCreateTest, MsCreateButton, MsShowAll, MsRecentList, ProjectChange}, data() { return { - projectRecent: { - title: this.$t('project.recent'), - url: "/project/recent/5", - index: function (item) { - return '/api/test/list/' + item.id; - }, - router: function (item) { - return {name: 'ApiTestList', params: {projectId: item.id, projectName: item.name}} - } - }, testRecent: { title: this.$t('load_test.recent'), url: "/api/recent/5", @@ -101,19 +91,10 @@ export default { currentProject: '' } }, - // watch: { - // '$route'(to) { - // this.init(); - // }, - // }, methods: { registerEvents() { ApiEvent.$on(LIST_CHANGE, () => { // // todo 这里偶尔会有 refs 为空的情况 - // if (!this.$refs.projectRecent) { - // return; - // } - // this.$refs.projectRecent.recent(); this.$refs.testRecent.recent(); this.$refs.reportRecent.recent(); }); @@ -124,17 +105,6 @@ export default { this.isRouterAlive = true; }); }, - // init() { - // let path = this.$route.path; - // if (path.indexOf("/api/test/list") >= 0 && !!this.$route.params.projectId) { - // this.apiTestProjectPath = path; - // //不激活项目菜单栏 - // this.isProjectActivation = false; - // this.reload(); - // } else { - // this.isProjectActivation = true; - // } - // }, }, mounted() { this.registerEvents(); diff --git a/frontend/src/business/components/common/head/SearchList.vue b/frontend/src/business/components/common/head/SearchList.vue index d4bbf9d1de..4b861ec45a 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -76,13 +76,6 @@ export default { }) } }, - search() { - if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) { - this.result = this.$post("/project/search", {name: this.searchString},response => { - this.items = response.data; - }) - } - }, query(queryString) { this.items = queryString ? this.searchArray.filter(this.createFilter(queryString)) : this.searchArray; }, diff --git a/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue b/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue index fedbe25eb6..117b735ac9 100644 --- a/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue +++ b/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue @@ -59,16 +59,6 @@ export default { }, data() { return { - projectRecent: { - title: this.$t('project.recent'), - url: "/project/recent/5", - index(item) { - return '/performance/test/' + item.id; - }, - router(item) { - return {name: 'perPlan', params: {projectId: item.id, projectName: item.name}} - } - }, testRecent: { title: this.$t('load_test.recent'), url: "/performance/recent/5", @@ -95,10 +85,6 @@ export default { registerEvents() { PerformanceEvent.$on(LIST_CHANGE, () => { // // todo 这里偶尔会有 refs 为空的情况 - // if (!this.$refs.projectRecent) { - // return; - // } - // this.$refs.projectRecent.recent(); this.$refs.testRecent.recent(); this.$refs.reportRecent.recent(); }); diff --git a/frontend/src/business/components/track/head/TrackHeaderMenus.vue b/frontend/src/business/components/track/head/TrackHeaderMenus.vue index 484234a688..7b9dbd4ac3 100644 --- a/frontend/src/business/components/track/head/TrackHeaderMenus.vue +++ b/frontend/src/business/components/track/head/TrackHeaderMenus.vue @@ -69,16 +69,6 @@ export default { testCaseProjectPath: '', isProjectActivation: true, currentProject: '', - projectRecent: { - title: this.$t('project.recent'), - url: "/project/recent/5", - index: function (item) { - return '/track/case/' + item.id; - }, - router: function (item) { - return {name: 'testCase', params: {projectId: item.id, projectName: item.name}} - } - }, caseRecent: { title: this.$t('test_track.recent_case'), url: "/test/case/recent/5", @@ -126,14 +116,6 @@ export default { }, init() { let path = this.$route.path; - // if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) { - // this.testCaseProjectPath = path; - // //不激活项目菜单栏 - // this.isProjectActivation = false; - // this.reload(); - // } else { - // this.isProjectActivation = true; - // } if (path.indexOf("/track/plan/view") >= 0) { this.testPlanViewPath = path; this.reload(); @@ -150,10 +132,6 @@ export default { registerEvents() { TrackEvent.$on(LIST_CHANGE, () => { // // todo 这里偶尔会有 refs 为空的情况 - // if (!this.$refs.projectRecent) { - // return; - // } - // this.$refs.projectRecent.recent(); this.$refs.planRecent.recent(); this.$refs.caseRecent.recent(); }); From 1bfeaa2c075452cdd50dfeb4f0783447b85f6702 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 16 Dec 2020 16:07:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/common/head/ProjectSwitch.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/common/head/ProjectSwitch.vue b/frontend/src/business/components/common/head/ProjectSwitch.vue index 85e1f77769..b9c024b3a9 100644 --- a/frontend/src/business/components/common/head/ProjectSwitch.vue +++ b/frontend/src/business/components/common/head/ProjectSwitch.vue @@ -1,5 +1,5 @@