From 6f93e09f4749f406d7326258c534e18c9a100553 Mon Sep 17 00:00:00 2001 From: Coooder-X <55648333+Coooder-X@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:21:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20(=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E3=80=81=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?)=20=E5=88=A0=E9=99=A4=E6=A8=A1=E5=9D=97=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8B=E7=9A=84=E6=89=80=E6=9C=89=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=88=96=E5=9C=BA=E6=99=AF=E8=A2=AB=E6=94=BE=E5=85=A5?= =?UTF-8?q?=E5=9B=9E=E6=94=B6=E7=AB=99=20(#1268)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 6 +++ .../api/service/ApiModuleService.java | 2 +- .../api/service/ApiScenarioModuleService.java | 2 +- .../mapper/ext/ExtApiDefinitionMapper.java | 4 ++ .../mapper/ext/ExtApiDefinitionMapper.xml | 9 +++++ .../base/mapper/ext/ExtApiScenarioMapper.java | 3 ++ .../base/mapper/ext/ExtApiScenarioMapper.xml | 38 +++++++++++++++++++ 7 files changed, 62 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 96278e134a..a8a190bf6e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -124,6 +124,12 @@ public class ApiAutomationService { apiScenarioMapper.deleteByExample(example); } + public void removeToGcByIds(List nodeIds) { + ApiScenarioExample example = new ApiScenarioExample(); + example.createCriteria().andApiScenarioModuleIdIn(nodeIds); + extApiScenarioMapper.removeToGcByExample(example); + } + public ApiScenario create(SaveApiScenarioRequest request, List bodyFiles) { request.setId(UUID.randomUUID().toString()); checkNameExist(request); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java index aa93724dae..b80947b793 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java @@ -240,7 +240,7 @@ public class ApiModuleService extends NodeTreeService { public int deleteNode(List nodeIds) { ApiDefinitionExample apiDefinitionExample = new ApiDefinitionExample(); apiDefinitionExample.createCriteria().andModuleIdIn(nodeIds); - apiDefinitionMapper.deleteByExample(apiDefinitionExample); + extApiDefinitionMapper.removeToGcByExample(apiDefinitionExample); // 删除模块,则模块下的接口放入回收站 ApiModuleExample apiDefinitionNodeExample = new ApiModuleExample(); apiDefinitionNodeExample.createCriteria().andIdIn(nodeIds); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java index 94a62fb6e7..6445f7d13a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java @@ -194,7 +194,7 @@ public class ApiScenarioModuleService extends NodeTreeService nodeIds) { - apiAutomationService.deleteByIds(nodeIds); + apiAutomationService.removeToGcByIds(nodeIds); ApiScenarioModuleExample apiScenarioModuleExample = new ApiScenarioModuleExample(); apiScenarioModuleExample.createCriteria().andIdIn(nodeIds); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java index 7c0156407f..d523317de7 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java @@ -6,6 +6,8 @@ import io.metersphere.api.dto.definition.ApiDefinitionRequest; import io.metersphere.api.dto.definition.ApiDefinitionResult; import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO; import io.metersphere.base.domain.ApiDefinition; +import io.metersphere.base.domain.ApiDefinitionExample; +import io.metersphere.base.domain.ApiModuleExample; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -19,6 +21,8 @@ public interface ExtApiDefinitionMapper { int removeToGc(@Param("ids") List ids); + int removeToGcByExample(ApiDefinitionExample example); + int reduction(@Param("ids") List ids); List countProtocolByProjectID(String projectId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml index cc3ead40b4..3a61cea026 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml @@ -311,6 +311,15 @@ + + update api_definition + set + status = 'Trash', module_path = null, module_id = null + + + + + update api_definition set diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java index 7645843c99..07ea9c380d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java @@ -4,6 +4,7 @@ import io.metersphere.api.dto.automation.ApiScenarioDTO; import io.metersphere.api.dto.automation.ApiScenarioRequest; import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.base.domain.ApiScenario; +import io.metersphere.base.domain.ApiScenarioExample; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import org.apache.ibatis.annotations.Param; @@ -20,6 +21,8 @@ public interface ExtApiScenarioMapper { int removeToGc(@Param("ids") List ids); + int removeToGcByExample(ApiScenarioExample example); + int reduction(@Param("ids") List ids); long countByProjectID(String projectId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 56556c85dd..1f391c031a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -7,6 +7,35 @@ + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + @@ -243,6 +272,15 @@ + + update api_scenario + set + status = 'Trash', module_path = null, api_scenario_module_id = null + + + + + update api_scenario set From 9f05de4205a448df18f7b9a5474aca61e704a3c4 Mon Sep 17 00:00:00 2001 From: Coooder-X <55648333+Coooder-X@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:21:43 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=E5=9C=A8=E6=8E=A5=E5=8F=A3=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=AD=89=E7=AA=97=E5=8F=A3=E4=B8=AD=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E7=82=B9=E5=87=BBID=E8=BF=9B=E5=85=A5=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20(#1269)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: (接口定义、接口自动化) 删除模块时,模块下的所有接口或场景被放入回收站 * feat:在接口列表等窗口中,可点击ID进入编辑页面 --- .../api/automation/scenario/ApiScenarioList.vue | 8 +++++++- .../api/definition/components/list/ApiCaseSimpleList.vue | 8 +++++++- .../components/api/definition/components/list/ApiList.vue | 8 +++++++- .../components/track/case/components/TestCaseList.vue | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 0878125e23..9fdae219b4 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -28,7 +28,13 @@ + show-overflow-tooltip> + + - + + + + sortable="custom"> + + diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index d076a1f38b..ad7a13f10a 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -32,7 +32,7 @@ @cell-mouse-enter="showPopover" row-key="id" class="test-content adjust-table ms-select-all" - ref="table"> + ref="table" @row-click="handleEdit"> Date: Tue, 26 Jan 2021 17:28:12 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20(=E6=B5=8B=E8=AF=95=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=B1=A0)=20=E4=BB=85=E5=BD=93IP=E5=92=8C=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E5=90=8C=E6=97=B6=E9=87=8D=E5=A4=8D=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=B7=BB=E5=8A=A0=E5=A4=B1=E8=B4=A5=20(#1264?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: (测试资源池)增加资源池中端口重复判断 * fix: (测试资源池) 仅当IP和端口同时重复时,提示添加失败 Co-authored-by: jianxing <41557596+AgAngle@users.noreply.github.com> --- .../service/NodeResourcePoolService.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java index fc16e3c70c..d6067166d0 100644 --- a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java +++ b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java @@ -10,6 +10,7 @@ import io.metersphere.commons.utils.LogUtil; import io.metersphere.dto.NodeDTO; import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.i18n.Translator; +import javafx.util.Pair; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; @@ -39,26 +40,16 @@ public class NodeResourcePoolService { } deleteTestResource(testResourcePool.getId()); - List nodeIps = testResourcePool.getResources().stream() + List Ip_Port = testResourcePool.getResources().stream() .map(resource -> { NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); - return nodeDTO.getIp(); + return new Pair(nodeDTO.getIp(), nodeDTO.getPort()); }) .distinct() .collect(Collectors.toList()); - List nodePorts = testResourcePool.getResources().stream() - .map(resource -> { - NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); - return nodeDTO.getPort(); - }) - .distinct() - .collect(Collectors.toList()); - if (nodeIps.size() < testResourcePool.getResources().size() && nodePorts.size() < testResourcePool.getResources().size()) { + if (Ip_Port.size() < testResourcePool.getResources().size()) { MSException.throwException(Translator.get("duplicate_node_ip_port")); } - else if (nodeIps.size() < testResourcePool.getResources().size()) { - MSException.throwException(Translator.get("duplicate_node_ip")); - } else if (nodePorts.size() < testResourcePool.getResources().size()) { MSException.throwException(Translator.get("duplicate_node_port")); } From 16a245095361d9b04afaaa95f36d7e0318c57b13 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 26 Jan 2021 17:34:54 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dpr=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/service/NodeResourcePoolService.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java index d6067166d0..7866f3e14e 100644 --- a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java +++ b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java @@ -50,9 +50,6 @@ public class NodeResourcePoolService { if (Ip_Port.size() < testResourcePool.getResources().size()) { MSException.throwException(Translator.get("duplicate_node_ip_port")); } - else if (nodePorts.size() < testResourcePool.getResources().size()) { - MSException.throwException(Translator.get("duplicate_node_port")); - } testResourcePool.setStatus(VALID.name()); boolean isValid = true; for (TestResource resource : testResourcePool.getResources()) { From 2ed98cb3fe7a10c8e8c20308cb9f907c35c61b2a Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:39:09 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/track/controller/TestPlanController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java index c1f1f6e0ef..5b99d9a620 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -50,7 +50,7 @@ public class TestPlanController { QueryTestPlanRequest request = new QueryTestPlanRequest(); request.setWorkspaceId(workspaceId); request.setProjectId(projectId); - return testPlanService.listTestPlan(request); + return testPlanService.listTestPlanByProject(request); } @PostMapping("/list/all") From 817fc25bb821964f1a4ce1648abfcdd332a26c72 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 26 Jan 2021 17:50:08 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=20sso=20=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=B7=B3=E8=BD=AC=E4=B9=8B=E5=90=8E=E5=8F=88=E6=89=A7?= =?UTF-8?q?=E8=A1=8Csignout=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/common/router/router.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/common/router/router.js b/frontend/src/business/components/common/router/router.js index f5821015c4..a7dbdbce6f 100644 --- a/frontend/src/business/components/common/router/router.js +++ b/frontend/src/business/components/common/router/router.js @@ -1,7 +1,6 @@ import Vue from "vue"; import VueRouter from 'vue-router' import RouterSidebar from "./RouterSidebar"; -import axios from "axios"; import Setting from "@/business/components/settings/router"; import API from "@/business/components/api/router"; import Performance from "@/business/components/performance/router"; @@ -31,8 +30,8 @@ router.beforeEach((to, from, next) => { //解决localStorage清空,cookie没失效导致的卡死问题 if (!localStorage.getItem('Admin-Token')) { - axios.get("/signout"); - console.log("signout"); + // axios.get("/signout"); + // console.log("signout"); localStorage.setItem('Admin-Token', "{}"); window.location.href = "/login"; next(); From 33a397b65ee56c3075f079ea18b1122510896c6d Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 26 Jan 2021 18:02:48 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=E6=9B=BF=E6=8D=A2Pair?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/service/NodeResourcePoolService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java index 7866f3e14e..2531d644c7 100644 --- a/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java +++ b/backend/src/main/java/io/metersphere/service/NodeResourcePoolService.java @@ -10,9 +10,9 @@ import io.metersphere.commons.utils.LogUtil; import io.metersphere.dto.NodeDTO; import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.i18n.Translator; -import javafx.util.Pair; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -40,10 +40,10 @@ public class NodeResourcePoolService { } deleteTestResource(testResourcePool.getId()); - List Ip_Port = testResourcePool.getResources().stream() + List Ip_Port = testResourcePool.getResources().stream() .map(resource -> { NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); - return new Pair(nodeDTO.getIp(), nodeDTO.getPort()); + return new ImmutablePair(nodeDTO.getIp(), nodeDTO.getPort()); }) .distinct() .collect(Collectors.toList());