fix(性能测试): 修复报告中的压力配置和高级配置显示错误的问题
This commit is contained in:
parent
e16ea43d2b
commit
eaf9b6ff30
|
@ -163,7 +163,7 @@ public class ShareController {
|
||||||
|
|
||||||
@GetMapping("/performance/report/get-jmx-content/{shareId}/{reportId}")
|
@GetMapping("/performance/report/get-jmx-content/{shareId}/{reportId}")
|
||||||
public LoadTestExportJmx getJmxContent(@PathVariable String shareId, @PathVariable String reportId) {
|
public LoadTestExportJmx getJmxContent(@PathVariable String shareId, @PathVariable String reportId) {
|
||||||
return performanceReportService.getJmxContent(reportId);
|
return performanceReportService.getJmxContent(reportId).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/performance/get-jmx-content/{shareId}/{testId}")
|
@GetMapping("/performance/get-jmx-content/{shareId}/{testId}")
|
||||||
|
|
|
@ -149,10 +149,20 @@ public class PerformanceReportController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("get-jmx-content/{reportId}")
|
@GetMapping("get-jmx-content/{reportId}")
|
||||||
public LoadTestExportJmx getJmxContent(@PathVariable String reportId) {
|
public List<LoadTestExportJmx> getJmxContent(@PathVariable String reportId) {
|
||||||
return performanceReportService.getJmxContent(reportId);
|
return performanceReportService.getJmxContent(reportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-load-config/{reportId}")
|
||||||
|
public String getLoadConfiguration(@PathVariable String reportId) {
|
||||||
|
return performanceReportService.getLoadConfiguration(reportId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-advanced-config/{reportId}")
|
||||||
|
public String getAdvancedConfiguration(@PathVariable String reportId) {
|
||||||
|
return performanceReportService.getAdvancedConfiguration(reportId);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("rename")
|
@PostMapping("rename")
|
||||||
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceReportService.class)
|
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceReportService.class)
|
||||||
public void renameReport(@RequestBody RenameReportRequest request) {
|
public void renameReport(@RequestBody RenameReportRequest request) {
|
||||||
|
|
|
@ -43,9 +43,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -377,12 +375,13 @@ public class PerformanceReportService {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadTestExportJmx getJmxContent(String reportId) {
|
public List<LoadTestExportJmx> getJmxContent(String reportId) {
|
||||||
LoadTestReportWithBLOBs loadTestReportWithBLOBs = loadTestReportMapper.selectByPrimaryKey(reportId);
|
LoadTestReportWithBLOBs loadTestReportWithBLOBs = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
if (loadTestReportWithBLOBs == null) {
|
if (loadTestReportWithBLOBs == null) {
|
||||||
return null;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return new LoadTestExportJmx(loadTestReportWithBLOBs.getTestName(), loadTestReportWithBLOBs.getJmxContent());
|
LoadTestExportJmx loadTestExportJmx = new LoadTestExportJmx(loadTestReportWithBLOBs.getTestName(), loadTestReportWithBLOBs.getJmxContent());
|
||||||
|
return Collections.singletonList(loadTestExportJmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renameReport(RenameReportRequest request) {
|
public void renameReport(RenameReportRequest request) {
|
||||||
|
@ -432,4 +431,20 @@ public class PerformanceReportService {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLoadConfiguration(String reportId) {
|
||||||
|
LoadTestReportWithBLOBs loadTestReportWithBLOBs = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
|
if (loadTestReportWithBLOBs == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return loadTestReportWithBLOBs.getLoadConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdvancedConfiguration(String reportId) {
|
||||||
|
LoadTestReportWithBLOBs loadTestReportWithBLOBs = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
|
if (loadTestReportWithBLOBs == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return loadTestReportWithBLOBs.getAdvancedConfiguration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1632,9 +1632,9 @@ public class TestPlanService {
|
||||||
String loadConfiguration = performanceTestService.getLoadConfiguration(item.getId());
|
String loadConfiguration = performanceTestService.getLoadConfiguration(item.getId());
|
||||||
response.setFixLoadConfiguration(loadConfiguration);
|
response.setFixLoadConfiguration(loadConfiguration);
|
||||||
}
|
}
|
||||||
LoadTestExportJmx jmxContent = performanceReportService.getJmxContent(reportId);
|
List<LoadTestExportJmx> jmxContent = performanceReportService.getJmxContent(reportId);
|
||||||
if (jmxContent != null) {
|
if (!CollectionUtils.isEmpty(jmxContent)) {
|
||||||
response.setJmxContent(JSONObject.toJSONString(jmxContent));
|
response.setJmxContent(JSONObject.toJSONString(jmxContent.get(0)));
|
||||||
}
|
}
|
||||||
List<LoadTestExportJmx> fixJmxContent = performanceTestService.getJmxContent(item.getId());
|
List<LoadTestExportJmx> fixJmxContent = performanceTestService.getJmxContent(item.getId());
|
||||||
response.setFixJmxContent(fixJmxContent);
|
response.setFixJmxContent(fixJmxContent);
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<monitor-card :report="report"/>
|
<monitor-card :report="report"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('测试配置')">
|
<el-tab-pane :label="$t('测试配置')">
|
||||||
<ms-test-configuration :report="report" :test="test" :test-id="testId"/>
|
<ms-test-configuration :test="test" :report-id="reportId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<el-tabs>
|
<el-tabs>
|
||||||
<el-tab-pane :label="$t('load_test.pressure_config')">
|
<el-tab-pane :label="$t('load_test.pressure_config')">
|
||||||
<performance-pressure-config :is-read-only="true" :test="test" :test-id="testId"/>
|
<performance-pressure-config :is-read-only="true" :test="test" :report-id="reportId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('load_test.advanced_config')">
|
<el-tab-pane :label="$t('load_test.advanced_config')">
|
||||||
<performance-advanced-config :is-read-only="true" :test-id="testId"/>
|
<performance-advanced-config :is-read-only="true" :report-id="reportId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,9 +18,9 @@ export default {
|
||||||
name: "TestConfiguration",
|
name: "TestConfiguration",
|
||||||
components: {PerformanceBasicConfig, PerformancePressureConfig, PerformanceAdvancedConfig},
|
components: {PerformanceBasicConfig, PerformancePressureConfig, PerformanceAdvancedConfig},
|
||||||
props: {
|
props: {
|
||||||
report: Object,
|
|
||||||
test: Object,
|
test: Object,
|
||||||
testId: String,
|
testId: String,
|
||||||
|
reportId: String,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -422,6 +422,9 @@ export default {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
testId: String,
|
testId: String,
|
||||||
|
reportId: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() {
|
default() {
|
||||||
|
@ -432,6 +435,8 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.testId) {
|
if (this.testId) {
|
||||||
this.getAdvancedConfig();
|
this.getAdvancedConfig();
|
||||||
|
} else if (this.reportId) {
|
||||||
|
this.getAdvancedConfig('report');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -450,8 +455,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getAdvancedConfig() {
|
getAdvancedConfig(type) {
|
||||||
this.$get('/performance/get-advanced-config/' + this.testId, (response) => {
|
let url = '/performance/get-advanced-config/' + this.testId;
|
||||||
|
if (type) {
|
||||||
|
url = '/performance/report/get-advanced-config/' + this.reportId;
|
||||||
|
}
|
||||||
|
this.$get(url, (response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
let data = JSON.parse(response.data);
|
let data = JSON.parse(response.data);
|
||||||
this.timeout = data.timeout;
|
this.timeout = data.timeout;
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<el-form-item :label="$t('load_test.select_resource_pool')">
|
<el-form-item :label="$t('load_test.select_resource_pool')">
|
||||||
<el-select v-model="resourcePool" size="mini" @change="resourcePoolChange">
|
<el-select v-model="resourcePool" size="mini" @change="resourcePoolChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in resourcePools"
|
v-for="item in resourcePools"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:disabled="!item.performance"
|
:disabled="!item.performance"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -80,10 +80,10 @@
|
||||||
<el-form-item :label="$t('load_test.on_sample_error')">
|
<el-form-item :label="$t('load_test.on_sample_error')">
|
||||||
<el-select v-model="threadGroup.onSampleError" size="mini">
|
<el-select v-model="threadGroup.onSampleError" size="mini">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in onSampleErrors"
|
v-for="item in onSampleErrors"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -221,10 +221,10 @@
|
||||||
<el-form-item :label="$t('load_test.specify_resource')">
|
<el-form-item :label="$t('load_test.specify_resource')">
|
||||||
<el-select v-model="threadGroup.resourceNodeIndex" size="mini">
|
<el-select v-model="threadGroup.resourceNodeIndex" size="mini">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(node, index) in resourceNodes"
|
v-for="(node, index) in resourceNodes"
|
||||||
:key="node.ip"
|
:key="node.ip"
|
||||||
:label="node.ip"
|
:label="node.ip"
|
||||||
:value="index">
|
:value="index">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -289,7 +289,7 @@ const RATIOS = "ratios";
|
||||||
|
|
||||||
const hexToRgb = function (hex) {
|
const hexToRgb = function (hex) {
|
||||||
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
|
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
|
||||||
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
|
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -302,6 +302,9 @@ export default {
|
||||||
testId: {
|
testId: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
reportId: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() {
|
default() {
|
||||||
|
@ -346,6 +349,8 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.testId) {
|
if (this.testId) {
|
||||||
this.getJmxContent();
|
this.getJmxContent();
|
||||||
|
} else if (this.reportId) {
|
||||||
|
this.getJmxContent();
|
||||||
} else {
|
} else {
|
||||||
this.calculateTotalChart();
|
this.calculateTotalChart();
|
||||||
}
|
}
|
||||||
|
@ -369,6 +374,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.getResourcePools();
|
this.getResourcePools();
|
||||||
},
|
},
|
||||||
|
reportId() {
|
||||||
|
if (this.reportId) {
|
||||||
|
this.getJmxContent();
|
||||||
|
} else {
|
||||||
|
this.calculateTotalChart();
|
||||||
|
}
|
||||||
|
this.getResourcePools();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getResourcePools() {
|
getResourcePools() {
|
||||||
|
@ -383,7 +396,17 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLoadConfig() {
|
getLoadConfig() {
|
||||||
this.$get('/performance/get-load-config/' + this.testId, (response) => {
|
let url = '';
|
||||||
|
if (this.testId) {
|
||||||
|
url = '/performance/get-load-config/' + this.testId;
|
||||||
|
}
|
||||||
|
if (this.reportId) {
|
||||||
|
url = '/performance/report/get-load-config/' + this.reportId;
|
||||||
|
}
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$get(url, (response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
let data = JSON.parse(response.data);
|
let data = JSON.parse(response.data);
|
||||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||||
|
@ -396,6 +419,10 @@ export default {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 这里是报告查询
|
||||||
|
if (this.reportId) {
|
||||||
|
j = i;
|
||||||
|
}
|
||||||
|
|
||||||
data[j].forEach(item => {
|
data[j].forEach(item => {
|
||||||
switch (item.key) {
|
switch (item.key) {
|
||||||
|
@ -496,20 +523,28 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getJmxContent() {
|
getJmxContent() {
|
||||||
|
let url = '';
|
||||||
if (this.testId) {
|
if (this.testId) {
|
||||||
let threadGroups = [];
|
url = '/performance/get-jmx-content/' + this.testId;
|
||||||
this.$get('/performance/get-jmx-content/' + this.testId, (response) => {
|
|
||||||
response.data.forEach(d => {
|
|
||||||
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
|
|
||||||
threadGroups.forEach(tg => {
|
|
||||||
tg.options = {};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.threadGroups = threadGroups;
|
|
||||||
this.$emit('fileChange', threadGroups);
|
|
||||||
this.getLoadConfig();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
if (this.reportId) {
|
||||||
|
url = '/performance/report/get-jmx-content/' + this.reportId;
|
||||||
|
}
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let threadGroups = [];
|
||||||
|
this.$get(url, (response) => {
|
||||||
|
response.data.forEach(d => {
|
||||||
|
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
|
||||||
|
threadGroups.forEach(tg => {
|
||||||
|
tg.options = {};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.threadGroups = threadGroups;
|
||||||
|
this.$emit('fileChange', threadGroups);
|
||||||
|
this.getLoadConfig();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
resourcePoolChange() {
|
resourcePoolChange() {
|
||||||
let result = this.resourcePools.filter(p => p.id === this.resourcePool);
|
let result = this.resourcePools.filter(p => p.id === this.resourcePool);
|
||||||
|
@ -588,8 +623,8 @@ export default {
|
||||||
let tg = handler.threadGroups[i];
|
let tg = handler.threadGroups[i];
|
||||||
|
|
||||||
if (tg.enabled === 'false' ||
|
if (tg.enabled === 'false' ||
|
||||||
tg.deleted === 'true' ||
|
tg.deleted === 'true' ||
|
||||||
tg.threadType === 'ITERATION') {
|
tg.threadType === 'ITERATION') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (this.getDuration(tg) < tg.rampUpTime) {
|
if (this.getDuration(tg) < tg.rampUpTime) {
|
||||||
|
@ -704,7 +739,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tg.threadNumber || !tg.duration
|
if (!tg.threadNumber || !tg.duration
|
||||||
|| !tg.rampUpTime || !tg.step || !tg.iterateNum) {
|
|| !tg.rampUpTime || !tg.step || !tg.iterateNum) {
|
||||||
this.$warning(this.$t('load_test.pressure_config_params_is_empty'));
|
this.$warning(this.$t('load_test.pressure_config_params_is_empty'));
|
||||||
this.$emit('changeActive', '1');
|
this.$emit('changeActive', '1');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
:share-id="shareId"/>
|
:share-id="shareId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('测试配置')">
|
<el-tab-pane :label="$t('测试配置')">
|
||||||
<ms-test-configuration :report="report" :test="test" :test-id="testId"/>
|
<ms-test-configuration :report-id="reportId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue