From f399ba2885119f20b6e636e484118dd684bee858 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 11 Dec 2020 10:50:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8C=89=E7=85=A7=E9=A1=B9=E7=9B=AE=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/APIReportService.java | 3 ++ .../api/service/APITestService.java | 9 ++++- backend/src/main/java/io/metersphere/xpack | 2 +- .../components/api/head/ApiHeaderMenus.vue | 33 +++++++++---------- .../components/common/head/SearchList.vue | 11 ++++++- frontend/src/business/components/xpack | 2 +- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/APIReportService.java b/backend/src/main/java/io/metersphere/api/service/APIReportService.java index a8ce783493..0e7e3d2926 100644 --- a/backend/src/main/java/io/metersphere/api/service/APIReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/APIReportService.java @@ -17,6 +17,7 @@ import io.metersphere.commons.constants.ReportTriggerMode; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ServiceUtils; +import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.DashboardTestDTO; import io.metersphere.i18n.Translator; import org.apache.commons.lang3.StringUtils; @@ -48,11 +49,13 @@ public class APIReportService { public List list(QueryAPIReportRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extApiTestReportMapper.list(request); } public List recentTest(QueryAPIReportRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extApiTestReportMapper.list(request); } diff --git a/backend/src/main/java/io/metersphere/api/service/APITestService.java b/backend/src/main/java/io/metersphere/api/service/APITestService.java index bcb068c941..8932a52370 100644 --- a/backend/src/main/java/io/metersphere/api/service/APITestService.java +++ b/backend/src/main/java/io/metersphere/api/service/APITestService.java @@ -1,6 +1,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSONObject; +import com.alibaba.nacos.client.utils.StringUtils; import io.github.ningyu.jmeter.plugin.dubbo.sample.ProviderService; import io.metersphere.api.dto.*; import io.metersphere.api.dto.parse.ApiImport; @@ -67,11 +68,13 @@ public class APITestService { public List list(QueryAPITestRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extApiTestMapper.list(request); } public List recentTest(QueryAPITestRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extApiTestMapper.list(request); } @@ -402,7 +405,11 @@ public class APITestService { .collect(Collectors.toList()); if (!resourceIds.isEmpty()) { ApiTestExample example = new ApiTestExample(); - example.createCriteria().andIdIn(resourceIds); + ApiTestExample.Criteria criteria = example.createCriteria(); + criteria.andIdIn(resourceIds); + if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) { + criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId()); + } List apiTests = apiTestMapper.selectByExample(example); Map apiTestMap = apiTests.stream().collect(Collectors.toMap(ApiTest::getId, ApiTest::getName)); scheduleService.build(apiTestMap, schedules); diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index bb494fc68a..905ca8af61 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6 +Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e diff --git a/frontend/src/business/components/api/head/ApiHeaderMenus.vue b/frontend/src/business/components/api/head/ApiHeaderMenus.vue index ef43d5ac1f..b4dcf3f51b 100644 --- a/frontend/src/business/components/api/head/ApiHeaderMenus.vue +++ b/frontend/src/business/components/api/head/ApiHeaderMenus.vue @@ -110,11 +110,11 @@ export default { apiTestProjectPath: '', } }, - watch: { - '$route'(to) { - this.init(); - }, - }, + // watch: { + // '$route'(to) { + // this.init(); + // }, + // }, methods: { registerEvents() { ApiEvent.$on(LIST_CHANGE, () => { @@ -133,18 +133,17 @@ 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; - } - - }, + // 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 5bf6e2fa18..9981df1e84 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -14,7 +14,10 @@
@@ -40,6 +43,7 @@ export default { items: [], search_text: '', userId: getCurrentUser().id, + projectId: localStorage.getItem(PROJECT_ID) } }, watch: { @@ -97,4 +101,9 @@ export default { overflow: hidden; text-overflow: ellipsis; } + +.el-icon-check { + color: #773888; + margin-left: 10px; +} diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index a22a3005d9..29a8fc0960 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a +Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836