refactor(性能测试): 性能测试重构, 资源池 backendListener 默认为 true

This commit is contained in:
Captain.B 2021-08-04 10:19:09 +08:00 committed by 刘瑞斌
parent b84501ab65
commit 2cd6c1085a
1 changed files with 42 additions and 42 deletions

View File

@ -53,13 +53,13 @@
</el-card> </el-card>
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
:title="form.id ? $t('test_resource_pool.update_resource_pool') : $t('test_resource_pool.create_resource_pool')" :title="form.id ? $t('test_resource_pool.update_resource_pool') : $t('test_resource_pool.create_resource_pool')"
:visible.sync="dialogVisible" width="80%" :visible.sync="dialogVisible" width="80%"
top="5%" top="5%"
@closed="closeFunc" @closed="closeFunc"
:destroy-on-close="true" :destroy-on-close="true"
v-loading="result.loading" v-loading="result.loading"
> >
<div style="height: 60vh;overflow: auto;"> <div style="height: 60vh;overflow: auto;">
<el-form :model="form" label-position="right" label-width="140px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="140px" size="small" :rules="rule"
@ -164,33 +164,33 @@
</el-row> </el-row>
<el-table :data="infoList" class="tb-edit" align="center" border highlight-current-row> <el-table :data="infoList" class="tb-edit" align="center" border highlight-current-row>
<el-table-column <el-table-column
align="center" align="center"
prop="ip" prop="ip"
label="IP"> label="IP">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-input size="small" v-model="row.ip" autocomplete="off"/> <el-input size="small" v-model="row.ip" autocomplete="off"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="port" prop="port"
label="Port"> label="Port">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-input-number size="small" v-model="row.port" :min="1" :max="65535"></el-input-number> <el-input-number size="small" v-model="row.port" :min="1" :max="65535"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="monitorPort" prop="monitorPort"
label="Monitor"> label="Monitor">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-input-number size="small" v-model="row.monitorPort" :min="1" :max="65535"></el-input-number> <el-input-number size="small" v-model="row.monitorPort" :min="1" :max="65535"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="maxConcurrency" prop="maxConcurrency"
:label="$t('test_resource_pool.max_threads')"> :label="$t('test_resource_pool.max_threads')">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-input-number size="small" v-model="row.maxConcurrency" :min="1" <el-input-number size="small" v-model="row.maxConcurrency" :min="1"
:max="1000000000"></el-input-number> :max="1000000000"></el-input-number>
@ -212,13 +212,13 @@
</div> </div>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
v-if="form.id" v-if="form.id"
@cancel="dialogVisible = false" @cancel="dialogVisible = false"
@confirm="updateTestResourcePool()"/> @confirm="updateTestResourcePool()"/>
<ms-dialog-footer <ms-dialog-footer
v-else v-else
@cancel="dialogVisible = false" @cancel="dialogVisible = false"
@confirm="createTestResourcePool()"/> @confirm="createTestResourcePool()"/>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
@ -246,7 +246,7 @@ export default {
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
form: {performance: true, api: true}, form: {performance: true, api: true, backendListener: true},
screenHeight: 'calc(100vh - 195px)', screenHeight: 'calc(100vh - 195px)',
requiredRules: [{required: true, message: this.$t('test_resource_pool.fill_the_data'), trigger: 'blur'}], requiredRules: [{required: true, message: this.$t('test_resource_pool.fill_the_data'), trigger: 'blur'}],
rule: { rule: {
@ -396,11 +396,11 @@ export default {
this.convertSubmitResources(); this.convertSubmitResources();
this.result = this.$post("/testresourcepool/add", this.form, () => { this.result = this.$post("/testresourcepool/add", this.form, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: this.$t('commons.save_success') message: this.$t('commons.save_success')
}, },
this.dialogVisible = false, this.dialogVisible = false,
this.initTableData()); this.initTableData());
}); });
} else { } else {
this.$warning(vri.msg); this.$warning(vri.msg);
@ -433,12 +433,12 @@ export default {
this.convertSubmitResources(); this.convertSubmitResources();
this.result = this.$post("/testresourcepool/update", this.form, () => { this.result = this.$post("/testresourcepool/update", this.form, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: this.$t('commons.modify_success') message: this.$t('commons.modify_success')
}, },
this.dialogVisible = false, this.dialogVisible = false,
this.initTableData(), this.initTableData(),
self.loading = false); self.loading = false);
}); });
} else { } else {
this.$warning(vri.msg); this.$warning(vri.msg);
@ -450,7 +450,7 @@ export default {
}); });
}, },
closeFunc() { closeFunc() {
this.form = {performance: true, api: true}; this.form = {performance: true, api: true, backendListener: true};
this.dialogVisible = false; this.dialogVisible = false;
removeGoBackListener(this.closeFunc); removeGoBackListener(this.closeFunc);
}, },
@ -492,10 +492,10 @@ export default {
}, },
updatePoolStatus(row) { updatePoolStatus(row) {
this.$get('/testresourcepool/update/' + row.id + '/' + row.status) this.$get('/testresourcepool/update/' + row.id + '/' + row.status)
.then(() => { .then(() => {
this.$success(this.$t('test_resource_pool.status_change_success')); this.$success(this.$t('test_resource_pool.status_change_success'));
this.result.loading = false; this.result.loading = false;
}).catch(() => { }).catch(() => {
this.$error(this.$t('test_resource_pool.status_change_failed')); this.$error(this.$t('test_resource_pool.status_change_failed'));
row.status = 'INVALID'; row.status = 'INVALID';
this.result.loading = false; this.result.loading = false;