From e0a349e43224168d60c958d75c4f2d2b11c77d67 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 16 Oct 2020 11:00:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=88=90=E5=91=98=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/system/Organization.vue | 14 +++++++- .../settings/system/SystemWorkspace.vue | 36 ++++++++++++++----- 2 files changed, 41 insertions(+), 9 deletions(-) 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) { From ce90cf9cb55680e295a3e2d896547d6b2199e252 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 16 Oct 2020 14:28:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E4=BE=8B=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/xmind/XmindCaseParser.java | 114 +++++++++--------- .../plan/view/comonents/TestCaseRelevance.vue | 20 ++- .../view/components/TestReviewRelevance.vue | 20 ++- 3 files changed, 76 insertions(+), 78 deletions(-) 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/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 @@