diff --git a/backend/src/main/java/io/metersphere/api/parse/MsParser.java b/backend/src/main/java/io/metersphere/api/parse/MsParser.java index 0b77a2c126..4a909cfbcd 100644 --- a/backend/src/main/java/io/metersphere/api/parse/MsParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/MsParser.java @@ -11,7 +11,6 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.jetty.http.HttpMethod; import java.io.InputStream; -import java.util.Map; public class MsParser extends ApiImportAbstractParser { @@ -19,9 +18,7 @@ public class MsParser extends ApiImportAbstractParser { public ApiImport parse(InputStream source, ApiTestImportRequest request) { String testStr = getApiTestStr(source); ApiImport apiImport = JSON.parseObject(parsePluginFormat(testStr), ApiImport.class); - apiImport.getScenarios().forEach(scenario -> { - setScenarioByRequest(scenario, request); - }); + apiImport.getScenarios().forEach(scenario -> setScenarioByRequest(scenario, request)); return apiImport; } @@ -45,9 +42,7 @@ public class MsParser extends ApiImportAbstractParser { requestObject.put("type", RequestType.HTTP); } - requestTmpObject.keySet().forEach(key -> { - requestObject.put(key, requestTmpObject.get(key)); - });; + requestTmpObject.keySet().forEach(key -> requestObject.put(key, requestTmpObject.get(key))); requestObject.put("name", requestName); JSONArray bodies = requestObject.getJSONArray("body"); if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) { diff --git a/backend/src/main/java/io/metersphere/api/parse/PostmanParser.java b/backend/src/main/java/io/metersphere/api/parse/PostmanParser.java index 0df43b12e7..5b83c21a6a 100644 --- a/backend/src/main/java/io/metersphere/api/parse/PostmanParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/PostmanParser.java @@ -22,7 +22,7 @@ import java.util.Map; public class PostmanParser extends ApiImportAbstractParser { - private static Map postmanBodyRowMap; + private static final Map postmanBodyRowMap; static { postmanBodyRowMap = new HashMap<>(); diff --git a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java index 7ec18fb824..18abdbeb48 100644 --- a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java @@ -27,7 +27,7 @@ public class Swagger2Parser extends ApiImportAbstractParser { @Override public ApiImport parse(InputStream source, ApiTestImportRequest request) { - Swagger swagger = null; + Swagger swagger; if (StringUtils.isNotBlank(request.getSwaggerUrl())) { swagger = new SwaggerParser().read(request.getSwaggerUrl()); } else { @@ -35,9 +35,7 @@ public class Swagger2Parser extends ApiImportAbstractParser { } ApiImport apiImport = new ApiImport(); apiImport.setScenarios(parseRequests(swagger)); - apiImport.getScenarios().forEach(scenario -> { - scenario.setEnvironmentId(request.getEnvironmentId()); - }); + apiImport.getScenarios().forEach(scenario -> scenario.setEnvironmentId(request.getEnvironmentId())); return apiImport; } @@ -45,7 +43,6 @@ public class Swagger2Parser extends ApiImportAbstractParser { Map paths = swagger.getPaths(); Set pathNames = paths.keySet(); Map scenarioMap = new HashMap<>(); - List scenarios = new ArrayList<>(); for (String pathName : pathNames) { Path path = paths.get(pathName); Map operationMap = path.getOperationMap(); @@ -78,8 +75,7 @@ public class Swagger2Parser extends ApiImportAbstractParser { } } - scenarios.addAll(scenarioMap.values()); - return scenarios; + return new ArrayList<>(scenarioMap.values()); } private void parseParameters(Operation operation, Map definitions, HttpRequest request) { diff --git a/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java b/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java index f21b8e3315..30927a2ef2 100644 --- a/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java +++ b/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java @@ -117,7 +117,7 @@ public class ShiroDBRealm extends AuthorizingRealm { UserDTO user = userService.getLoginUser(userId, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name())); String msg; if (user == null) { - user = userService.getLoginUserByEmail(email, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name())); + user = userService.getUserDTOByEmail(email, UserSource.LDAP.name(), UserSource.LOCAL.name()); if (user == null) { msg = "The user does not exist: " + userId; logger.warn(msg); @@ -136,7 +136,7 @@ public class ShiroDBRealm extends AuthorizingRealm { UserDTO user = userService.getLoginUser(userId, Collections.singletonList(UserSource.LOCAL.name())); String msg; if (user == null) { - user = userService.getLoginUserByEmail(userId, Collections.singletonList(UserSource.LOCAL.name())); + user = userService.getUserDTOByEmail(userId, UserSource.LOCAL.name()); if (user == null) { msg = "The user does not exist: " + userId; logger.warn(msg); diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index f61843832b..3f64c00ffc 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -199,23 +199,21 @@ public class UserService { return getUserDTO(userId); } - public UserDTO getUserDTOByEmail(String email) { + public UserDTO getUserDTOByEmail(String email, String... source) { UserExample example = new UserExample(); - example.createCriteria().andEmailEqualTo(email); - List users = userMapper.selectByExample(example); - if (users == null || users.size() <= 0) { - return null; - } - return getUserDTO(users.get(0).getId()); - } + UserExample.Criteria criteria = example.createCriteria(); + criteria.andEmailEqualTo(email); + + if (!CollectionUtils.isEmpty(Arrays.asList(source))) { + criteria.andSourceIn(Arrays.asList(source)); + } - public UserDTO getLoginUserByEmail(String email, List list) { - UserExample example = new UserExample(); - example.createCriteria().andEmailEqualTo(email).andSourceIn(list); List users = userMapper.selectByExample(example); + if (users == null || users.size() <= 0) { return null; } + return getUserDTO(users.get(0).getId()); } diff --git a/frontend/src/business/components/api/home/ApiReportRecentList.vue b/frontend/src/business/components/api/home/ApiReportRecentList.vue index 3fc94c1bbe..629610d079 100644 --- a/frontend/src/business/components/api/home/ApiReportRecentList.vue +++ b/frontend/src/business/components/api/home/ApiReportRecentList.vue @@ -3,7 +3,7 @@ - + - @@ -83,7 +83,8 @@ {text: 'Running', value: 'Running'}, {text: 'Reporting', value: 'Reporting'}, {text: 'Completed', value: 'Completed'}, - {text: 'Error', value: 'Error'} + {text: 'Error', value: 'Error'}, + {text: 'Success', value: 'Success'}, ], triggerFilters: [ {text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'}, diff --git a/frontend/src/business/components/api/report/ApiReportStatus.vue b/frontend/src/business/components/api/report/ApiReportStatus.vue index 05c25d2826..06e2464a07 100644 --- a/frontend/src/business/components/api/report/ApiReportStatus.vue +++ b/frontend/src/business/components/api/report/ApiReportStatus.vue @@ -1,9 +1,12 @@ - + @@ -106,13 +106,7 @@ rules: { name: [ {required: true, message: this.$t('project.input_name'), trigger: 'blur'}, - {min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}, - { - required: true, - pattern: /^(?!-)(?!.*?-$)[a-zA-Z0-9\u4e00-\u9fa5-]+$/, - message: this.$t('project.special_characters_are_not_supported'), - trigger: 'blur' - } + {min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'} ], description: [ {max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'} diff --git a/frontend/src/business/components/settings/organization/OrganizationMember.vue b/frontend/src/business/components/settings/organization/OrganizationMember.vue index 2ec1d4d600..aa7a946008 100644 --- a/frontend/src/business/components/settings/organization/OrganizationMember.vue +++ b/frontend/src/business/components/settings/organization/OrganizationMember.vue @@ -5,7 +5,7 @@ - + diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index 237e3d8e4f..86aecf23b6 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -5,7 +5,7 @@ - + diff --git a/frontend/src/business/components/settings/personal/ApiKeys.vue b/frontend/src/business/components/settings/personal/ApiKeys.vue index 2cbe3152d2..d4a78e1989 100644 --- a/frontend/src/business/components/settings/personal/ApiKeys.vue +++ b/frontend/src/business/components/settings/personal/ApiKeys.vue @@ -15,7 +15,7 @@ - + - + diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index fdd26d5e5f..bf223872c1 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -7,7 +7,7 @@ :create-tip="$t('organization.create')" :title="$t('commons.organization')"/> - + @@ -31,7 +31,7 @@ - + diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index ce5f1ec08c..cc85d4c990 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -6,7 +6,7 @@ :create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/> - + diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index 56de2ecb33..2ec9f74d97 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -5,7 +5,7 @@ - + diff --git a/frontend/src/business/components/settings/system/User.vue b/frontend/src/business/components/settings/system/User.vue index b735db6b2e..2228a4c962 100644 --- a/frontend/src/business/components/settings/system/User.vue +++ b/frontend/src/business/components/settings/system/User.vue @@ -7,7 +7,7 @@ :create-tip="$t('user.create')" :title="$t('commons.user')"/> - + diff --git a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue index bcf1b72a35..ecb508387b 100644 --- a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue +++ b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue @@ -5,7 +5,7 @@ - + diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index fb53b22d81..90a140a28f 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -28,6 +28,7 @@ ref="testCaseImport"/> + class="test-content adjust-table"> diff --git a/frontend/src/business/components/track/home/components/TestCaseSideList.vue b/frontend/src/business/components/track/home/components/TestCaseSideList.vue index 8aae85075c..3fda7b8bac 100644 --- a/frontend/src/business/components/track/home/components/TestCaseSideList.vue +++ b/frontend/src/business/components/track/home/components/TestCaseSideList.vue @@ -4,6 +4,8 @@ diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index b16eb23f0d..c2807fe371 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -8,6 +8,8 @@