From cf9e24f069b76a19fd6ae6e4bbcc29cf7dbe03e8 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 21 Jan 2021 10:32:03 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20json=E7=BB=93=E6=9E=9C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/response/ResponseResult.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue index c6f64ebdcc..83ed95ee60 100644 --- a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue +++ b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue @@ -101,10 +101,10 @@ this.mode = mode; }, setBodyType() { - if (!this.response.headers) { + if (!this.response.responseResult.headers) { return; } - if (this.response.headers.indexOf("Content-Type: application/json") > 0) { + if (this.response.responseResult.headers.indexOf("Content-Type: application/json") > 0) { if (this.$refs.modeDropdown) { this.$refs.modeDropdown.handleCommand(BODY_FORMAT.JSON); this.msCodeReload(); From 141a526e1d452ec84ed516f4cb2ee57130305da3 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 21 Jan 2021 10:55:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?refactor:=20=E5=90=AF=E5=8A=A8=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=97=B6=E6=A3=80=E6=9F=A5=E5=BD=93=E5=89=8D=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E9=85=8D=E7=BD=AE=E6=98=AF=E5=90=A6=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/utils/UrlTestUtils.java | 20 +++++++++++++++++++ .../engine/docker/DockerTestEngine.java | 9 +++++++++ backend/src/main/java/io/metersphere/xpack | 2 +- .../resources/i18n/messages_en_US.properties | 2 +- .../resources/i18n/messages_zh_CN.properties | 2 +- .../resources/i18n/messages_zh_TW.properties | 2 +- 6 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java diff --git a/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java b/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java new file mode 100644 index 0000000000..d536cf484d --- /dev/null +++ b/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java @@ -0,0 +1,20 @@ +package io.metersphere.commons.utils; + +import java.net.URL; +import java.net.URLConnection; + +public class UrlTestUtils { + + public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) { + try { + URL url = new URL(urlString); + URLConnection co = url.openConnection(); + co.setConnectTimeout(timeOutMillSeconds); + co.connect(); + return true; + } catch (Exception e) { + LogUtil.error(e); + return false; + } + } +} diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index c58107318f..abcfa543c8 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -6,6 +6,7 @@ import io.metersphere.base.domain.TestResource; import io.metersphere.commons.constants.ResourceStatusEnum; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; +import io.metersphere.commons.utils.UrlTestUtils; import io.metersphere.config.JmeterProperties; import io.metersphere.config.KafkaProperties; import io.metersphere.controller.ResultHolder; @@ -15,6 +16,7 @@ import io.metersphere.i18n.Translator; import io.metersphere.performance.engine.AbstractEngine; import io.metersphere.performance.engine.request.StartTestRequest; import io.metersphere.service.SystemParameterService; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.client.RestTemplate; import java.util.HashMap; @@ -77,6 +79,12 @@ public class DockerTestEngine extends AbstractEngine { metersphereUrl = baseInfo.getUrl(); } + // docker 不能从 localhost 中下载文件 + if (StringUtils.contains(metersphereUrl, "http://localhost") + || !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) { + MSException.throwException(Translator.get("run_load_test_file_init_error")); + } + Map env = new HashMap<>(); env.put("RATIO", "" + ratio); env.put("RESOURCE_INDEX", "" + resourceIndex); @@ -123,4 +131,5 @@ public class DockerTestEngine extends AbstractEngine { } }); } + } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 7f7808c6f0..132f406fac 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 7f7808c6f0457dd2df6b19a1622558f3f8122646 +Subproject commit 132f406fac7fb4d841210343eb98c09f78317f18 diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 1a5222966c..63a9f26f1e 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -34,7 +34,7 @@ edit_load_test_not_found=Cannot edit test, test not found= run_load_test_not_found=Cannot run test, test not found= run_load_test_file_not_found=Unable to run test, unable to get test file meta information, test ID= run_load_test_file_content_not_found=Cannot run test, cannot get test file content, test ID= -run_load_test_file_init_error=Failed to run test, failed to initialize run environment, test ID= +run_load_test_file_init_error=Failed to run test, please check current end point configuration load_test_is_running=Load test is running, please wait. load_test_kafka_invalid=Kafka is not available, please check the configuration cannot_edit_load_test_running=Cannot modify the running test diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 2d077f1e49..d42e0b0162 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -34,7 +34,7 @@ edit_load_test_not_found=无法编辑测试,未找到测试: run_load_test_not_found=无法运行测试,未找到测试: run_load_test_file_not_found=无法运行测试,无法获取测试文件元信息,测试ID: run_load_test_file_content_not_found=无法运行测试,无法获取测试文件内容,测试ID: -run_load_test_file_init_error=无法运行测试,初始化运行环境失败,测试ID: +run_load_test_file_init_error=无法运行测试,请检查当前站点配置 load_test_is_running=测试正在运行, 请等待 load_test_kafka_invalid=Kafka 不可用,请检查配置 cannot_edit_load_test_running=不能修改正在运行的测试 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 7314bdecaa..5c2666354b 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -34,7 +34,7 @@ edit_load_test_not_found=無法編輯測試,未找到測試: run_load_test_not_found=無法運行測試,未找到測試: run_load_test_file_not_found=無法運行測試,無法獲取測試文件元信息,測試ID: run_load_test_file_content_not_found=無法運行測試,無法獲取測試文件內容,測試ID: -run_load_test_file_init_error=無法運行測試,初始化運行環境失敗,測試ID: +run_load_test_file_init_error=無法運行測試,請檢查當前站點配置 load_test_is_running=測試正在運行, 請等待 load_test_kafka_invalid=Kafka 不可用,請檢查配置 cannot_edit_load_test_running=不能修改正在運行的測試 From 73f98975cc68c791f867a46b6b7373f5623ef419 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 21 Jan 2021 11:15:41 +0800 Subject: [PATCH 3/7] =?UTF-8?q?style(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89)?= =?UTF-8?q?:=20=E7=BB=9F=E4=B8=80TAG=20=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/EditApiScenario.vue | 2 +- .../api/automation/scenario/MsInputTag.vue | 191 ++++++++--- .../components/complete/BasisApi.vue | 4 +- .../complete/EditCompleteHTTPApi.vue | 318 +++++++++--------- 4 files changed, 306 insertions(+), 209 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index f0843743bf..a3910bdd22 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -72,7 +72,7 @@ - + diff --git a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue index bbd8f50874..c57493173e 100644 --- a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue +++ b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue @@ -1,68 +1,165 @@ diff --git a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue index 8dc7951e7e..b9f96ddcf1 100644 --- a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue @@ -53,12 +53,12 @@ - + - + - +
{{ $t('commons.save') }} @@ -34,6 +34,20 @@ + + + + + + + +
@@ -51,21 +65,8 @@ - - - - - - - - - + + @@ -73,7 +74,6 @@ - @@ -109,167 +109,167 @@ From 8840053d18b0fc9ad5f1dcb5680de62a3766e19d Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 21 Jan 2021 11:30:23 +0800 Subject: [PATCH 4/7] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89):=20=E7=82=B9=E5=87=BB=E7=94=A8=E4=BE=8B=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=8A=B6=E6=80=81=EF=BC=8C=E5=B1=95=E5=BC=80=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E7=BB=93=E6=9E=9C=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 1 - .../automation/scenario/component/ApiResponseComponent.vue | 3 +++ .../api/definition/components/case/ApiCaseItem.vue | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 10bf93c1b4..ab73330e9e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -38,7 +38,6 @@ "vue-echarts": "^4.1.0", "vue-float-action-button": "^0.6.6", "vue-i18n": "^8.15.3", - "vue-input-tag": "^2.0.7", "vue-jsonpath-picker": "^1.1.5", "vue-papa-parse": "^2.0.0", "vue-pdf": "^4.2.0", diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue index 8b74501e7c..1fd226a48b 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue @@ -33,6 +33,9 @@ }, created() { this.getExecResult(); + if (this.apiItem.isActive) { + this.isActive = true; + } }, methods: { getExecResult() { diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 201d9465e2..7f7c4a326c 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -269,8 +269,9 @@ return true; } }, - showExecResult(data) { - this.$emit('showExecResult', data); + showExecResult(item) { + item.active = false; + item.isActive = true; }, getBodyUploadFiles(row) { let bodyUploadFiles = []; From 0ca5ae9565d1bbc9b534aad7024a802e11aa3a78 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 21 Jan 2021 11:32:06 +0800 Subject: [PATCH 5/7] =?UTF-8?q?style(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89)?= =?UTF-8?q?:=20tag=20=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/case/ApiCaseItem.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 7f7c4a326c..219a83de3c 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -40,7 +40,9 @@ - +
+ +
@@ -326,6 +328,6 @@ } .tag-item { - margin-right: 30px; + margin-right: 20px; } From ca3a26a17155ff6e04ab43cd9ea725b3a5b501ca Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 21 Jan 2021 12:13:01 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=E6=A0=91=E4=BF=AE=E6=94=B9=E5=90=8E?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/ApiScenarioModule.vue | 4 ++ .../environment/EnvironmentTcpConfig.vue | 45 +++++++++++++++++++ .../components/module/ApiModule.vue | 3 ++ .../components/track/common/NodeTree.vue | 19 ++++++-- .../track/common/TestCaseNodeTree.vue | 3 ++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 frontend/src/business/components/api/definition/components/environment/EnvironmentTcpConfig.vue diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index 551e1e8532..855d04e0fa 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -119,6 +119,9 @@ buildNodePath(node, {path: ''}, moduleOptions); }); this.$emit('setModuleOptions', moduleOptions); + if (this.$refs.nodeTree) { + this.$refs.nodeTree.filter(this.condition.filterText); + } } }); }, @@ -142,6 +145,7 @@ }, (error) => { this.list(); }); + }, remove(nodeIds) { this.$post("/api/automation/module/delete", nodeIds, () => { diff --git a/frontend/src/business/components/api/definition/components/environment/EnvironmentTcpConfig.vue b/frontend/src/business/components/api/definition/components/environment/EnvironmentTcpConfig.vue new file mode 100644 index 0000000000..879c4b8b6f --- /dev/null +++ b/frontend/src/business/components/api/definition/components/environment/EnvironmentTcpConfig.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/frontend/src/business/components/api/definition/components/module/ApiModule.vue b/frontend/src/business/components/api/definition/components/module/ApiModule.vue index 73e221ba19..f9ef4094e3 100644 --- a/frontend/src/business/components/api/definition/components/module/ApiModule.vue +++ b/frontend/src/business/components/api/definition/components/module/ApiModule.vue @@ -126,6 +126,9 @@ buildNodePath(node, {path: ''}, moduleOptions); }); this.$emit('setModuleOptions', moduleOptions); + if (this.$refs.nodeTree) { + this.$refs.nodeTree.filter(this.condition.filterText); + } } }); }, diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue index 324572a30c..4100d799e8 100644 --- a/frontend/src/business/components/track/common/NodeTree.vue +++ b/frontend/src/business/components/track/common/NodeTree.vue @@ -137,7 +137,15 @@ export default { return false; }, filter(val) { - this.$refs.tree.filter(val); + if (!val) { + val = this.filterText; + } else { + // 记录condition 的 filterText + this.filterText = val; + } + this.$nextTick(() => { + this.$refs.tree.filter(val); + }); }, nodeExpand(data) { if (data.id) { @@ -149,10 +157,15 @@ export default { this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1); } }, - edit(node, data) { + edit(node, data, isAppend) { this.$set(data, 'isEdit', true); this.$nextTick(() => { this.$refs.nameInput.focus(); + if (!isAppend) { + this.$nextTick(() => { + this.filter(this.filterText); + }); + } }); }, append(node, data) { @@ -166,7 +179,7 @@ export default { this.$set(data, 'children', []) } data.children.push(newChild); - this.edit(node, newChild); + this.edit(node, newChild, true); node.expanded = true; this.$nextTick(() => { this.$refs.nameInput.focus(); diff --git a/frontend/src/business/components/track/common/TestCaseNodeTree.vue b/frontend/src/business/components/track/common/TestCaseNodeTree.vue index e18238be7a..c0ec0c222d 100644 --- a/frontend/src/business/components/track/common/TestCaseNodeTree.vue +++ b/frontend/src/business/components/track/common/TestCaseNodeTree.vue @@ -51,6 +51,9 @@ if (this.projectId) { this.result = this.$get("/case/node/list/" + this.projectId, response => { this.treeNodes = response.data; + if (this.$refs.nodeTree) { + this.$refs.nodeTree.filter(); + } }); } }, From feeb44155b2f5e8f993ae8d11bc0cb424ac4027c Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 21 Jan 2021 12:18:54 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=88=9D=E5=A7=8B=E5=8C=96TAG=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/automation/scenario/MsInputTag.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue index c57493173e..6e5b83d248 100644 --- a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue +++ b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue @@ -41,10 +41,15 @@ }, size: {type: String, default: "small"} }, + created() { + if (!this.currentScenario.tags) { + this.currentScenario.tags = []; + } + }, data() { return { newTag: '', - innerTags: [...this.currentScenario.tags] + innerTags: this.currentScenario.tags ? [...this.currentScenario.tags] : [] } }, watch: {