From 5178c5b45718621f25d0b70918f42f872784420f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 21 Jul 2021 12:08:58 +0800 Subject: [PATCH 01/23] =?UTF-8?q?fix:=20=E8=84=91=E5=9B=BE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=A8=E4=BE=8B=E7=AD=89=E7=BA=A7=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestCaseService.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 46e906872dba..a6020ea2a699 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1243,6 +1243,18 @@ public List listTestCaseIds(QueryTestCaseRequest request) { public void minderEdit(TestCaseMinderEditRequest request) { List data = request.getData(); + if (CollectionUtils.isEmpty(data)) { + return; + } + + TestCaseExample example = new TestCaseExample(); + List editIds = data.stream() + .filter(t -> StringUtils.isNotBlank(t.getId()) && t.getId().length() > 20) + .map(TestCaseWithBLOBs::getId).collect(Collectors.toList()); + example.createCriteria().andIdIn(editIds); + List testCaseWithBLOBs = testCaseMapper.selectByExampleWithBLOBs(example); + Map testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t)); + data.forEach(item -> { if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) { item.setNodeId(""); @@ -1253,6 +1265,10 @@ public void minderEdit(TestCaseMinderEditRequest request) { item.setMaintainer(SessionUtils.getUserId()); addTestCase(item); } else { + TestCaseWithBLOBs dbCase = testCaseMap.get(item.getId()); + if (editCustomFieldsPriority(dbCase, item.getPriority())) { + item.setCustomFields(dbCase.getCustomFields()); + }; editTestCase(item); } }); @@ -1264,6 +1280,28 @@ public void minderEdit(TestCaseMinderEditRequest request) { } } + /** + * 脑图编辑之后修改用例等级,同时修改自定义字段的用例等级 + * @param dbCase + * @param priority + * @return + */ + private boolean editCustomFieldsPriority(TestCaseWithBLOBs dbCase, String priority) { + String customFields = dbCase.getCustomFields(); + if (StringUtils.isNotBlank(customFields)) { + JSONArray fields = JSONObject.parseArray(customFields); + for (int i = 0; i < fields.size(); i++) { + JSONObject field = fields.getJSONObject(i); + if (field.getString("name").equals("用例等级")) { + field.put("value", priority); + dbCase.setCustomFields(JSONObject.toJSONString(fields)); + return true; + } + } + } + return false; + } + public List getTestCaseByProjectId(String projectId) { TestCaseExample example = new TestCaseExample(); example.createCriteria().andProjectIdEqualTo(projectId); From 2b7109ab85e18d331e6f370fc482b99aac87c830 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 21 Jul 2021 10:59:06 +0800 Subject: [PATCH 02/23] =?UTF-8?q?refactor:=20=E7=BC=BA=E9=99=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/workspace/template/CustomFieldFormList.vue | 4 +--- .../settings/workspace/template/CustomFieldList.vue | 7 +++---- .../settings/workspace/template/CustomFieldRelateList.vue | 1 + .../settings/workspace/template/FieldTemplateEdit.vue | 1 + .../settings/workspace/template/IssuesTemplateList.vue | 7 +++---- .../settings/workspace/template/TestCaseTemplateList.vue | 7 +++---- .../business/components/track/issue/IssueEditDetail.vue | 8 ++++---- .../business/components/track/issue/TestCaseIssueList.vue | 1 + 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue index 48e89f9d3a4c..70c0fb001c40 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue @@ -122,6 +122,7 @@ export default { this.tableData.splice(index, 1); }, refreshTable() { + this.$refs.table.reloadTable(); }, appendData(customFieldIds) { let condition = {}; @@ -148,7 +149,4 @@ export default { diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldList.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldList.vue index f22d631d40f0..3d3da3a2b425 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldList.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldList.vue @@ -18,7 +18,8 @@ field-key="CUSTOM_FIELD" :screen-height="tableHeight" @handlePageChange="getCustomFields" - @refresh="getCustomFields"> + @refresh="getCustomFields" + ref="table">
@@ -200,6 +201,7 @@ export default { let data = response.data; this.total = data.itemCount; this.tableData = data.listObject; + this.$refs.table.reloadTable(); }); }, handleEdit(data) { @@ -232,7 +234,4 @@ export default { diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldRelateList.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldRelateList.vue index b7ab7c9dd32a..687146fbf624 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldRelateList.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldRelateList.vue @@ -159,6 +159,7 @@ export default { let data = response.data; this.total = data.itemCount; this.tableData = data.listObject; + this.$refs.table.reloadTable(); }); } }, diff --git a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue index 9b9a4431ddd5..db3f9281af05 100644 --- a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue @@ -199,6 +199,7 @@ export default { } this.templateContainIds.add(item.fieldId); }); + this.$refs.customFieldFormList.refreshTable(); }); } else { this.appendDefaultFiled(); diff --git a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue index b80fe18aa2ef..7b106607153b 100644 --- a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue +++ b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue @@ -17,7 +17,8 @@ :screen-height="tableHeight" :enable-selection="false" @handlePageChange="initTableData" - @refresh="initTableData"> + @refresh="initTableData" + ref="table"> diff --git a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue index bcd1dee18738..e6f0469c225b 100644 --- a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue +++ b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue @@ -16,7 +16,8 @@ :screen-height="tableHeight" :enable-selection="false" @handlePageChange="initTableData" - @refresh="initTableData"> + @refresh="initTableData" + ref="table"> diff --git a/frontend/src/business/components/track/issue/IssueEditDetail.vue b/frontend/src/business/components/track/issue/IssueEditDetail.vue index 193da33394b4..be4796b50dfc 100644 --- a/frontend/src/business/components/track/issue/IssueEditDetail.vue +++ b/frontend/src/business/components/track/issue/IssueEditDetail.vue @@ -24,7 +24,7 @@ - + - + - + { this.testCaseContainIds.add(item.id); }); + this.$refs.table.reloadTable(); }); } }, From ea927a82fcc2b2eb25a8165c99eccb7b6ed8cf8b Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 21 Jul 2021 10:54:04 +0800 Subject: [PATCH 03/23] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=9A=E4=B9=89ID?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E8=BF=87=E6=BB=A4=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E9=A6=96=E5=B0=BE=E7=A9=BA=E7=99=BD=E5=AD=97=E7=AC=A6?= =?UTF-8?q?#1005283?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1005283 --user=lyh 【系统设置-项目】【项目管理-更新】自定义id为空格,依然可以保存 https://www.tapd.cn/55049933/s/1026776 --- .../components/api/automation/scenario/EditApiScenario.vue | 2 +- .../business/components/track/case/components/TestCaseEdit.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 5576891c4386..07820a587008 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -90,7 +90,7 @@ - + diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 43b23c5a3680..b5bb4c7b6475 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -65,7 +65,7 @@ - + From dd1758493aa8e4a25dee3f032fbf5e930c7c24ab Mon Sep 17 00:00:00 2001 From: chenxiaowu Date: Mon, 19 Jul 2021 14:56:57 +0800 Subject: [PATCH 04/23] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=85=B3=E8=81=94=E9=A1=B5=E9=9D=A2=E8=B0=83=E8=AF=95?= =?UTF-8?q?form-data=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=A4=B1=E8=B4=A5=20#4812?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/plan/view/comonents/api/TestPlanApiCaseList.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue index 20bedadd9ef9..ff718599445e 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -460,7 +460,6 @@ export default { let apiCase = response.data; let request = JSON.parse(apiCase.request); request.name = row.id; - request.id = row.id; request.useEnvironment = row.environmentId; this.runData.push(request); /*触发执行操作*/ From 34811a96136f61e19722684332874abae0f58aa1 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 21 Jul 2021 11:26:36 +0800 Subject: [PATCH 05/23] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A0=E7=8E=AF=E5=A2=83=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#09e9b5b7=20--bug=3D1005268=20--user=3D=E8=B5=B5?= =?UTF-8?q?=E5=8B=87=20=E3=80=90=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E3=80=91=E7=BC=96=E8=BE=91=E5=9C=BA...=20https://www.?= =?UTF-8?q?tapd.cn/55049933/s/1026836?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 8 +- .../automation/report/SysnApiReportDetail.vue | 4 +- .../automation/scenario/EditApiScenario.vue | 90 +++++++------------ .../scenario/component/ApiComponent.vue | 29 +++--- .../component/ApiScenarioComponent.vue | 9 +- .../scenario/component/ComponentConfig.vue | 3 +- .../scenario/component/IfController.vue | 15 +++- .../component/JmeterElementComponent.vue | 19 +++- .../scenario/component/LoopController.vue | 8 +- .../component/TransactionController.vue | 15 +++- 10 files changed, 112 insertions(+), 88 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 3fc87894f67a..218968ca3465 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1393,9 +1393,11 @@ public String debugRun(RunDefinitionRequest request, List bodyFil if (map != null) { map.keySet().forEach(id -> { ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(id)); - EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class); - env.setApiEnvironmentid(environment.getId()); - envConfig.put(id, env); + if (environment != null && environment.getConfig() != null) { + EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class); + env.setApiEnvironmentid(environment.getId()); + envConfig.put(id, env); + } }); } try { diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index d94630e13078..232036a4de6f 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -449,7 +449,9 @@ export default { .report-header { font-size: 15px; } - +/deep/ .el-card__body{ + padding: 0px; +} .report-header a { text-decoration: none; } diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 07820a587008..50e397037af5 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -195,7 +195,7 @@ :allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable ref="stepTree"> - @@ -416,6 +416,7 @@ export default { stopDebug: "", isTop: false, stepSize: 0, + message: "", } }, created() { @@ -509,6 +510,7 @@ export default { if (e.data) { let data = JSON.parse(e.data); this.formatResult(data); + this.message = getUUID(); if (data.end) { this.removeReport(); this.debugLoading = false; @@ -561,7 +563,7 @@ export default { } this.debugResult = resMap; this.sort(); - this.reload(); + // this.reload(); this.reloadDebug = getUUID(); }, removeReport() { @@ -709,74 +711,44 @@ export default { this.isBtnHide = true; this.$refs.scenarioApiRelevance.open(); }, - recursiveSorting(arr, scenarioProjectId) { - for (let i in arr) { - arr[i].index = Number(i) + 1; - if (!arr[i].resourceId) { - arr[i].resourceId = getUUID(); + sort(stepArray, scenarioProjectId) { + if (!stepArray) { + stepArray = this.scenarioDefinition; + } + for (let i in stepArray) { + stepArray[i].index = Number(i) + 1; + if (!stepArray[i].resourceId) { + stepArray[i].resourceId = getUUID(); } - if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) { - arr[i].countController.proceed = true; + if (stepArray[i].type === ELEMENT_TYPE.LoopController + && stepArray[i].loopType === "LOOP_COUNT" + && stepArray[i].hashTree + && stepArray[i].hashTree.length > 1) { + stepArray[i].countController.proceed = true; } - if (!arr[i].projectId) { + if (!stepArray[i].projectId) { // 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID - arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId; + stepArray[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId; } else { - const project = this.projectList.find(p => p.id === arr[i].projectId); + const project = this.projectList.find(p => p.id === stepArray[i].projectId); if (!project) { - arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId; + stepArray[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId; } } // 添加debug结果 - let key = arr[i].resourceId; + let key = stepArray[i].resourceId; if (this.debugResult && this.debugResult.get(key)) { - arr[i].requestResult = this.debugResult.get(key); - arr[i].result = null; - arr[i].debug = this.debug; - this.findNode(key, arr[i].requestResult[0].success); + stepArray[i].requestResult = this.debugResult.get(key); + stepArray[i].result = null; + stepArray[i].debug = this.debug; + this.findNode(key, stepArray[i].requestResult[0].success); } - if (arr[i].hashTree && arr[i].hashTree.length > 0) { - this.stepSize += arr[i].hashTree.length; - this.recursiveSorting(arr[i].hashTree, arr[i].projectId); + if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) { + this.stepSize += stepArray[i].hashTree.length; + this.sort(stepArray[i].hashTree, stepArray[i].projectId); } } }, - sort() { - this.stepSize = this.scenarioDefinition.length; - for (let i in this.scenarioDefinition) { - // 排序 - this.scenarioDefinition[i].index = Number(i) + 1; - if (!this.scenarioDefinition[i].resourceId) { - this.scenarioDefinition[i].resourceId = getUUID(); - } - // 设置循环控制 - if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree - && this.scenarioDefinition[i].hashTree.length > 1) { - this.scenarioDefinition[i].countController.proceed = true; - } - // 设置项目ID - if (!this.scenarioDefinition[i].projectId) { - this.scenarioDefinition[i].projectId = this.projectId; - } else { - const project = this.projectList.find(p => p.id === this.scenarioDefinition[i].projectId); - if (!project) { - this.scenarioDefinition[i].projectId = this.projectId; - } - } - - if (this.scenarioDefinition[i].hashTree !== undefined && this.scenarioDefinition[i].hashTree.length > 0) { - this.stepSize += this.scenarioDefinition[i].hashTree.length; - this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId); - } - // 添加debug结果 - if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].resourceId)) { - this.scenarioDefinition[i].result = null; - this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].resourceId); - this.scenarioDefinition[i].debug = this.debug; - } - - } - }, addCustomizeApi(request) { this.customizeVisible = false; request.enable === undefined ? request.enable = true : request.enable; @@ -970,7 +942,6 @@ export default { }); } }, - checkDataIsCopy() { // 如果是复制按钮创建的场景,直接进行保存 if (this.currentScenario.copy) { @@ -1148,8 +1119,7 @@ export default { this.currentScenario.apiScenarioModuleId = this.currentModule.id; } this.currentScenario.projectId = this.projectId; - } - , + }, runRefresh() { if (!this.debug) { this.debugVisible = true; diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 6934a0234776..0c9c03e3467c 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -23,7 +23,7 @@ {{ $t('api_test.scenario.reference') }} @@ -133,7 +133,8 @@ export default { currentEnvironmentId: String, projectList: Array, expandedNode: Array, - envMap: Map + envMap: Map, + message: String }, components: { TemplateComponent, @@ -188,6 +189,9 @@ export default { envMap() { this.getEnvironments(); }, + message() { + this.reload(); + }, }, computed: { displayColor() { @@ -264,7 +268,7 @@ export default { if (this.request.protocol === 'SQL' || this.request.type === 'JDBCSampler') { if (this.environment && this.environment.config) { let config = JSON.parse(this.environment.config); - if(config && config.databaseConfigs) { + if (config && config.databaseConfigs) { config.databaseConfigs.forEach(item => { databaseConfigsOptions.push(item); }); @@ -337,7 +341,10 @@ export default { }) } }, - recursiveSorting(arr) { + sort(arr) { + if (!arr) { + arr = this.request.hashTree; + } for (let i in arr) { arr[i].disabled = true; arr[i].index = Number(i) + 1; @@ -345,19 +352,7 @@ export default { arr[i].resourceId = getUUID(); } if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) { - this.recursiveSorting(arr[i].hashTree); - } - } - }, - sort() { - for (let i in this.request.hashTree) { - if (!this.request.hashTree[i].resourceId) { - this.request.hashTree[i].resourceId = getUUID(); - } - this.request.hashTree[i].disabled = true; - this.request.hashTree[i].index = Number(i) + 1; - if (this.request.hashTree[i].hashTree != undefined && this.request.hashTree[i].hashTree.length > 0) { - this.recursiveSorting(this.request.hashTree[i].hashTree); + this.sort(arr[i].hashTree); } } }, diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index 2fb68febaa1d..d98d858c3239 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -23,7 +23,7 @@ {{ getProjectName(scenario.projectId) }} @@ -43,6 +43,7 @@ export default { name: "ApiScenarioComponent", props: { scenario: {}, + message: String, node: {}, isMax: { type: Boolean, @@ -59,7 +60,11 @@ export default { currentEnvironmentId: String, projectList: Array }, - watch: {}, + watch: { + message() { + this.reload(); + }, + }, created() { if (!this.scenario.projectId) { this.scenario.projectId = getCurrentProjectID(); diff --git a/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue b/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue index eaa4dd073f01..30bcfb27852a 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue @@ -4,7 +4,7 @@ + @remove="remove" @copyRow="copyRow" @refReload="refReload" @openScenario="openScenario" :project-list="projectList" :env-map="envMap" :message="message"/>
@@ -28,6 +28,7 @@ components: {MsConstantTimer, MsIfController, MsTransactionController, MsJsr233Processor, MsApiAssertions, MsApiExtract, MsApiComponent, MsLoopController, MsApiScenarioComponent, MsJdbcProcessor,JmeterElementComponent}, props: { type: String, + message: String, scenario: {}, draggable: { type: Boolean, diff --git a/frontend/src/business/components/api/automation/scenario/component/IfController.vue b/frontend/src/business/components/api/automation/scenario/component/IfController.vue index b3c6785e94f0..77134af11fc8 100644 --- a/frontend/src/business/components/api/automation/scenario/component/IfController.vue +++ b/frontend/src/business/components/api/automation/scenario/component/IfController.vue @@ -27,7 +27,7 @@ @@ -43,6 +43,7 @@ props: { controller: {}, node: {}, + message: String, isMax: { type: Boolean, default: false, @@ -59,6 +60,7 @@ }, data() { return { + loading: false, operators: { EQ: { label: "commons.adv_search.operators.equals", @@ -95,7 +97,18 @@ } } }, + watch: { + message() { + this.reload(); + }, + }, methods: { + reload() { + this.loading = true + this.$nextTick(() => { + this.loading = false + }) + }, getCode() { if (this.node && this.node.data.debug) { if (this.node.data.code && this.node.data.code === 'error') { diff --git a/frontend/src/business/components/api/automation/scenario/component/JmeterElementComponent.vue b/frontend/src/business/components/api/automation/scenario/component/JmeterElementComponent.vue index 10fa84ecdb86..6c67cbbb2200 100644 --- a/frontend/src/business/components/api/automation/scenario/component/JmeterElementComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/JmeterElementComponent.vue @@ -15,7 +15,7 @@ @@ -38,6 +38,7 @@ type: Boolean, default: false, }, + message: String, isReadOnly: { type: Boolean, default: @@ -59,7 +60,23 @@ defBackgroundColor: {type: String, default: "#F4F4FF"}, node: {}, }, + data() { + return { + loading: false, + } + }, + watch: { + message() { + this.reload(); + }, + }, methods: { + reload() { + this.loading = true + this.$nextTick(() => { + this.loading = false + }) + }, getCode() { if (this.node && this.node.data.debug) { if (this.node.data.code && this.node.data.code === 'error') { diff --git a/frontend/src/business/components/api/automation/scenario/component/LoopController.vue b/frontend/src/business/components/api/automation/scenario/component/LoopController.vue index 40e5d7442f2e..7d075fc7119a 100644 --- a/frontend/src/business/components/api/automation/scenario/component/LoopController.vue +++ b/frontend/src/business/components/api/automation/scenario/component/LoopController.vue @@ -71,7 +71,7 @@ @@ -95,6 +95,7 @@ export default { currentEnvironmentId: String, currentScenario: {}, node: {}, + message: String, isMax: { type: Boolean, default: false, @@ -156,6 +157,11 @@ export default { }, }; }, + watch: { + message() { + this.reload(); + }, + }, methods: { getCode() { if (this.node && this.node.data.debug) { diff --git a/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue b/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue index 0b8d5e0e309d..523466a36324 100644 --- a/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue +++ b/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue @@ -11,7 +11,7 @@ background-color="#FCF6EE" :title="$t('api_test.automation.transcation_controller')"> @@ -34,6 +34,7 @@ export default { props: { controller: {}, node: {}, + message: String, isMax: { type: Boolean, default: false, @@ -48,6 +49,11 @@ export default { default: false, }, }, + watch: { + message() { + this.reload(); + }, + }, created() { if (this.controller.generateParentSample == null) { this.controller.generateParentSample = true; @@ -58,6 +64,7 @@ export default { }, data() { return { + loading: false, operators: { EQ: { label: "commons.adv_search.operators.equals", @@ -95,6 +102,12 @@ export default { } }, methods: { + reload() { + this.loading = true; + this.$nextTick(() => { + this.loading = false; + }); + }, getCode() { if (this.node && this.node.data.debug) { if (this.node.data.code && this.node.data.code === 'error') { From d061c07f0209f0be171c2d4d7db59e36c9180b61 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 21 Jul 2021 14:06:58 +0800 Subject: [PATCH 06/23] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=85=B3=E8=81=94=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=90=8E=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=E5=85=B3=E8=81=94?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml index 59687849b969..6bcf50283423 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanLoadCaseMapper.xml @@ -53,8 +53,8 @@ p.name as projectName from test_plan_load_case tplc inner join load_test lt on tplc.load_case_id = lt.id - inner join user u on lt.user_id = u.id - inner join project p on lt.project_id = p.id + left join user u on lt.user_id = u.id + left join project p on lt.project_id = p.id tplc.test_plan_id = #{request.testPlanId} From 70702c14a091df8ee5c950623e6c2bd9bb80bd64 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 21 Jul 2021 14:23:19 +0800 Subject: [PATCH 07/23] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=BB=84=E7=BB=87=E5=92=8C=E5=B7=A5=E4=BD=9C=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E4=B9=8B=E5=90=8E=E7=9A=84=E8=B7=B3=E8=BD=AC=20--bug?= =?UTF-8?q?=3D1003175=20--user=3D=E5=88=98=E7=91=9E=E6=96=8C=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=87=E6=8D=A2=E7=BB=84=E7=BB=87/=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E7=A9=BA=E9=97=B4...=20https://www.tapd.cn/55049933/s?= =?UTF-8?q?/1026983?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/business/components/api/router.js | 1 + .../components/common/head/HeaderOrgWs.vue | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/api/router.js b/frontend/src/business/components/api/router.js index 4256c60088b0..6abb580c1314 100644 --- a/frontend/src/business/components/api/router.js +++ b/frontend/src/business/components/api/router.js @@ -3,6 +3,7 @@ import MsProject from "@/business/components/settings/workspace/MsProject"; export default { path: "/api", name: "api", + redirect: "/api/home", components: { content: () => import('@/business/components/api/ApiTest') }, diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index 4c5fc9f0df42..8fae069d76b7 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -1,6 +1,5 @@ Date: Wed, 21 Jul 2021 17:49:47 +0800 Subject: [PATCH 21/23] =?UTF-8?q?fix(=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97)?= =?UTF-8?q?:=20=E7=99=BB=E5=87=BA=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=20#1005204=20--bug=3D1005204=20--user=3D?= =?UTF-8?q?=E8=B5=B5=E5=8B=87=20=E3=80=90=E7=B3=BB=E7=BB=9F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E3=80=91...=20ht?= =?UTF-8?q?tps://www.tapd.cn/55049933/s/1027443?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/LoginController.java | 2 +- .../metersphere/log/aspect/MsLogAspect.java | 34 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/LoginController.java b/backend/src/main/java/io/metersphere/controller/LoginController.java index 25d28015b5bc..6481280ff2b8 100644 --- a/backend/src/main/java/io/metersphere/controller/LoginController.java +++ b/backend/src/main/java/io/metersphere/controller/LoginController.java @@ -64,7 +64,7 @@ public ResultHolder currentUser() { } @GetMapping(value = "/signout") - @MsAuditLog(module = "auth_title", type = OperLogConstants.LOGIN, title = "登出") + @MsAuditLog(module = "auth_title", beforeEvent = "#msClass.getUserId(id)",type = OperLogConstants.LOGIN, title = "登出",msClass = SessionUtils.class) public ResultHolder logout() throws Exception { userService.logout(); SecurityUtils.getSubject().logout(); diff --git a/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java b/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java index 976395b50efa..f454dc3a0acd 100644 --- a/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java +++ b/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java @@ -86,25 +86,26 @@ public void before(JoinPoint joinPoint) { for (int len = 0; len < params.length; len++) { context.setVariable(params[len], args[len]); } - for (Class clazz : msLog.msClass()) { - context.setVariable("msClass", applicationContext.getBean(clazz)); - } - Expression expression = parser.parseExpression(msLog.beforeEvent()); - String beforeContent = expression.getValue(context, String.class); - InvocationHandler invocationHandler = Proxy.getInvocationHandler(msLog); - Field value = invocationHandler.getClass().getDeclaredField("memberValues"); - value.setAccessible(true); - Map memberValues = (Map) value.get(invocationHandler); - memberValues.put("beforeValue", beforeContent); - } - if (msLog != null && StringUtils.isEmpty(msLog.operUser())) { InvocationHandler invocationHandler = Proxy.getInvocationHandler(msLog); Field value = invocationHandler.getClass().getDeclaredField("memberValues"); value.setAccessible(true); - Map memberValues = (Map) value.get(invocationHandler); - memberValues.put("operUser", SessionUtils.getUserId()); + boolean isNext = false; + for (Class clazz : msLog.msClass()) { + if (clazz.getName().equals("io.metersphere.commons.utils.SessionUtils")) { + Map memberValues = (Map) value.get(invocationHandler); + memberValues.put("operUser", SessionUtils.getUserId()); + continue; + } + context.setVariable("msClass", applicationContext.getBean(clazz)); + isNext = true; + } + if (isNext) { + Expression expression = parser.parseExpression(msLog.beforeEvent()); + String beforeContent = expression.getValue(context, String.class); + Map memberValues = (Map) value.get(invocationHandler); + memberValues.put("beforeValue", beforeContent); + } } - } catch (Exception e) { LogUtil.error(e.getMessage()); } @@ -147,6 +148,9 @@ public void saveLog(JoinPoint joinPoint) { } for (Class clazz : msLog.msClass()) { + if (clazz.getName().equals("io.metersphere.commons.utils.SessionUtils")) { + continue; + } context.setVariable("msClass", applicationContext.getBean(clazz)); } // 项目ID 表达式 From 1670db034c0b4c423251e6525be97f2905f63d7a Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 21 Jul 2021 18:38:18 +0800 Subject: [PATCH 22/23] refactor: i18n#1005314 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1005314 --user=lyh 【测试跟踪】国际化问题 https://www.tapd.cn/55049933/s/1027432 --- .../track/plan/view/comonents/base/TestCaseRelevanceBase.vue | 2 +- .../plan/view/comonents/functional/FunctionalTestCaseEdit.vue | 2 +- .../track/review/view/components/TestReviewRelevance.vue | 2 +- frontend/src/i18n/en-US.js | 3 +++ frontend/src/i18n/zh-CN.js | 3 +++ frontend/src/i18n/zh-TW.js | 3 +++ 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue index a048ea05dba8..303b82817bf6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue +++ b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue @@ -20,7 +20,7 @@
- 同步添加关联的接口和性能测试 + {{ $t('test_track.sync_add_api_load') }}
diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue index da63a8ea9137..81b4c999eb1a 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue @@ -29,7 +29,7 @@ - {{$t('test_track.save')}} & 下一条 + {{$t('test_track.save')}} & {{$t('test_track.next')}} diff --git a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue index 22079a186dde..12c380ffb158 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue @@ -77,7 +77,7 @@
{{$t('test_track.review_view.last_page')}}
-
共 {{total}} 条
+
{{$t('test_track.total_size', [total])}}
diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 7fd2f213eb80..904b9a998010 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1332,6 +1332,9 @@ export default { date: "Date" }, test_track: { + sync_add_api_load: 'Synchronously add associated api and load tests', + next: 'Next', + total_size: 'Total {0}', related_requirements: 'Related requirements', please_related_requirements: 'Please select the requirements to associate', please_select_the_test_to_associate: "Please select the test to associate", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 497e7b6ace44..3db3067ed0d5 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1337,6 +1337,9 @@ export default { date: "日期" }, test_track: { + sync_add_api_load: '同步添加关联的接口和性能测试', + next: '下一条', + total_size: '共 {0} 条', related_requirements: '关联需求', please_related_requirements: '请选择要关联的需求', please_select_the_test_to_associate: "请选择需要关联的测试", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 6d30bf9fac68..e5dcc46da304 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1337,6 +1337,9 @@ export default { date: "日期" }, test_track: { + sync_add_api_load: '同步添加關聯的接口和性能測試', + next: '下一條', + total_size: '共 {0} 條', related_requirements: '關聯需求', please_related_requirements: '請選擇要關聯的需求', please_select_the_test_to_associate: "請選擇需要關聯的測試", From 7e635552e4e25cd5b26e32bb1d176de165d70efd Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 21 Jul 2021 18:56:24 +0800 Subject: [PATCH 23/23] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BA=8B=E7=89=A9=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/report/SysnApiReportDetail.vue | 63 ++++++++++++++----- .../automation/scenario/EditApiScenario.vue | 61 ++++++++++++------ .../component/TransactionController.vue | 6 ++ 3 files changed, 95 insertions(+), 35 deletions(-) diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index 232036a4de6f..af1448f42324 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -258,23 +258,50 @@ export default { if (item && item.requestResults) { item.requestResults.forEach(req => { req.responseResult.console = res.console; - if (resMap.get(req.resourceId)) { - if (resMap.get(req.resourceId).indexOf(req) === -1) { - resMap.get(req.resourceId).push(req); - } - } else { - resMap.set(req.resourceId, [req]); - } - if (req.success) { - this.content.success++; + if (req.method === 'Request') { + req.subRequestResults.forEach(subItem => { + this.reqTotal++; + let key = subItem.resourceId; + if (resMap.get(key)) { + if (resMap.get(key).indexOf(subItem) === -1) { + resMap.get(key).push(subItem); + } + } else { + resMap.set(key, [subItem]); + } + if (subItem.success) { + this.reqSuccess++; + } else { + this.reqError++; + } + if (subItem.startTime && Number(subItem.startTime) < startTime) { + startTime = subItem.startTime; + } + if (subItem.endTime && Number(subItem.endTime) > endTime) { + endTime = subItem.endTime; + } + }) } else { - this.content.error++; - } - if (req.startTime && Number(req.startTime) < startTime) { - startTime = req.startTime; - } - if (req.endTime && Number(req.endTime) > endTime) { - endTime = req.endTime; + this.reqTotal++; + let key = req.resourceId; + if (resMap.get(key)) { + if (resMap.get(key).indexOf(req) === -1) { + resMap.get(key).push(req); + } + } else { + resMap.set(key, [req]); + } + if (req.success) { + this.reqSuccess++; + } else { + this.reqError++; + } + if (req.startTime && Number(req.startTime) < startTime) { + startTime = req.startTime; + } + if (req.endTime && Number(req.endTime) > endTime) { + endTime = req.endTime; + } } }) } @@ -449,9 +476,11 @@ export default { .report-header { font-size: 15px; } -/deep/ .el-card__body{ + +/deep/ .el-card__body { padding: 0px; } + .report-header a { text-decoration: none; } diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 50e397037af5..bd493c609567 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -531,28 +531,53 @@ export default { this.clearDebug(); if (res && res.scenarios) { res.scenarios.forEach(item => { - this.reqTotal += item.requestResults.length; if (item && item.requestResults) { item.requestResults.forEach(req => { req.responseResult.console = res.console; - let key = req.resourceId; - if (resMap.get(key)) { - if (resMap.get(key).indexOf(req) === -1) { - resMap.get(key).push(req); - } - } else { - resMap.set(key, [req]); - } - if (req.success) { - this.reqSuccess++; + if (req.method === 'Request') { + req.subRequestResults.forEach(subItem => { + this.reqTotal++; + let key = subItem.resourceId; + if (resMap.get(key)) { + if (resMap.get(key).indexOf(subItem) === -1) { + resMap.get(key).push(subItem); + } + } else { + resMap.set(key, [subItem]); + } + if (subItem.success) { + this.reqSuccess++; + } else { + this.reqError++; + } + if (subItem.startTime && Number(subItem.startTime) < startTime) { + startTime = subItem.startTime; + } + if (subItem.endTime && Number(subItem.endTime) > endTime) { + endTime = subItem.endTime; + } + }) } else { - this.reqError++; - } - if (req.startTime && Number(req.startTime) < startTime) { - startTime = req.startTime; - } - if (req.endTime && Number(req.endTime) > endTime) { - endTime = req.endTime; + this.reqTotal++; + let key = req.resourceId; + if (resMap.get(key)) { + if (resMap.get(key).indexOf(req) === -1) { + resMap.get(key).push(req); + } + } else { + resMap.set(key, [req]); + } + if (req.success) { + this.reqSuccess++; + } else { + this.reqError++; + } + if (req.startTime && Number(req.startTime) < startTime) { + startTime = req.startTime; + } + if (req.endTime && Number(req.endTime) > endTime) { + endTime = req.endTime; + } } }) } diff --git a/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue b/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue index 523466a36324..2aa6bcecae42 100644 --- a/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue +++ b/frontend/src/business/components/api/automation/scenario/component/TransactionController.vue @@ -156,7 +156,13 @@ export default { width: 15%; margin-left: 5px; } +.ms-req-error { + color: #F56C6C; +} +.ms-req-success { + color: #67C23A; +} .ms-step-debug-code { display: inline-block; margin: 0 5px;