Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-11-24 14:37:10 +08:00
commit dbba491d44
6 changed files with 35 additions and 20 deletions

View File

@ -99,7 +99,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
// 一个脚本里可能包含多个场景(ThreadGroup)所以要区分开key: 场景Id
final Map<String, ScenarioResult> scenarios = new LinkedHashMap<>();
queue.forEach(result -> {
queue.forEach(result -> {
// 线程名称: <场景名> <场景Index>-<请求Index>, 例如Scenario 2-1
String scenarioName = StringUtils.substringBeforeLast(result.getThreadName(), THREAD_SPLIT);
String index = StringUtils.substringAfterLast(result.getThreadName(), THREAD_SPLIT);
@ -107,7 +107,12 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
ScenarioResult scenarioResult;
if (!scenarios.containsKey(scenarioId)) {
scenarioResult = new ScenarioResult();
scenarioResult.setId(scenarioId);
try {
scenarioResult.setId(Integer.parseInt(scenarioId));
} catch (Exception e) {
scenarioResult.setId(0);
LogUtil.error("场景ID转换异常: " + e.getMessage());
}
scenarioResult.setName(scenarioName);
scenarios.put(scenarioId, scenarioResult);
} else {

View File

@ -8,7 +8,7 @@ import java.util.List;
@Data
public class ScenarioResult {
private String id;
private Integer id;
private String name;

@ -1 +1 @@
Subproject commit 419c75bca64b7c5bfbd1194d7f0fd9919f0caa04
Subproject commit 57d6f78efa4b0300be188e8b024511ceef0873ed

View File

@ -20,7 +20,7 @@
:description="$t('api_test.request.parameters_desc')"
v-if="body.isKV()"/>
<div class="body-raw" v-if="body.type == 'Raw'">
<ms-code-edit :mode="body.format" :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" ref="codeEdit"/>
<ms-code-edit :mode="body.format" :enable-format="false" :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" ref="codeEdit"/>
</div>
</div>

View File

@ -28,6 +28,12 @@
init: {
type: Function
},
enableFormat: {
type: Boolean,
default() {
return true;
}
},
readOnly: {
type: Boolean,
default() {
@ -74,20 +80,24 @@
}
},
format() {
switch (this.mode) {
case 'json':
this.formatData = formatJson(this.data);
break;
case 'html':
this.formatData = toDiffableHtml(this.data);
break;
case 'xml':
this.formatData = formatXml(this.data);
break;
default:
if (this.data) {
this.formatData = this.data;
}
if (this.enableFormat) {
switch (this.mode) {
case 'json':
this.formatData = formatJson(this.data);
break;
case 'html':
this.formatData = toDiffableHtml(this.data);
break;
case 'xml':
this.formatData = formatXml(this.data);
break;
default:
if (this.data) {
this.formatData = this.data;
}
}
} else {
this.formatData = this.data;
}
}
}

@ -1 +1 @@
Subproject commit 33bbdb3f528c914bf333b2c1839dd6d3bbd9b569
Subproject commit 71d57ae5d7f8bb5c93a29504ac6f2300dc189ce9