Merge branch 'dev' of github.com:fit2cloudrd/metersphere-server into dev

This commit is contained in:
Captain.B 2020-05-09 13:23:37 +08:00
commit f3c04ce4eb
14 changed files with 89 additions and 28 deletions

View File

@ -118,10 +118,8 @@ public class UserController {
return userService.getUserList(); return userService.getUserList();
} }
@PostMapping("/update/currentuser") @PostMapping("/update/current")
public UserDTO updateCurrentUser(@RequestBody User user) { public UserDTO updateCurrentUser(@RequestBody User user) {
SessionUser sessionUser = SessionUtils.getUser();
BeanUtils.copyProperties(user, sessionUser);
userService.updateUser(user); userService.updateUser(user);
return SessionUtils.getUser(); return SessionUtils.getUser();
} }

View File

@ -7,7 +7,9 @@ import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.service.TestCaseService; import io.metersphere.service.TestCaseService;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -38,12 +40,19 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
public String validate(TestCaseExcelData data, String errMsg) { public String validate(TestCaseExcelData data, String errMsg) {
String nodePath = data.getNodePath(); String nodePath = data.getNodePath();
StringBuilder stringBuilder = new StringBuilder(errMsg); StringBuilder stringBuilder = new StringBuilder(errMsg);
if ( nodePath.split("/").length > TestCaseConstants.MAX_NODE_DEPTH + 1) { String[] nodes = nodePath.split("/");
if ( nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
stringBuilder.append("节点最多为" + TestCaseConstants.MAX_NODE_DEPTH + "层;"); stringBuilder.append("节点最多为" + TestCaseConstants.MAX_NODE_DEPTH + "层;");
} }
if ( nodePath.trim().contains(" ")) {
stringBuilder.append("所属模块不能包含空格"); for (int i = 0; i < nodes.length; i++) {
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
stringBuilder.append("所属模块不能为空格");
break;
}
} }
if (!userIds.contains(data.getMaintainer())) { if (!userIds.contains(data.getMaintainer())) {
stringBuilder.append("该工作空间下无该用户:" + data.getMaintainer() + ";"); stringBuilder.append("该工作空间下无该用户:" + data.getMaintainer() + ";");
} }

View File

@ -124,6 +124,9 @@ public class UserService {
} }
public void updateUser(User user) { public void updateUser(User user) {
UserDTO userDTO = getUserDTO(user.getId());
BeanUtils.copyProperties(user, userDTO);
SessionUtils.putUser(SessionUser.fromUser(userDTO));
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
} }

View File

@ -3,7 +3,7 @@
<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 type="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>
<!-- --> <!-- -->
@ -85,7 +85,7 @@
<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 type="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>
<!-- --> <!-- -->
@ -258,8 +258,8 @@
this.domains = data.domains || []; this.domains = data.domains || [];
this.params = data.params || []; this.params = data.params || [];
this.add('domains'); 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);*/
} }
}); });
}, },

View File

@ -43,6 +43,9 @@
<el-form-item :label="$t('commons.phone')" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.password')" prop="password">
<el-input v-model="form.password" autocomplete="off" show-password/>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@ -65,7 +68,7 @@
result: {}, result: {},
updateVisible: false, updateVisible: false,
tableData: [], tableData: [],
updatePath: '/user/update/currentuser', updatePath: '/user/update/current',
form: {}, form: {},
rule: { rule: {
name: [ name: [
@ -94,6 +97,15 @@
message: this.$t('member.email_format_is_incorrect'), message: this.$t('member.email_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
],
password: [
{required: true, message: this.$t('user.input_password'), trigger: 'blur'},
{
required:true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
] ]
} }
} }

View File

@ -55,6 +55,9 @@
<el-form-item :label="$t('commons.phone')" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.password')" prop="password">
<el-input v-model="form.password" autocomplete="off" show-password/>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@ -78,6 +81,10 @@
<el-form-item :label="$t('commons.phone')" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.password')" prop="password">
<el-input v-model="form.password" autocomplete="off" show-password/>
</el-form-item>
<!--<el-input placeholder="请输入密码" v-model="input" show-password></el-input>-->
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@ -101,6 +108,7 @@
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTableOperator, MsDialogFooter}, components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTableOperator, MsDialogFooter},
data() { data() {
return { return {
/*input:'',*/
queryPath: '/user/special/list', queryPath: '/user/special/list',
deletePath: '/user/special/delete/', deletePath: '/user/special/delete/',
createPath: '/user/special/add', createPath: '/user/special/add',
@ -147,6 +155,15 @@
message: this.$t('user.email_format_is_incorrect'), message: this.$t('user.email_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
],
password: [
{required: true, message: this.$t('user.input_password'), trigger: 'blur'},
{
required:true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
] ]
} }
} }

View File

@ -117,7 +117,7 @@
} }
} }
if (!hasCurrentProject) { if (!hasCurrentProject) {
this.currentProject = null; this.setCurrentProject(this.projects[0]);
} }
} else { } else {
if(this.projects.length > 0){ if(this.projects.length > 0){
@ -189,6 +189,7 @@
this.$get('/project/get/' + id, response => { this.$get('/project/get/' + id, response => {
let project = response.data; let project = response.data;
this.setCurrentProject(project); this.setCurrentProject(project);
this.$router.push('/track/case/all');
}); });
} }
if (id === 'all') { if (id === 'all') {

View File

@ -13,7 +13,7 @@
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input :disabled="readOnly" v-model.trim="form.name"></el-input> <el-input :disabled="readOnly" v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -313,6 +313,11 @@
if(localStorage.getItem(CURRENT_PROJECT)) { if(localStorage.getItem(CURRENT_PROJECT)) {
param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id; param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;
} }
param.name = param.name.trim();
if (param.name == '') {
this.$warning(this.$t('test_track.case.input_name'));
return;
}
this.$post('/test/case/' + this.operationType, param, () => { this.$post('/test/case/' + this.operationType, param, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false; this.dialogFormVisible = false;

View File

@ -5,7 +5,7 @@
:before-close="close" :before-close="close"
width="20%"> width="20%">
<el-select v-model.trim="module" <el-select v-model="module"
:placeholder="$t('test_track.case.move')" :placeholder="$t('test_track.case.move')"
filterable> filterable>
<el-option v-for="item in moduleOptions" :key="item.id" <el-option v-for="item in moduleOptions" :key="item.id"
@ -40,7 +40,7 @@
methods: { methods: {
save() { save() {
if (this.module === '') { if (this.module === '') {
this.$warning(this.$t('test_track.plan_view.select_execute_result')); this.$warning(this.$t('test_track.case.input_module'));
return; return;
} }
let param = {}; let param = {};
@ -50,11 +50,6 @@
param.nodePath = item.path; param.nodePath = item.path;
} }
}); });
if (this.module === '') {
this.$warning(this.$t('test_track.plan_view.select_executor'));
return;
}
param.ids = [...this.selectIds]; param.ids = [...this.selectIds];
this.$post('/test/case/batch/edit' , param, () => { this.$post('/test/case/batch/edit' , param, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));

View File

@ -12,7 +12,7 @@
:label="$t('test_track.module.name')" :label="$t('test_track.module.name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model.trim="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
@ -69,7 +69,10 @@
if (valid) { if (valid) {
let param = {}; let param = {};
let url = this.buildParam(param); let url = this.buildParam(param);
if (param.name.trim() == '') {
this.$warning(this.$t('test_track.case.input_name'));
return;
}
this.$post(url, param, () => { this.$post(url, param, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$emit('refresh'); this.$emit('refresh');
@ -95,7 +98,7 @@
param.id = this.node.id; param.id = this.node.id;
param.level = this.node.level; param.level = this.node.level;
} }
param.name = this.form.name; param.name = this.form.name.trim();
param.label = this.form.name; param.label = this.form.name;
if (localStorage.getItem(CURRENT_PROJECT)) { if (localStorage.getItem(CURRENT_PROJECT)) {
param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id; param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;

View File

@ -15,7 +15,7 @@
:label="$t('test_track.plan.plan_name')" :label="$t('test_track.plan.plan_name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model.trim="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -149,6 +149,11 @@
if (valid) { if (valid) {
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
param.name = param.name.trim();
if (param.name == '') {
this.$warning(this.$t('test_track.plan.input_plan_name'));
return;
}
param.workspaceId = localStorage.getItem(WORKSPACE_ID); param.workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/test/plan/' + this.operationType, param, () => { this.$post('/test/plan/' + this.operationType, param, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));

View File

@ -195,16 +195,14 @@
}, },
watch: { watch: {
planId() { planId() {
this.getTestPlanById(); this.refreshTableAndPlan();
this.initTableData();
}, },
selectNodeIds() { selectNodeIds() {
this.search(); this.search();
} }
}, },
mounted() { mounted() {
this.getTestPlanById(); this.refreshTableAndPlan();
this.initTableData();
}, },
methods: { methods: {
initTableData() { initTableData() {
@ -224,6 +222,16 @@
this.selectIds.clear(); this.selectIds.clear();
this.$emit('refresh'); this.$emit('refresh');
}, },
refreshTableAndPlan() {
this.getTestPlanById();
this.initTableData();
},
refreshTestPlanRecent() {
let param = {};
param.id = this.planId;
param.updateTime = Date.now();
this.$post('/test/plan/edit', param);
},
search() { search() {
this.initTableData(); this.initTableData();
}, },
@ -298,6 +306,7 @@
if (this.planId) { if (this.planId) {
this.$post('/test/plan/get/' + this.planId, {}, response => { this.$post('/test/plan/get/' + this.planId, {}, response => {
this.testPlan = response.data; this.testPlan = response.data;
this.refreshTestPlanRecent();
}); });
} }
}, },

View File

@ -94,6 +94,7 @@ export default {
'special_characters_are_not_supported': 'Special characters are not supported', 'special_characters_are_not_supported': 'Special characters are not supported',
'mobile_number_format_is_incorrect': 'Mobile number format is incorrect', 'mobile_number_format_is_incorrect': 'Mobile number format is incorrect',
'email_format_is_incorrect': 'Email format is incorrect', 'email_format_is_incorrect': 'Email format is incorrect',
'password_format_is_incorrect':'Password format is incorrect (At least 8-16 characters, at least 1 uppercase letter, 1 lowercase letter and 1 number)',
}, },
user: { user: {
'create': 'Create', 'create': 'Create',
@ -101,6 +102,7 @@ export default {
'input_name': 'Please enter a user name', 'input_name': 'Please enter a user name',
'input_id': 'Please enter a ID', 'input_id': 'Please enter a ID',
'input_email': 'Please enter a email', 'input_email': 'Please enter a email',
'input_password':'Please enter a password',
'special_characters_are_not_supported': 'Special characters are not supported', 'special_characters_are_not_supported': 'Special characters are not supported',
'mobile_number_format_is_incorrect': 'Mobile number format is incorrect', 'mobile_number_format_is_incorrect': 'Mobile number format is incorrect',
'email_format_is_incorrect': 'Email format is incorrect', 'email_format_is_incorrect': 'Email format is incorrect',

View File

@ -96,6 +96,7 @@ export default {
'special_characters_are_not_supported': '不支持特殊字符', 'special_characters_are_not_supported': '不支持特殊字符',
'mobile_number_format_is_incorrect': '手机号码格式不正确', 'mobile_number_format_is_incorrect': '手机号码格式不正确',
'email_format_is_incorrect': '邮箱格式不正确', 'email_format_is_incorrect': '邮箱格式不正确',
'password_format_is_incorrect':'密码格式不正确(至少8-16个字符至少1个大写字母1个小写字母和1个数字)',
}, },
user: { user: {
'create': '创建用户', 'create': '创建用户',
@ -103,6 +104,7 @@ export default {
'input_name': '请输入用户名', 'input_name': '请输入用户名',
'input_id': '请输入ID', 'input_id': '请输入ID',
'input_email': '请输入邮箱', 'input_email': '请输入邮箱',
'input_password':'请输入密码',
'special_characters_are_not_supported': '不支持特殊字符', 'special_characters_are_not_supported': '不支持特殊字符',
'mobile_number_format_is_incorrect': '手机号码格式不正确', 'mobile_number_format_is_incorrect': '手机号码格式不正确',
'email_format_is_incorrect': '邮箱格式不正确', 'email_format_is_incorrect': '邮箱格式不正确',