refactor(性能测试): 重构压力配置部分前端代码

This commit is contained in:
CaptainB 2021-11-19 00:45:08 +08:00 committed by 刘瑞斌
parent caccb7014e
commit 453c97bbe2
2 changed files with 26 additions and 8 deletions

View File

@ -386,9 +386,18 @@ export default {
this.$get('/performance/get-load-config/' + this.testId, (response) => {
if (response.data) {
let data = JSON.parse(response.data);
for (let i = 0; i < data.length; i++) {
let d = data[i];
d.forEach(item => {
for (let i = 0; i < this.threadGroups.length; i++) {
let handler = this.threadGroups[i].handler;
let j = 0;
for (; j < data.length; j++) {
let res = data[j].filter(v => v.key === HANDLER && v.value === handler);
if (res.length > 0) {
break;
}
}
data[j].forEach(item => {
switch (item.key) {
case TARGET_LEVEL:
this.threadGroups[i].threadNumber = item.value;

View File

@ -376,10 +376,19 @@ export default {
this.$get('/test/plan/load/case/get-load-config/' + this.loadCaseId, (response) => {
if (response.data) {
let data = JSON.parse(response.data);
let oldVersion;
for (let i = 0; i < data.length; i++) {
let d = data[i];
d.forEach(item => {
for (let i = 0; i < this.threadGroups.length; i++) {
let handler = this.threadGroups[i].handler;
let j = 0;
for (; j < data.length; j++) {
let res = data[j].filter(v => v.key === HANDLER && v.value === handler);
if (res.length > 0) {
break;
}
}
data[j].forEach(item => {
switch (item.key) {
case TARGET_LEVEL:
this.threadGroups[i].threadNumber = item.value;
@ -671,7 +680,7 @@ export default {
tg.durationMinutes = tg.durationMinutes || 0;
tg.durationSeconds = tg.durationSeconds || 0;
this.getDuration(tg);
if (tg.enabled === 'false' ) {
if (tg.enabled === 'false') {
continue;
}