This commit is contained in:
chenjianxing 2020-07-09 14:13:03 +08:00
commit beba2650eb
8 changed files with 77 additions and 18 deletions

View File

@ -8,6 +8,7 @@ import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ApiTestMapper;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.ext.ExtApiTestMapper;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.exception.MSException;
@ -46,6 +47,8 @@ public class APITestService {
private JMeterService jMeterService;
@Resource
private APIReportService apiReportService;
@Resource
private TestCaseMapper testCaseMapper;
public List<APITestResult> list(QueryAPITestRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -110,6 +113,20 @@ public class APITestService {
}
public void delete(String testId) {
// 是否关联测试用例
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andTestIdEqualTo(testId);
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
if (testCases.size() > 0) {
String caseName = "";
for (int i = 0; i < testCases.size(); i++) {
caseName = caseName + testCases.get(i).getName() + ",";
}
caseName = caseName.substring(0, caseName.length() - 1);
MSException.throwException(Translator.get("related_case_del_fail_prefix") + caseName + Translator.get("related_case_del_fail_suffix"));
}
deleteFileByTestId(testId);
apiReportService.deleteByTestId(testId);
apiTestMapper.deleteByPrimaryKey(testId);

View File

@ -40,17 +40,24 @@ public class SystemParameterService {
public void editMail(List<SystemParameter> parameters) {
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
boolean empty = paramList.size() < 2;
boolean empty = paramList.size() <= 0;
parameters.forEach(parameter -> {
SystemParameterExample example = new SystemParameterExample();
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
parameter.setParamValue(string);
if (!StringUtils.isBlank(parameter.getParamValue())) {
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
parameter.setParamValue(string);
}
}
if (empty) {
systemParameterMapper.insert(parameter);
} else {
example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
if (systemParameterMapper.countByExample(example) > 0) {
systemParameterMapper.updateByPrimaryKey(parameter);
} else {
systemParameterMapper.insert(parameter);
}
example.clear();
});
}
@ -68,6 +75,8 @@ public class SystemParameterService {
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey()));
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey()));
Properties props = new Properties();
props.put("mail.smtp.timeout", "5000");
props.put("mail.smtp.connectiontimeout", "5000");
props.put("mail.smtp.auth", "true");
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) {
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
@ -105,8 +114,11 @@ public class SystemParameterService {
}
} else {
paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> {
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
param.setParamValue(string);
if (!StringUtils.isBlank(param.getParamValue())) {
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
param.setParamValue(string);
}
});
}
paramList.sort(Comparator.comparingInt(SystemParameter::getSort));

View File

@ -131,12 +131,15 @@
let transactions = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.transactions);
}, 0);
transactions = transactions.toFixed(2);
let received = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.received);
}, 0);
received = received.toFixed(2);
let sent = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.sent);
}, 0);
sent = sent.toFixed(2);
let error = (Math.round(failSize / allSamples * 10000) / 100) + '%';
let averageTime = (averageTimeTotal / allSamples).toFixed(2);

View File

@ -39,7 +39,7 @@
</el-card>
</ms-main-container>
<el-dialog :title="title" :visible.sync="createVisible">
<el-dialog :title="title" :visible.sync="createVisible" destroy-on-close>
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>

View File

@ -57,7 +57,7 @@
</el-dialog>
<!--Change personal password-->
<el-dialog :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="35%" left>
<el-dialog :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="35%" :before-close='closeDialog' left >
<el-form :model="ruleForm" :rules="rules" ref="editPasswordForm" label-width="120px" class="demo-ruleForm">
<el-form-item :label="$t('member.old_password')" prop="password" style="margin-bottom: 29px">
<el-input v-model="ruleForm.password" autocomplete="off" show-password/>
@ -68,7 +68,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<ms-dialog-footer
@cancel="editPasswordVisible = false"
@cancel="cancel()"
@confirm="updatePassword('editPasswordForm')"/>
</span>
</el-dialog>
@ -156,6 +156,16 @@
editPassword(row) {
this.editPasswordVisible = true;
},
cancel(){
this.editPasswordVisible = false;
this.ruleForm.password="";
this.ruleForm.newpassword="";
},
closeDialog(){
this.editPasswordVisible = false;
this.ruleForm.password="";
this.ruleForm.newpassword="";
},
updateUser(updateUserForm) {
this.$refs[updateUserForm].validate(valid => {
if (valid) {

View File

@ -95,7 +95,7 @@
host: [
{
required: true,
message: ''
message: ' '
},
],
port: [
@ -115,6 +115,7 @@
activated() {
this.query()
this.change()
},
methods: {
changeType() {
@ -126,9 +127,15 @@
this.$set(this.formInline, "port", response.data[1].paramValue);
this.$set(this.formInline, "account", response.data[2].paramValue);
this.$set(this.formInline, "password", response.data[3].paramValue);
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
if(response.data[4].paramValue!=""){
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
}
if(response.data[5].paramValue!=""){
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
}
if(response.data[6].paramValue!=""){
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
}
})
},
change() {
@ -161,6 +168,7 @@
})
},
edit() {
this.change()
this.showEdit = false;
this.showSave = true;
this.showCancel = true;
@ -197,11 +205,13 @@
})
},
cancel() {
this.query();
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
this.query();
this.change()
}
}

View File

@ -9,7 +9,7 @@
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="name" :label="$t('commons.username')" width="200"/>
<el-table-column prop="name" :label="$t('commons.name')" width="200"/>
<el-table-column :label="$t('commons.role')" width="120">
<template v-slot:default="scope">
<ms-roles-tag :roles="scope.row.roles"/>
@ -162,7 +162,7 @@
</el-dialog>
<!--Modify user information in system settings-->
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true"
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true"
@close="handleClose">
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id">

View File

@ -355,6 +355,13 @@
this.$success(this.$t('commons.save_success'));
if (this.operationType == 'add' && this.isCreateContinue) {
this.form.name = '';
this.form.prerequisite = '';
this.form.steps = [{
num: 1,
desc: '',
result: ''
}];
this.form.remark = '';
this.$emit("refresh");
return;
}