diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index db912696b3..5aa583730d 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -83,6 +83,9 @@ public class XmindCaseParser { private final Map 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 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(); } diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index abf1d5dbda..ddf0d4be45 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -102,7 +102,7 @@ size="small"> + class="select-width" :filter-method="dataFilter"> { 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); diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index bb7661abd2..b7d58e1b88 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -28,7 +28,8 @@ - + @@ -56,7 +57,8 @@ - + @@ -85,7 +87,8 @@ - + @@ -101,7 +104,8 @@ @@ -111,14 +115,15 @@ - + class="select-width" :filter-method="dataFilter"> - @@ -165,7 +171,8 @@ - + { + 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) { diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue index f986634948..c7edff0096 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue @@ -1,7 +1,5 @@