diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index 035d922ec5..e44ed2f5a2 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -50,8 +50,8 @@ public class APITestController { return apiTestService.getApiTestByProjectId(projectId); } - /*查询某个api测试状态*/ - @GetMapping("/list/all/{testId}") + + @GetMapping("/state/get/{testId}") public ApiTest apiState(@PathVariable String testId) { return apiTestService.getApiTestByTestId(testId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 647d676656..863966c10b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -3,7 +3,7 @@ diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index d30a68dad6..c9950afca1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -71,6 +71,9 @@ and test_plan_test_case.plan_id = #{request.planId} + + and test_case.method = #{request.method} + and test_case.node_path in diff --git a/backend/src/main/java/io/metersphere/config/ShiroConfig.java b/backend/src/main/java/io/metersphere/config/ShiroConfig.java index 5f0487cf75..92d723b810 100644 --- a/backend/src/main/java/io/metersphere/config/ShiroConfig.java +++ b/backend/src/main/java/io/metersphere/config/ShiroConfig.java @@ -56,7 +56,6 @@ public class ShiroConfig { filterChainDefinitionMap.put("/swagger-ui/**", "anon"); filterChainDefinitionMap.put("/v3/api-docs/**", "anon"); - filterChainDefinitionMap.put("/api/**", "anon"); filterChainDefinitionMap.put("/403", "anon"); filterChainDefinitionMap.put("/anonymous/**", "anon"); filterChainDefinitionMap.put("/**", "apikey, authc"); diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index 4620020bef..b0520ec039 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -55,8 +55,8 @@ public class PerformanceTestController { return performanceTestService.getLoadTestByProjectId(projectId); } - /*查询某个测试状态*/ - @GetMapping("/list/all/{testId}") + + @GetMapping("/state/get/{testId}") public LoadTest listByTestId(@PathVariable String testId) { return performanceTestService.getLoadTestBytestId(testId); } diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java index dca34abc3c..77e1fdee6c 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java @@ -42,6 +42,7 @@ public class TestPlanTestCaseController { QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); request.setPlanId(planId); request.setNodePaths(list); + request.setMethod("auto"); return testPlanTestCaseService.listByNode(request); } diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue index 09a11d8979..0697dc3b24 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue @@ -19,26 +19,47 @@ - + - + - - - - + + + + + + + + + + @@ -56,107 +77,128 @@ import NodeTree from '../../../common/NodeTree'; import MsDialogFooter from '../../../../common/components/MsDialogFooter' + import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem"; + import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem"; + import {_filter} from "../../../../../../common/js/utils"; export default { - name: "TestCaseRelevance", - components: {NodeTree, MsDialogFooter}, - data() { - return { - result: {}, - dialogFormVisible: false, - isCheckAll: false, - testCases: [], - selectIds: new Set(), - treeNodes: [], - selectNodeIds: [], - selectNodeNames: [] - }; - }, - props: { - planId: { - type: String - } - }, - watch: { - planId() { - this.initData(); - }, - selectNodeIds() { - this.getCaseNames(); - } - }, - methods: { - openTestCaseRelevanceDialog() { - this.initData(); - this.dialogFormVisible = true; - }, - saveCaseRelevance(){ - let param = {}; - param.planId = this.planId; - param.testCaseIds = [...this.selectIds]; - this.$post('/test/plan/relevance' , param, () => { - this.selectIds.clear(); - this.$success(this.$t('commons.save_success')); - this.dialogFormVisible = false; - this.$emit('refresh'); - }); - }, - getCaseNames() { - let param = {}; - if (this.planId) { - param.planId = this.planId; - } - if (this.selectNodeIds && this.selectNodeIds.length > 0){ - param.nodeIds = this.selectNodeIds; - } - this.result = this.$post('/test/case/name', param, response => { - this.testCases = response.data; - this.testCases.forEach(item => { - item.checked = false; - }); - }); - }, - handleSelectAll(selection) { - if(selection.length > 0){ - this.testCases.forEach(item => { - this.selectIds.add(item.id); - }); - } else { - this.selectIds.clear(); - } - }, - handleSelectionChange(selection, row) { - if(this.selectIds.has(row.id)){ - this.selectIds.delete(row.id); - } else { - this.selectIds.add(row.id); - } - }, - nodeChange(nodeIds, nodeNames) { - this.selectNodeIds = nodeIds; - this.selectNodeNames = nodeNames; - }, - initData() { - this.getCaseNames(); - this.getAllNodeTreeByPlanId(); - }, - refresh() { - this.close(); - }, - getAllNodeTreeByPlanId() { - if (this.planId) { - this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => { - this.treeNodes = response.data; - }); - } - }, - close() { - this.selectIds.clear(); - this.selectNodeIds = []; - this.selectNodeNames = []; - } + name: "TestCaseRelevance", + components: {NodeTree, MsDialogFooter, PriorityTableItem, TypeTableItem}, + data() { + return { + result: {}, + dialogFormVisible: false, + isCheckAll: false, + testCases: [], + selectIds: new Set(), + treeNodes: [], + selectNodeIds: [], + selectNodeNames: [], + condition: {}, + priorityFilters: [ + {text: 'P0', value: 'P0'}, + {text: 'P1', value: 'P1'}, + {text: 'P2', value: 'P2'}, + {text: 'P3', value: 'P3'} + ], + typeFilters: [ + {text: this.$t('commons.functional'), value: 'functional'}, + {text: this.$t('commons.performance'), value: 'performance'}, + {text: this.$t('commons.api'), value: 'api'} + ] + }; + }, + props: { + planId: { + type: String } + }, + watch: { + planId() { + this.initData(); + }, + selectNodeIds() { + this.getCaseNames(); + } + }, + methods: { + openTestCaseRelevanceDialog() { + this.initData(); + this.dialogFormVisible = true; + }, + saveCaseRelevance() { + let param = {}; + param.planId = this.planId; + param.testCaseIds = [...this.selectIds]; + this.$post('/test/plan/relevance', param, () => { + this.selectIds.clear(); + this.$success(this.$t('commons.save_success')); + this.dialogFormVisible = false; + this.$emit('refresh'); + }); + }, + getCaseNames() { + let param = {}; + if (this.planId) { + // param.planId = this.planId; + this.condition.planId = this.planId; + } + if (this.selectNodeIds && this.selectNodeIds.length > 0) { + // param.nodeIds = this.selectNodeIds; + this.condition.nodeIds = this.selectNodeIds; + } + this.result = this.$post('/test/case/name', this.condition, response => { + this.testCases = response.data; + this.testCases.forEach(item => { + item.checked = false; + }); + }); + }, + handleSelectAll(selection) { + if (selection.length > 0) { + this.testCases.forEach(item => { + this.selectIds.add(item.id); + }); + } else { + this.selectIds.clear(); + } + }, + handleSelectionChange(selection, row) { + if (this.selectIds.has(row.id)) { + this.selectIds.delete(row.id); + } else { + this.selectIds.add(row.id); + } + }, + nodeChange(nodeIds, nodeNames) { + this.selectNodeIds = nodeIds; + this.selectNodeNames = nodeNames; + }, + initData() { + this.getCaseNames(); + this.getAllNodeTreeByPlanId(); + }, + refresh() { + this.close(); + }, + getAllNodeTreeByPlanId() { + if (this.planId) { + this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => { + this.treeNodes = response.data; + }); + } + }, + close() { + this.selectIds.clear(); + this.selectNodeIds = []; + this.selectNodeNames = []; + }, + filter(filters) { + _filter(filters, this.condition); + this.initData(); + }, } + }