From 510850db51d9e185e83fb942ef76ec202866b688 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 20 Oct 2020 16:48:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81=E6=8F=90=E5=8F=96=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/scenario/extract/ExtractCommon.java | 1 + .../base/mapper/ext/ExtTestReviewCaseMapper.java | 2 +- .../api/test/components/ApiVariableInput.vue | 6 +++++- .../test/components/extract/ApiExtractCommon.vue | 13 ++++++++++++- .../components/api/test/model/ScenarioModel.js | 2 ++ frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 8 files changed, 24 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/extract/ExtractCommon.java b/backend/src/main/java/io/metersphere/api/dto/scenario/extract/ExtractCommon.java index 6757bc4cad..efd38b6a49 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/extract/ExtractCommon.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/extract/ExtractCommon.java @@ -10,4 +10,5 @@ public class ExtractCommon extends ExtractType { private String value; // value: ${variable} private String expression; private String description; + private Boolean multipleMatching; } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java index 267793343d..b3a19d01b6 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java @@ -11,5 +11,5 @@ public interface ExtTestReviewCaseMapper { List list(@Param("request") QueryCaseReviewRequest request); List getStatusByReviewId(String reviewId); - List findRelateTestReviewId(String userId, String workspaceId); + List findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId); } diff --git a/frontend/src/business/components/api/test/components/ApiVariableInput.vue b/frontend/src/business/components/api/test/components/ApiVariableInput.vue index 0cbd17338f..f9319f713b 100644 --- a/frontend/src/business/components/api/test/components/ApiVariableInput.vue +++ b/frontend/src/business/components/api/test/components/ApiVariableInput.vue @@ -29,6 +29,10 @@ type: Boolean, default: true }, + showCopyTipWithMultiple: { + type: Boolean, + default: false + }, }, data() { @@ -63,7 +67,7 @@ computed: { variable() { - return "${" + this.value + "}"; + return "${" + (this.showCopyTipWithMultiple ? (this.value + "_n") : this.value) + "}"; } } diff --git a/frontend/src/business/components/api/test/components/extract/ApiExtractCommon.vue b/frontend/src/business/components/api/test/components/extract/ApiExtractCommon.vue index 2ad04fa5ae..0413286773 100644 --- a/frontend/src/business/components/api/test/components/extract/ApiExtractCommon.vue +++ b/frontend/src/business/components/api/test/components/extract/ApiExtractCommon.vue @@ -8,12 +8,17 @@ + @change="change" :show-copy-tip-with-multiple="common.multipleMatching" show-word-limit :placeholder="$t('api_test.variable_name')"/> + + + {{ $t('api_test.request.extract.multiple_matching') }} + + @@ -159,4 +164,10 @@ .extract-btn { width: 60px; } + + .multiple_checkbox { + text-align: center; + width: 120px; + } + diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index f79efe313e..a95344447c 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -855,6 +855,7 @@ export class ExtractCommon extends ExtractType { this.value = ""; // ${variable} this.expression = undefined; this.description = undefined; + this.multipleMatching = undefined; this.set(options); } @@ -1460,6 +1461,7 @@ class JMXGenerator { let props = { name: extractCommon.variable, expression: extractCommon.expression, + match: extractCommon.multipleMatching ? -1 : undefined } let testName = props.name switch (extractCommon.type) { diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 19f9ed48c5..bd5080f504 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -554,6 +554,7 @@ export default { select_type: "Choose type", description: "Extract data from the response and store it in variables. Use the variables in subsequent requests.", regex: "Regex", + multiple_matching: "Multiple matching", regex_expression: "Regular expression", json_path_expression: "JSONPath expression", xpath_expression: "XPath expression", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 58ff7df239..ecf0997d9d 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -554,6 +554,7 @@ export default { }, extract: { label: "提取", + multiple_matching: "匹配多条", select_type: "请选择类型", description: "从响应结果中提取数据并将其存储在变量中,在后续请求中使用变量。", regex: "正则", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 01d7cd0532..3a25b475ec 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -554,6 +554,7 @@ export default { }, extract: { label: "提取", + multiple_matching: "匹配多條", select_type: "請選擇類型", description: "從響應結果中提取數據並將其存儲在變量中,在後續請求中使用變量。", regex: "正則", From fd77afcfc622d4518dba324743156e351261a54c Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 20 Oct 2020 16:59:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/controller/TestCaseController.java | 11 ++++- backend/src/main/java/io/metersphere/xpack | 2 +- frontend/package.json | 3 +- .../track/case/components/TestCaseEdit.vue | 16 ++++++- .../track/case/components/TestCaseFile.vue | 48 +++++++++++++++++++ .../track/case/components/TestCasePdf.vue | 38 +++++++++++++++ 6 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 frontend/src/business/components/track/case/components/TestCaseFile.vue create mode 100644 frontend/src/business/components/track/case/components/TestCasePdf.vue diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 1d5d86db88..790279babb 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -167,7 +167,7 @@ public class TestCaseController { } @PostMapping("/file/download") - public ResponseEntity downloadJmx(@RequestBody FileOperationRequest fileOperationRequest) { + public ResponseEntity download(@RequestBody FileOperationRequest fileOperationRequest) { byte[] bytes = fileService.loadFileAsBytes(fileOperationRequest.getId()); return ResponseEntity.ok() .contentType(MediaType.parseMediaType("application/octet-stream")) @@ -175,4 +175,13 @@ public class TestCaseController { .body(bytes); } + @GetMapping("/file/preview/{fileId}") + public ResponseEntity preview(@PathVariable String fileId) { + byte[] bytes = fileService.loadFileAsBytes(fileId); + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType("application/octet-stream")) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileId + "\"") + .body(bytes); + } + } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index cf6b065263..ee74568be0 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit cf6b06526324326a563d933e07118fac014a63b4 +Subproject commit ee74568be0beba46da19616f5832e83f9164c688 diff --git a/frontend/package.json b/frontend/package.json index c0ead7bf5d..1b15b96a2d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -35,7 +35,8 @@ "jspdf": "^2.1.1", "yan-progress": "^1.0.3", "nprogress": "^0.2.0", - "el-table-infinite-scroll": "^1.0.10" + "el-table-infinite-scroll": "^1.0.10", + "vue-pdf": "^4.2.0" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index dabae32940..9d9addf80b 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -252,6 +252,10 @@