Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-05-09 15:33:00 +08:00
commit c1035e00ae
1 changed files with 145 additions and 176 deletions

View File

@ -3,12 +3,13 @@
<el-row type="flex" justify="start"> <el-row type="flex" justify="start">
<el-col :span="8"> <el-col :span="8">
<h3>{{$t('load_test.domain_bind')}}</h3> <h3>{{$t('load_test.domain_bind')}}</h3>
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('domains')">{{$t('commons.add')}}</el-button> <el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('domains')">{{$t('commons.add')}}
</el-button>
</el-col> </el-col>
</el-row> </el-row>
<!-- --> <!-- -->
<el-row> <el-row>
<el-col :span="20"> <el-col :span="24">
<el-table :data="domains" size="mini" class="tb-edit" align="center" border highlight-current-row> <el-table :data="domains" size="mini" class="tb-edit" align="center" border highlight-current-row>
<el-table-column <el-table-column
align="center" align="center"
@ -25,7 +26,7 @@
:placeholder="$t('load_test.domain')" :placeholder="$t('load_test.domain')"
clearable> clearable>
</el-input> </el-input>
<span >{{row.domain}}</span> <span>{{row.domain}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -63,12 +64,6 @@
</el-table-column> </el-table-column>
<el-table-column align="center" :label="$t('load_test.operating')"> <el-table-column align="center" :label="$t('load_test.operating')">
<template v-slot:default="{row, $index}"> <template v-slot:default="{row, $index}">
<el-button
type="primary"
icon="el-icon-plus"
circle size="mini"
@click="add('domains')">
</el-button>
<el-button <el-button
type="danger" type="danger"
size="mini" size="mini"
@ -85,12 +80,13 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<h3>{{$t('load_test.params')}}</h3> <h3>{{$t('load_test.params')}}</h3>
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('params')">{{$t('commons.add')}}</el-button> <el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="add('params')">{{$t('commons.add')}}
</el-button>
</el-col> </el-col>
</el-row> </el-row>
<!-- --> <!-- -->
<el-row> <el-row>
<el-col :span="20"> <el-col :span="24">
<el-table :data="params" size="mini" class="tb-edit" align="center" border highlight-current-row> <el-table :data="params" size="mini" class="tb-edit" align="center" border highlight-current-row>
<el-table-column <el-table-column
align="center" align="center"
@ -107,7 +103,7 @@
:placeholder="$t('load_test.param_name')" :placeholder="$t('load_test.param_name')"
clearable> clearable>
</el-input> </el-input>
<span >{{row.name}}</span> <span>{{row.name}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -146,13 +142,6 @@
</el-table-column> </el-table-column>
<el-table-column align="center" :label="$t('load_test.operating')"> <el-table-column align="center" :label="$t('load_test.operating')">
<template v-slot:default="{row, $index}"> <template v-slot:default="{row, $index}">
<el-button
type="primary"
size="mini"
icon="el-icon-plus"
circle
@click="add(row)">
</el-button>
<el-button <el-button
type="danger" type="danger"
size="mini" size="mini"
@ -233,21 +222,6 @@
} }
}, },
methods: { methods: {
revertObject(row) {
Object.keys(row).forEach(function (key) {
row[key] = row[key + 'Origin'];
});
},
saveOriginObject(row) {
Object.keys(row).forEach(function (key) {
row[key + 'Origin'] = row[key];
});
},
delOriginObject(row) {
Object.keys(row).forEach(function (key) {
delete row[key + 'Origin'];
});
},
getAdvancedConfig(testId) { getAdvancedConfig(testId) {
this.$get('/performance/get-advanced-config/' + testId, (response) => { this.$get('/performance/get-advanced-config/' + testId, (response) => {
if (response.data) { if (response.data) {
@ -257,7 +231,6 @@
this.statusCodeStr = this.statusCode.join(','); this.statusCodeStr = this.statusCode.join(',');
this.domains = data.domains || []; this.domains = data.domains || [];
this.params = data.params || []; this.params = data.params || [];
this.add('domains');
/*this.domains.forEach(d => d.edit = false); /*this.domains.forEach(d => d.edit = false);
this.params.forEach(d => d.edit = false);*/ this.params.forEach(d => d.edit = false);*/
} }
@ -267,7 +240,7 @@
if (dataName === 'domains') { if (dataName === 'domains') {
this[dataName].push({ this[dataName].push({
domain: 'fit2cloud.com', domain: 'fit2cloud.com',
enable: false, enable: true,
ip: '127.0.0.1', ip: '127.0.0.1',
edit: true, edit: true,
}); });
@ -282,21 +255,14 @@
} }
}, },
edit(row) { edit(row) {
this.saveOriginObject(row);
row.edit = !row.edit row.edit = !row.edit
}, },
del(row, dataName, index) { del(row, dataName, index) {
this[dataName].splice(index, 1); this[dataName].splice(index, 1);
}, },
cancelEdit(row) {
row.edit = false;
// rollback changes
this.revertObject(row);
},
confirmEdit(row) { confirmEdit(row) {
row.edit = false; row.edit = false;
row.enable=true, row.enable = true;
this.saveOriginObject(row);
}, },
groupBy(data, key) { groupBy(data, key) {
return data.reduce((p, c) => { return data.reduce((p, c) => {
@ -343,8 +309,6 @@
this.params.forEach(d => d.edit = false); this.params.forEach(d => d.edit = false);
}, },
configurations() { configurations() {
this.domains.forEach(d => this.delOriginObject(d));
this.params.forEach(d => this.delOriginObject(d));
let statusCode = []; let statusCode = [];
if (this.statusCodeStr) { if (this.statusCodeStr) {
statusCode = this.statusCodeStr.split(','); statusCode = this.statusCodeStr.split(',');
@ -368,20 +332,25 @@
.edit-input { .edit-input {
padding-right: 0px; padding-right: 0px;
} }
.tb-edit .el-textarea { .tb-edit .el-textarea {
display: none; display: none;
} }
.tb-edit .current-row .el-textarea { .tb-edit .current-row .el-textarea {
display: block; display: block;
} }
.tb-edit .current-row .el-textarea+span {
.tb-edit .current-row .el-textarea + span {
display: none; display: none;
} }
.el-col{
.el-col {
text-align: left; text-align: left;
} }
.el-col .el-table{
align:center; .el-col .el-table {
align: center;
} }
</style> </style>