merge v1.0
This commit is contained in:
commit
23c8f9a8ea
|
@ -12,6 +12,7 @@ import io.metersphere.api.parse.MsParser;
|
|||
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.constants.FileType;
|
||||
|
@ -57,6 +58,8 @@ public class APITestService {
|
|||
private APIReportService apiReportService;
|
||||
@Resource
|
||||
private ScheduleService scheduleService;
|
||||
@Resource
|
||||
private TestCaseMapper testCaseMapper;
|
||||
|
||||
public List<APITestResult> list(QueryAPITestRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
@ -129,6 +132,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);
|
||||
|
|
|
@ -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())) {
|
||||
if (!StringUtils.isBlank(parameter.getParamValue())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
}
|
||||
if (empty) {
|
||||
systemParameterMapper.insert(parameter);
|
||||
} else {
|
||||
systemParameterMapper.updateByPrimaryKey(parameter);
|
||||
}
|
||||
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 -> {
|
||||
if (!StringUtils.isBlank(param.getParamValue())) {
|
||||
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
param.setParamValue(string);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
paramList.sort(Comparator.comparingInt(SystemParameter::getSort));
|
||||
|
|
|
@ -405,7 +405,13 @@ class JMXRequest {
|
|||
this.port = url.port;
|
||||
this.protocol = url.protocol.split(":")[0];
|
||||
if (this.method.toUpperCase() !== "GET") {
|
||||
this.pathname += url.search.replace('&', '&');
|
||||
// this.pathname += url.search.replace('&', '&');
|
||||
this.pathname += '?';
|
||||
request.parameters.forEach(parameter => {
|
||||
if (parameter.name) {
|
||||
this.pathname += (parameter.name + '=' + parameter.value + '&');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -44,7 +44,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>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -21,7 +21,144 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'email'
|
||||
formInline: {
|
||||
/*host: 'smtp.163.com',
|
||||
port: '465',
|
||||
account: 'xjj0608@163.com',
|
||||
password: '2345678',*/
|
||||
},
|
||||
|
||||
input: '',
|
||||
visible: true,
|
||||
result: {},
|
||||
showEdit: true,
|
||||
showSave: false,
|
||||
showCancel: false,
|
||||
show: true,
|
||||
disabledConnection: false,
|
||||
disabledSave: false,
|
||||
loading: false,
|
||||
activeName: 'email',
|
||||
rules: {
|
||||
host: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
},
|
||||
],
|
||||
port: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
}
|
||||
],
|
||||
account: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
this.query()
|
||||
this.change()
|
||||
},
|
||||
methods: {
|
||||
changeType() {
|
||||
this.$refs.input = 'password'
|
||||
},
|
||||
query() {
|
||||
this.result = this.$get("/system/mail/info", response => {
|
||||
this.$set(this.formInline, "host", response.data[0].paramValue);
|
||||
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);
|
||||
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() {
|
||||
if (!this.formInline.host || !this.formInline.port || !this.formInline.account) {
|
||||
this.disabledConnection = true;
|
||||
this.disabledSave = true;
|
||||
} else {
|
||||
this.disabledConnection = false;
|
||||
this.disabledSave = false;
|
||||
}
|
||||
},
|
||||
testConnection(formInline) {
|
||||
let param = {
|
||||
"smtp.server": this.formInline.host,
|
||||
"smtp.port": this.formInline.port,
|
||||
"smtp.account": this.formInline.account,
|
||||
"smtp.password": this.formInline.password,
|
||||
"smtp.ssl": this.formInline.SSL,
|
||||
"smtp.tls": this.formInline.TLS,
|
||||
"smtp.smtp": this.formInline.SMTP,
|
||||
};
|
||||
this.$refs[formInline].validate((valid) => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/system/testConnection", param, response => {
|
||||
this.$success(this.$t('commons.connection_successful'));
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
edit() {
|
||||
this.change()
|
||||
this.showEdit = false;
|
||||
this.showSave = true;
|
||||
this.showCancel = true;
|
||||
this.show = false;
|
||||
},
|
||||
save(formInline) {
|
||||
this.showEdit = true;
|
||||
this.showCancel = false;
|
||||
this.showSave = false;
|
||||
this.show = true;
|
||||
let param = [
|
||||
{paramKey: "smtp.host", paramValue: this.formInline.host, type: "text", sort: 1},
|
||||
{paramKey: "smtp.port", paramValue: this.formInline.port, type: "text", sort: 2},
|
||||
{paramKey: "smtp.account", paramValue: this.formInline.account, type: "text", sort: 3},
|
||||
{paramKey: "smtp.password", paramValue: this.formInline.password, type: "password", sort: 4},
|
||||
{paramKey: "smtp.ssl", paramValue: this.formInline.SSL, type: "text", sort: 5},
|
||||
{paramKey: "smtp.tls", paramValue: this.formInline.TLS, type: "text", sort: 6},
|
||||
{paramKey: "smtp.smtp", paramValue: this.formInline.SMTP, type: "text", sort: 7}
|
||||
]
|
||||
|
||||
this.$refs[formInline].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/system/edit/email", param, response => {
|
||||
let flag = response.success;
|
||||
if (flag) {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
} else {
|
||||
this.$message.error(this.$t('commons.save_failed'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.query();
|
||||
this.showEdit = true;
|
||||
this.showCancel = false;
|
||||
this.showSave = false;
|
||||
this.show = true;
|
||||
this.change()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue