Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
f18c55b67f
|
@ -83,6 +83,9 @@ public class XmindCaseParser {
|
|||
|
||||
private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api");
|
||||
|
||||
/**
|
||||
* 验证模块的合规性
|
||||
*/
|
||||
public void validate() {
|
||||
nodePaths.forEach(nodePath -> {
|
||||
String[] nodes = nodePath.split("/");
|
||||
|
@ -90,9 +93,11 @@ public class XmindCaseParser {
|
|||
process.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
String path = "";
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
path += nodes[i].trim() + "/";
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
process.append(Translator.get("module_not_null") + "; ");
|
||||
process.append(path + ":" + Translator.get("module_not_null") + "; ");
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
process.append(nodes[i].trim() + ":" + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
}
|
||||
|
@ -100,12 +105,61 @@ public class XmindCaseParser {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用例的合规性
|
||||
*/
|
||||
private boolean validate(TestCaseWithBLOBs data) {
|
||||
String nodePath = data.getNodePath();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if (data.getName().length() > 50) {
|
||||
stringBuilder.append(data.getName() + ":" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(nodePath)) {
|
||||
String[] nodes = nodePath.split("/");
|
||||
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
|
||||
stringBuilder.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
stringBuilder.append(Translator.get("test_case") + "," + data.getName() + Translator.get("module_not_null") + "; ");
|
||||
break;
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
stringBuilder.append(nodes[i].trim() + ":" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
|
||||
}
|
||||
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
boolean dbExist = testCaseService.exist(data);
|
||||
if (dbExist) {
|
||||
// db exist
|
||||
stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; ");
|
||||
}
|
||||
|
||||
} else {
|
||||
testCaseNames.add(data.getName());
|
||||
}
|
||||
if (!StringUtils.isEmpty(stringBuilder.toString())) {
|
||||
process.append(stringBuilder.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归处理案例数据
|
||||
*/
|
||||
private void recursion(Attached parent, int level, List<Attached> attacheds) {
|
||||
for (Attached item : attacheds) {
|
||||
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
|
||||
if (isAvailable(item.getTitle(), TC_REGEX)) {
|
||||
item.setParent(parent);
|
||||
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
|
||||
} else {
|
||||
|
@ -121,7 +175,8 @@ public class XmindCaseParser {
|
|||
if (nodePath.endsWith("/")) {
|
||||
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
||||
}
|
||||
nodePaths.add(nodePath); // 没有用例的路径
|
||||
// 没有用例的路径
|
||||
nodePaths.add(nodePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,55 +296,6 @@ public class XmindCaseParser {
|
|||
compartDatas.add(compartData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证合法性
|
||||
*/
|
||||
private boolean validate(TestCaseWithBLOBs data) {
|
||||
String nodePath = data.getNodePath();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if (data.getName().length() > 50) {
|
||||
stringBuilder.append(data.getName() + ":" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(nodePath)) {
|
||||
String[] nodes = nodePath.split("/");
|
||||
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
|
||||
stringBuilder.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
stringBuilder.append(Translator.get("module_not_null") + "; ");
|
||||
break;
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
stringBuilder.append(nodes[i].trim() + ":" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
|
||||
}
|
||||
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
boolean dbExist = testCaseService.exist(data);
|
||||
if (dbExist) {
|
||||
// db exist
|
||||
stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; ");
|
||||
}
|
||||
|
||||
} else {
|
||||
testCaseNames.add(data.getName());
|
||||
}
|
||||
if (!StringUtils.isEmpty(stringBuilder.toString())) {
|
||||
process.append(stringBuilder.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入思维导图处理
|
||||
*/
|
||||
|
@ -323,8 +329,8 @@ public class XmindCaseParser {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.validate(); //检查目录合规性
|
||||
//检查目录合规性
|
||||
this.validate();
|
||||
} catch (Exception ex) {
|
||||
return ex.getMessage();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
size="small">
|
||||
<el-form-item :label="$t('commons.member')" prop="userIds">
|
||||
<el-select filterable v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
|
||||
class="select-width">
|
||||
class="select-width" :filter-method="dataFilter">
|
||||
<el-option
|
||||
v-for="item in memberForm.userList"
|
||||
:key="item.id"
|
||||
|
@ -268,11 +268,23 @@ export default {
|
|||
this.memberForm = {};
|
||||
this.result = this.$get('/user/list/', response => {
|
||||
this.$set(this.memberForm, "userList", response.data);
|
||||
this.$set(this.memberForm, "copyUserList", response.data);
|
||||
});
|
||||
this.result = this.$get('/role/list/org', response => {
|
||||
this.$set(this.memberForm, "roles", response.data);
|
||||
})
|
||||
},
|
||||
dataFilter(val) {
|
||||
if (val) {
|
||||
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
||||
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.memberForm.userList = this.memberForm.copyUserList;
|
||||
}
|
||||
},
|
||||
edit(row) {
|
||||
this.dialogOrgUpdateVisible = true;
|
||||
this.form = Object.assign({}, row);
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
</el-card>
|
||||
|
||||
<!-- add workspace dialog -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%" @close="close">
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible"
|
||||
width="30%" @close="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"/>
|
||||
|
@ -56,7 +57,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- update workspace dialog -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible" width="30%" @close="close">
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible"
|
||||
width="30%" @close="close">
|
||||
<el-form :model="form" :rules="rules" ref="updateForm" 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"/>
|
||||
|
@ -85,7 +87,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- dialog of workspace member -->
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="closeWsMemberDialog" class="dialog-css">
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true"
|
||||
@close="closeWsMemberDialog" class="dialog-css">
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||
<!-- organization member table -->
|
||||
|
@ -101,7 +104,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)" @deleteClick="delMember(scope.row)"/>
|
||||
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
|
||||
@deleteClick="delMember(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -111,14 +115,15 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- add workspace member dialog -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible"
|
||||
width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose">
|
||||
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
|
||||
size="small">
|
||||
<el-form-item :label="$t('commons.member')" prop="userIds">
|
||||
<el-select filterable v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
|
||||
class="select-width">
|
||||
class="select-width" :filter-method="dataFilter">
|
||||
<el-option
|
||||
v-for="item in memberForm.userList"
|
||||
:key="item.id"
|
||||
|
@ -149,7 +154,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- update workspace member dialog -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible"
|
||||
width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose">
|
||||
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
||||
|
@ -165,7 +171,8 @@
|
|||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||
<el-form-item :label="$t('commons.role')" prop="roleIds"
|
||||
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||
<el-select filterable v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
|
||||
class="select-width">
|
||||
<el-option
|
||||
|
@ -231,6 +238,17 @@
|
|||
})
|
||||
listenGoBack(this.close);
|
||||
},
|
||||
dataFilter(val) {
|
||||
if (val) {
|
||||
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
||||
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.memberForm.userList = this.memberForm.copyUserList;
|
||||
}
|
||||
},
|
||||
submit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
|
@ -252,10 +270,12 @@
|
|||
this.dialogWsMemberAddVisible = true;
|
||||
this.result = this.$get('/user/list/', response => {
|
||||
this.$set(this.memberForm, "userList", response.data);
|
||||
this.$set(this.memberForm, "copyUserList", response.data);
|
||||
});
|
||||
this.result = this.$get('/role/list/test', response => {
|
||||
this.$set(this.memberForm, "roles", response.data);
|
||||
});
|
||||
|
||||
listenGoBack(this.handleClose);
|
||||
},
|
||||
cellClick(row) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
||||
:visible.sync="dialogFormVisible"
|
||||
@close="close"
|
||||
|
@ -29,7 +27,7 @@
|
|||
@filter-change="filter"
|
||||
row-key="id"
|
||||
@mouseleave.passive="leave"
|
||||
v-el-table-infinite-scroll="loadData"
|
||||
v-el-table-infinite-scroll="scrollLoading"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
height="50vh"
|
||||
|
@ -196,9 +194,9 @@
|
|||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testCases = [];
|
||||
this.getTestCases();
|
||||
this.getTestCases(true);
|
||||
},
|
||||
getTestCases() {
|
||||
getTestCases(flag) {
|
||||
if (this.planId) {
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
|
@ -216,7 +214,7 @@
|
|||
tableData.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.testCases = this.testCases.concat(tableData);
|
||||
flag ? this.testCases = tableData : this.testCases = this.testCases.concat(tableData);
|
||||
this.lineStatus = tableData.length === 50 && this.testCases.length < this.total;
|
||||
});
|
||||
}
|
||||
|
@ -249,12 +247,10 @@
|
|||
refresh() {
|
||||
this.close();
|
||||
},
|
||||
loadData() {
|
||||
if (this.dialogFormVisible) {
|
||||
if (this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getTestCases();
|
||||
}
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getTestCases();
|
||||
}
|
||||
},
|
||||
getAllNodeTreeByPlanId() {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
||||
width="60%" v-loading="result.loading"
|
||||
:close-on-click-modal="false"
|
||||
|
@ -19,7 +17,7 @@
|
|||
<el-container>
|
||||
<el-main class="case-content">
|
||||
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
|
||||
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="loadData"
|
||||
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading"
|
||||
@filter-change="filter" row-key="id"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
|
@ -202,7 +200,7 @@
|
|||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
getReviews() {
|
||||
getReviews(flag) {
|
||||
if (this.reviewId) {
|
||||
this.condition.reviewId = this.reviewId;
|
||||
}
|
||||
|
@ -220,7 +218,7 @@
|
|||
tableData.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.testReviews = this.testReviews.concat(tableData);
|
||||
flag ? this.testReviews = tableData : this.testReviews = this.testReviews.concat(tableData);
|
||||
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
|
||||
|
||||
});
|
||||
|
@ -301,18 +299,16 @@
|
|||
switchProject() {
|
||||
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||
},
|
||||
loadData() {
|
||||
if (this.dialogFormVisible) {
|
||||
if (this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testReviews = [];
|
||||
this.getReviews();
|
||||
this.getReviews(true);
|
||||
},
|
||||
|
||||
getProjectNode(projectId) {
|
||||
|
|
Loading…
Reference in New Issue