From e6231fc07ec5cbd1fd662c895625ccfd47447680 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 9 Nov 2020 10:53:13 +0800 Subject: [PATCH 01/19] =?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=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=A8=A1=E5=9D=97=E6=A0=91=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/track/service/TestCaseNodeService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java index bda8df1325..6594536019 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java @@ -191,17 +191,19 @@ public class TestCaseNodeService { * 获取当前计划下 * 有关联数据的节点 * - * @param planId - * @return + * @param planId plan id + * @return List */ public List getNodeByPlanId(String planId) { List list = new ArrayList<>(); List projectIds = testPlanProjectService.getProjectIdsByPlanId(planId); projectIds.forEach(id -> { - String name = projectMapper.selectByPrimaryKey(id).getName(); + Project project = projectMapper.selectByPrimaryKey(id); + String name = project.getName(); List nodeList = getNodeDTO(id, planId); TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO(); + testCaseNodeDTO.setId(project.getId()); testCaseNodeDTO.setName(name); testCaseNodeDTO.setLabel(name); testCaseNodeDTO.setChildren(nodeList); From 2d1a5a199541c043d1fa517ccc6fb293d2d0f297 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 6 Nov 2020 18:11:21 +0800 Subject: [PATCH 02/19] =?UTF-8?q?feat(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?):=20=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E7=BA=BF=E7=A8=8B=E7=BB=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PerformanceTestController.java | 6 + .../performance/engine/AbstractEngine.java | 20 +- .../performance/engine/EngineContext.java | 9 - .../performance/engine/EngineFactory.java | 37 +- .../engine/docker/DockerTestEngine.java | 11 +- .../xml/reader/jmx/JmeterDocumentParser.java | 66 ++- .../service/PerformanceTestService.java | 11 + backend/src/main/java/io/metersphere/xpack | 2 +- frontend/package.json | 3 +- .../components/PerformancePressureConfig.vue | 426 +++++++++++------ .../test/EditPerformanceTestPlan.vue | 15 +- .../components/PerformanceBasicConfig.vue | 14 + .../components/PerformancePressureConfig.vue | 435 ++++++++++++------ .../performance/test/model/ThreadGroup.js | 20 + 14 files changed, 751 insertions(+), 324 deletions(-) create mode 100644 frontend/src/business/components/performance/test/model/ThreadGroup.js diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index 764fd73a94..bdcb8bbb59 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -104,6 +104,12 @@ public class PerformanceTestController { return performanceTestService.getLoadConfiguration(testId); } + @GetMapping("/get-jmx-content/{testId}") + public String getJmxContent(@PathVariable String testId) { + checkOwnerService.checkPerformanceTestOwner(testId); + return performanceTestService.getJmxContent(testId); + } + @PostMapping("/delete") public void delete(@RequestBody DeleteTestPlanRequest request) { checkOwnerService.checkPerformanceTestOwner(request.getId()); diff --git a/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java b/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java index 210829db7c..60a8e7ffcc 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/AbstractEngine.java @@ -18,6 +18,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.List; +import java.util.Map; import java.util.UUID; public abstract class AbstractEngine implements Engine { @@ -81,9 +82,22 @@ public abstract class AbstractEngine implements Engine { String loadConfiguration = t.getLoadConfiguration(); JSONArray jsonArray = JSON.parseArray(loadConfiguration); for (int i = 0; i < jsonArray.size(); i++) { - JSONObject o = jsonArray.getJSONObject(i); - if (StringUtils.equals(o.getString("key"), "TargetLevel")) { - s = o.getInteger("value"); + if (jsonArray.get(i) instanceof Map) { + JSONObject o = jsonArray.getJSONObject(i); + if (StringUtils.equals(o.getString("key"), "TargetLevel")) { + s = o.getInteger("value"); + break; + } + } + if (jsonArray.get(i) instanceof List) { + JSONArray o = jsonArray.getJSONArray(i); + for (int j = 0; j < o.size(); j++) { + JSONObject b = o.getJSONObject(j); + if (StringUtils.equals(b.getString("key"), "TargetLevel")) { + s += b.getInteger("value"); + break; + } + } } } return s; diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java b/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java index 4f13fd3fb6..ab640de3af 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java @@ -10,7 +10,6 @@ public class EngineContext { private String fileType; private String content; private String resourcePoolId; - private Long threadNum; private Long startTime; private String reportId; private Integer resourceIndex; @@ -95,14 +94,6 @@ public class EngineContext { this.resourcePoolId = resourcePoolId; } - public Long getThreadNum() { - return threadNum; - } - - public void setThreadNum(Long threadNum) { - this.threadNum = threadNum; - } - public Long getStartTime() { return startTime; } diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java index 478c79fa7d..97a14aee04 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java @@ -9,6 +9,7 @@ import io.metersphere.base.domain.TestResourcePool; import io.metersphere.commons.constants.FileType; import io.metersphere.commons.constants.ResourcePoolTypeEnum; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.config.KafkaProperties; import io.metersphere.i18n.Translator; import io.metersphere.performance.engine.docker.DockerTestEngine; @@ -22,6 +23,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.ByteArrayInputStream; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,7 +54,7 @@ public class EngineFactory { return null; } - public static EngineContext createContext(LoadTestWithBLOBs loadTest, String resourceId, long threadNum, long startTime, String reportId, int resourceIndex) { + public static EngineContext createContext(LoadTestWithBLOBs loadTest, String resourceId, double ratio, long startTime, String reportId, int resourceIndex) { final List fileMetadataList = fileService.getFileMetadataByTestId(loadTest.getId()); if (org.springframework.util.CollectionUtils.isEmpty(fileMetadataList)) { MSException.throwException(Translator.get("run_load_test_file_not_found") + loadTest.getId()); @@ -73,7 +75,6 @@ public class EngineFactory { engineContext.setTestName(loadTest.getName()); engineContext.setNamespace(loadTest.getProjectId()); engineContext.setFileType(jmxFile.getType()); - engineContext.setThreadNum(threadNum); engineContext.setResourcePoolId(loadTest.getTestResourcePoolId()); engineContext.setStartTime(startTime); engineContext.setReportId(reportId); @@ -90,8 +91,34 @@ public class EngineFactory { final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration()); for (int i = 0; i < jsonArray.size(); i++) { - final JSONObject jsonObject = jsonArray.getJSONObject(i); - engineContext.addProperty(jsonObject.getString("key"), jsonObject.get("value")); + if (jsonArray.get(i) instanceof Map) { + JSONObject o = jsonArray.getJSONObject(i); + String key = o.getString("key"); + if ("TargetLevel".equals(key)) { + engineContext.addProperty(key, Math.round(((Integer) o.get("value")) * ratio)); + } else { + engineContext.addProperty(key, o.get("value")); + } + } + if (jsonArray.get(i) instanceof List) { + JSONArray o = jsonArray.getJSONArray(i); + for (int j = 0; j < o.size(); j++) { + JSONObject b = o.getJSONObject(j); + String key = b.getString("key"); + Object values = engineContext.getProperty(key); + if (values == null) { + values = new ArrayList<>(); + } + if (values instanceof List) { + Object value = b.get("value"); + if ("TargetLevel".equals(key)) { + value = Math.round(((Integer) b.get("value")) * ratio); + } + ((List) values).add(value); + engineContext.addProperty(key, values); + } + } + } } } /* @@ -112,8 +139,10 @@ public class EngineFactory { String content = engineSourceParser.parse(engineContext, source); engineContext.setContent(content); } catch (MSException e) { + LogUtil.error(e); throw e; } catch (Exception e) { + LogUtil.error(e); MSException.throwException(e); } diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index a10569ba51..4aba1aa1ff 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -6,6 +6,7 @@ import io.metersphere.base.domain.TestResource; import io.metersphere.commons.constants.ResourceStatusEnum; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.controller.ResultHolder; import io.metersphere.dto.NodeDTO; import io.metersphere.i18n.Translator; @@ -52,19 +53,21 @@ public class DockerTestEngine extends AbstractEngine { for (int i = 0, size = resourceList.size(); i < size; i++) { int ratio = resourceRatio.get(i); - double realThreadNum = ((double) ratio / totalThreadNum) * threadNum; - runTest(resourceList.get(i), Math.round(realThreadNum), i); +// double realThreadNum = ((double) ratio / totalThreadNum) * threadNum; + runTest(resourceList.get(i), ((double) ratio / totalThreadNum), i); } } - private void runTest(TestResource resource, long realThreadNum, int resourceIndex) { + private void runTest(TestResource resource, double ratio, int resourceIndex) { EngineContext context = null; try { - context = EngineFactory.createContext(loadTest, resource.getId(), realThreadNum, this.getStartTime(), this.getReportId(), resourceIndex); + context = EngineFactory.createContext(loadTest, resource.getId(), ratio, this.getStartTime(), this.getReportId(), resourceIndex); } catch (MSException e) { + LogUtil.error(e); throw e; } catch (Exception e) { + LogUtil.error(e); MSException.throwException(e); } diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 695baa09ac..d4103c5107 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -777,8 +777,22 @@ public class JmeterDocumentParser implements DocumentParser { elementProp.setAttribute("elementType", "com.blazemeter.jmeter.control.VirtualUserController"); threadGroup.appendChild(elementProp); // 持续时长 - String duration = context.getProperty("duration").toString(); - String rampUp = context.getProperty("RampUp").toString(); + Object durations = context.getProperty("duration"); + String duration; + if (durations instanceof List) { + Object o = ((List) durations).get(0); + duration = o.toString(); + } else { + duration = durations.toString(); + } + Object rampUps = context.getProperty("RampUp"); + String rampUp; + if (rampUps instanceof List) { + Object o = ((List) rampUps).get(0); + rampUp = o.toString(); + } else { + rampUp = rampUps.toString(); + } int realHold = Integer.parseInt(duration) - Integer.parseInt(rampUp); threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue")); threadGroup.appendChild(createStringProp(document, "TargetLevel", "2")); @@ -803,9 +817,18 @@ public class JmeterDocumentParser implements DocumentParser { */ - if (context.getProperty("rpsLimitEnable") == null || StringUtils.equals(context.getProperty("rpsLimitEnable").toString(), "false")) { + if (context.getProperty("rpsLimitEnable") == null) { return; } + Object rpsLimitEnables = context.getProperty("rpsLimitEnable"); + if (rpsLimitEnables instanceof List) { + Object o = ((List) rpsLimitEnables).get(0); + ((List) rpsLimitEnables).remove(0); + if (o == null || "false".equals(o.toString())) { + return; + } + } + Document document = element.getOwnerDocument(); @@ -866,11 +889,6 @@ public class JmeterDocumentParser implements DocumentParser { if (nodeNameEquals(ele, STRING_PROP)) { parseStringProp(ele); } - - // 设置具体的线程数 - if (nodeNameEquals(ele, STRING_PROP) && "TargetLevel".equals(ele.getAttribute("name"))) { - ele.getFirstChild().setNodeValue(context.getThreadNum().toString()); - } } } } @@ -902,11 +920,28 @@ public class JmeterDocumentParser implements DocumentParser { stringPropCount++; } else { stringPropCount = 0; - Integer duration = (Integer) context.getProperty("duration");// 传入的是分钟数, 需要转化成秒数 + Object durations = context.getProperty("duration");// 传入的是分钟数, 需要转化成秒数 + Integer duration; + if (durations instanceof List) { + Object o = ((List) durations).get(0); + duration = (Integer) o; + ((List) durations).remove(0); + } else { + duration = (Integer) durations; + } prop.getFirstChild().setNodeValue(String.valueOf(duration * 60)); continue; } - prop.getFirstChild().setNodeValue(context.getProperty("rpsLimit").toString()); + Object rpsLimits = context.getProperty("rpsLimit"); + String rpsLimit; + if (rpsLimits instanceof List) { + Object o = ((List) rpsLimits).get(0); + ((List) rpsLimits).remove(0); + rpsLimit = o.toString(); + } else { + rpsLimit = rpsLimits.toString(); + } + prop.getFirstChild().setNodeValue(rpsLimit); } } } @@ -920,8 +955,15 @@ public class JmeterDocumentParser implements DocumentParser { } private void parseStringProp(Element stringProp) { - if (stringProp.getChildNodes().getLength() > 0 && context.getProperty(stringProp.getAttribute("name")) != null) { - stringProp.getFirstChild().setNodeValue(context.getProperty(stringProp.getAttribute("name")).toString()); + Object threadParams = context.getProperty(stringProp.getAttribute("name")); + if (stringProp.getChildNodes().getLength() > 0 && threadParams != null) { + if (threadParams instanceof List) { + Object o = ((List) threadParams).get(0); + ((List) threadParams).remove(0); + stringProp.getFirstChild().setNodeValue(o.toString()); + } else { + stringProp.getFirstChild().setNodeValue(threadParams.toString()); + } } } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 5bd56c5215..1dc40dfe1d 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -345,6 +345,17 @@ public class PerformanceTestService { return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getLoadConfiguration(); } + public String getJmxContent(String testId) { + List fileMetadataList = fileService.getFileMetadataByTestId(testId); + for (FileMetadata metadata : fileMetadataList) { + if (FileType.JMX.name().equals(metadata.getType())) { + FileContent fileContent = fileService.getFileContent(metadata.getId()); + return new String(fileContent.getFile()); + } + } + return null; + } + public List selectByTestResourcePoolId(String resourcePoolId) { LoadTestExample example = new LoadTestExample(); example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId); diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 24047fea95..57d6f78efa 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 24047fea950a74f7848a9fdaa857a22b884c4ce2 +Subproject commit 57d6f78efa4b0300be188e8b024511ceef0873ed diff --git a/frontend/package.json b/frontend/package.json index 6a709fd88a..02e22efaba 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -37,7 +37,8 @@ "nprogress": "^0.2.0", "el-table-infinite-scroll": "^1.0.10", "vue-pdf": "^4.2.0", - "diffable-html": "^4.0.0" + "diffable-html": "^4.0.0", + "xml-js": "^1.6.11" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue index 2492cee7c9..38d7be1413 100644 --- a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue @@ -1,98 +1,81 @@ diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index f13525ea02..d6a29fdf21 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -1,5 +1,6 @@ import { Arguments, + ConstantTimer as JMXConstantTimer, CookieManager, DNSCacheManager, DubboSample, @@ -10,22 +11,24 @@ import { HTTPSamplerArguments, HTTPsamplerFiles, HTTPSamplerProxy, + IfController as JMXIfController, JDBCDataSource, JDBCSampler, JSONPathAssertion, JSONPostProcessor, + JSR223Assertion, JSR223PostProcessor, JSR223PreProcessor, RegexExtractor, ResponseCodeAssertion, ResponseDataAssertion, ResponseHeadersAssertion, + TCPSampler, TestElement, TestPlan, ThreadGroup, + XPath2Assertion, XPath2Extractor, - IfController as JMXIfController, - ConstantTimer as JMXConstantTimer, TCPSampler, JSR223Assertion, XPath2Assertion, } from "./JMX"; import Mock from "mockjs"; import {funcFilters} from "@/common/js/func-filter"; @@ -226,6 +229,7 @@ export class Scenario extends BaseConfig { this.enable = true; this.databaseConfigs = []; this.tcpConfig = undefined; + this.assertions = undefined; this.set(options); this.sets({ @@ -242,6 +246,7 @@ export class Scenario extends BaseConfig { options.databaseConfigs = options.databaseConfigs || []; options.dubboConfig = new DubboConfig(options.dubboConfig); options.tcpConfig = new TCPConfig(options.tcpConfig); + options.assertions = new Assertions(options.assertions); return options; } @@ -1151,6 +1156,9 @@ class JMXGenerator { this.addScenarioCookieManager(threadGroup, scenario); this.addJDBCDataSources(threadGroup, scenario); + + this.addAssertion(threadGroup, scenario); + scenario.requests.forEach(request => { if (request.enable) { if (!request.isValid()) return; @@ -1175,7 +1183,7 @@ class JMXGenerator { this.addRequestExtractor(sampler, request); - this.addRequestAssertion(sampler, request); + this.addAssertion(sampler, request); this.addJSR223PreProcessor(sampler, request); @@ -1467,7 +1475,7 @@ class JMXGenerator { httpSamplerProxy.add(new HTTPsamplerFiles(files)); } - addRequestAssertion(httpSamplerProxy, request) { + addAssertion(httpSamplerProxy, request) { let assertions = request.assertions; if (assertions.regex.length > 0) { assertions.regex.filter(this.filter).forEach(regex => { From c2e3dd99a906b8c728673fb52ef381ac75704a48 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 11 Nov 2020 15:07:45 +0800 Subject: [PATCH 12/19] =?UTF-8?q?refactor:=20=E6=8B=86=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/organization/BugManagement.vue | 240 ++---------------- .../organization/components/BugManageBtn.vue | 71 ++++++ .../organization/components/JiraSetting.vue | 189 ++++++++++++++ .../organization/components/TapdSetting.vue | 169 ++++++++++++ .../organization/components/ZentaoSetting.vue | 167 ++++++++++++ frontend/src/common/js/constants.js | 4 + 6 files changed, 625 insertions(+), 215 deletions(-) create mode 100644 frontend/src/business/components/settings/organization/components/BugManageBtn.vue create mode 100644 frontend/src/business/components/settings/organization/components/JiraSetting.vue create mode 100644 frontend/src/business/components/settings/organization/components/TapdSetting.vue create mode 100644 frontend/src/business/components/settings/organization/components/ZentaoSetting.vue diff --git a/frontend/src/business/components/settings/organization/BugManagement.vue b/frontend/src/business/components/settings/organization/BugManagement.vue index 8a2ee1511d..670a4ff8cf 100644 --- a/frontend/src/business/components/settings/organization/BugManagement.vue +++ b/frontend/src/business/components/settings/organization/BugManagement.vue @@ -15,227 +15,45 @@ -
-
{{ $t('organization.integration.basic_auth_info') }}
- - - - - - - - - - - - - - -
+ + + -
- {{ $t('ldap.test_connect') }} - - {{ $t('commons.edit') }} - {{ $t('commons.save') }} - {{ $t('organization.integration.cancel_edit') }} - - - {{ $t('organization.integration.cancel_integration') }} - -
- -
-
{{ $t('organization.integration.use_tip') }}
-
- 1. {{ $t('organization.integration.use_tip_tapd') }} -
-
- 2. {{ $t('organization.integration.use_tip_jira') }} -
-
- 3. {{ $t('organization.integration.use_tip_two') }} - - {{ $t('organization.integration.link_the_project_now') }} - -
-
+ + diff --git a/frontend/src/business/components/settings/organization/components/JiraSetting.vue b/frontend/src/business/components/settings/organization/components/JiraSetting.vue new file mode 100644 index 0000000000..08c721631e --- /dev/null +++ b/frontend/src/business/components/settings/organization/components/JiraSetting.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/frontend/src/business/components/settings/organization/components/TapdSetting.vue b/frontend/src/business/components/settings/organization/components/TapdSetting.vue new file mode 100644 index 0000000000..73d78240c5 --- /dev/null +++ b/frontend/src/business/components/settings/organization/components/TapdSetting.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue new file mode 100644 index 0000000000..54cce82a5e --- /dev/null +++ b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/frontend/src/common/js/constants.js b/frontend/src/common/js/constants.js index 72882106ac..4342253b7d 100644 --- a/frontend/src/common/js/constants.js +++ b/frontend/src/common/js/constants.js @@ -20,6 +20,10 @@ export const ZH_CN = 'zh_CN'; export const ZH_TW = 'zh_TW'; export const EN_US = 'en_US'; +export const TAPD = 'Tapd'; +export const JIRA = 'Jira'; +export const ZEN_TAO = 'Zentao'; + export const SCHEDULE_TYPE = { API_TEST: 'API_TEST', PERFORMANCE_TEST: 'PERFORMANCE_TEST' From 1ed403f92aee587d16324e850f15b363fb187e8a Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 11 Nov 2020 15:45:46 +0800 Subject: [PATCH 13/19] refactor: i18n --- .../organization/components/JiraSetting.vue | 15 +++++------- .../organization/components/TapdSetting.vue | 9 +++----- .../organization/components/ZentaoSetting.vue | 23 ++++++++----------- frontend/src/i18n/en-US.js | 7 ++++++ frontend/src/i18n/zh-CN.js | 7 ++++++ frontend/src/i18n/zh-TW.js | 7 ++++++ 6 files changed, 40 insertions(+), 28 deletions(-) diff --git a/frontend/src/business/components/settings/organization/components/JiraSetting.vue b/frontend/src/business/components/settings/organization/components/JiraSetting.vue index 08c721631e..77db317592 100644 --- a/frontend/src/business/components/settings/organization/components/JiraSetting.vue +++ b/frontend/src/business/components/settings/organization/components/JiraSetting.vue @@ -3,10 +3,10 @@
{{ $t('organization.integration.basic_auth_info') }}
- + - + @@ -53,9 +53,6 @@ export default { created() { this.init(); }, - beforeDestroy() { - console.log("jira setting destroy"); - }, data() { return { show: true, @@ -73,12 +70,12 @@ export default { }, url: { required: true, - message: this.$t('organization.integration.input_api_password'), + message: this.$t('organization.integration.input_jira_url'), trigger: ['change', 'blur'] }, issuetype: { required: true, - message: this.$t('organization.integration.input_api_password'), + message: this.$t('organization.integration.input_jira_issuetype'), trigger: ['change', 'blur'] } }, @@ -86,9 +83,9 @@ export default { }, methods: { init() { + const {lastOrganizationId} = getCurrentUser(); let param = {}; param.platform = JIRA; - const {lastOrganizationId} = getCurrentUser(); param.orgId = lastOrganizationId; this.$parent.result = this.$post("service/integration/type", param, response => { let data = response.data; @@ -159,8 +156,8 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - let param = {}; const {lastOrganizationId} = getCurrentUser(); + let param = {}; param.orgId = lastOrganizationId; param.platform = JIRA; this.$parent.result = this.$post("service/integration/delete", param, () => { diff --git a/frontend/src/business/components/settings/organization/components/TapdSetting.vue b/frontend/src/business/components/settings/organization/components/TapdSetting.vue index 73d78240c5..cefa7dc86e 100644 --- a/frontend/src/business/components/settings/organization/components/TapdSetting.vue +++ b/frontend/src/business/components/settings/organization/components/TapdSetting.vue @@ -49,9 +49,6 @@ export default { created() { this.init(); }, - beforeDestroy() { - console.log("tapd setting destroy"); - }, data() { return { show: true, @@ -72,9 +69,9 @@ export default { }, methods: { init() { + const {lastOrganizationId} = getCurrentUser(); let param = {}; param.platform = TAPD; - const {lastOrganizationId} = getCurrentUser(); param.orgId = lastOrganizationId; this.$parent.result = this.$post("service/integration/type", param, response => { let data = response.data; @@ -87,7 +84,7 @@ export default { } }) }, - save: function () { + save() { this.$refs['form'].validate(valid => { if (valid) { @@ -137,8 +134,8 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - let param = {}; const {lastOrganizationId} = getCurrentUser(); + let param = {}; param.orgId = lastOrganizationId; param.platform = TAPD; this.$parent.result = this.$post("service/integration/delete", param, () => { diff --git a/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue index 54cce82a5e..64f9b5205f 100644 --- a/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue +++ b/frontend/src/business/components/settings/organization/components/ZentaoSetting.vue @@ -3,12 +3,12 @@
{{ $t('organization.integration.basic_auth_info') }}
- - + + - + + :placeholder="$t('organization.integration.input_app_key')" show-password/>
@@ -24,7 +24,7 @@
{{ $t('organization.integration.use_tip') }}
- 1. {{ $t('organization.integration.use_tip_tapd') }} + 1. {{ $t('organization.integration.use_tip_zentao') }}
2. {{ $t('organization.integration.use_tip_two') }} @@ -49,9 +49,6 @@ export default { created() { this.init(); }, - beforeDestroy() { - console.log("zentao setting destroy"); - }, data() { return { show: true, @@ -59,12 +56,12 @@ export default { rules: { account: { required: true, - message: this.$t('organization.integration.input_api_account'), + message: this.$t('organization.integration.input_app_name'), trigger: ['change', 'blur'] }, password: { required: true, - message: this.$t('organization.integration.input_api_password'), + message: this.$t('organization.integration.input_app_key'), trigger: ['change', 'blur'] } }, @@ -75,12 +72,12 @@ export default { this.$refs['form'].validate(valid => { if (valid) { + const {lastOrganizationId} = getCurrentUser(); let param = {}; let auth = { account: this.form.account, password: this.form.password, }; - const {lastOrganizationId} = getCurrentUser(); param.organizationId = lastOrganizationId; param.platform = ZEN_TAO; param.configuration = JSON.stringify(auth); @@ -99,9 +96,9 @@ export default { }) }, init() { + const {lastOrganizationId} = getCurrentUser(); let param = {}; param.platform = ZEN_TAO; - const {lastOrganizationId} = getCurrentUser(); param.orgId = lastOrganizationId; this.$parent.result = this.$post("service/integration/type", param, response => { let data = response.data; @@ -137,8 +134,8 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - let param = {}; const {lastOrganizationId} = getCurrentUser(); + let param = {}; param.orgId = lastOrganizationId; param.platform = ZEN_TAO; this.$parent.result = this.$post("service/integration/delete", param, () => { diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 2d61eb2afc..2fbdc80cc1 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -250,15 +250,22 @@ export default { basic_auth_info: 'Basic Auth account information:', api_account: 'API account', api_password: 'API password', + app_name: 'APP name', + app_key: 'APP key', + account: 'Account', + password: 'Password', jira_url: 'JIRA url', jira_issuetype: 'JIRA issuetype', input_api_account: 'please enter account', input_api_password: 'Please enter password', + input_app_name: 'Please enter the application code', + input_app_key: 'Please enter the key', input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/', input_jira_issuetype: 'Please enter the question type', use_tip: 'Usage guidelines:', use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"', use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)', + use_tip_zentao: 'Log in to ZenTao as a super administrator user, enter the background-secondary development-application, click [Add Application] to add an application', use_tip_two: 'After saving the Basic Auth account information, you need to manually associate the ID/key in the Metersphere project', link_the_project_now: 'Link the project now', cancel_edit: 'Cancel edit', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 14b8c2292c..b77911f571 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -250,15 +250,22 @@ export default { basic_auth_info: 'Basic Auth 账号信息:', api_account: 'API 账号', api_password: 'API 口令', + app_name: '应用代号', + app_key: '密钥', + account: '账号', + password: '密码', jira_url: 'JIRA 地址', jira_issuetype: '问题类型', input_api_account: '请输入账号', input_api_password: '请输入口令', + input_app_name: '请输入应用代号', + input_app_key: '请输入密钥', input_jira_url: '请输入Jira地址,例:https://metersphere.atlassian.net/', input_jira_issuetype: '请输入问题类型', use_tip: '使用指引:', use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询', use_tip_jira: 'Jira software server 认证信息为 账号密码,Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)', + use_tip_zentao: '用超级管理员用户登录禅道,进入后台-二次开发-应用,点击【添加应用】新增一个应用', use_tip_two: '保存 Basic Auth 账号信息后,需要在 Metersphere 项目中手动关联 ID/key', link_the_project_now: '马上关联项目', cancel_edit: '取消编辑', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index bed8f7a34c..43cc46c469 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -252,15 +252,22 @@ export default { basic_auth_info: 'Basic Auth 賬號信息:', api_account: 'API 賬號', api_password: 'API 口令', + app_name: '應用代號', + app_key: '密鑰', + account: '賬號', + password: '密碼', jira_url: 'JIRA 地址', jira_issuetype: '問題類型', input_api_account: '請輸入賬號', input_api_password: '請輸入口令', + input_app_name: '請輸入應用代號', + input_app_key: '請輸入密鑰', input_jira_url: '請輸入Jira地址,例:https://metersphere.atlassian.net/', input_jira_issuetype: '請輸入問題類型', use_tip: '使用指引:', use_tip_tapd: 'Tapd Basic Auth 賬號信息在"公司管理-安全與集成-開放平臺"中查詢', use_tip_jira: 'Jira software server 認證信息為 賬號密碼,Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)', + use_tip_zentao: '用超級管理員用戶登錄禪道,進入後台-二次開發-應用,點擊【添加應用】添加一個應用', use_tip_two: '保存 Basic Auth 賬號信息後,需要在 Metersphere 項目中手動關聯 ID/key', link_the_project_now: '馬上關聯項目', cancel_edit: '取消編輯', From 8394d880931ac53b079ba17e857dfba574347db2 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 11 Nov 2020 16:02:36 +0800 Subject: [PATCH 14/19] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/performance/router.js | 10 +-- ...ceTestPlan.vue => EditPerformanceTest.vue} | 62 +++++++++---------- ...ceTestPlan.vue => PerformanceTestList.vue} | 20 +++--- .../components/PerformanceBasicConfig.vue | 16 ++--- .../components/PerformancePressureConfig.vue | 16 +++-- .../performance/test/model/ThreadGroup.js | 10 +++ .../comonents/test/PerformanceTestDetail.vue | 37 +++++------ 7 files changed, 94 insertions(+), 77 deletions(-) rename frontend/src/business/components/performance/test/{EditPerformanceTestPlan.vue => EditPerformanceTest.vue} (83%) rename frontend/src/business/components/performance/test/{PerformanceTestPlan.vue => PerformanceTestList.vue} (93%) diff --git a/frontend/src/business/components/performance/router.js b/frontend/src/business/components/performance/router.js index d16b239673..8c4197e01d 100644 --- a/frontend/src/business/components/performance/router.js +++ b/frontend/src/business/components/performance/router.js @@ -2,8 +2,8 @@ import MsProject from "@/business/components/project/MsProject"; const PerformanceTest = () => import('@/business/components/performance/PerformanceTest') const PerformanceTestHome = () => import('@/business/components/performance/home/PerformanceTestHome') -const EditPerformanceTestPlan = () => import('@/business/components/performance/test/EditPerformanceTestPlan') -const PerformanceTestPlan = () => import('@/business/components/performance/test/PerformanceTestPlan') +const EditPerformanceTest = () => import('@/business/components/performance/test/EditPerformanceTest') +const PerformanceTestList = () => import('@/business/components/performance/test/PerformanceTestList') const PerformanceTestReport = () => import('@/business/components/performance/report/PerformanceTestReport') const PerformanceChart = () => import('@/business/components/performance/report/components/PerformanceChart') const PerformanceReportView = () => import('@/business/components/performance/report/PerformanceReportView') @@ -24,12 +24,12 @@ export default { { path: 'test/create', name: "createPerTest", - component: EditPerformanceTestPlan, + component: EditPerformanceTest, }, { path: "test/edit/:testId", name: "editPerTest", - component: EditPerformanceTestPlan, + component: EditPerformanceTest, props: { content: (route) => { return { @@ -41,7 +41,7 @@ export default { { path: "test/:projectId", name: "perPlan", - component: PerformanceTestPlan + component: PerformanceTestList }, { path: "project/:type", diff --git a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue similarity index 83% rename from frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue rename to frontend/src/business/components/performance/test/EditPerformanceTest.vue index f4b652cba5..baf4c660ca 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -4,12 +4,12 @@ -