fix: --bug=1007391 --user=刘瑞斌 【测试计划】-关联性能测试-编辑压力配置-时间设置仍是旧版 https://www.tapd.cn/55049933/s/1058519
This commit is contained in:
parent
26970d290b
commit
04bc76ff2c
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :close-on-click-modal="false" :visible.sync="visible" :title="$t('load_test.pressure_config')"
|
<el-dialog :close-on-click-modal="false" :visible.sync="visible" :title="$t('load_test.pressure_config')"
|
||||||
width="61%" top="8vh" @close="close" v-loading="result.loading" :destroy-on-close="true">
|
width="85%" top="8vh" @close="close" v-loading="result.loading" :destroy-on-close="true">
|
||||||
<performance-load-config :test-id="loadTestId" :load-case-id="loadCaseId" :resource-pool="poolId"
|
<performance-load-config :test-id="loadTestId" :load-case-id="loadCaseId" :resource-pool="poolId"
|
||||||
@fileChange="fileChange" ref="pressureConfig" style="height: 50vh; overflow-y: auto;"/>
|
@fileChange="fileChange" ref="pressureConfig" style="height: 50vh; overflow-y: auto;"/>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
|
|
|
@ -51,7 +51,16 @@
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'DURATION'">
|
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'DURATION'">
|
||||||
{{ $t('load_test.thread_num') }}{{ threadGroup.threadNumber }},
|
{{ $t('load_test.thread_num') }}{{ threadGroup.threadNumber }},
|
||||||
{{ $t('load_test.duration') }}: {{ threadGroup.duration }} {{ getUnitLabel(threadGroup) }}
|
{{ $t('load_test.duration') }}:
|
||||||
|
<span v-if="threadGroup.durationHours">
|
||||||
|
{{ threadGroup.durationHours }}{{ $t('schedule.cron.hours') }}
|
||||||
|
</span>
|
||||||
|
<span v-if="threadGroup.durationMinutes">
|
||||||
|
{{ threadGroup.durationMinutes }}{{ $t('schedule.cron.minutes') }}
|
||||||
|
</span>
|
||||||
|
<span v-if="threadGroup.durationSeconds">
|
||||||
|
{{ threadGroup.durationSeconds }}{{ $t('schedule.cron.seconds') }}
|
||||||
|
</span>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'ITERATION'">
|
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'ITERATION'">
|
||||||
{{ $t('load_test.thread_num') }} {{ threadGroup.threadNumber }},
|
{{ $t('load_test.thread_num') }} {{ threadGroup.threadNumber }},
|
||||||
|
@ -89,27 +98,41 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<div v-if="threadGroup.threadType === 'DURATION'">
|
<div v-if="threadGroup.threadType === 'DURATION'">
|
||||||
<el-form-item :label="$t('load_test.duration')">
|
<el-form-item>
|
||||||
<el-input-number
|
<el-input-number controls-position="right"
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
v-model="threadGroup.duration"
|
v-model="threadGroup.durationHours"
|
||||||
:min="1"
|
:min="0"
|
||||||
:max="9999"
|
:max="9999"
|
||||||
@change="calculateTotalChart()"
|
@change="calculateTotalChart()"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('schedule.cron.hours')"/>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio-group v-model="threadGroup.unit" @change="changeUnit(threadGroup)">
|
<el-input-number controls-position="right"
|
||||||
<el-radio label="S">{{ $t('schedule.cron.seconds') }}</el-radio>
|
:disabled="isReadOnly"
|
||||||
<el-radio label="M">{{ $t('schedule.cron.minutes') }}</el-radio>
|
v-model="threadGroup.durationMinutes"
|
||||||
<el-radio label="H">{{ $t('schedule.cron.hours') }}</el-radio>
|
:min="0"
|
||||||
</el-radio-group>
|
:max="59"
|
||||||
|
@change="calculateTotalChart()"
|
||||||
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('schedule.cron.minutes')"/>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input-number controls-position="right"
|
||||||
|
:disabled="isReadOnly"
|
||||||
|
v-model="threadGroup.durationSeconds"
|
||||||
|
:min="0"
|
||||||
|
:max="59"
|
||||||
|
@change="calculateTotalChart()"
|
||||||
|
size="mini"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('schedule.cron.seconds')"/>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item :label="$t('load_test.rps_limit')">
|
<el-form-item :label="$t('load_test.rps_limit')">
|
||||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||||
|
|
||||||
<el-input-number
|
<el-input-number controls-position="right"
|
||||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||||
v-model="threadGroup.rpsLimit"
|
v-model="threadGroup.rpsLimit"
|
||||||
@change="calculateTotalChart()"
|
@change="calculateTotalChart()"
|
||||||
|
@ -120,7 +143,7 @@
|
||||||
<br>
|
<br>
|
||||||
<div v-if="threadGroup.tgType === 'com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup'">
|
<div v-if="threadGroup.tgType === 'com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup'">
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
||||||
<el-input-number
|
<el-input-number controls-position="right"
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
:min="1"
|
:min="1"
|
||||||
v-if="rampUpTimeVisible"
|
v-if="rampUpTimeVisible"
|
||||||
|
@ -129,8 +152,8 @@
|
||||||
@change="calculateTotalChart()"
|
@change="calculateTotalChart()"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
|
<el-form-item :label="$t('load_test.ramp_up_time_minutes')">
|
||||||
<el-input-number
|
<el-input-number controls-position="right"
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
||||||
|
@ -143,7 +166,7 @@
|
||||||
|
|
||||||
<div v-if="threadGroup.tgType === 'ThreadGroup'">
|
<div v-if="threadGroup.tgType === 'ThreadGroup'">
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
||||||
<el-input-number
|
<el-input-number controls-position="right"
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
v-if="rampUpTimeVisible"
|
v-if="rampUpTimeVisible"
|
||||||
:min="1"
|
:min="1"
|
||||||
|
@ -152,7 +175,7 @@
|
||||||
@change="calculateTotalChart()"
|
@change="calculateTotalChart()"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
|
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -185,7 +208,7 @@
|
||||||
v-model="threadGroup.iterateRampUp"
|
v-model="threadGroup.iterateRampUp"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
|
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
|
@ -216,6 +239,9 @@ const RAMP_UP = "RampUp";
|
||||||
const ITERATE_RAMP_UP = "iterateRampUpTime";
|
const ITERATE_RAMP_UP = "iterateRampUpTime";
|
||||||
const STEPS = "Steps";
|
const STEPS = "Steps";
|
||||||
const DURATION = "duration";
|
const DURATION = "duration";
|
||||||
|
const DURATION_HOURS = "durationHours";
|
||||||
|
const DURATION_MINUTES = "durationMinutes";
|
||||||
|
const DURATION_SECONDS = "durationSeconds";
|
||||||
const UNIT = "unit";
|
const UNIT = "unit";
|
||||||
const RPS_LIMIT = "rpsLimit";
|
const RPS_LIMIT = "rpsLimit";
|
||||||
const RPS_LIMIT_ENABLE = "rpsLimitEnable";
|
const RPS_LIMIT_ENABLE = "rpsLimitEnable";
|
||||||
|
@ -334,7 +360,15 @@ export default {
|
||||||
break;
|
break;
|
||||||
case DURATION:
|
case DURATION:
|
||||||
this.threadGroups[i].duration = item.value;
|
this.threadGroups[i].duration = item.value;
|
||||||
oldVersion = item.unit;
|
break;
|
||||||
|
case DURATION_HOURS:
|
||||||
|
this.threadGroups[i].durationHours = item.value;
|
||||||
|
break;
|
||||||
|
case DURATION_MINUTES:
|
||||||
|
this.threadGroups[i].durationMinutes = item.value;
|
||||||
|
break;
|
||||||
|
case DURATION_SECONDS:
|
||||||
|
this.threadGroups[i].durationSeconds = item.value;
|
||||||
break;
|
break;
|
||||||
case UNIT:
|
case UNIT:
|
||||||
this.threadGroups[i].unit = item.value;
|
this.threadGroups[i].unit = item.value;
|
||||||
|
@ -392,21 +426,10 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||||
// 处理老版本的问题
|
let tg = this.threadGroups[i];
|
||||||
if (oldVersion) {
|
tg.durationHours = Math.floor(tg.duration / 3600);
|
||||||
break;
|
tg.durationMinutes = Math.floor((tg.duration / 60 % 60));
|
||||||
}
|
tg.durationSeconds = Math.floor((tg.duration % 60));
|
||||||
// 恢复成单位需要的值
|
|
||||||
switch (this.threadGroups[i].unit) {
|
|
||||||
case 'M':
|
|
||||||
this.threadGroups[i].duration = this.threadGroups[i].duration / 60;
|
|
||||||
break;
|
|
||||||
case 'H':
|
|
||||||
this.threadGroups[i].duration = this.threadGroups[i].duration / 60 / 60;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.calculateTotalChart();
|
this.calculateTotalChart();
|
||||||
}
|
}
|
||||||
|
@ -523,18 +546,8 @@ export default {
|
||||||
let threadInc2 = Math.ceil(tg.threadNumber / tg.step);
|
let threadInc2 = Math.ceil(tg.threadNumber / tg.step);
|
||||||
let inc2count = tg.threadNumber - tg.step * threadInc1;
|
let inc2count = tg.threadNumber - tg.step * threadInc1;
|
||||||
|
|
||||||
let times = 1;
|
|
||||||
switch (tg.unit) {
|
let duration = tg.duration;
|
||||||
case 'M':
|
|
||||||
times *= 60;
|
|
||||||
break;
|
|
||||||
case 'H':
|
|
||||||
times *= 3600;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let duration = tg.duration * times;
|
|
||||||
for (let j = 0; j <= duration; j++) {
|
for (let j = 0; j <= duration; j++) {
|
||||||
// x 轴
|
// x 轴
|
||||||
let xAxis = handler.options.xAxis.data;
|
let xAxis = handler.options.xAxis.data;
|
||||||
|
@ -596,14 +609,19 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||||
if (!this.threadGroups[i].threadNumber || !this.threadGroups[i].duration
|
let tg = this.threadGroups[i];
|
||||||
|| !this.threadGroups[i].rampUpTime || !this.threadGroups[i].step || !this.threadGroups[i].iterateNum) {
|
tg.durationHours = tg.durationHours || 0;
|
||||||
|
tg.durationMinutes = tg.durationMinutes || 0;
|
||||||
|
tg.durationSeconds = tg.durationSeconds || 0;
|
||||||
|
this.getDuration(tg);
|
||||||
|
if (!tg.threadNumber || !tg.duration
|
||||||
|
|| !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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.threadGroups[i].rpsLimitEnable && !this.threadGroups[i].rpsLimit) {
|
if (tg.rpsLimitEnable && !tg.rpsLimit) {
|
||||||
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;
|
||||||
|
@ -613,47 +631,11 @@ export default {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
getHold(tg) {
|
getHold(tg) {
|
||||||
if (tg.unit === 'S') {
|
return tg.durationHours * 60 * 60 + tg.durationMinutes * 60 + tg.durationSeconds - tg.rampUpTime;
|
||||||
return tg.duration - tg.rampUpTime;
|
|
||||||
}
|
|
||||||
if (tg.unit === 'M') {
|
|
||||||
return tg.duration * 60 - tg.rampUpTime;
|
|
||||||
}
|
|
||||||
if (tg.unit === 'H') {
|
|
||||||
return tg.duration * 60 * 60 - tg.rampUpTime;
|
|
||||||
}
|
|
||||||
return tg.duration - tg.rampUpTime;
|
|
||||||
},
|
},
|
||||||
getDuration(tg) {
|
getDuration(tg) {
|
||||||
if (tg.unit === 'S') {
|
tg.duration = tg.durationHours * 60 * 60 + tg.durationMinutes * 60 + tg.durationSeconds;
|
||||||
return tg.duration;
|
return tg.duration;
|
||||||
}
|
|
||||||
if (tg.unit === 'M') {
|
|
||||||
return tg.duration * 60;
|
|
||||||
}
|
|
||||||
if (tg.unit === 'H') {
|
|
||||||
return tg.duration * 60 * 60;
|
|
||||||
}
|
|
||||||
return tg.duration;
|
|
||||||
},
|
|
||||||
changeUnit(tg) {
|
|
||||||
this.rampUpTimeVisible = false;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.rampUpTimeVisible = true;
|
|
||||||
this.calculateTotalChart();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getUnitLabel(tg) {
|
|
||||||
if (tg.unit === 'S') {
|
|
||||||
return this.$t('schedule.cron.seconds');
|
|
||||||
}
|
|
||||||
if (tg.unit === 'M') {
|
|
||||||
return this.$t('schedule.cron.minutes');
|
|
||||||
}
|
|
||||||
if (tg.unit === 'H') {
|
|
||||||
return this.$t('schedule.cron.hours');
|
|
||||||
}
|
|
||||||
return this.$t('schedule.cron.seconds');
|
|
||||||
},
|
},
|
||||||
convertProperty() {
|
convertProperty() {
|
||||||
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
||||||
|
@ -667,6 +649,9 @@ export default {
|
||||||
{key: RAMP_UP, value: this.threadGroups[i].rampUpTime},
|
{key: RAMP_UP, value: this.threadGroups[i].rampUpTime},
|
||||||
{key: STEPS, value: this.threadGroups[i].step},
|
{key: STEPS, value: this.threadGroups[i].step},
|
||||||
{key: DURATION, value: this.getDuration(this.threadGroups[i])},
|
{key: DURATION, value: this.getDuration(this.threadGroups[i])},
|
||||||
|
{key: DURATION_HOURS, value: this.threadGroups[i].durationHours},
|
||||||
|
{key: DURATION_MINUTES, value: this.threadGroups[i].durationMinutes},
|
||||||
|
{key: DURATION_SECONDS, value: this.threadGroups[i].durationSeconds},
|
||||||
{key: UNIT, value: this.threadGroups[i].unit},
|
{key: UNIT, value: this.threadGroups[i].unit},
|
||||||
{key: RPS_LIMIT, value: this.threadGroups[i].rpsLimit},
|
{key: RPS_LIMIT, value: this.threadGroups[i].rpsLimit},
|
||||||
{key: RPS_LIMIT_ENABLE, value: this.threadGroups[i].rpsLimitEnable},
|
{key: RPS_LIMIT_ENABLE, value: this.threadGroups[i].rpsLimitEnable},
|
||||||
|
|
|
@ -182,7 +182,7 @@ export default {
|
||||||
tip: '修改压力配置',
|
tip: '修改压力配置',
|
||||||
icon: "el-icon-setting",
|
icon: "el-icon-setting",
|
||||||
exec: this.changeLoadConfig,
|
exec: this.changeLoadConfig,
|
||||||
type: 'danger',
|
type: 'success',
|
||||||
isDisable: this.isReadOnly,
|
isDisable: this.isReadOnly,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue