From 9ebb834878e98cca757f859c3eeceaff9e5b3ee8 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 30 Jul 2021 15:38:29 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=8D=95=E6=9D=A1=E5=9C=BA=E6=99=AF=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=94=AF=E6=8C=81=E5=AF=BC=E5=87=BA=E5=8F=8A=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiAutomationController.java | 5 +- .../automation/report/ApiReportViewHeader.vue | 94 ++++++++++--------- .../automation/report/SysnApiReportDetail.vue | 28 +++++- .../automation/scenario/ApiScenarioList.vue | 1 + 4 files changed, 77 insertions(+), 51 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index 2a42c18ec2..823f1601db 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -20,6 +20,7 @@ import io.metersphere.controller.request.ScheduleRequest; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testplan.FileOperationRequest; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -182,7 +183,9 @@ public class ApiAutomationController { @PostMapping(value = "/run") @MsAuditLog(module = "api_automation", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.ids)", msClass = ApiAutomationService.class) public String run(@RequestBody RunScenarioRequest request) { - request.setExecuteType(ExecuteType.Completed.name()); + if(!StringUtils.equals(request.getExecuteType(),ExecuteType.Saved.name())){ + request.setExecuteType(ExecuteType.Completed.name()); + } request.setTriggerMode(TriggerMode.MANUAL.name()); request.setRunMode(ApiRunMode.SCENARIO.name()); return apiAutomationService.run(request); diff --git a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue index 6f58caa422..e98be5d26f 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue @@ -2,7 +2,7 @@
- + @@ -17,12 +17,12 @@ {{ report.createTime | timestampFormatDate }} - - {{$t('test_track.plan_view.export_report')}} + + {{ $t('test_track.plan_view.export_report') }} - {{$t('commons.save')}} + {{ $t('commons.save') }} @@ -32,56 +32,60 @@ diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index b29002f833..c00d20112a 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -3,7 +3,7 @@
- +
@@ -61,8 +61,8 @@ export default { failsTreeNodes: [], totalTime: 0, isRequestResult: false, - startTime : 99991611737506593, - endTime : 0, + startTime: 99991611737506593, + endTime: 0, request: {}, isActive: false, scenarioName: null, @@ -71,6 +71,7 @@ export default { fullTreeNodes: [], debugResult: new Map, scenarioMap: new Map, + exportFlag:false, } }, activated() { @@ -247,7 +248,7 @@ export default { this.$success(this.$t('schedule.event_success')); }); }, - getTransaction(transRequests,resMap) { + getTransaction(transRequests, resMap) { transRequests.forEach(subItem => { if (subItem.method === 'Request') { this.getTransaction(subItem.subRequestResults, resMap); @@ -365,6 +366,7 @@ export default { }) this.formatTree(array, this.failsTreeNodes); this.recursiveSorting(this.failsTreeNodes); + this.exportFlag = true; } }, formatTree(array, tree) { @@ -459,6 +461,22 @@ export default { } } }, + handleSave() { + if (!this.report.name) { + this.$warning(this.$t('api_test.automation.report_name_info')); + return; + } + this.loading = true; + this.report.projectId = this.projectId; + let url = "/api/scenario/report/update"; + this.result = this.$post(url, this.report, response => { + this.$success(this.$t('commons.save_success')); + this.loading = false; + this.$emit('refresh'); + }, error => { + this.loading = false; + }); + }, }, computed: { projectId() { @@ -486,7 +504,7 @@ export default { } /deep/ .el-card__body { - padding: 0px; + padding: 10px; } .report-header a { diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index d820ecb504..f738c103de 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -836,6 +836,7 @@ export default { run.id = getUUID(); run.projectId = this.projectId; run.ids = scenarioIds; + run.executeType = "Saved"; this.$post(url, run, response => { this.runVisible = true; this.reportId = run.id;