From b6ec991ce7f4fa1eb528a64f6cd28f323400fa7c Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 24 Mar 2021 13:20:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E6=96=B0=E5=BB=BA=E5=92=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtLoadTestMapper.xml | 1 + .../test/components/ExistFiles.vue | 37 +++++++------------ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml index 8580002eff..2eb995b3d8 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml @@ -148,5 +148,6 @@ AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%') + order by update_time DESC \ No newline at end of file diff --git a/frontend/src/business/components/performance/test/components/ExistFiles.vue b/frontend/src/business/components/performance/test/components/ExistFiles.vue index 224c874960..53f7541e98 100644 --- a/frontend/src/business/components/performance/test/components/ExistFiles.vue +++ b/frontend/src/business/components/performance/test/components/ExistFiles.vue @@ -221,15 +221,6 @@ export default { f().then(res => { let response = res.data; if (response.data.length === 0) { - let type = file.name.substring(file.name.lastIndexOf(".") + 1); - - this.tableData.push({ - name: file.name, - size: (file.size / 1024).toFixed(2) + ' KB', - type: type.toUpperCase(), - updateTime: file.lastModified, - }); - callback(); } else { this.$error(this.$t('load_test.project_file_exist') + ', name: ' + file.name); @@ -241,21 +232,21 @@ export default { let file = uploadResources.file; this.checkFileExist(file, () => { - self.uploadList.push(file); - let type = file.name.substring(file.name.lastIndexOf(".") + 1); - if (type.toLowerCase() !== 'jmx') { - return; + let formData = new FormData(); + let url = '/project/upload/files/' + getCurrentProjectID() + formData.append("file", file); + let options = { + method: 'POST', + url: url, + data: formData, + headers: { + 'Content-Type': undefined + } } - let jmxReader = new FileReader(); - jmxReader.onload = (event) => { - let threadGroups = findThreadGroup(event.target.result, file.name); - threadGroups.forEach(tg => { - tg.options = {}; - self.scenarios.push(tg); - }); - self.$emit('fileChange', self.scenarios); - }; - jmxReader.readAsText(file); + self.$request(options, (response) => { + self.$success(this.$t('commons.save_success')); + self.getProjectFiles(); + }); }) }, handleExceed() { From 034042fca54b9e8bc8a198b4743c720883aea29e Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 24 Mar 2021 13:23:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8DJSON-SCHEMA=20=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=99=A8=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E6=AD=A5=E9=AA=A4=E5=BC=95=E7=94=A8=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 16 +- .../scenario/common/ApiBaseComponent.vue | 2 +- .../scenario/component/ApiComponent.vue | 14 +- .../scenario/variable/VariableList.vue | 15 +- .../common/json-schema/JsonSchemaEditor.vue | 6 +- .../common/json-schema/convert/convert.js | 178 ++++++++++++++++++ .../common/json-schema/import/ImportJson.vue | 7 +- 7 files changed, 213 insertions(+), 25 deletions(-) create mode 100644 frontend/src/business/components/common/json-schema/convert/convert.js diff --git a/frontend/package.json b/frontend/package.json index c688f436de..d67ac0605e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -22,14 +22,22 @@ "el-table-infinite-scroll": "^1.0.10", "el-tree-transfer": "^2.4.7", "element-ui": "^2.13.0", - "generate-schema": "^2.6.0", "html2canvas": "^1.0.0-rc.7", "js-base64": "^3.4.4", + "jsencrypt": "^3.1.0", "json-bigint": "^1.0.0", "json-schema-faker": "^0.5.0-rcv.32", "json5": "^2.1.3", "jsoneditor": "^9.1.2", + "jsonpath": "^1.1.0", "jspdf": "^2.1.1", + "lodash.isboolean": "^3.0.3", + "lodash.isempty": "^4.4.0", + "lodash.isinteger": "^4.0.4", + "lodash.isnull": "^3.0.0", + "lodash.isnumber": "^3.0.3", + "lodash.isobject": "^3.0.2", + "lodash.isstring": "^4.0.1", "md5": "^2.3.0", "mockjs": "^1.1.0", "nprogress": "^0.2.0", @@ -41,16 +49,14 @@ "vue-float-action-button": "^0.6.6", "vue-i18n": "^8.15.3", "vue-jsonpath-picker": "^1.1.5", + "vue-minder-editor-plus": "^1.0.19", "vue-papa-parse": "^2.0.0", "vue-pdf": "^4.2.0", "vue-router": "^3.1.3", "vuedraggable": "^2.24.3", "vuex": "^3.1.2", "xml-js": "^1.6.11", - "yan-progress": "^1.0.3", - "jsonpath": "^1.1.0", - "vue-minder-editor-plus": "^1.0.19", - "jsencrypt": "^3.1.0" + "yan-progress": "^1.0.3" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue index cf5fa0edc0..d9284a41c7 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue @@ -31,7 +31,7 @@ - + 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 034bdff500..332207c0b7 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -83,9 +83,10 @@ import ApiBaseComponent from "../common/ApiBaseComponent"; import ApiResponseComponent from "./ApiResponseComponent"; import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo"; + const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); - const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {}; - const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {}; + const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {}; + const esbDefinitionResponse = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {}; export default { name: "MsApiComponent", @@ -122,7 +123,7 @@ reportId: "", runData: [], isShowInput: false, - showXpackCompnent:false, + showXpackCompnent: false, } }, created() { @@ -148,7 +149,7 @@ } } } - if (requireComponent != null && JSON.stringify(esbDefinition) != '{}'&& JSON.stringify(esbDefinitionResponse) != '{}') { + if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') { this.showXpackCompnent = true; } }, @@ -245,7 +246,8 @@ } this.request.requestResult = requestResult; this.request.id = response.data.id; - //this.request.disabled = true; + this.request.disabled = true; + this.request.root = true; if (!this.request.projectId) { this.request.projectId = response.data.projectId; } @@ -311,7 +313,7 @@ this.request.requestResult = data; this.request.result = undefined; this.loading = false; - this.$emit('refReload',this.request,this.node); + this.$emit('refReload', this.request, this.node); }, reload() { this.loading = true diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index 12700397ca..8ddf66800f 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -7,9 +7,9 @@ -
+
- +
@@ -20,9 +20,9 @@ - +
- +
{{ $t('commons.add') }} @@ -37,7 +37,7 @@ {{ $t('commons.delete') }} - +
@@ -219,10 +219,10 @@ return this.selection.includes(row.id) }, open: function (variables, headers, disabled) { - if(variables){ + if (variables) { this.variables = variables; } - if(headers){ + if (headers) { this.headers = headers; } this.visible = true; @@ -313,6 +313,7 @@ float: right; margin-right: 45px; } + fieldset { padding: 0px; margin: 0px; diff --git a/frontend/src/business/components/common/json-schema/JsonSchemaEditor.vue b/frontend/src/business/components/common/json-schema/JsonSchemaEditor.vue index 7a5ebbd578..e3be6893c1 100644 --- a/frontend/src/business/components/common/json-schema/JsonSchemaEditor.vue +++ b/frontend/src/business/components/common/json-schema/JsonSchemaEditor.vue @@ -21,8 +21,8 @@