Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-11-25 10:13:28 +08:00
commit fe7b1abdac
19 changed files with 105 additions and 69 deletions

View File

@ -95,8 +95,7 @@ public interface ParamConstants {
PASSWORD("smtp.password", 4), PASSWORD("smtp.password", 4),
SSL("smtp.ssl", 5), SSL("smtp.ssl", 5),
TLS("smtp.tls", 6), TLS("smtp.tls", 6),
SMTP("smtp.smtp", 7); ANON("smtp.anon", 7);
/* ANON("smtp.anon", 7);*/
private String key; private String key;
private Integer value; private Integer value;

View File

@ -48,10 +48,6 @@ public class JsonPathUtils {
String o_json_path = "$" + jsonPath.next().replaceAll("/", "."); String o_json_path = "$" + jsonPath.next().replaceAll("/", ".");
String value = JSONPath.eval(jsonObject, o_json_path).toString(); String value = JSONPath.eval(jsonObject, o_json_path).toString();
if(o_json_path.toLowerCase().contains("id")) {
continue;
}
if(value.equals("") || value.equals("[]") || o_json_path.equals("")) { if(value.equals("") || value.equals("[]") || o_json_path.equals("")) {
continue; continue;
} }

View File

@ -19,6 +19,7 @@ import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.mail.MailException; import org.springframework.mail.MailException;
@ -369,10 +370,13 @@ public class MailService {
private JavaMailSenderImpl getMailSender() { private JavaMailSenderImpl getMailSender() {
Properties props = new Properties();
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
List<SystemParameter> paramList = systemParameterService.getParamList(ParamConstants.Classify.MAIL.getValue()); List<SystemParameter> paramList = systemParameterService.getParamList(ParamConstants.Classify.MAIL.getValue());
javaMailSender.setDefaultEncoding("UTF-8"); javaMailSender.setDefaultEncoding("UTF-8");
javaMailSender.setProtocol("smtps"); javaMailSender.setProtocol("smtp");
props.put("mail.smtp.auth", "true");
for (SystemParameter p : paramList) { for (SystemParameter p : paramList) {
switch (p.getParamKey()) { switch (p.getParamKey()) {
case "smtp.host": case "smtp.host":
@ -387,14 +391,30 @@ public class MailService {
case "smtp.password": case "smtp.password":
javaMailSender.setPassword(EncryptUtils.aesDecrypt(p.getParamValue()).toString()); javaMailSender.setPassword(EncryptUtils.aesDecrypt(p.getParamValue()).toString());
break; break;
case "smtp.ssl":
javaMailSender.setProtocol("smtps");
if (BooleanUtils.toBoolean(p.getParamValue())) {
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
}
break;
case "smtp.tls":
String result = BooleanUtils.toString(BooleanUtils.toBoolean(p.getParamValue()), "true", "false");
props.put("mail.smtp.starttls.enable", result);
props.put("mail.smtp.starttls.required", result);
break;
case "smtp.anon":
boolean isAnon = BooleanUtils.toBoolean(p.getParamValue());
if (isAnon) {
props.put("mail.smtp.auth", "false");
javaMailSender.setUsername(null);
javaMailSender.setPassword(null);
}
break;
default: default:
break; break;
} }
} }
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.required", "true");
props.put("mail.smtp.timeout", "30000"); props.put("mail.smtp.timeout", "30000");
props.put("mail.smtp.connectiontimeout", "5000"); props.put("mail.smtp.connectiontimeout", "5000");
javaMailSender.setJavaMailProperties(props); javaMailSender.setJavaMailProperties(props);

View File

@ -87,7 +87,14 @@ public class SystemParameterService {
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey())); javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey()));
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey())); javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey()));
Properties props = new Properties(); Properties props = new Properties();
props.put("mail.smtp.auth", "true"); boolean isAnon = Boolean.parseBoolean(hashMap.get(ParamConstants.MAIL.ANON.getKey()));
if (isAnon) {
props.put("mail.smtp.auth", "false");
javaMailSender.setUsername(null);
javaMailSender.setPassword(null);
} else {
props.put("mail.smtp.auth", "true");
}
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) { if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) {
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
} }

View File

@ -1,26 +0,0 @@
package io.metersphere.track.issue;
import io.metersphere.commons.utils.EncryptUtils;
public class ZentaoUtils {
/**
* @param code Zentao 应用代号
* @param key Zentao 密钥
* @return token
*/
public static String getToken(String code, String key, String time) {
return (String) EncryptUtils.md5Encrypt(code + key + time);
}
/**
* @param url Zentao url
* @param code Zentao 应用代号
* @param key Zentao 密钥
* @return url
*/
public static String getUrl(String url, String code, String key) {
String time = String.valueOf(System.currentTimeMillis());;
return url + "api.php?" + "code=" + code + "&time=" + time + "&token=" + getToken(code, key, time);
}
}

View File

@ -96,7 +96,7 @@ public class TestPlanService {
@Resource @Resource
UserMapper userMapper; UserMapper userMapper;
public void addTestPlan(AddTestPlanRequest testPlan) { public synchronized void addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) { if (getTestPlanByName(testPlan.getName()).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists")); MSException.throwException(Translator.get("plan_name_already_exists"));
} }
@ -141,7 +141,7 @@ public class TestPlanService {
} }
} }
public synchronized List<TestPlan> getTestPlanByName(String name) { public List<TestPlan> getTestPlanByName(String name) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId()) example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andNameEqualTo(name); .andNameEqualTo(name);

@ -1 +1 @@
Subproject commit 419c75bca64b7c5bfbd1194d7f0fd9919f0caa04 Subproject commit 57d6f78efa4b0300be188e8b024511ceef0873ed

View File

@ -20,7 +20,7 @@
:description="$t('api_test.request.parameters_desc')" :description="$t('api_test.request.parameters_desc')"
v-if="body.isKV()"/> v-if="body.isKV()"/>
<div class="body-raw" v-if="body.type == 'Raw'"> <div class="body-raw" v-if="body.type == 'Raw'">
<ms-code-edit :mode="body.format" :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" ref="codeEdit"/> <ms-code-edit :mode="body.format" :enable-format="false" :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" ref="codeEdit"/>
</div> </div>
</div> </div>

View File

@ -29,7 +29,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('api_test.request.sql.pool_max')" prop="poolMax"> <el-form-item :label="$t('api_test.request.sql.pool_max')" prop="poolMax">
<el-input-number size="small" :disabled="isReadOnly" v-model="currentConfig.poolMax" :placeholder="$t('commons.please_select')" :max="1000*10000000" :min="0"/> <el-input-number size="small" :disabled="isReadOnly" v-model="currentConfig.poolMax" :placeholder="$t('commons.please_select')" :max="100" :min="0"/>
</el-form-item> </el-form-item>

View File

@ -609,8 +609,8 @@ export class DatabaseConfig extends BaseConfig {
super(); super();
this.id = undefined; this.id = undefined;
this.name = undefined; this.name = undefined;
this.poolMax = undefined; this.poolMax = 1;
this.timeout = undefined; this.timeout = 100000;
this.driver = undefined; this.driver = undefined;
this.dbUrl = undefined; this.dbUrl = undefined;
this.username = undefined; this.username = undefined;

View File

@ -28,6 +28,12 @@
init: { init: {
type: Function type: Function
}, },
enableFormat: {
type: Boolean,
default() {
return true;
}
},
readOnly: { readOnly: {
type: Boolean, type: Boolean,
default() { default() {
@ -74,20 +80,24 @@
} }
}, },
format() { format() {
switch (this.mode) { if (this.enableFormat) {
case 'json': switch (this.mode) {
this.formatData = formatJson(this.data); case 'json':
break; this.formatData = formatJson(this.data);
case 'html': break;
this.formatData = toDiffableHtml(this.data); case 'html':
break; this.formatData = toDiffableHtml(this.data);
case 'xml': break;
this.formatData = formatXml(this.data); case 'xml':
break; this.formatData = formatXml(this.data);
default: break;
if (this.data) { default:
this.formatData = this.data; if (this.data) {
} this.formatData = this.data;
}
}
} else {
this.formatData = this.data;
} }
} }
} }

View File

@ -11,6 +11,11 @@
<br/> <br/>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="tip" v-if="withTip">
<span>
<slot class="tip"></slot>
</span>
</el-row>
<el-row> <el-row>
<el-col :span="15"> <el-col :span="15">
<el-input v-model="value" :placeholder="$t('commons.input_content')"/> <el-input v-model="value" :placeholder="$t('commons.input_content')"/>
@ -41,6 +46,12 @@
default() { default() {
return this.$t('commons.title') return this.$t('commons.title')
} }
},
withTip: {
type: Boolean,
default() {
return false
}
} }
}, },
methods: { methods: {
@ -80,5 +91,9 @@
font-weight: bold; font-weight: bold;
} }
.tip {
margin-bottom: 20px;
color: red;
}
</style> </style>

View File

@ -45,7 +45,7 @@
<el-checkbox v-model="formInline.TLS" :label="$t('system_parameter_setting.TLS')"></el-checkbox> <el-checkbox v-model="formInline.TLS" :label="$t('system_parameter_setting.TLS')"></el-checkbox>
</div> </div>
<div style="border: 0px;margin-bottom: 20px"> <div style="border: 0px;margin-bottom: 20px">
<el-checkbox v-model="formInline.SMTP" :label="$t('system_parameter_setting.SMTP')"></el-checkbox> <el-checkbox v-model="formInline.ANON" :label="$t('system_parameter_setting.SMTP')"></el-checkbox>
</div> </div>
<template v-slot:footer> <template v-slot:footer>
</template> </template>
@ -120,7 +120,7 @@ export default {
this.$set(this.formInline, "password", response.data[3].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, "SSL", JSON.parse(response.data[4].paramValue));
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue)); this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue)); this.$set(this.formInline, "ANON", JSON.parse(response.data[6].paramValue));
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.formInline.clearValidate(); this.$refs.formInline.clearValidate();
}) })
@ -143,7 +143,7 @@ export default {
"smtp.password": this.formInline.password, "smtp.password": this.formInline.password,
"smtp.ssl": this.formInline.SSL, "smtp.ssl": this.formInline.SSL,
"smtp.tls": this.formInline.TLS, "smtp.tls": this.formInline.TLS,
"smtp.smtp": this.formInline.SMTP, "smtp.anon": this.formInline.ANON,
}; };
this.$refs[formInline].validate((valid) => { this.$refs[formInline].validate((valid) => {
if (valid) { if (valid) {
@ -173,7 +173,7 @@ export default {
{paramKey: "smtp.password", paramValue: this.formInline.password, type: "password", sort: 4}, {paramKey: "smtp.password", paramValue: this.formInline.password, type: "password", sort: 4},
{paramKey: "smtp.ssl", paramValue: this.formInline.SSL, type: "text", sort: 5}, {paramKey: "smtp.ssl", paramValue: this.formInline.SSL, type: "text", sort: 5},
{paramKey: "smtp.tls", paramValue: this.formInline.TLS, type: "text", sort: 6}, {paramKey: "smtp.tls", paramValue: this.formInline.TLS, type: "text", sort: 6},
{paramKey: "smtp.smtp", paramValue: this.formInline.SMTP, type: "text", sort: 7} {paramKey: "smtp.anon", paramValue: this.formInline.ANON, type: "text", sort: 7}
] ]
this.$refs[formInline].validate(valid => { this.$refs[formInline].validate(valid => {

View File

@ -137,7 +137,9 @@
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/> <test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/> <test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"/> <ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
{{$t('test_track.plan.plan_delete_tip')}}
</ms-delete-confirm>
</el-card> </el-card>
</template> </template>
@ -171,6 +173,7 @@ export default {
data() { data() {
return { return {
result: {}, result: {},
enableDeleteTip: false,
queryPath: "/test/plan/list", queryPath: "/test/plan/list",
deletePath: "/test/plan/delete", deletePath: "/test/plan/delete",
condition: { condition: {
@ -249,6 +252,7 @@ export default {
}); });
}, },
handleDelete(testPlan) { handleDelete(testPlan) {
this.enableDeleteTip = testPlan.status === 'Underway' ? true : false;
this.$refs.deleteConfirm.open(testPlan); this.$refs.deleteConfirm.open(testPlan);
}, },
_handleDelete(testPlan) { _handleDelete(testPlan) {

@ -1 +1 @@
Subproject commit 33bbdb3f528c914bf333b2c1839dd6d3bbd9b569 Subproject commit 71d57ae5d7f8bb5c93a29504ac6f2300dc189ce9

View File

@ -108,3 +108,11 @@ body {
margin: 5px 0; margin: 5px 0;
border-radius: 5px; border-radius: 5px;
} }
/* 修复带长度限制的文本框,内容太长造成的无法查看内容的问题 */
/*.el-input-padding-fix .el-input__inner {*/
/*padding-right: 60px ;*/
/*}*/
.el-input__inner[maxlength] {
padding-right: 60px ;
}

View File

@ -837,6 +837,7 @@ export default {
actual_start_time: "Actual Start Time", actual_start_time: "Actual Start Time",
actual_end_time: "Actual End Time", actual_end_time: "Actual End Time",
plan_delete_confirm: "All use cases under this plan will be deleted,confirm delete test plan: ", plan_delete_confirm: "All use cases under this plan will be deleted,confirm delete test plan: ",
plan_delete_tip: "The test plan is under way, please confirm and delete it!",
plan_delete: "Delete test plan", plan_delete: "Delete test plan",
}, },
review: { review: {

View File

@ -470,7 +470,7 @@ export default {
title: "jar包管理", title: "jar包管理",
jar_file: "jar包", jar_file: "jar包",
delete_tip: "删除需重启服务后生效", delete_tip: "删除需重启服务后生效",
file_exist: "该项目下已存在jar包", file_exist: "该项目下已存在jar包",
upload_limit_size: "上传文件大小不能超过 30MB!", upload_limit_size: "上传文件大小不能超过 30MB!",
}, },
environment: { environment: {
@ -839,6 +839,7 @@ export default {
actual_start_time: "实际开始", actual_start_time: "实际开始",
actual_end_time: "实际结束", actual_end_time: "实际结束",
plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ", plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ",
plan_delete_tip: "该测试计划正在进行中,请确认再删除!",
plan_delete: "删除计划", plan_delete: "删除计划",
}, },
review: { review: {
@ -1006,7 +1007,7 @@ export default {
SMTP_password: 'SMTP密码', SMTP_password: 'SMTP密码',
SSL: '开启SSL(如果SMTP端口是465通常需要启用SSL)', SSL: '开启SSL(如果SMTP端口是465通常需要启用SSL)',
TLS: '开启TLS(如果SMTP端口是587通常需要启用TLS)', TLS: '开启TLS(如果SMTP端口是587通常需要启用TLS)',
SMTP: '是否匿名 SMTP', SMTP: '是否免密 SMTP',
host: '主机号不能为空', host: '主机号不能为空',
port: '端口号不能为空', port: '端口号不能为空',
account: '账户不能为空', account: '账户不能为空',

View File

@ -472,7 +472,7 @@ export default {
title: "jar包管理", title: "jar包管理",
jar_file: "jar包", jar_file: "jar包",
delete_tip: "刪除需重啟服務後生效", delete_tip: "刪除需重啟服務後生效",
file_exist: "該項目下已存在jar包", file_exist: "該項目下已存在jar包",
upload_limit_size: "上傳文件大小不能超過 30MB!", upload_limit_size: "上傳文件大小不能超過 30MB!",
}, },
environment: { environment: {
@ -840,6 +840,7 @@ export default {
actual_start_time: "實際開始", actual_start_time: "實際開始",
actual_end_time: "實際結束", actual_end_time: "實際結束",
plan_delete_confirm: "將刪除該測試計劃下所有用例,確認刪除測試計劃: ", plan_delete_confirm: "將刪除該測試計劃下所有用例,確認刪除測試計劃: ",
plan_delete_tip: "該測試計劃正在進行中,請確認再刪除!",
plan_delete: "刪除計劃", plan_delete: "刪除計劃",
}, },
review: { review: {
@ -1007,7 +1008,7 @@ export default {
SMTP_password: 'SMTP密碼', SMTP_password: 'SMTP密碼',
SSL: '開啟SSL(如果SMTP端口是465通常需要啟用SSL)', SSL: '開啟SSL(如果SMTP端口是465通常需要啟用SSL)',
TLS: '開啟TLS(如果SMTP端口是587通常需要啟用TLS)', TLS: '開啟TLS(如果SMTP端口是587通常需要啟用TLS)',
SMTP: '是否匿名 SMTP', SMTP: '是否免密 SMTP',
host: '主機號不能為空', host: '主機號不能為空',
port: '端口號不能為空', port: '端口號不能為空',
account: '賬戶不能為空', account: '賬戶不能為空',