feat(性能测试): 支持自定义图,增加恢复默认和取消所有选项
This commit is contained in:
parent
3848209ede
commit
bab7f7d831
|
@ -2,6 +2,11 @@
|
||||||
<div>
|
<div>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
|
<div style="padding-bottom: 5px;">
|
||||||
|
<el-link type="primary" @click="resetDefault()">{{ $t('load_test.report.set_default') }}</el-link>
|
||||||
|
/
|
||||||
|
<el-link type="danger" @click="unselectAll()">{{ $t('load_test.report.unselect_all') }}</el-link>
|
||||||
|
</div>
|
||||||
<el-collapse v-model="activeNames" class="test-detail">
|
<el-collapse v-model="activeNames" class="test-detail">
|
||||||
<el-collapse-item :title="$t('load_test.report.ActiveThreadsChart')" name="users">
|
<el-collapse-item :title="$t('load_test.report.ActiveThreadsChart')" name="users">
|
||||||
<el-checkbox-group v-model="checkList['ActiveThreadsChart']"
|
<el-checkbox-group v-model="checkList['ActiveThreadsChart']"
|
||||||
|
@ -179,7 +184,30 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resetDefault() {
|
||||||
|
this.chartData = [];
|
||||||
|
this.checkList['ActiveThreadsChart'] = ['ALL'];
|
||||||
|
this.checkList['TransactionsChart'] = ['ALL'];
|
||||||
|
this.checkList['ResponseTimeChart'] = ['ALL'];
|
||||||
|
this.getTotalChart();
|
||||||
|
},
|
||||||
|
unselectAll() {
|
||||||
|
this.chartData = [];
|
||||||
|
this.totalOption = {};
|
||||||
|
for (const name in this.checkList) {
|
||||||
|
this.checkList[name] = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
handleChecked(name) {
|
handleChecked(name) {
|
||||||
|
// let minus = this.checkOptions[name].filter((v) => {
|
||||||
|
// return this.checkList[name].indexOf(v) === -1;
|
||||||
|
// })
|
||||||
|
// let groupName = this.$t('load_test.report.' + name) + ': ';
|
||||||
|
// for (const m of minus) {
|
||||||
|
// this.chartData = this.chartData.filter(c => c.groupName !== groupName + m);
|
||||||
|
// }
|
||||||
|
// this.totalOption = this.generateOption(this.baseOption, this.chartData);
|
||||||
|
// this.getChart(name, this.checkList[name]);
|
||||||
this.getTotalChart();
|
this.getTotalChart();
|
||||||
},
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
|
@ -189,17 +217,14 @@ export default {
|
||||||
this.getCheckOptions(name);
|
this.getCheckOptions(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkList['ActiveThreadsChart'] = ['ALL'];
|
this.resetDefault();
|
||||||
this.checkList['TransactionsChart'] = ['ALL'];
|
|
||||||
this.checkList['ResponseTimeChart'] = ['ALL'];
|
|
||||||
|
|
||||||
this.getTotalChart();
|
|
||||||
},
|
},
|
||||||
getCheckOptions(reportKey) {
|
getCheckOptions(reportKey) {
|
||||||
this.$get("/performance/report/content/" + reportKey + "/" + this.id)
|
this.$get("/performance/report/content/" + reportKey + "/" + this.id)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let data = res.data.data;
|
let data = res.data.data;
|
||||||
if (!data) {
|
if (!data || data.length === 0) {
|
||||||
|
this.init = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let yAxisIndex0List = data.filter(m => m.yAxis2 === -1).map(m => m.groupName);
|
let yAxisIndex0List = data.filter(m => m.yAxis2 === -1).map(m => m.groupName);
|
||||||
|
@ -217,12 +242,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getChart(reportKey, checkList) {
|
getChart(reportKey, checkList) {
|
||||||
|
if (!checkList || checkList.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$get("/performance/report/content/" + reportKey + "/" + this.id)
|
this.$get("/performance/report/content/" + reportKey + "/" + this.id)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let data = res.data.data;
|
let data = res.data.data;
|
||||||
if (!data || data.length === 0) {
|
|
||||||
this.init = false;
|
|
||||||
}
|
|
||||||
if (checkList) {
|
if (checkList) {
|
||||||
data = data.filter(item => {
|
data = data.filter(item => {
|
||||||
if (checkList.indexOf('ALL') > -1) {
|
if (checkList.indexOf('ALL') > -1) {
|
||||||
|
|
|
@ -647,6 +647,8 @@ export default {
|
||||||
project_file_update_type_error: 'Updated file types must be consistent',
|
project_file_update_type_error: 'Updated file types must be consistent',
|
||||||
report: {
|
report: {
|
||||||
diff: "Compare",
|
diff: "Compare",
|
||||||
|
set_default: 'Set to Default',
|
||||||
|
unselect_all: 'Unselect All',
|
||||||
ActiveThreadsChart: 'Users',
|
ActiveThreadsChart: 'Users',
|
||||||
TransactionsChart: 'Requests/Transactions',
|
TransactionsChart: 'Requests/Transactions',
|
||||||
ErrorsChart: 'Error',
|
ErrorsChart: 'Error',
|
||||||
|
|
|
@ -645,6 +645,8 @@ export default {
|
||||||
project_file_exist: "项目中已存在该文件,请直接引用",
|
project_file_exist: "项目中已存在该文件,请直接引用",
|
||||||
report: {
|
report: {
|
||||||
diff: "对比",
|
diff: "对比",
|
||||||
|
set_default: '恢复默认',
|
||||||
|
unselect_all: '取消所有',
|
||||||
ActiveThreadsChart: '用户数',
|
ActiveThreadsChart: '用户数',
|
||||||
TransactionsChart: '请求/事务数',
|
TransactionsChart: '请求/事务数',
|
||||||
ErrorsChart: '错误',
|
ErrorsChart: '错误',
|
||||||
|
|
|
@ -645,6 +645,8 @@ export default {
|
||||||
project_file_exist: "項目中已存在該文件,請直接引用",
|
project_file_exist: "項目中已存在該文件,請直接引用",
|
||||||
report: {
|
report: {
|
||||||
diff: "對比",
|
diff: "對比",
|
||||||
|
set_default: '恢復默認',
|
||||||
|
unselect_all: '取消所有',
|
||||||
ActiveThreadsChart: '用戶數',
|
ActiveThreadsChart: '用戶數',
|
||||||
TransactionsChart: '請求/事務數',
|
TransactionsChart: '請求/事務數',
|
||||||
ErrorsChart: '錯誤',
|
ErrorsChart: '錯誤',
|
||||||
|
|
Loading…
Reference in New Issue