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();
}
@PostMapping("/update/currentuser")
@PostMapping("/update/current")
public UserDTO updateCurrentUser(@RequestBody User user) {
SessionUser sessionUser = SessionUtils.getUser();
BeanUtils.copyProperties(user, sessionUser);
userService.updateUser(user);
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.utils.BeanUtils;
import io.metersphere.service.TestCaseService;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -38,12 +40,19 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
public String validate(TestCaseExcelData data, String errMsg) {
String nodePath = data.getNodePath();
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 + "层;");
}
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())) {
stringBuilder.append("该工作空间下无该用户:" + data.getMaintainer() + ";");
}

View File

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

View File

@ -3,7 +3,7 @@
<el-row type="flex" justify="start">
<el-col :span="8">
<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-row>
<!-- -->
@ -85,7 +85,7 @@
<el-row>
<el-col :span="8">
<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-row>
<!-- -->
@ -258,8 +258,8 @@
this.domains = data.domains || [];
this.params = data.params || [];
this.add('domains');
this.domains.forEach(d => d.edit = false);
this.params.forEach(d => d.edit = false);
/*this.domains.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-input v-model="form.phone" autocomplete="off"/>
</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>
<template v-slot:footer>
<ms-dialog-footer
@ -65,7 +68,7 @@
result: {},
updateVisible: false,
tableData: [],
updatePath: '/user/update/currentuser',
updatePath: '/user/update/current',
form: {},
rule: {
name: [
@ -94,6 +97,15 @@
message: this.$t('member.email_format_is_incorrect'),
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-input v-model="form.phone" autocomplete="off"/>
</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>
<template v-slot:footer>
<ms-dialog-footer
@ -78,6 +81,10 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/>
</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>
<template v-slot:footer>
<ms-dialog-footer
@ -101,6 +108,7 @@
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTableOperator, MsDialogFooter},
data() {
return {
/*input:'',*/
queryPath: '/user/special/list',
deletePath: '/user/special/delete/',
createPath: '/user/special/add',
@ -147,6 +155,15 @@
message: this.$t('user.email_format_is_incorrect'),
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) {
this.currentProject = null;
this.setCurrentProject(this.projects[0]);
}
} else {
if(this.projects.length > 0){
@ -189,6 +189,7 @@
this.$get('/project/get/' + id, response => {
let project = response.data;
this.setCurrentProject(project);
this.$router.push('/track/case/all');
});
}
if (id === 'all') {

View File

@ -13,7 +13,7 @@
:label="$t('test_track.case.name')"
:label-width="formLabelWidth"
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-col>
@ -313,6 +313,11 @@
if(localStorage.getItem(CURRENT_PROJECT)) {
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.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;

View File

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

View File

@ -12,7 +12,7 @@
:label="$t('test_track.module.name')"
:label-width="formLabelWidth"
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>
</el-col>
@ -69,7 +69,10 @@
if (valid) {
let 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.$success(this.$t('commons.save_success'));
this.$emit('refresh');
@ -95,7 +98,7 @@
param.id = this.node.id;
param.level = this.node.level;
}
param.name = this.form.name;
param.name = this.form.name.trim();
param.label = this.form.name;
if (localStorage.getItem(CURRENT_PROJECT)) {
param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;

View File

@ -15,7 +15,7 @@
:label="$t('test_track.plan.plan_name')"
:label-width="formLabelWidth"
prop="name">
<el-input v-model.trim="form.name"></el-input>
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
@ -149,6 +149,11 @@
if (valid) {
let param = {};
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);
this.$post('/test/plan/' + this.operationType, param, () => {
this.$success(this.$t('commons.save_success'));

View File

@ -195,16 +195,14 @@
},
watch: {
planId() {
this.getTestPlanById();
this.initTableData();
this.refreshTableAndPlan();
},
selectNodeIds() {
this.search();
}
},
mounted() {
this.getTestPlanById();
this.initTableData();
this.refreshTableAndPlan();
},
methods: {
initTableData() {
@ -224,6 +222,16 @@
this.selectIds.clear();
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() {
this.initTableData();
},
@ -298,6 +306,7 @@
if (this.planId) {
this.$post('/test/plan/get/' + this.planId, {}, response => {
this.testPlan = response.data;
this.refreshTestPlanRecent();
});
}
},

View File

@ -94,6 +94,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':'Password format is incorrect (At least 8-16 characters, at least 1 uppercase letter, 1 lowercase letter and 1 number)',
},
user: {
'create': 'Create',
@ -101,6 +102,7 @@ export default {
'input_name': 'Please enter a user name',
'input_id': 'Please enter a ID',
'input_email': 'Please enter a email',
'input_password':'Please enter a 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',

View File

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