From 61d81a46ee9930332d21dd6c0ea29d8a363f7f28 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 23 Jul 2020 16:46:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20=E5=8F=96=E6=B6=88=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=8D=E7=A7=B0=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/project/MsProject.vue | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index ecf618f9e8..a1854fcca7 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -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'} From f7f8258371200a0335aae326f6b7014bb71ddd20 Mon Sep 17 00:00:00 2001 From: q4speed Date: Thu, 23 Jul 2020 17:39:26 +0800 Subject: [PATCH 2/6] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/api/parse/MsParser.java | 9 ++------- .../java/io/metersphere/api/parse/PostmanParser.java | 2 +- .../java/io/metersphere/api/parse/Swagger2Parser.java | 10 +++------- 3 files changed, 6 insertions(+), 15 deletions(-) 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) { From bb8571da2d432d2abc9130515880a4806946cfac Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 23 Jul 2020 19:46:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A0=A1=E9=AA=8CURL=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/test/model/ScenarioModel.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 965b35b0e1..3c3e59e9d5 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -283,10 +283,20 @@ export class HttpRequest extends Request { info: 'api_test.request.input_path' } } - } else if (!this.url) { - return { - isValid: false, - info: 'api_test.request.input_url' + } else { + if (!this.url) { + return { + isValid: false, + info: 'api_test.request.input_url' + } + } + try { + new URL(this.url) + } catch (e) { + return { + isValid: false, + info: 'api_test.request.url_invalid' + } } } return { @@ -631,6 +641,9 @@ class JMXHttpRequest { this.useEnvironment = request.useEnvironment; this.method = request.method; if (!request.useEnvironment) { + if (!request.url.startsWith("http://") && !request.url.startsWith("https://")) { + request.url = 'http://' + request.url; + } let url = new URL(request.url); this.hostname = decodeURIComponent(url.hostname); this.pathname = decodeURIComponent(url.pathname); From f33246db907b298979cb77b0d0bad1392cdaf61a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 24 Jul 2020 12:01:17 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E8=A1=A8=E6=A0=BC=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E8=A1=A8=E5=A4=B4=E8=B0=83=E6=95=B4=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/home/ApiReportRecentList.vue | 2 +- .../components/api/home/ApiTestRecentList.vue | 2 +- .../components/api/report/ApiReportList.vue | 2 +- .../components/api/test/ApiReportDialog.vue | 2 +- .../components/api/test/ApiTestList.vue | 2 +- .../home/PerformanceReportRecentList.vue | 2 +- .../home/PerformanceTestRecentList.vue | 2 +- .../report/PerformanceTestReport.vue | 2 +- .../performance/test/PerformanceTestPlan.vue | 2 +- .../business/components/project/MsProject.vue | 2 +- .../organization/OrganizationMember.vue | 2 +- .../organization/OrganizationWorkspace.vue | 2 +- .../components/settings/personal/ApiKeys.vue | 2 +- .../settings/personal/PersonSetting.vue | 2 +- .../settings/system/Organization.vue | 4 +-- .../settings/system/SystemWorkspace.vue | 2 +- .../settings/system/TestResourcePool.vue | 2 +- .../components/settings/system/User.vue | 2 +- .../settings/workspace/WorkspaceMember.vue | 2 +- .../track/case/components/TestCaseList.vue | 3 +- .../home/components/RelatedTestPlanList.vue | 2 ++ .../home/components/TestCaseSideList.vue | 2 ++ .../track/plan/components/TestPlanList.vue | 2 ++ .../view/comonents/TestPlanTestCaseList.vue | 2 ++ .../TemplateComponent/TestResultComponent.vue | 2 ++ frontend/src/common/css/main.css | 28 +++++++++++++++++++ 26 files changed, 60 insertions(+), 21 deletions(-) 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 @@ - + - diff --git a/frontend/src/business/components/api/test/ApiReportDialog.vue b/frontend/src/business/components/api/test/ApiReportDialog.vue index 106d37748f..12f74815a0 100644 --- a/frontend/src/business/components/api/test/ApiReportDialog.vue +++ b/frontend/src/business/components/api/test/ApiReportDialog.vue @@ -1,6 +1,6 @@ - - + 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 @@