refactor(性能测试): 报告中去除前端的人工处理

This commit is contained in:
CaptainB 2023-07-24 14:26:36 +08:00 committed by 刘瑞斌
parent e52feb6814
commit a76fbc9297
1 changed files with 4 additions and 30 deletions

View File

@ -396,9 +396,9 @@ export default {
methods: {
resetDefault() {
this.checkList['ActiveThreadsChart'] = ['ALL'];
this.checkList['TransactionsChart'] = ['ALL'];
this.checkList['ResponseTimeChart'] = ['ALL'];
this.checkList['ActiveThreadsChart'] = ['Total'];
this.checkList['TransactionsChart'] = ['Total'];
this.checkList['ResponseTimeChart'] = ['Total'];
//
this.checkList['ResponseTimePercentilesChart'] = [];
this.checkList['ErrorsChart'] = [];
@ -474,7 +474,7 @@ export default {
}
let yAxisIndex0List = data.filter(m => m.yAxis2 === -1).map(m => m.groupName);
yAxisIndex0List = this._unique(yAxisIndex0List);
this.checkOptions[reportKey] = ['ALL'].concat(yAxisIndex0List);
this.checkOptions[reportKey] = yAxisIndex0List;
},
getTotalChart() {
this.totalOption = {};
@ -553,28 +553,6 @@ export default {
}
},
handleGetChart(data, reportKey, checkList) {
let allData = [];
let checkAllOption = checkList.indexOf('ALL') > -1;
if (checkAllOption) {
let avgOpt = [
'ResponseTimeChart',
'ResponseTimePercentilesChart',
'LatencyChart',
];
let result = groupBy(data, 'xAxis');
for (const xAxis in result) {
let yAxis = result[xAxis].map(a => a.yAxis).reduce((a, b) => a + b, 0);
if (avgOpt.indexOf(reportKey) > -1) {
yAxis = yAxis / result[xAxis].length;
}
allData.push({
groupName: 'ALL',
xAxis: xAxis,
yAxis: yAxis
});
}
}
//
data = data.filter(item => {
if (checkList.indexOf(item.groupName) > -1) {
@ -582,10 +560,6 @@ export default {
}
});
// all
data = data.concat(allData);
// prefix
data.forEach(item => {
item.groupName = this.$t('load_test.report.' + reportKey) + ': ' + item.groupName;