fix(性能测试): 修复停止测试之后报告的缓存

This commit is contained in:
Captain.B 2021-05-24 18:49:12 +08:00 committed by 刘瑞斌
parent 3c95beec2d
commit bc6fd9c6e0
2 changed files with 41 additions and 33 deletions

View File

@ -133,6 +133,7 @@ import MsPerformanceReportExport from "./PerformanceReportExport";
import {Message} from "element-ui"; import {Message} from "element-ui";
import SameTestReports from "@/business/components/performance/report/components/SameTestReports"; import SameTestReports from "@/business/components/performance/report/components/SameTestReports";
import MonitorCard from "@/business/components/performance/report/components/MonitorCard"; import MonitorCard from "@/business/components/performance/report/components/MonitorCard";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
export default { export default {
@ -264,6 +265,8 @@ export default {
this.result = this.$get('/performance/stop/' + this.reportId + '/' + forceStop, () => { this.result = this.$get('/performance/stop/' + this.reportId + '/' + forceStop, () => {
this.$success(this.$t('report.test_stop_success')); this.$success(this.$t('report.test_stop_success'));
if (forceStop) { if (forceStop) {
// 广 head
PerformanceEvent.$emit(LIST_CHANGE);
this.$router.push('/performance/report/all'); this.$router.push('/performance/report/all');
this.websocket.close(); this.websocket.close();
} else { } else {
@ -281,6 +284,7 @@ export default {
this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, (response) => { this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, (response) => {
this.reportId = response.data; this.reportId = response.data;
this.$router.push({path: '/performance/report/view/' + this.reportId}); this.$router.push({path: '/performance/report/view/' + this.reportId});
this.clearData();
}); });
}).catch(() => { }).catch(() => {
}); });

View File

@ -31,11 +31,11 @@
<el-form :inline="true"> <el-form :inline="true">
<el-form-item :label="$t('load_test.thread_num')"> <el-form-item :label="$t('load_test.thread_num')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:placeholder="$t('load_test.input_thread_num')" :placeholder="$t('load_test.input_thread_num')"
v-model="threadGroup.threadNumber" v-model="threadGroup.threadNumber"
:min="1" :min="1"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item> <el-form-item>
@ -98,10 +98,10 @@
<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
:disabled="true" :disabled="true"
:min="1" :min="1"
v-model="threadGroup.rampUpTime" v-model="threadGroup.rampUpTime"
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', [getUnitLabel(threadGroup)])"/>
</div> </div>
@ -171,11 +171,11 @@ const DELETED = "deleted";
const hexToRgba = function (hex, opacity) { const hexToRgba = function (hex, opacity) {
return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ',' return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
+ parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')'; + parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')';
}; };
const hexToRgb = function (hex) { const hexToRgb = function (hex) {
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')'; + ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
}; };
export default { export default {
@ -288,30 +288,34 @@ export default {
return; return;
} }
let threadGroups = []; let threadGroups = [];
this.result = this.$get('/performance/report/get-jmx-content/' + this.report.id, (response) => { this.result = this.$get('/performance/report/get-jmx-content/' + this.report.id)
let d = response.data; .then((response) => {
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name)); let d = response.data.data;
threadGroups.forEach(tg => { threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
tg.options = {}; threadGroups.forEach(tg => {
}); tg.options = {};
this.threadGroups = threadGroups;
this.getLoadConfig();
//
if (!threadGroups || threadGroups.length === 0) {
this.result = this.$get('/performance/get-jmx-content/' + this.report.testId, (response) => {
response.data.forEach(d => {
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
threadGroups.forEach(tg => {
tg.options = {};
});
this.threadGroups = threadGroups;
this.getLoadConfig();
});
}); });
} this.threadGroups = threadGroups;
this.getLoadConfig();
}); //
if (!threadGroups || threadGroups.length === 0) {
this.result = this.$get('/performance/get-jmx-content/' + this.report.testId)
.then((response) => {
response.data.data.forEach(d => {
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
threadGroups.forEach(tg => {
tg.options = {};
});
this.threadGroups = threadGroups;
this.getLoadConfig();
});
})
.catch(() => {
});
}
}).catch(() => {
});
}, },
calculateTotalChart() { calculateTotalChart() {
let handler = this; let handler = this;