refactor(性能测试): 性能测试显示压力预估图时排除按照迭代次数

This commit is contained in:
Captain.B 2021-05-17 17:37:04 +08:00 committed by 刘瑞斌
parent 0621a25ec2
commit 730d2a0d47
1 changed files with 18 additions and 16 deletions

View File

@ -64,7 +64,7 @@
<el-input-number
:disabled="isReadOnly"
v-model="threadGroup.threadNumber"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
:min="resourcePoolResourceLength"
:max="maxThreadNumbers"
size="mini"/>
@ -84,7 +84,7 @@
v-model="threadGroup.duration"
:min="1"
:max="9999"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
size="mini"/>
</el-form-item>
<el-form-item>
@ -101,7 +101,7 @@
<el-input-number
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
v-model="threadGroup.rpsLimit"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
:min="1"
:max="99999"
size="mini"/>
@ -114,7 +114,7 @@
:min="1"
:max="threadGroup.duration"
v-model="threadGroup.rampUpTime"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
size="mini"/>
</el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
@ -123,7 +123,7 @@
:min="1"
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
v-model="threadGroup.step"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
size="mini"/>
</el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
@ -136,7 +136,7 @@
:min="1"
:max="threadGroup.duration"
v-model="threadGroup.rampUpTime"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
size="mini"/>
</el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
@ -150,7 +150,7 @@
v-model="threadGroup.iterateNum"
:min="1"
:max="9999999"
@change="calculateTotalChart(threadGroup)"
@change="calculateTotalChart()"
size="mini"/>
</el-form-item>
<br>
@ -213,11 +213,11 @@ const DELETED = "deleted";
const hexToRgba = function (hex, opacity) {
return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
+ parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')';
}
};
const hexToRgb = function (hex) {
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
}
};
export default {
name: "PerformancePressureConfig",
@ -253,7 +253,7 @@ export default {
serializeThreadGroups: false,
autoStop: false,
autoStopDelay: 30,
}
};
},
mounted() {
if (this.testId) {
@ -287,7 +287,7 @@ export default {
}
this.resourcePoolChange();
})
});
},
getLoadConfig() {
this.$get('/performance/get-load-config/' + this.testId, (response) => {
@ -358,7 +358,7 @@ export default {
this.$set(this.threadGroups[i], "iterateRampUp", this.threadGroups[i].iterateRampUp || 10);
this.$set(this.threadGroups[i], "enabled", this.threadGroups[i].enabled || 'true');
this.$set(this.threadGroups[i], "deleted", this.threadGroups[i].deleted || 'false');
})
});
}
this.calculateTotalChart();
}
@ -386,13 +386,13 @@ export default {
let threadNumber = 0;
result[0].resources.forEach(resource => {
threadNumber += JSON.parse(resource.configuration).maxConcurrency;
})
});
this.$set(this, 'maxThreadNumbers', threadNumber);
this.threadGroups.forEach(tg => {
if (tg.threadNumber > threadNumber) {
this.$set(tg, "threadNumber", threadNumber);
}
})
});
this.calculateTotalChart();
}
},
@ -427,7 +427,9 @@ export default {
};
for (let i = 0; i < handler.threadGroups.length; i++) {
if (handler.threadGroups[i].enabled === 'false' || handler.threadGroups[i].deleted === 'true') {
if (handler.threadGroups[i].enabled === 'false' ||
handler.threadGroups[i].deleted === 'true' ||
handler.threadGroups[i].threadType === 'ITERATION') {
continue;
}
let seriesData = {
@ -701,7 +703,7 @@ export default {
return result;
}
}
}
};
</script>