From 6bcb7aa16bdb28c01dedffb68bac64b6144ecd81 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Mon, 31 Aug 2020 17:27:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4js=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/PerformanceReportView.vue | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index 34b33e0bd0..240cf424fe 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -127,7 +127,7 @@ export default { } }, methods: { - initBreadcrumb() { + initBreadcrumb(callback) { if (this.reportId) { this.result = this.$get("/performance/report/test/pro/info/" + this.reportId, res => { let data = res.data; @@ -137,6 +137,10 @@ export default { this.testName = data.testName; this.projectId = data.projectId; this.projectName = data.projectName; + // + if (callback) callback(res); + } else { + this.$error(this.$t('report.not_exist')); } }) } @@ -280,27 +284,16 @@ export default { } let reportId = to.path.split('/')[4]; this.reportId = reportId; - if (reportId) { - this.$get("/performance/report/test/pro/info/" + reportId, response => { - let data = response.data; - if (data) { - this.status = data.status; - this.reportName = data.name; - this.testName = data.testName; - this.testId = data.testId; - this.projectName = data.projectName; + this.initBreadcrumb((response) => { + let data = response.data; - this.$set(this.report, "id", reportId); - this.$set(this.report, "status", data.status); + this.$set(this.report, "id", reportId); + this.$set(this.report, "status", data.status); - this.checkReportStatus(data.status); - this.initReportTimeInfo(); - } else { - this.$error(this.$t('report.not_exist')); - } - }); - - } + this.checkReportStatus(data.status); + this.initReportTimeInfo(); + }); + this.initWebSocket(); } else { console.log("close socket."); this.websocket.close() //离开路由之后断开websocket连接 From 4c18b8d29a514a9716e31c6603ea7d946c25408e Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 1 Sep 2020 10:21:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81=E4=B8=8A=E4=BC=A0=E5=A4=9A=E4=B8=AAcsv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/performance/test/EditPerformanceTestPlan.vue | 2 +- .../performance/test/components/PerformanceBasicConfig.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue b/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue index e50d70dc37..6c1f611061 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue @@ -58,7 +58,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig"; import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig"; import MsContainer from "../../common/components/MsContainer"; import MsMainContainer from "../../common/components/MsMainContainer"; -import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils"; +import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; import MsScheduleConfig from "../../common/components/MsScheduleConfig"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue index 428d604d2e..a244e6c11c 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue @@ -4,7 +4,7 @@ accept=".jmx,.csv" drag action="" - :limit="2" + :limit="5" multiple :show-file-list="false" :before-upload="beforeUpload" From 3707c02df91439337fcfe39f03eb4fc9b1daf6bb Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 1 Sep 2020 10:35:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=A4=8D=E5=88=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes 298 --- .../performance/service/PerformanceTestService.java | 7 +++++-- .../src/main/java/io/metersphere/service/FileService.java | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 08c36d9281..64e71fa08a 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; @@ -42,8 +43,6 @@ import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; -import javax.annotation.Resource; - @Service @Transactional(rollbackFor = Exception.class) public class PerformanceTestService { @@ -381,6 +380,10 @@ public class PerformanceTestService { if (!CollectionUtils.isEmpty(loadTestFiles)) { loadTestFiles.forEach(loadTestFile -> { FileMetadata fileMetadata = fileService.copyFile(loadTestFile.getFileId()); + if (fileMetadata == null) { + // 如果性能测试出现文件变更,这里会有 null + return; + } loadTestFile.setTestId(copy.getId()); loadTestFile.setFileId(fileMetadata.getId()); loadTestFileMapper.insert(loadTestFile); diff --git a/backend/src/main/java/io/metersphere/service/FileService.java b/backend/src/main/java/io/metersphere/service/FileService.java index 952288f5f8..b82c2f784d 100644 --- a/backend/src/main/java/io/metersphere/service/FileService.java +++ b/backend/src/main/java/io/metersphere/service/FileService.java @@ -60,6 +60,10 @@ public class FileService { FileContentExample example2 = new FileContentExample(); example2.createCriteria().andFileIdIn(ids); fileContentMapper.deleteByExample(example2); + + LoadTestFileExample example3 = new LoadTestFileExample(); + example3.createCriteria().andFileIdIn(ids); + loadTestFileMapper.deleteByExample(example3); } public FileMetadata saveFile(MultipartFile file) { From 1ae6ab2b883355fc02beb946f7d4f666891be347 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 2 Sep 2020 10:42:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E4=BF=AE=E6=94=B9=E9=AB=98=E7=BA=A7=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AE=BE=E7=BD=AE=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/test/components/ApiVariable.vue | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/frontend/src/business/components/api/test/components/ApiVariable.vue b/frontend/src/business/components/api/test/components/ApiVariable.vue index aa9a29da1e..d2fb7bb5ae 100644 --- a/frontend/src/business/components/api/test/components/ApiVariable.vue +++ b/frontend/src/business/components/api/test/components/ApiVariable.vue @@ -7,10 +7,11 @@ - + @@ -31,12 +32,12 @@ value-key="name" highlight-first-item @select="change"> - + - +