refacotr: 合并v1.1

This commit is contained in:
chenjianxing 2020-08-25 15:44:07 +08:00
commit 52049d61d4
8 changed files with 78 additions and 49 deletions

View File

@ -219,7 +219,7 @@
<dependency>
<groupId>io.metersphere</groupId>
<artifactId>jmeter-plugins-dubbo</artifactId>
<version>2.7.9</version>
<version>2.7.10</version>
</dependency>
<!-- LDAP Module -->

View File

@ -135,16 +135,21 @@ public class Swagger2Parser extends ApiImportAbstractParser {
simpleRef = refModel.getSimpleRef();
}
Model model = definitions.get(simpleRef);
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions);
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions, refSet);
body.setRaw(bodyParameters.toJSONString());
} else if (schema instanceof ArrayModel) {
ArrayModel arrayModel = (ArrayModel) bodyParameter.getSchema();
Property items = arrayModel.getItems();
if (items instanceof RefProperty) {
RefProperty refProperty = (RefProperty) items;
Model model = definitions.get(refProperty.getSimpleRef());
String simpleRef = refProperty.getSimpleRef();
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
JSONArray propertyList = new JSONArray();
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions));
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet));
body.setRaw(propertyList.toString());
}
}
@ -152,20 +157,26 @@ public class Swagger2Parser extends ApiImportAbstractParser {
body.setFormat("json");
}
private JSONObject getBodyJSONObjectParameters(Map<String, Property> properties, Map<String, Model> definitions) {
private JSONObject getBodyJSONObjectParameters(Map<String, Property> properties, Map<String, Model> definitions, HashSet<String> refSet) {
JSONObject jsonObject = new JSONObject();
properties.forEach((key, value) -> {
if (value instanceof ObjectProperty) {
ObjectProperty objectProperty = (ObjectProperty) value;
jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions));
jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions, refSet));
} else if (value instanceof ArrayProperty) {
ArrayProperty arrayProperty = (ArrayProperty) value;
Property items = arrayProperty.getItems();
if (items instanceof RefProperty) {
RefProperty refProperty = (RefProperty) items;
Model model = definitions.get(refProperty.getSimpleRef());
String simpleRef = refProperty.getSimpleRef();
if (refSet.contains(simpleRef)) {
jsonObject.put(key, new JSONArray());
return;
}
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
JSONArray propertyList = new JSONArray();
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions));
propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet));
jsonObject.put(key, propertyList);
} else {
jsonObject.put(key, new ArrayList<>());

View File

@ -749,13 +749,15 @@ class JMXHttpRequest {
getPostQueryParameters(request, path) {
if (this.method.toUpperCase() !== "GET") {
path += '?';
let parameters = [];
request.parameters.forEach(parameter => {
if (parameter.name && parameter.value) {
parameters.push(parameter);
}
});
if (parameters.length > 0) {
path += '?';
}
for (let i = 0; i < parameters.length; i++) {
let parameter = parameters[i];
path += (parameter.name + '=' + parameter.value);
@ -942,7 +944,7 @@ class JMXGenerator {
addBodyFormat(request) {
let bodyFormat = request.body.format;
if (bodyFormat) {
if (!request.body.isKV() && bodyFormat) {
switch (bodyFormat) {
case BODY_FORMAT.JSON:
this.addContentType(request, 'application/json');

View File

@ -286,4 +286,8 @@ export default {
cursor: pointer;
}
pre {
margin: 0 0;
}
</style>

View File

@ -75,13 +75,13 @@
</el-col>
<el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
<el-col :offset="2" :span="2">
@ -137,13 +137,13 @@
</el-col>
<el-col :span="6">
<el-form-item prop="port" label="Port" style="padding-left: 20px">
<el-input-number v-model="item.port" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
</el-form-item>
</el-col>
<el-col :offset="2" :span="2">

View File

@ -141,29 +141,29 @@
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="35%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
v-if="!readOnly"
:disabled="readOnly"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:rows="2"
v-model="scope.row.desc"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.desc}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="35%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
v-if="!readOnly"
:disabled="readOnly"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:rows="2"
v-model="scope.row.result"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.result}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.input_content')" min-width="15%">
@ -512,18 +512,6 @@
<style scoped>
.tb-edit .el-textarea {
display: none;
}
.tb-edit .current-row .el-textarea {
display: block;
}
.tb-edit .current-row .el-textarea + pre {
display: none;
}
.el-switch {
margin-bottom: 10px;
}

View File

@ -128,17 +128,30 @@
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="21%">
<template v-slot:default="scope">
<pre>{{scope.row.desc}}</pre>
<el-input
size="mini"
class="border-hidden"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4}"
:disabled="true"
v-model="scope.row.desc"/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="21%">
<template v-slot:default="scope">
<pre>{{scope.row.result}}</pre>
<el-input
size="mini"
class="border-hidden"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4}"
:disabled="true"
v-model="scope.row.result"/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.plan_view.actual_result')" min-width="21%">
<template v-slot:default="scope">
<el-input
class="table-edit-input"
size="mini"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
@ -146,8 +159,7 @@
:disabled="isReadOnly"
v-model="scope.row.actualResult"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<pre>{{scope.row.actualResult}}</pre>
clearable/>
</template>
</el-table-column>
<el-table-column :label="$t('test_track.plan_view.step_result')" min-width="12%">
@ -302,7 +314,7 @@
},
test: {},
activeTab: 'detail',
isFailure: false,
isFailure: true,
};
},
props: {
@ -480,7 +492,7 @@
stepResultChange() {
if (this.testCase.method == 'manual') {
this.isFailure = this.testCase.steptResults.filter(s => {
return !s.executeResult || s.executeResult === 'Failure' || s.executeResult === 'Blocking';
return s.executeResult === 'Failure' || s.executeResult === 'Blocking';
}).length > 0;
}
@ -520,17 +532,10 @@
<style scoped>
.tb-edit .el-textarea {
display: none;
}
.tb-edit .current-row .el-textarea {
display: block;
}
.tb-edit .current-row .el-textarea + pre {
display: none;
.border-hidden >>> .el-textarea__inner {
border-style: hidden;
background-color: white;
color: #606266;
}
.cast_label {

View File

@ -75,3 +75,22 @@ body {
background-color: #EBEEF5;
}
/* 表格拖拽表头调整宽度 --> */
/* <-- 表格 input 编辑效果*/
.table-edit-input .el-textarea__inner {
border-style: hidden;
}
.table-edit-input.is-disabled .el-textarea__inner {
background-color: white;
color: #606266;
}
.el-table .current-row .table-edit-input {
border: 1px solid #DCDFE6;
border-radius: 5px;
}
.table-edit-input .el-textarea__inner:focus {
border: 1px solid #409EFF;
}
/* 表格 input 编辑效果 --> */