Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ab57c77967
|
@ -60,5 +60,5 @@ jobs:
|
|||
username: metersphere
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
repository: metersphere/metersphere
|
||||
tag_with_ref: true
|
||||
tags: ${{ env.GITHUB_REF_SLUG }}
|
||||
build_args: MS_VERSION=${{ env.GITHUB_REF_SLUG }}-${{ env.GITHUB_SHA_SHORT }}
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.ReferenceDTO;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
|
@ -93,5 +95,9 @@ public class ApiDefinitionController {
|
|||
return apiDefinitionService.apiTestImport(file, request);
|
||||
}
|
||||
|
||||
@PostMapping("/getReference")
|
||||
public ReferenceDTO getReference(@RequestBody ApiScenarioRequest request) {
|
||||
return apiDefinitionService.getReference(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.request.assertions.MsAssertions;
|
||||
import io.metersphere.api.dto.definition.request.auth.MsAuthManager;
|
||||
import io.metersphere.api.dto.definition.request.configurations.MsHeaderManager;
|
||||
|
@ -16,6 +19,9 @@ import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
|||
import io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
|
||||
import io.metersphere.api.dto.definition.request.timer.MsConstantTimer;
|
||||
import io.metersphere.api.service.ApiDefinitionService;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import lombok.Data;
|
||||
import org.apache.jmeter.protocol.http.control.AuthManager;
|
||||
|
@ -50,7 +56,7 @@ import java.util.List;
|
|||
MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, AuthManager.class, MsAssertions.class,
|
||||
MsExtract.class, MsTCPSampler.class, MsDubboSampler.class, MsJDBCSampler.class, MsConstantTimer.class, MsIfController.class, MsScenario.class}, typeKey = "type")
|
||||
@Data
|
||||
public class MsTestElement {
|
||||
public abstract class MsTestElement {
|
||||
private String type;
|
||||
@JSONField(ordinal = 1)
|
||||
private String id;
|
||||
|
@ -106,6 +112,18 @@ public class MsTestElement {
|
|||
return jmeterTestPlanHashTree;
|
||||
}
|
||||
|
||||
public void getRefElement(MsTestElement element) {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {});
|
||||
hashTree.add(element);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,13 @@ public class MsDubboSampler extends MsTestElement {
|
|||
private List<KeyValue> attachmentArgs;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
||||
final HashTree testPlanTree = new ListedHashTree();
|
||||
testPlanTree.add(dubboConfig());
|
||||
tree.set(dubboSample(), testPlanTree);
|
||||
|
|
|
@ -86,6 +86,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
private List<KeyValue> arguments;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
|
||||
sampler.setEnabled(true);
|
||||
sampler.setName(this.getName());
|
||||
|
|
|
@ -40,6 +40,9 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
private String environmentId;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
final HashTree samplerHashTree = tree.add(jdbcSampler());
|
||||
tree.add(jdbcDataSource());
|
||||
tree.add(arguments(this.getName() + " Variables", this.getVariables()));
|
||||
|
|
|
@ -50,6 +50,9 @@ public class MsTCPSampler extends MsTestElement {
|
|||
private String request;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
final HashTree samplerHashTree = new ListedHashTree();
|
||||
samplerHashTree.add(tcpConfig());
|
||||
tree.set(tcpSampler(), samplerHashTree);
|
||||
|
|
|
@ -22,7 +22,6 @@ import io.metersphere.commons.constants.APITestStatus;
|
|||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
|
@ -34,13 +33,11 @@ import org.apache.ibatis.session.SqlSession;
|
|||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.jorphan.collections.ListedHashTree;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -51,6 +48,8 @@ public class ApiAutomationService {
|
|||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private ExtApiScenarioMapper extApiScenarioMapper;
|
||||
@Resource
|
||||
private ApiTagMapper apiTagMapper;
|
||||
|
@ -126,13 +125,13 @@ public class ApiAutomationService {
|
|||
apiScenarioMapper.insert(scenario);
|
||||
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
}
|
||||
|
||||
public void update(SaveApiScenarioRequest request, List<MultipartFile> bodyFiles) {
|
||||
checkNameExist(request);
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
|
||||
final ApiScenario scenario = new ApiScenario();
|
||||
scenario.setId(request.getId());
|
||||
|
@ -177,7 +176,7 @@ public class ApiAutomationService {
|
|||
|
||||
private void checkNameExist(SaveApiScenarioRequest request) {
|
||||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
|
||||
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(request.getId());
|
||||
if (apiScenarioMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("automation_name_already_exists"));
|
||||
}
|
||||
|
@ -194,26 +193,6 @@ public class ApiAutomationService {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
|
||||
if (!bodyUploadIds.isEmpty() && !bodyFiles.isEmpty()) {
|
||||
File testDir = new File(BODY_FILE_DIR);
|
||||
if (!testDir.exists()) {
|
||||
testDir.mkdirs();
|
||||
}
|
||||
for (int i = 0; i < bodyUploadIds.size(); i++) {
|
||||
MultipartFile item = bodyFiles.get(i);
|
||||
File file = new File(BODY_FILE_DIR + "/" + bodyUploadIds.get(i) + "_" + item.getOriginalFilename());
|
||||
try (InputStream in = item.getInputStream(); OutputStream out = new FileOutputStream(file)) {
|
||||
file.createNewFile();
|
||||
FileUtil.copyStream(in, out);
|
||||
} catch (IOException e) {
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(Translator.get("upload_fail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTag(String id) {
|
||||
List<ApiScenario> list = extApiScenarioMapper.selectByTagId(id);
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -264,11 +243,9 @@ public class ApiAutomationService {
|
|||
MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class);
|
||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
new TypeReference<LinkedList<MsTestElement>>() {});
|
||||
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||
new TypeReference<LinkedList<KeyValue>>() {
|
||||
});
|
||||
new TypeReference<LinkedList<KeyValue>>() {});
|
||||
scenario.setHashTree(elements);
|
||||
scenario.setVariables(variables);
|
||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||
|
@ -297,7 +274,7 @@ public class ApiAutomationService {
|
|||
*/
|
||||
public String run(RunDefinitionRequest request, List<MultipartFile> bodyFiles) {
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
EnvironmentConfig envConfig = null;
|
||||
if (request.getEnvironmentId() != null) {
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(request.getEnvironmentId());
|
||||
|
@ -306,8 +283,6 @@ public class ApiAutomationService {
|
|||
ParameterConfig config = new ParameterConfig();
|
||||
config.setConfig(envConfig);
|
||||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||
request.getTestElement().getJmx(hashTree);
|
||||
|
||||
// 调用执行方法
|
||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
|
||||
createAPIReportResult(request.getId(), ReportTriggerMode.MANUAL.name());
|
||||
|
@ -343,6 +318,7 @@ public class ApiAutomationService {
|
|||
.flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||
item.setApiIds(JSON.toJSONString(result));
|
||||
}
|
||||
item.setScenarioIds(null);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
||||
|
@ -356,6 +332,7 @@ public class ApiAutomationService {
|
|||
.flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||
item.setScenarioIds(JSON.toJSONString(result));
|
||||
}
|
||||
item.setApiIds(null);
|
||||
}
|
||||
}
|
||||
mapper.updatePlan(item);
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.ReferenceDTO;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
|
@ -16,6 +18,8 @@ import io.metersphere.base.mapper.ApiDefinitionMapper;
|
|||
import io.metersphere.base.mapper.ApiTestFileMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
|
@ -25,7 +29,8 @@ import io.metersphere.commons.utils.ServiceUtils;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.service.FileService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
|
@ -33,13 +38,15 @@ import org.apache.jorphan.collections.HashTree;
|
|||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.security.util.Cache;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -63,7 +70,9 @@ public class ApiDefinitionService {
|
|||
@Resource
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private ApiModuleService apiModuleService;
|
||||
private ExtApiScenarioMapper extApiScenarioMapper;
|
||||
@Resource
|
||||
private ExtTestPlanMapper extTestPlanMapper;
|
||||
|
||||
private static Cache cache = Cache.newHardMemoryCache(0, 3600 * 24);
|
||||
|
||||
|
@ -96,6 +105,10 @@ public class ApiDefinitionService {
|
|||
return apiDefinitionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public ApiDefinitionWithBLOBs getBLOBs(String id) {
|
||||
return apiDefinitionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void create(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
createTest(request);
|
||||
|
@ -103,15 +116,17 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void update(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
|
||||
deleteFileByTestId(request.getRequest().getId());
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
if (request.getRequest() != null) {
|
||||
deleteFileByTestId(request.getRequest().getId());
|
||||
}
|
||||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
request.setBodyUploadIds(null);
|
||||
updateTest(request);
|
||||
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
}
|
||||
|
||||
private void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
|
||||
if (bodyUploadIds.size() > 0) {
|
||||
public void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
|
||||
if (CollectionUtils.isNotEmpty(bodyUploadIds) && CollectionUtils.isNotEmpty(bodyFiles)) {
|
||||
File testDir = new File(BODY_FILE_DIR);
|
||||
if (!testDir.exists()) {
|
||||
testDir.mkdirs();
|
||||
|
@ -139,10 +154,9 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void deleteBatch(List<String> apiIds) {
|
||||
// 简单处理后续优化
|
||||
apiIds.forEach(item -> {
|
||||
delete(item);
|
||||
});
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
example.createCriteria().andIdIn(apiIds);
|
||||
apiDefinitionMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public void removeToGc(List<String> apiIds) {
|
||||
|
@ -160,14 +174,14 @@ public class ApiDefinitionService {
|
|||
private void checkNameExist(SaveApiDefinitionRequest request) {
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
if (request.getProtocol().equals(RequestType.HTTP)) {
|
||||
example.createCriteria().andMethodEqualTo(request.getMethod())
|
||||
example.createCriteria().andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash")
|
||||
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
|
||||
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
|
||||
if (apiDefinitionMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("api_definition_url_not_repeating"));
|
||||
}
|
||||
} else {
|
||||
example.createCriteria().andProtocolEqualTo(request.getProtocol())
|
||||
example.createCriteria().andProtocolEqualTo(request.getProtocol()).andStatusNotEqualTo("Trash")
|
||||
.andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId())
|
||||
.andIdNotEqualTo(request.getId());
|
||||
if (apiDefinitionMapper.countByExample(example) > 0) {
|
||||
|
@ -176,7 +190,6 @@ public class ApiDefinitionService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private ApiDefinition updateTest(SaveApiDefinitionRequest request) {
|
||||
checkNameExist(request);
|
||||
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
|
||||
|
@ -349,4 +362,13 @@ public class ApiDefinitionService {
|
|||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
public ReferenceDTO getReference(ApiScenarioRequest request) {
|
||||
ReferenceDTO dto = new ReferenceDTO();
|
||||
dto.setScenarioList(extApiScenarioMapper.selectReference(request));
|
||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||
planRequest.setApiId(request.getId());
|
||||
planRequest.setProjectId(request.getProjectId());
|
||||
dto.setTestPlanList(extTestPlanMapper.selectReference(planRequest));
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
<select id="selectReference" resultType="io.metersphere.base.domain.ApiScenario">
|
||||
select * from api_scenario
|
||||
<where>
|
||||
id != #{request.id}
|
||||
<if test="request.workspaceId != null">
|
||||
AND project.workspace_id = #{request.workspaceId}
|
||||
</if>
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-aside-container>
|
||||
<ms-api-scenario-module @selectModule="selectModule" @getApiModuleTree="initTree" @changeProject="changeProject"
|
||||
<ms-api-scenario-module @selectModule="selectModule" @getApiModuleTree="initTree"
|
||||
@refresh="refresh" @saveAsEdit="editScenario"/>
|
||||
</ms-aside-container>
|
||||
<ms-main-container>
|
||||
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
|
||||
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_test')">
|
||||
<ms-api-scenario-list
|
||||
:current-project="currentProject"
|
||||
:current-module="currentModule"
|
||||
@edit="editScenario"
|
||||
ref="apiScenarioList"/>
|
||||
|
@ -21,7 +20,7 @@
|
|||
:name="item.name"
|
||||
closable>
|
||||
<div class="ms-api-scenario-div">
|
||||
<ms-edit-api-scenario :current-project="currentProject" :currentScenario="item.currentScenario" :moduleOptions="moduleOptions"/>
|
||||
<ms-edit-api-scenario :currentScenario="item.currentScenario" :moduleOptions="moduleOptions"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -53,7 +52,6 @@
|
|||
return {
|
||||
isHide: true,
|
||||
activeName: 'default',
|
||||
currentProject: null,
|
||||
currentModule: null,
|
||||
moduleOptions: {},
|
||||
tabs: [],
|
||||
|
@ -102,9 +100,6 @@
|
|||
initTree(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
changeProject(data) {
|
||||
this.currentProject = data;
|
||||
},
|
||||
refresh(data) {
|
||||
this.$refs.apiScenarioList.search(data);
|
||||
},
|
||||
|
|
|
@ -58,9 +58,8 @@
|
|||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import {getCurrentUser, getUUID,getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
name: "MsAddBasisScenario",
|
||||
components: {MsDialogFooter},
|
||||
|
@ -70,7 +69,6 @@ export default {
|
|||
scenarioForm: {},
|
||||
visible: false,
|
||||
currentModule: {},
|
||||
projectId: "",
|
||||
userOptions: [],
|
||||
rule: {
|
||||
name: [
|
||||
|
@ -107,7 +105,7 @@ export default {
|
|||
})
|
||||
},
|
||||
setParameter() {
|
||||
this.scenarioForm.projectId = this.projectId;
|
||||
this.scenarioForm.projectId = getCurrentProjectID();
|
||||
this.scenarioForm.id = getUUID().substring(0, 8);
|
||||
this.scenarioForm.protocol = this.currentProtocol;
|
||||
if (this.currentModule != null) {
|
||||
|
@ -121,10 +119,9 @@ export default {
|
|||
this.userOptions = response.data;
|
||||
});
|
||||
},
|
||||
open(currentModule, projectId) {
|
||||
open(currentModule) {
|
||||
this.scenarioForm = {principal: getCurrentUser().id};
|
||||
this.currentModule = currentModule;
|
||||
this.projectId = projectId;
|
||||
this.getMaintainerOptions();
|
||||
this.visible = true;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,9 @@
|
|||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import {getCurrentUser, getUUID,getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import MsTablePagination from "../../../common/pagination/TablePagination";
|
||||
|
||||
export default {
|
||||
name: "MsAddTag",
|
||||
components: {MsDialogFooter,MsTablePagination},
|
||||
|
@ -94,8 +93,8 @@
|
|||
setParameter() {
|
||||
this.tagForm.projectId = this.projectId;
|
||||
},
|
||||
open(projectId) {
|
||||
this.projectId = projectId;
|
||||
open() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.visible = true;
|
||||
this.initTable();
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
|
||||
@click="active(request)" v-if="request.referenced!=undefined && request.referenced!='Deleted' && request.referenced!='REF'"/>
|
||||
<span>{{request.type!= 'create' ? request.name:''}} </span>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced==='Deleted'" type="danger">引用不存在</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced ==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
|
||||
|
@ -30,9 +30,9 @@
|
|||
</div>
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-api-request-form :headers="request.headers " :request="request" v-if="request.protocol==='HTTP'"/>
|
||||
<ms-tcp-basis-parameters :request="request" :currentProject="currentProject" v-if="request.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="request" :currentProject="currentProject" v-if="request.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="request" :currentProject="currentProject" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'"/>
|
||||
<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'"/>
|
||||
<!-- 保存操作 -->
|
||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">
|
||||
{{$t('commons.save')}}
|
||||
|
@ -55,13 +55,23 @@
|
|||
props: {
|
||||
request: {},
|
||||
node: {},
|
||||
currentProject: {},
|
||||
},
|
||||
components: {MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm},
|
||||
data() {
|
||||
return {loading: false, reqOptions: REQ_METHOD,}
|
||||
},
|
||||
created() {
|
||||
if (this.request.id && this.request.referenced === 'REF') {
|
||||
this.$get("/api/definition/get/" + this.request.id, response => {
|
||||
if (response.data) {
|
||||
this.request.name = response.data.name;
|
||||
this.reload();
|
||||
} else {
|
||||
this.request.referenced = "Deleted";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (this.request.protocol === 'HTTP') {
|
||||
try {
|
||||
let urlObject = new URL(this.request.url);
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
</el-form>
|
||||
<!--不同协议请求-->
|
||||
<ms-debug-http-page :scenario="true" :current-api="request" @saveAs="editApi" :currentProtocol="request.protocol" v-if="request.protocol==='HTTP'"/>
|
||||
<ms-debug-jdbc-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" :currentProject="currentProject" v-if="request.protocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" :currentProject="currentProject" v-if="request.protocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" :currentProject="currentProject" v-if="request.protocol==='DUBBO'"/>
|
||||
|
||||
<ms-debug-jdbc-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='DUBBO'"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -33,7 +32,6 @@
|
|||
name: "ApiCustomize",
|
||||
props: {
|
||||
node: {},
|
||||
currentProject: {},
|
||||
request: {},
|
||||
},
|
||||
components: {MsDebugHttpPage, MsDebugJdbcPage, MsDebugTcpPage, MsDebugDubboPage},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="el-step__icon-inner">{{scenario.index}}</div>
|
||||
</div>
|
||||
<div style="margin-left: 20px;float: left"> {{scenario.name}}</div>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Deleted'" type="danger">引用不存在</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
|
||||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
|
||||
</el-row>
|
||||
|
@ -25,7 +25,6 @@
|
|||
props: {
|
||||
scenario: {},
|
||||
node: {},
|
||||
currentProject: {},
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
|
@ -70,13 +69,6 @@
|
|||
color: #606266;
|
||||
}
|
||||
|
||||
.ms-api-col-create {
|
||||
background-color: #EBF2F2;
|
||||
border-color: #008080;
|
||||
margin-right: 10px;
|
||||
color: #008080;
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
|
|
@ -47,11 +47,17 @@
|
|||
show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
|
||||
<template v-slot:default="{row}">
|
||||
<el-button type="text" @click="edit(row)">{{ $t('api_test.automation.edit') }}</el-button>
|
||||
<el-button type="text" @click="execute(row)">{{ $t('api_test.automation.execute') }}</el-button>
|
||||
<el-button type="text" @click="copy(row)">{{ $t('api_test.automation.copy') }}</el-button>
|
||||
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button>
|
||||
<ms-scenario-extend-buttons :row="row"/>
|
||||
<div v-if="currentModule!=undefined && currentModule.id === 'gc'">
|
||||
<el-button type="text" @click="reductionApi(row)">恢复</el-button>
|
||||
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-button type="text" @click="edit(row)">{{ $t('api_test.automation.edit') }}</el-button>
|
||||
<el-button type="text" @click="execute(row)">{{ $t('api_test.automation.execute') }}</el-button>
|
||||
<el-button type="text" @click="copy(row)">{{ $t('api_test.automation.copy') }}</el-button>
|
||||
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button>
|
||||
<ms-scenario-extend-buttons :row="row"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -60,7 +66,7 @@
|
|||
<div>
|
||||
<!-- 执行结果 -->
|
||||
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="currentProject!=undefined ? currentProject.id:''"/>
|
||||
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
||||
</el-drawer>
|
||||
<!--测试计划-->
|
||||
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||
|
@ -77,7 +83,7 @@
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import MsTag from "../../../common/components/MsTag";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "./TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -87,7 +93,6 @@
|
|||
name: "MsApiScenarioList",
|
||||
components: {MsTablePagination, MsTableMoreBtn, ShowMoreBtn, MsTableHeader, MsTag, MsApiReportDetail, MsScenarioExtendButtons, MsTestPlanList},
|
||||
props: {
|
||||
currentProject: Object,
|
||||
currentModule: Object,
|
||||
referenced: {
|
||||
type: Boolean,
|
||||
|
@ -110,6 +115,7 @@
|
|||
infoDb: false,
|
||||
runVisible: false,
|
||||
planVisible: false,
|
||||
projectId: "",
|
||||
runData: [],
|
||||
buttons: [
|
||||
{
|
||||
|
@ -120,10 +126,11 @@
|
|||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.search();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.search();
|
||||
},
|
||||
currentModule() {
|
||||
this.search();
|
||||
},
|
||||
|
@ -142,8 +149,8 @@
|
|||
this.condition.moduleIds = this.currentModule.ids;
|
||||
}
|
||||
}
|
||||
if (this.currentProject != null) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
if (this.projectId != null) {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
|
||||
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
|
||||
|
@ -202,6 +209,13 @@
|
|||
edit(row) {
|
||||
this.$emit('edit', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
let obj = {id: row.id, projectId: row.projectId, name: row.name, status: 'Underway'}
|
||||
this.$fileUpload("/api/automation/update", null, [], obj, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
})
|
||||
},
|
||||
execute(row) {
|
||||
this.infoDb = false;
|
||||
let url = "/api/automation/run";
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<template>
|
||||
<div>
|
||||
<select-menu
|
||||
:data="projects"
|
||||
:current-data="currentProject"
|
||||
:title="$t('test_track.project')"
|
||||
@dataChange="changeProject" style="margin-bottom: 20px"/>
|
||||
<el-input style="width: 275px;" :placeholder="$t('test_track.module.search')" v-model="filterText"
|
||||
size="small">
|
||||
<template v-slot:append>
|
||||
|
@ -81,381 +76,365 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: 'MsApiScenarioModule',
|
||||
components: {
|
||||
MsAddBasisScenario,
|
||||
SelectMenu,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
httpVisible: false,
|
||||
expandedNode: [],
|
||||
filterText: "",
|
||||
nextFlag: true,
|
||||
currentProject: {},
|
||||
projects: [],
|
||||
currentModule: {},
|
||||
newLabel: "",
|
||||
data: [{
|
||||
"id": "gc",
|
||||
"name": "回收站",
|
||||
"level": 1,
|
||||
"children": [],
|
||||
}, {
|
||||
"id": "root",
|
||||
"name": "默认模块",
|
||||
"level": 0,
|
||||
"children": [],
|
||||
}]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getProjects();
|
||||
this.changeProtocol();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.getApiModuleTree();
|
||||
this.$emit('changeProject', this.currentProject);
|
||||
export default {
|
||||
name: 'MsApiScenarioModule',
|
||||
components: {
|
||||
MsAddBasisScenario,
|
||||
SelectMenu,
|
||||
},
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getApiModuleTree() {
|
||||
if (this.currentProject) {
|
||||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
}
|
||||
this.$get("/api/automation/module/list/" + this.currentProject.id, response => {
|
||||
if (response.data !== undefined && response.data !== null) {
|
||||
this.data[1].children = response.data;
|
||||
let moduleOptions = [];
|
||||
this.data[1].children.forEach(node => {
|
||||
this.buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.$emit('getApiModuleTree', moduleOptions);
|
||||
data() {
|
||||
return {
|
||||
httpVisible: false,
|
||||
expandedNode: [],
|
||||
filterText: "",
|
||||
nextFlag: true,
|
||||
currentModule: {},
|
||||
newLabel: "",
|
||||
data: [{
|
||||
"id": "gc",
|
||||
"name": "回收站",
|
||||
"level": 1,
|
||||
"children": [],
|
||||
}, {
|
||||
"id": "root",
|
||||
"name": "默认模块",
|
||||
"level": 0,
|
||||
"children": [],
|
||||
}]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.changeProtocol();
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getApiModuleTree() {
|
||||
let projectId = getCurrentProjectID();
|
||||
if (projectId) {
|
||||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
buildNodePath(node, option, moduleOptions) {
|
||||
//递归构建节点路径
|
||||
option.id = node.id;
|
||||
option.path = option.path + '/' + node.name;
|
||||
node.path = option.path;
|
||||
moduleOptions.push(option);
|
||||
if (node.children) {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
this.buildNodePath(node.children[i], {path: option.path}, moduleOptions);
|
||||
this.$get("/api/automation/module/list/" + projectId, response => {
|
||||
if (response.data !== undefined && response.data !== null) {
|
||||
this.data[1].children = response.data;
|
||||
let moduleOptions = [];
|
||||
this.data[1].children.forEach(node => {
|
||||
this.buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.$emit('getApiModuleTree', moduleOptions);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
findTreeByNodeId(rootNode, nodeId) {
|
||||
if (rootNode.id === nodeId) {
|
||||
return rootNode;
|
||||
}
|
||||
if (rootNode.children) {
|
||||
for (let i = 0; i < rootNode.children.length; i++) {
|
||||
if (this.findTreeByNodeId(rootNode.children[i], nodeId)) {
|
||||
return rootNode;
|
||||
},
|
||||
buildNodePath(node, option, moduleOptions) {
|
||||
//递归构建节点路径
|
||||
option.id = node.id;
|
||||
option.path = option.path + '/' + node.name;
|
||||
node.path = option.path;
|
||||
moduleOptions.push(option);
|
||||
if (node.children) {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
this.buildNodePath(node.children[i], {path: option.path}, moduleOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
buildParam(draggingNode, dropNode, dropType) {
|
||||
let param = {};
|
||||
param.id = draggingNode.data.id;
|
||||
param.name = draggingNode.data.name;
|
||||
param.projectId = draggingNode.data.projectId;
|
||||
if (dropType === "inner") {
|
||||
param.parentId = dropNode.data.id;
|
||||
param.level = dropNode.data.level;
|
||||
} else {
|
||||
if (!dropNode.parent.id || dropNode.parent.id === 0) {
|
||||
param.parentId = 0;
|
||||
param.level = 1;
|
||||
},
|
||||
findTreeByNodeId(rootNode, nodeId) {
|
||||
if (rootNode.id === nodeId) {
|
||||
return rootNode;
|
||||
}
|
||||
if (rootNode.children) {
|
||||
for (let i = 0; i < rootNode.children.length; i++) {
|
||||
if (this.findTreeByNodeId(rootNode.children[i], nodeId)) {
|
||||
return rootNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
buildParam(draggingNode, dropNode, dropType) {
|
||||
let param = {};
|
||||
param.id = draggingNode.data.id;
|
||||
param.name = draggingNode.data.name;
|
||||
param.projectId = draggingNode.data.projectId;
|
||||
if (dropType === "inner") {
|
||||
param.parentId = dropNode.data.id;
|
||||
param.level = dropNode.data.level;
|
||||
} else {
|
||||
param.parentId = dropNode.parent.data.id;
|
||||
param.level = dropNode.parent.data.level;
|
||||
}
|
||||
}
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(draggingNode.data, nodeIds);
|
||||
if (dropNode.level === 1 && dropType !== "inner") {
|
||||
param.nodeTree = draggingNode.data;
|
||||
} else {
|
||||
for (let i = 0; i < this.data.length; i++) {
|
||||
param.nodeTree = this.findTreeByNodeId(this.data[i], dropNode.data.id);
|
||||
if (param.nodeTree) {
|
||||
break;
|
||||
if (!dropNode.parent.id || dropNode.parent.id === 0) {
|
||||
param.parentId = 0;
|
||||
param.level = 1;
|
||||
} else {
|
||||
param.parentId = dropNode.parent.data.id;
|
||||
param.level = dropNode.parent.data.level;
|
||||
}
|
||||
}
|
||||
}
|
||||
param.nodeIds = nodeIds;
|
||||
return param;
|
||||
},
|
||||
getTreeNode(nodes, id, list) {
|
||||
if (!nodes) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].id === id) {
|
||||
i - 1 >= 0 ? list[0] = nodes[i - 1].id : list[0] = "";
|
||||
list[1] = nodes[i].id;
|
||||
i + 1 < nodes.length ? list[2] = nodes[i + 1].id : list[2] = "";
|
||||
return;
|
||||
}
|
||||
if (nodes[i].children) {
|
||||
this.getTreeNode(nodes[i].children, id, list);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType) {
|
||||
if (dropNode.data.id === "root" || dropType === "none" || dropType === undefined) {
|
||||
return;
|
||||
}
|
||||
let param = this.buildParam(draggingNode, dropNode, dropType);
|
||||
|
||||
this.list = [];
|
||||
if (param.parentId === "root") {
|
||||
param.parentId = null;
|
||||
}
|
||||
this.getTreeNode(this.data, draggingNode.data.id, this.list);
|
||||
|
||||
this.$post("/api/automation/module/drag", param, () => {
|
||||
this.getApiModuleTree();
|
||||
}, () => {
|
||||
this.getApiModuleTree();
|
||||
});
|
||||
},
|
||||
|
||||
allowDrop(draggingNode, dropNode) {
|
||||
return dropNode.data.id !== "root";
|
||||
},
|
||||
allowDrag(draggingNode) {
|
||||
// 顶层默认分组不允许拖拽
|
||||
return draggingNode.data.id !== "root";
|
||||
},
|
||||
append(node, data) {
|
||||
if (this.nextFlag === true) {
|
||||
const newChild = {
|
||||
id: "newId",
|
||||
isEdit: 0,
|
||||
name: "",
|
||||
children: []
|
||||
}
|
||||
if (!data.children) {
|
||||
this.$set(data, 'children', [])
|
||||
}
|
||||
this.nextFlag = false;
|
||||
data.children.push(newChild)
|
||||
this.edit(node, newChild);
|
||||
} else {
|
||||
this.$message.warning(this.$t('commons.please_save'));
|
||||
}
|
||||
},
|
||||
|
||||
remove(node, data) {
|
||||
if (data.name === "") {
|
||||
this.nextFlag = true;
|
||||
}
|
||||
let delIds = [];
|
||||
this.getChildNodeId(data, delIds);
|
||||
delIds.push(data.id);
|
||||
this.$post("/api/automation/module/delete", delIds, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
// 移除节点
|
||||
const parent = node.parent
|
||||
const children = parent.data.children || parent.data
|
||||
const index = children.findIndex(d => d.id !== undefined && data.id !== undefined && d.id === data.id)
|
||||
children.splice(index, 1);
|
||||
});
|
||||
},
|
||||
|
||||
edit(node, data) {
|
||||
this.$set(data, 'isEdit', 1)
|
||||
this.newLabel = data.name
|
||||
this.$nextTick(() => {
|
||||
})
|
||||
},
|
||||
|
||||
submitEdit(node, data) {
|
||||
// 触发了保存按钮
|
||||
if (this.newLabel === "") {
|
||||
this.nextFlag = false;
|
||||
this.$message.warning(this.$t('commons.input_name'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.$set(data, 'name', this.newLabel)
|
||||
let flag = this.editApiModule(node, data);
|
||||
if (flag === false) {
|
||||
this.$set(data, 'isEdit', 1)
|
||||
return;
|
||||
}
|
||||
this.$set(data, 'isEdit', 0)
|
||||
this.newLabel = ""
|
||||
this.nextFlag = true;
|
||||
},
|
||||
|
||||
cancelEdit(node, data) {
|
||||
this.newLabel = ""
|
||||
this.$set(data, 'isEdit', 0)
|
||||
},
|
||||
|
||||
getChildNodeId(rootNode, nodeIds) {
|
||||
//递归获取所有子节点ID
|
||||
nodeIds.push(rootNode.id);
|
||||
this.nodePath += rootNode.name + "/";
|
||||
if (rootNode.children) {
|
||||
for (let i = 0; i < rootNode.children.length; i++) {
|
||||
this.getChildNodeId(rootNode.children[i], nodeIds);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 保存或修改
|
||||
editApiModule(node, data) {
|
||||
if (!this.currentProject) {
|
||||
this.$error("$t('api_test.select_project')");
|
||||
return;
|
||||
}
|
||||
let url = "";
|
||||
if (data.id === "newId") {
|
||||
url = '/api/automation/module/add';
|
||||
data.level = 1;
|
||||
if (node.parent && node.parent.key !== "root") {
|
||||
data.parentId = node.parent.key;
|
||||
data.level = node.parent.level;
|
||||
}
|
||||
} else {
|
||||
url = '/api/automation/module/edit';
|
||||
let ids = [];
|
||||
this.getChildNodeId(data, ids);
|
||||
data.nodeIds = ids;
|
||||
}
|
||||
data.protocol = this.protocol;
|
||||
data.projectId = this.currentProject.id;
|
||||
this.$post(url, data, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.getApiModuleTree();
|
||||
this.nextFlag = true;
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
selectModule(data) {
|
||||
if (data.id !== "root") {
|
||||
if (data.path !== undefined && !data.path.startsWith("/")) {
|
||||
data.path = "/" + data.path;
|
||||
}
|
||||
if (data.path !== undefined && data.path.endsWith("/")) {
|
||||
data.path = data.path.substr(0, data.path.length - 1);
|
||||
}
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(data, nodeIds);
|
||||
data.ids = nodeIds;
|
||||
this.currentModule = data;
|
||||
}
|
||||
this.$emit('selectModule', data);
|
||||
},
|
||||
refresh(data) {
|
||||
this.$emit('refresh', data);
|
||||
},
|
||||
saveAsEdit(data) {
|
||||
this.$emit('saveAsEdit', data);
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
addScenario() {
|
||||
this.$refs.basisScenario.open(this.currentModule, this.currentProject.id);
|
||||
},
|
||||
// 项目相关方法
|
||||
changeProject(project) {
|
||||
this.currentProject = project;
|
||||
},
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projects = response.data;
|
||||
if (this.projects.length > 0) {
|
||||
this.currentProject = this.projects[0];
|
||||
this.getChildNodeId(draggingNode.data, nodeIds);
|
||||
if (dropNode.level === 1 && dropType !== "inner") {
|
||||
param.nodeTree = draggingNode.data;
|
||||
} else {
|
||||
for (let i = 0; i < this.data.length; i++) {
|
||||
param.nodeTree = this.findTreeByNodeId(this.data[i], dropNode.data.id);
|
||||
if (param.nodeTree) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
this.expandedNode.push(data.id);
|
||||
param.nodeIds = nodeIds;
|
||||
return param;
|
||||
},
|
||||
getTreeNode(nodes, id, list) {
|
||||
if (!nodes) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].id === id) {
|
||||
i - 1 >= 0 ? list[0] = nodes[i - 1].id : list[0] = "";
|
||||
list[1] = nodes[i].id;
|
||||
i + 1 < nodes.length ? list[2] = nodes[i + 1].id : list[2] = "";
|
||||
return;
|
||||
}
|
||||
if (nodes[i].children) {
|
||||
this.getTreeNode(nodes[i].children, id, list);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType) {
|
||||
if (dropNode.data.id === "root" || dropType === "none" || dropType === undefined) {
|
||||
return;
|
||||
}
|
||||
let param = this.buildParam(draggingNode, dropNode, dropType);
|
||||
|
||||
this.list = [];
|
||||
if (param.parentId === "root") {
|
||||
param.parentId = null;
|
||||
}
|
||||
this.getTreeNode(this.data, draggingNode.data.id, this.list);
|
||||
|
||||
this.$post("/api/automation/module/drag", param, () => {
|
||||
this.getApiModuleTree();
|
||||
}, () => {
|
||||
this.getApiModuleTree();
|
||||
});
|
||||
},
|
||||
|
||||
allowDrop(draggingNode, dropNode) {
|
||||
return dropNode.data.id !== "root";
|
||||
},
|
||||
allowDrag(draggingNode) {
|
||||
// 顶层默认分组不允许拖拽
|
||||
return draggingNode.data.id !== "root";
|
||||
},
|
||||
append(node, data) {
|
||||
if (this.nextFlag === true) {
|
||||
const newChild = {
|
||||
id: "newId",
|
||||
isEdit: 0,
|
||||
name: "",
|
||||
children: []
|
||||
}
|
||||
if (!data.children) {
|
||||
this.$set(data, 'children', [])
|
||||
}
|
||||
this.nextFlag = false;
|
||||
data.children.push(newChild)
|
||||
this.edit(node, newChild);
|
||||
} else {
|
||||
this.$message.warning(this.$t('commons.please_save'));
|
||||
}
|
||||
},
|
||||
|
||||
remove(node, data) {
|
||||
if (data.name === "") {
|
||||
this.nextFlag = true;
|
||||
}
|
||||
let delIds = [];
|
||||
this.getChildNodeId(data, delIds);
|
||||
delIds.push(data.id);
|
||||
this.$post("/api/automation/module/delete", delIds, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
// 移除节点
|
||||
const parent = node.parent
|
||||
const children = parent.data.children || parent.data
|
||||
const index = children.findIndex(d => d.id !== undefined && data.id !== undefined && d.id === data.id)
|
||||
children.splice(index, 1);
|
||||
});
|
||||
},
|
||||
|
||||
edit(node, data) {
|
||||
this.$set(data, 'isEdit', 1)
|
||||
this.newLabel = data.name
|
||||
this.$nextTick(() => {
|
||||
})
|
||||
},
|
||||
|
||||
submitEdit(node, data) {
|
||||
// 触发了保存按钮
|
||||
if (this.newLabel === "") {
|
||||
this.nextFlag = false;
|
||||
this.$message.warning(this.$t('commons.input_name'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.$set(data, 'name', this.newLabel)
|
||||
let flag = this.editApiModule(node, data);
|
||||
if (flag === false) {
|
||||
this.$set(data, 'isEdit', 1)
|
||||
return;
|
||||
}
|
||||
this.$set(data, 'isEdit', 0)
|
||||
this.newLabel = ""
|
||||
this.nextFlag = true;
|
||||
},
|
||||
|
||||
cancelEdit(node, data) {
|
||||
this.newLabel = ""
|
||||
this.$set(data, 'isEdit', 0)
|
||||
},
|
||||
|
||||
getChildNodeId(rootNode, nodeIds) {
|
||||
//递归获取所有子节点ID
|
||||
nodeIds.push(rootNode.id);
|
||||
this.nodePath += rootNode.name + "/";
|
||||
if (rootNode.children) {
|
||||
for (let i = 0; i < rootNode.children.length; i++) {
|
||||
this.getChildNodeId(rootNode.children[i], nodeIds);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 保存或修改
|
||||
editApiModule(node, data) {
|
||||
let projectId = getCurrentProjectID();
|
||||
if (!projectId) {
|
||||
this.$error("$t('api_test.select_project')");
|
||||
return;
|
||||
}
|
||||
let url = "";
|
||||
if (data.id === "newId") {
|
||||
url = '/api/automation/module/add';
|
||||
data.level = 1;
|
||||
if (node.parent && node.parent.key !== "root") {
|
||||
data.parentId = node.parent.key;
|
||||
data.level = node.parent.level;
|
||||
}
|
||||
} else {
|
||||
url = '/api/automation/module/edit';
|
||||
let ids = [];
|
||||
this.getChildNodeId(data, ids);
|
||||
data.nodeIds = ids;
|
||||
}
|
||||
data.protocol = this.protocol;
|
||||
data.projectId = projectId;
|
||||
this.$post(url, data, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.getApiModuleTree();
|
||||
this.nextFlag = true;
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
selectModule(data) {
|
||||
if (data.id !== "root") {
|
||||
if (data.path !== undefined && !data.path.startsWith("/")) {
|
||||
data.path = "/" + data.path;
|
||||
}
|
||||
if (data.path !== undefined && data.path.endsWith("/")) {
|
||||
data.path = data.path.substr(0, data.path.length - 1);
|
||||
}
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(data, nodeIds);
|
||||
data.ids = nodeIds;
|
||||
this.currentModule = data;
|
||||
}
|
||||
this.$emit('selectModule', data);
|
||||
},
|
||||
refresh(data) {
|
||||
this.$emit('refresh', data);
|
||||
},
|
||||
saveAsEdit(data) {
|
||||
this.$emit('saveAsEdit', data);
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
addScenario() {
|
||||
this.$refs.basisScenario.open(this.currentModule);
|
||||
},
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
this.expandedNode.push(data.id);
|
||||
}
|
||||
},
|
||||
nodeCollapse(data) {
|
||||
if (data.id) {
|
||||
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
|
||||
}
|
||||
},
|
||||
changeProtocol() {
|
||||
this.getApiModuleTree();
|
||||
this.$emit('changeProtocol', this.protocol);
|
||||
}
|
||||
},
|
||||
nodeCollapse(data) {
|
||||
if (data.id) {
|
||||
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
|
||||
}
|
||||
},
|
||||
changeProtocol() {
|
||||
this.getApiModuleTree();
|
||||
this.$emit('changeProtocol', this.protocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.node-tree {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.node-tree {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.ms-el-input {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.ms-el-input {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.custom-tree-node {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
.custom-tree-node {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.father .child {
|
||||
display: none;
|
||||
}
|
||||
.father .child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.father:hover .child {
|
||||
display: block;
|
||||
}
|
||||
.father:hover .child {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.node-title {
|
||||
width: 0;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1 1 auto;
|
||||
padding: 0 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.node-title {
|
||||
width: 0;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1 1 auto;
|
||||
padding: 0 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.node-operate > i {
|
||||
color: #409eff;
|
||||
margin: 0 5px;
|
||||
}
|
||||
.node-operate > i {
|
||||
color: #409eff;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
/deep/ .el-tree-node__content {
|
||||
height: 33px;
|
||||
}
|
||||
/deep/ .el-tree-node__content {
|
||||
height: 33px;
|
||||
}
|
||||
|
||||
.ms-api-buttion {
|
||||
width: 30px;
|
||||
}
|
||||
.ms-api-buttion {
|
||||
width: 30px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
<!--提取规则-->
|
||||
<ms-api-extract @remove="remove" v-if="data.type==='Extract'" customizeStyle="margin-top: 0px" :extract="data" :node="node"/>
|
||||
<!--API 导入 -->
|
||||
<ms-api-component :request="data" @remove="remove" current-project="currentProject" v-if="data.type==='HTTPSamplerProxy'||data.type==='DubboSampler'||data.type==='JDBCSampler'||data.type==='TCPSampler'" :node="node"/>
|
||||
<ms-api-component :request="data" @remove="remove" v-if="data.type==='HTTPSamplerProxy'||data.type==='DubboSampler'||data.type==='JDBCSampler'||data.type==='TCPSampler'" :node="node"/>
|
||||
</template>
|
||||
</span>
|
||||
</el-tree>
|
||||
|
@ -239,13 +239,13 @@
|
|||
<!--接口列表-->
|
||||
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.api_list_import')" :modal="false" size="90%">
|
||||
<ms-api-definition :visible="true" :currentRow="currentRow"/>
|
||||
<!--<el-button style="float: right;margin: 20px" type="primary" @click="copyApi('REF')">{{$t('api_test.scenario.reference')}}</el-button>-->
|
||||
<el-button style="float: right;margin: 20px 0px 0px " type="primary" @click="copyApi('Copy')">{{ $t('commons.copy') }}</el-button>
|
||||
<el-button style="float: right;margin: 0px 20px 0px" type="primary" @click="copyApi('REF')">{{$t('api_test.scenario.reference')}}</el-button>
|
||||
<el-button style="float: right;" type="primary" @click="copyApi('Copy')">{{ $t('commons.copy') }}</el-button>
|
||||
</el-drawer>
|
||||
|
||||
<!--自定义接口-->
|
||||
<el-drawer :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.customize_req')" style="overflow: auto" :modal="false" size="90%">
|
||||
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi" :current-project="currentProject"/>
|
||||
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi" />
|
||||
<!--<el-button style="float: right;margin: 20px" @click="addCustomizeApi">{{$t('commons.save')}}</el-button>-->
|
||||
</el-drawer>
|
||||
<!--场景导入 -->
|
||||
|
@ -263,7 +263,7 @@
|
|||
@runRefresh="runRefresh" ref="runTest"/>
|
||||
<!-- 调试结果 -->
|
||||
<el-drawer :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||
<ms-api-report-detail :report-id="reportId" :debug="true" :currentProjectId="currentProject.id"/>
|
||||
<ms-api-report-detail :report-id="reportId" :debug="true" :currentProjectId="projectId"/>
|
||||
</el-drawer>
|
||||
|
||||
<!--场景公共参数-->
|
||||
|
@ -286,7 +286,7 @@
|
|||
import MsApiComponent from "./ApiComponent";
|
||||
import {ELEMENTS, ELEMENT_TYPE} from "./Setting";
|
||||
import MsApiCustomize from "./ApiCustomize";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsAddTag from "./AddTag";
|
||||
import MsRun from "./DebugRun";
|
||||
|
@ -295,12 +295,10 @@
|
|||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsScenarioParameters from "./ScenarioParameters";
|
||||
|
||||
|
||||
export default {
|
||||
name: "EditApiScenario",
|
||||
props: {
|
||||
moduleOptions: Array,
|
||||
currentProject: {},
|
||||
currentScenario: {},
|
||||
},
|
||||
components: {
|
||||
|
@ -326,6 +324,7 @@
|
|||
userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
apiScenarioModuleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
||||
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||
principal: [{required: true, message: this.$t('api_test.definition.request.responsible'), trigger: 'change'}],
|
||||
},
|
||||
environments: [],
|
||||
tags: [],
|
||||
|
@ -349,9 +348,11 @@
|
|||
path: "/api/automation/create",
|
||||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.getMaintainerOptions();
|
||||
this.refreshTags();
|
||||
|
@ -361,7 +362,7 @@
|
|||
watch: {},
|
||||
methods: {
|
||||
nodeClick(e) {
|
||||
if (e.referenced != 'REF') {
|
||||
if (e.referenced != 'REF' && e.referenced != 'Deleted') {
|
||||
this.operatingElements = ELEMENTS.get(e.type);
|
||||
} else {
|
||||
this.operatingElements = [];
|
||||
|
@ -513,14 +514,14 @@
|
|||
|
||||
},
|
||||
openTagConfig() {
|
||||
if (!this.currentProject) {
|
||||
if (!this.projectId) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.tag.open(this.currentProject.id);
|
||||
this.$refs.tag.open();
|
||||
},
|
||||
refreshTags() {
|
||||
let obj = {projectId: this.currentProject.id};
|
||||
let obj = {projectId: this.projectId};
|
||||
let tagIds = [];
|
||||
this.$post('/api/tag/list', obj, response => {
|
||||
this.tags = response.data;
|
||||
|
@ -561,8 +562,8 @@
|
|||
this.reportId = getUUID().substring(0, 8);
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
|
@ -571,11 +572,11 @@
|
|||
}
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
if (!this.projectId) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(this.projectId);
|
||||
},
|
||||
environmentConfigClose() {
|
||||
this.getEnvironments();
|
||||
|
@ -684,16 +685,18 @@
|
|||
this.path = "/api/automation/update";
|
||||
if (response.data.scenarioDefinition != null) {
|
||||
let obj = JSON.parse(response.data.scenarioDefinition);
|
||||
this.currentEnvironmentId = obj.environmentId;
|
||||
this.currentScenario.variables = obj.variables;
|
||||
this.scenarioDefinition = obj.hashTree;
|
||||
if (obj) {
|
||||
this.currentEnvironmentId = obj.environmentId;
|
||||
this.currentScenario.variables = obj.variables;
|
||||
this.scenarioDefinition = obj.hashTree;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
setParameter() {
|
||||
this.currentScenario.projectId = this.currentProject.id;
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
if (!this.currentScenario.id) {
|
||||
this.currentScenario.id = getUUID();
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-aside-container>
|
||||
<ms-api-scenario-module @selectModule="selectModule" @getApiModuleTree="initTree" @changeProject="changeProject"
|
||||
<ms-api-scenario-module @selectModule="selectModule" @getApiModuleTree="initTree"
|
||||
@refresh="refresh" @saveAsEdit="editScenario"/>
|
||||
</ms-aside-container>
|
||||
<ms-main-container>
|
||||
<ms-api-scenario-list
|
||||
:current-project="currentProject"
|
||||
:current-module="currentModule"
|
||||
@edit="editScenario"
|
||||
@selection="setData"
|
||||
|
@ -37,7 +36,6 @@
|
|||
return {
|
||||
isHide: true,
|
||||
activeName: 'default',
|
||||
currentProject: null,
|
||||
currentModule: null,
|
||||
currentScenario: [],
|
||||
currentScenarioIds: [],
|
||||
|
@ -85,9 +83,6 @@
|
|||
initTree(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
changeProject(data) {
|
||||
this.currentProject = data;
|
||||
},
|
||||
refresh(data) {
|
||||
this.$refs.apiScenarioList.search(data);
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-aside-container>
|
||||
<ms-node-tree @selectModule="selectModule" @getApiModuleTree="initTree" @changeProject="changeProject" @changeProtocol="changeProtocol"
|
||||
<ms-node-tree @selectModule="selectModule" @getApiModuleTree="initTree" @changeProtocol="changeProtocol"
|
||||
@refresh="refresh" @saveAsEdit="editApi" @debug="debug" @exportAPI="exportAPI"/>
|
||||
</ms-aside-container>
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
|||
<!-- 列表集合 -->
|
||||
<ms-api-list
|
||||
v-if="item.type === 'list'"
|
||||
:current-project="currentProject"
|
||||
:current-protocol="currentProtocol"
|
||||
:current-module="currentModule"
|
||||
@editApi="editApi"
|
||||
|
@ -38,7 +37,6 @@
|
|||
<!-- 添加测试窗口-->
|
||||
<div v-else-if="item.type=== 'add'" class="ms-api-div">
|
||||
<ms-api-config @runTest="runTest" @saveApi="saveApi" :current-api="currentApi"
|
||||
:currentProject="currentProject"
|
||||
:currentProtocol="currentProtocol"
|
||||
:moduleOptions="moduleOptions" ref="apiConfig"/>
|
||||
</div>
|
||||
|
@ -46,17 +44,17 @@
|
|||
<!-- 快捷调试 -->
|
||||
<div v-else-if="item.type=== 'debug'" class="ms-api-div">
|
||||
<ms-debug-http-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :currentProject="currentProject" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :currentProtocol="currentProtocol" :currentProject="currentProject" @saveAs="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :currentProtocol="currentProtocol" :currentProject="currentProject" @saveAs="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-debug-jdbc-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
|
||||
<!-- 测试-->
|
||||
<div v-else-if="item.type=== 'test'" class="ms-api-div">
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -84,8 +82,7 @@
|
|||
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
|
||||
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
|
||||
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
|
||||
|
||||
import {downloadFile, getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiDefinition",
|
||||
|
@ -118,7 +115,6 @@
|
|||
return {
|
||||
isHide: true,
|
||||
apiDefaultTab: 'default',
|
||||
currentProject: null,
|
||||
currentProtocol: null,
|
||||
currentModule: null,
|
||||
currentApi: {},
|
||||
|
@ -209,7 +205,7 @@
|
|||
if (!this.$refs.apiList[0].tableData) {
|
||||
return;
|
||||
}
|
||||
let obj = {projectName: this.currentProject.name, protocol: this.currentProtocol, data: this.$refs.apiList[0].tableData}
|
||||
let obj = {projectName: getCurrentProjectID(), protocol: this.currentProtocol, data: this.$refs.apiList[0].tableData}
|
||||
downloadFile("导出API.json", JSON.stringify(obj));
|
||||
},
|
||||
refresh(data) {
|
||||
|
@ -236,9 +232,6 @@
|
|||
initTree(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
changeProject(data) {
|
||||
this.currentProject = data;
|
||||
},
|
||||
changeProtocol(data) {
|
||||
this.currentProtocol = data;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,6 @@
|
|||
<el-col :span="10">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': item.active}"
|
||||
@click="active(item)"/>
|
||||
|
||||
<el-input v-if="item.type==='create'" size="small" v-model="item.name" :name="index" :key="index"
|
||||
class="ms-api-header-select" style="width: 180px"
|
||||
@blur="saveTestCase(item)"/>
|
||||
|
@ -108,8 +107,14 @@
|
|||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(item)"/>
|
||||
</span>
|
||||
<div v-if="item.type!='create'" style="color: #999999;font-size: 12px">
|
||||
<span> {{item.createTime | timestampFormatDate }}</span> {{item.createUser}} 创建
|
||||
<span> {{item.updateTime | timestampFormatDate }}</span> {{item.updateUser}} 更新
|
||||
<span>
|
||||
{{item.createTime | timestampFormatDate }}
|
||||
{{item.createUser}} {{$t('api_test.definition.request.create_info')}}
|
||||
</span>
|
||||
<span>
|
||||
{{item.updateTime | timestampFormatDate }}
|
||||
{{item.updateUser}} {{$t('api_test.definition.request.update_info')}}
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
|
@ -119,8 +124,8 @@
|
|||
<ms-tip-button @click="copyCase(item)" :tip="$t('commons.copy')" icon="el-icon-document-copy"
|
||||
size="mini" circle/>
|
||||
<ms-tip-button @click="deleteCase(index,item)" :tip="$t('commons.delete')" icon="el-icon-delete"
|
||||
size="mini"
|
||||
circle/>
|
||||
size="mini" circle/>
|
||||
<ms-api-extend-btns :row="item"/>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="3">
|
||||
|
@ -137,9 +142,9 @@
|
|||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
|
||||
<ms-api-request-form :is-read-only="isReadOnly" :headers="item.request.headers " :request="item.request" v-if="api.protocol==='HTTP'"/>
|
||||
<ms-tcp-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="item.request" :currentProject="currentProject" v-if="api.protocol==='DUBBO'"/>
|
||||
<ms-tcp-basis-parameters :request="item.request" v-if="api.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="item.request" v-if="api.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="item.request" v-if="api.protocol==='DUBBO'"/>
|
||||
<!-- 保存操作 -->
|
||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)">
|
||||
{{$t('commons.save')}}
|
||||
|
@ -163,7 +168,7 @@
|
|||
import MsTag from "../../../common/components/MsTag";
|
||||
import MsTipButton from "../../../common/components/MsTipButton";
|
||||
import MsApiRequestForm from "./request/http/ApiRequestForm";
|
||||
import {downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {parseEnvironment} from "../model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "./environment/ApiEnvironmentConfig";
|
||||
import {PRIORITY, RESULT_MAP} from "../model/JsonData";
|
||||
|
@ -172,6 +177,7 @@
|
|||
import MsSqlBasisParameters from "./request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "./request/tcp/BasisParameters";
|
||||
import MsDubboBasisParameters from "./request/dubbo/BasisParameters";
|
||||
import MsApiExtendBtns from "./reference/ApiExtendBtns";
|
||||
|
||||
export default {
|
||||
name: 'ApiCaseList',
|
||||
|
@ -184,7 +190,8 @@
|
|||
MsSqlBasisParameters,
|
||||
MsTcpBasisParameters,
|
||||
MsDubboBasisParameters,
|
||||
MsRun
|
||||
MsRun,
|
||||
MsApiExtendBtns
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
|
@ -196,7 +203,6 @@
|
|||
default: false,
|
||||
},
|
||||
loaded: Boolean,
|
||||
currentProject: {},
|
||||
refreshSign: String,
|
||||
currentRow: Object,
|
||||
},
|
||||
|
@ -214,6 +220,7 @@
|
|||
loading: false,
|
||||
runData: [],
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
checkedCases: new Set(),
|
||||
|
||||
}
|
||||
|
@ -226,12 +233,6 @@
|
|||
}
|
||||
this.getApiTest();
|
||||
},
|
||||
currentProject() {
|
||||
if (this.currentRow) {
|
||||
this.currentRow.cases = [];
|
||||
}
|
||||
this.getEnvironments();
|
||||
},
|
||||
refreshSign() {
|
||||
if (this.currentRow) {
|
||||
this.currentRow.cases = [];
|
||||
|
@ -243,6 +244,7 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.getEnvironments();
|
||||
if (this.createCase) {
|
||||
this.sysAddition();
|
||||
|
@ -431,8 +433,8 @@
|
|||
});
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
|
@ -453,11 +455,11 @@
|
|||
}
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
if (!this.projectId) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(this.projectId);
|
||||
},
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -3,17 +3,16 @@
|
|||
<div class="card-container">
|
||||
<!-- HTTP 请求参数 -->
|
||||
<ms-edit-complete-http-api @runTest="runTest" @saveApi="saveApi" :request="request" :response="response"
|
||||
:basisData="currentApi" :moduleOptions="moduleOptions" :currentProject="currentProject" v-if="currentProtocol === 'HTTP'"/>
|
||||
:basisData="currentApi" :moduleOptions="moduleOptions" v-if="currentProtocol === 'HTTP'"/>
|
||||
<!-- TCP -->
|
||||
<ms-edit-complete-tcp-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
|
||||
<ms-edit-complete-tcp-api :request="request" @runTest="runTest" @saveApi="saveApi" :basisData="currentApi"
|
||||
:moduleOptions="moduleOptions" v-if="currentProtocol === 'TCP'"/>
|
||||
<!--DUBBO-->
|
||||
<ms-edit-complete-dubbo-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
|
||||
<ms-edit-complete-dubbo-api :request="request" @runTest="runTest" @saveApi="saveApi" :basisData="currentApi"
|
||||
:moduleOptions="moduleOptions" v-if="currentProtocol === 'DUBBO'"/>
|
||||
<!--SQL-->
|
||||
<ms-edit-complete-sql-api :request="request" @runTest="runTest" @saveApi="saveApi" :currentProject="currentProject" :basisData="currentApi"
|
||||
<ms-edit-complete-sql-api :request="request" @runTest="runTest" @saveApi="saveApi" :basisData="currentApi"
|
||||
:moduleOptions="moduleOptions" v-if="currentProtocol === 'SQL'"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -24,10 +23,9 @@
|
|||
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
|
||||
|
||||
import {ResponseFactory, Body} from "../model/ApiTestModel";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {createComponent, Request} from "./jmeter/components";
|
||||
import Sampler from "./jmeter/components/sampler/sampler";
|
||||
import HeaderManager from "./jmeter/components/configurations/header-manager";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
|
||||
export default {
|
||||
|
@ -39,16 +37,17 @@
|
|||
request: Sampler,
|
||||
config: {},
|
||||
response: {},
|
||||
projectId: "",
|
||||
maintainerOptions: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentApi: {},
|
||||
moduleOptions: {},
|
||||
currentProject: {},
|
||||
currentProtocol: String,
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.getMaintainerOptions();
|
||||
switch (this.currentProtocol) {
|
||||
case Request.TYPES.SQL:
|
||||
|
@ -137,7 +136,7 @@
|
|||
});
|
||||
},
|
||||
setParameters(data) {
|
||||
data.projectId = this.currentProject.id;
|
||||
data.projectId = this.projectId;
|
||||
this.request.name = this.currentApi.name;
|
||||
data.protocol = this.currentProtocol;
|
||||
data.request = this.request;
|
||||
|
|
|
@ -77,7 +77,8 @@
|
|||
<el-button type="text" @click="handleTestCase(scope.row)">用例</el-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-button type="text" @click="editApi(scope.row)">编辑</el-button>
|
||||
<el-button type="text" @click="reductionApi(scope.row)" v-if="currentModule!=undefined && currentModule.id === 'gc'">恢复</el-button>
|
||||
<el-button type="text" @click="editApi(scope.row)" v-else>编辑</el-button>
|
||||
<el-button type="text" @click="handleTestCase(scope.row)">用例</el-button>
|
||||
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">删除</el-button>
|
||||
</div>
|
||||
|
@ -91,7 +92,7 @@
|
|||
<div id="svgResize"/>
|
||||
<div id="svgDown">
|
||||
<ms-bottom-container v-bind:enableAsideHidden="isHide">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :visible="visible" :currentRow="currentRow" :api="selectApi" :current-project="currentProject"/>
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :visible="visible" :currentRow="currentRow" :api="selectApi"/>
|
||||
</ms-bottom-container>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -111,7 +112,8 @@
|
|||
import MsContainer from "../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "./BottomContainer";
|
||||
import ShowMoreBtn from "../../../../components/track/case/components/ShowMoreBtn";
|
||||
import {API_METHOD_COLOUR, FILTER_MAP_1, FILTER_MAP_2} from "../model/JsonData";
|
||||
import {API_METHOD_COLOUR} from "../model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiList",
|
||||
|
@ -141,11 +143,11 @@
|
|||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
projectId: "",
|
||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: Object,
|
||||
currentProtocol: String,
|
||||
currentModule: Object,
|
||||
visible: {
|
||||
|
@ -157,16 +159,13 @@
|
|||
}
|
||||
},
|
||||
created: function () {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.initApiTable();
|
||||
},
|
||||
mounted() {
|
||||
this.dragControllerDiv();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initApiTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
currentModule() {
|
||||
this.initApiTable();
|
||||
this.apiCaseClose();
|
||||
|
@ -190,8 +189,8 @@
|
|||
this.condition.moduleIds = this.currentModule.ids;
|
||||
}
|
||||
}
|
||||
if (this.currentProject != null) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
if (this.projectId != null) {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
|
@ -256,6 +255,15 @@
|
|||
editApi(row) {
|
||||
this.$emit('editApi', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
row.status = 'Underway';
|
||||
row.request = null;
|
||||
row.response = null;
|
||||
this.$fileUpload("/api/definition/update", null, [], row, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
if (this.currentModule != undefined && this.currentModule.id == "gc") {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
<template>
|
||||
<div v-loading="result.loading">
|
||||
<select-menu
|
||||
:data="projects"
|
||||
:current-data="currentProject"
|
||||
:title="$t('test_track.project')"
|
||||
@dataChange="changeProject" style="margin-bottom: 20px"/>
|
||||
|
||||
<el-select style="width: 100px ;height: 30px" size="small" v-model="protocol" @change="changeProtocol">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
|
@ -95,7 +89,7 @@
|
|||
</el-tree>
|
||||
|
||||
<ms-add-basis-api :current-protocol="protocol" ref="basisApi"></ms-add-basis-api>
|
||||
<api-import ref="apiImport" :project-id="currentProject.id" @refresh="refresh"/>
|
||||
<api-import ref="apiImport" :project-id="projectId" @refresh="refresh"/>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -106,6 +100,7 @@
|
|||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import {OPTIONS, DEFAULT_DATA} from "../model/JsonData";
|
||||
import ApiImport from "./import/ApiImport";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: 'MsApiModule',
|
||||
|
@ -123,43 +118,36 @@
|
|||
expandedNode: [],
|
||||
filterText: "",
|
||||
nextFlag: true,
|
||||
currentProject: {},
|
||||
projects: [],
|
||||
projectId: "",
|
||||
data: DEFAULT_DATA,
|
||||
currentModule: {},
|
||||
newLabel: ""
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getProjects();
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.changeProtocol();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.getApiModuleTree();
|
||||
this.$emit('changeProject', this.currentProject);
|
||||
},
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getApiModuleTree() {
|
||||
if (this.currentProject) {
|
||||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
}
|
||||
this.result = this.$get("/api/module/list/" + this.currentProject.id + "/" + this.protocol, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data[1].children = response.data;
|
||||
let moduleOptions = [];
|
||||
this.data[1].children.forEach(node => {
|
||||
this.buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.$emit('getApiModuleTree', moduleOptions);
|
||||
}
|
||||
});
|
||||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
}
|
||||
this.result = this.$get("/api/module/list/" + this.projectId + "/" + this.protocol, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data[1].children = response.data;
|
||||
let moduleOptions = [];
|
||||
this.data[1].children.forEach(node => {
|
||||
this.buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.$emit('getApiModuleTree', moduleOptions);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -364,7 +352,7 @@
|
|||
},
|
||||
// 保存或修改
|
||||
editApiModule(node, data) {
|
||||
if (!this.currentProject) {
|
||||
if (!this.projectId) {
|
||||
this.$error("$t('api_test.select_project')");
|
||||
return;
|
||||
}
|
||||
|
@ -383,7 +371,7 @@
|
|||
data.nodeIds = ids;
|
||||
}
|
||||
data.protocol = this.protocol;
|
||||
data.projectId = this.currentProject.id;
|
||||
data.projectId = this.projectId;
|
||||
this.$post(url, data, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.getApiModuleTree();
|
||||
|
@ -420,20 +408,7 @@
|
|||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
addApi() {
|
||||
this.$refs.basisApi.open(this.currentModule, this.currentProject.id);
|
||||
},
|
||||
// 项目相关方法
|
||||
changeProject(project) {
|
||||
this.currentProject = project;
|
||||
},
|
||||
getProjects() {
|
||||
let projectId;
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projects = response.data;
|
||||
if (this.projects.length > 0) {
|
||||
this.currentProject = this.projects[0];
|
||||
}
|
||||
});
|
||||
this.$refs.basisApi.open(this.currentModule, this.projectId);
|
||||
},
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
basicForm: {},
|
||||
httpVisible: false,
|
||||
currentModule: {},
|
||||
projectId: "",
|
||||
maintainerOptions: [],
|
||||
rule: {
|
||||
name: [
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
|
||||
<!-- 请求参数 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-basis-parameters :request="request" :currentProject="currentProject"/>
|
||||
<ms-basis-parameters :request="request"/>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -40,7 +39,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -57,10 +55,6 @@
|
|||
validateApi() {
|
||||
this.validated = false;
|
||||
this.basisData.method = this.request.protocol;
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
|
|
|
@ -103,13 +103,9 @@
|
|||
options: API_STATUS,
|
||||
}
|
||||
},
|
||||
props: {moduleOptions: {}, currentProject: {}, request: {}, response: {}, basisData: {}},
|
||||
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}},
|
||||
methods: {
|
||||
runTest() {
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs['httpForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.setParameter();
|
||||
|
@ -132,10 +128,6 @@
|
|||
this.httpForm.request.useEnvironment = undefined;
|
||||
},
|
||||
saveApi() {
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['httpForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.setParameter();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<!-- 请求参数 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-basis-parameters :request="request" :currentProject="currentProject"/>
|
||||
<ms-basis-parameters :request="request"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -38,7 +38,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -55,10 +54,6 @@
|
|||
},
|
||||
validateApi() {
|
||||
this.validated = false;
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<!-- 请求参数 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-basis-parameters :request="request" :currentProject="currentProject"/>
|
||||
<ms-basis-parameters :request="request"/>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -57,10 +56,6 @@
|
|||
validateApi() {
|
||||
this.validated = false;
|
||||
this.basisData.method = "TCP";
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- TCP 请求参数 -->
|
||||
<ms-basis-parameters :request="request" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="request" ref="requestForm"/>
|
||||
|
||||
|
||||
<!-- TCP 请求返回数据 -->
|
||||
|
@ -45,7 +45,6 @@
|
|||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
currentProject: {},
|
||||
scenario: Boolean,
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- JDBC 请求参数 -->
|
||||
<ms-basis-parameters :request="request" @callback="runDebug" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
|
||||
|
||||
|
||||
<!-- JDBC 请求返回数据 -->
|
||||
|
@ -47,7 +47,6 @@
|
|||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
currentProject: {},
|
||||
scenario: Boolean,
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- TCP 请求参数 -->
|
||||
<ms-basis-parameters :request="request" @callback="runDebug" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
|
||||
|
||||
|
||||
<!-- TCP 请求返回数据 -->
|
||||
|
@ -46,7 +46,6 @@
|
|||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
currentProject: {},
|
||||
scenario: Boolean,
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<template>
|
||||
<el-dropdown @command="handleCommand" class="scenario-ext-btn">
|
||||
<el-link type="primary" :underline="false">
|
||||
<el-icon class="el-icon-more"></el-icon>
|
||||
</el-link>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="add_plan">{{ $t('api_test.automation.batch_add_plan') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<ms-reference-view ref="viewRef"/>
|
||||
<!--测试计划-->
|
||||
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||
<ms-test-plan-list @addTestPlan="addTestPlan"/>
|
||||
</el-drawer>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsReferenceView from "./ReferenceView";
|
||||
import MsTestPlanList from "../../../automation/scenario/testplan/TestPlanList";
|
||||
|
||||
export default {
|
||||
name: "MsApiExtendBtns",
|
||||
components: {MsReferenceView, MsTestPlanList},
|
||||
props: {
|
||||
row: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
planVisible: false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
if (this.row.id) {
|
||||
switch (cmd) {
|
||||
case "ref":
|
||||
this.$refs.viewRef.open(this.row);
|
||||
break;
|
||||
case "add_plan":
|
||||
this.addCaseToPlan();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.$warning(this.$t('api_test.automation.save_case_info'))
|
||||
}
|
||||
},
|
||||
addCaseToPlan() {
|
||||
this.planVisible = true;
|
||||
},
|
||||
addTestPlan(plans) {
|
||||
let obj = {planIds: plans, apiIds: [this.row.id]};
|
||||
this.planVisible = false;
|
||||
this.$post("/api/automation/scenario/plan", obj, response => {
|
||||
this.$success(this.$t("commons.save_success"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scenario-ext-btn {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.case_ref')" :visible.sync="visible"
|
||||
width="45%" :destroy-on-close="true">
|
||||
<span>{{ $t('api_test.automation.scenario_ref') }}:</span>
|
||||
<div class="refs" v-loading="scenarioLoading">
|
||||
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">{{ item.name }}</div>
|
||||
</div>
|
||||
|
||||
<span>{{ $t('api_test.automation.plan_ref') }}:</span>
|
||||
<div class="refs">
|
||||
<div v-for="(item, index) in planRefs" :key="index" class="el-button--text">{{ item.name }}</div>
|
||||
</div>
|
||||
|
||||
<template v-slot:footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="visible = false" @keydown.enter.native.prevent>
|
||||
{{ $t('commons.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "MsReferenceView",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
scenarioLoading: false,
|
||||
scenarioRefs: [],
|
||||
planRefs: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getReferenceData(row) {
|
||||
if (row.id === undefined) {
|
||||
return;
|
||||
}
|
||||
this.scenarioLoading = true;
|
||||
this.scenarioRefs = [];
|
||||
this.$post("/api/definition/getReference/", row, response => {
|
||||
this.scenarioRefs = response.data.scenarioList;
|
||||
this.planRefs = response.data.testPlanList;
|
||||
this.scenarioLoading = false;
|
||||
})
|
||||
},
|
||||
open(row) {
|
||||
this.getReferenceData(row);
|
||||
this.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.refs {
|
||||
min-height: 50px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
font-size: 12px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
</style>
|
|
@ -106,6 +106,7 @@
|
|||
import {Assertions, Extract} from "../../../model/ApiTestModel";
|
||||
import {parseEnvironment} from "../../../model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "../../environment/ApiEnvironmentConfig";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -117,7 +118,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -172,10 +172,6 @@
|
|||
})
|
||||
},
|
||||
validate() {
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['request'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit('callback');
|
||||
|
@ -191,23 +187,17 @@
|
|||
},
|
||||
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.environments = [];
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
this.initDataSource();
|
||||
this.environments = [];
|
||||
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
}
|
||||
this.initDataSource();
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
initDataSource() {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -148,10 +147,6 @@
|
|||
})
|
||||
},
|
||||
validateApi() {
|
||||
if (this.currentProject === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
|
@ -185,6 +180,7 @@
|
|||
/deep/ .el-form-item {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.ms-left-cell {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
import ApiEnvironmentConfig from "../../environment/ApiEnvironmentConfig";
|
||||
import {API_STATUS} from "../../../model/JsonData";
|
||||
import TCPSampler from "../../jmeter/components/sampler/tcp-sampler";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -143,7 +144,6 @@
|
|||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
currentProject: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
|
@ -156,6 +156,7 @@
|
|||
classes: TCPSampler.CLASSES,
|
||||
isReloadData: false,
|
||||
options: API_STATUS,
|
||||
currentProjectId: "",
|
||||
rules: {
|
||||
classname: [{required: true, message: "请选择TCPClient", trigger: 'change'}],
|
||||
server: [{required: true, message: this.$t('api_test.request.tcp.server_cannot_be_empty'), trigger: 'blur'}],
|
||||
|
@ -164,6 +165,7 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.currentProjectId = getCurrentProjectID();
|
||||
this.getEnvironments();
|
||||
},
|
||||
methods: {
|
||||
|
@ -199,7 +201,7 @@
|
|||
})
|
||||
},
|
||||
validateApi() {
|
||||
if (this.currentProject === null) {
|
||||
if (this.currentProjectId === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
|
@ -213,7 +215,7 @@
|
|||
|
||||
},
|
||||
validate() {
|
||||
if (this.currentProject === null) {
|
||||
if (this.currentProjectId === null) {
|
||||
this.$error(this.$t('api_test.select_project'), 2000);
|
||||
return;
|
||||
}
|
||||
|
@ -224,9 +226,9 @@
|
|||
})
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
if (this.currentProjectId) {
|
||||
this.environments = [];
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
this.$get('/api/environment/list/' + this.currentProjectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
|
@ -236,11 +238,11 @@
|
|||
}
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
if (!this.currentProjectId) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(this.currentProjectId);
|
||||
},
|
||||
initDataSource() {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- TCP 请求参数 -->
|
||||
<ms-basis-parameters :request="api.request" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="api.request" ref="requestForm"/>
|
||||
|
||||
<!--返回结果-->
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
|
@ -31,7 +31,7 @@
|
|||
<!-- 加载用例 -->
|
||||
<el-drawer :visible.sync="visible" direction="btt" :with-header="false" :modal="false" size="50%">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :api="api"
|
||||
:currentProject="currentProject" :loaded="loaded" :refreshSign="refreshSign" :createCase="createCase"
|
||||
:loaded="loaded" :refreshSign="refreshSign" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
</el-drawer>
|
||||
>
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import {downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -56,7 +56,6 @@
|
|||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
|
||||
export default {
|
||||
|
@ -92,7 +91,7 @@
|
|||
reportId: "",
|
||||
}
|
||||
},
|
||||
props: {apiData: {}, currentProject: {}, currentProtocol: String,},
|
||||
props: {apiData: {}, currentProtocol: String,},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -184,36 +183,27 @@
|
|||
}
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
} else {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<!-- 加载用例 -->
|
||||
<el-drawer :visible.sync="visible" direction="btt" :with-header="false" :modal="false" size="50%" ref="drawer">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :api="api" :refreshSign="refreshSign"
|
||||
:currentProject="currentProject" :loaded="loaded" :createCase="createCase"
|
||||
:loaded="loaded" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
</el-drawer>
|
||||
|
||||
|
@ -87,14 +87,13 @@
|
|||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import {downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import {parseEnvironment} from "../../model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
|
||||
export default {
|
||||
|
@ -126,9 +125,10 @@
|
|||
},
|
||||
runData: [],
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
}
|
||||
},
|
||||
props: {apiData: {}, currentProject: {}, currentProtocol: String,},
|
||||
props: {apiData: {}, currentProtocol: String,},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -226,8 +226,8 @@
|
|||
}
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
|
@ -251,11 +251,11 @@
|
|||
}
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
if (!this.projectId) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(this.projectId);
|
||||
},
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
@ -279,6 +279,7 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.api = this.apiData;
|
||||
this.api.protocol = this.currentProtocol;
|
||||
this.currentRequest = this.api.request;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- TCP 请求参数 -->
|
||||
<ms-basis-parameters :request="api.request" @callback="runTest" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="api.request" @callback="runTest" ref="requestForm"/>
|
||||
|
||||
<!--返回结果-->
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
|
@ -30,7 +30,7 @@
|
|||
<!-- 加载用例 -->
|
||||
<el-drawer :visible.sync="visible" direction="btt" :with-header="false" :modal="false" size="50%">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :api="api" :refreshSign="refreshSign"
|
||||
:currentProject="currentProject" :loaded="loaded" :createCase="createCase"
|
||||
:loaded="loaded" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
</el-drawer>
|
||||
>
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import {downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -55,7 +55,6 @@
|
|||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
import MsBasisParameters from "../request/database/BasisParameters";
|
||||
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
|
||||
export default {
|
||||
|
@ -91,7 +90,7 @@
|
|||
reportId: "",
|
||||
}
|
||||
},
|
||||
props: {apiData: {}, currentProject: {}, currentProtocol: String,},
|
||||
props: {apiData: {}, currentProtocol: String,},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -182,36 +181,27 @@
|
|||
}
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
} else {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- TCP 请求参数 -->
|
||||
<ms-basis-parameters :request="api.request" @callback="runTest" :currentProject="currentProject" ref="requestForm"/>
|
||||
<ms-basis-parameters :request="api.request" @callback="runTest" ref="requestForm"/>
|
||||
|
||||
<!--返回结果-->
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
|
@ -31,7 +31,7 @@
|
|||
<!-- 加载用例 -->
|
||||
<el-drawer :visible.sync="visible" direction="btt" :with-header="false" :modal="false" size="50%">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :api="api" :refreshSign="refreshSign"
|
||||
:currentProject="currentProject" :loaded="loaded" :createCase="createCase"
|
||||
:loaded="loaded" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
</el-drawer>
|
||||
<!-- 环境 -->
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import {downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -54,7 +54,6 @@
|
|||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
import MsBasisParameters from "../request/tcp/BasisParameters";
|
||||
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
|
||||
export default {
|
||||
|
@ -90,7 +89,7 @@
|
|||
reportId: "",
|
||||
}
|
||||
},
|
||||
props: {apiData: {}, currentProject: {}, currentProtocol: String,},
|
||||
props: {apiData: {}, currentProtocol: String,},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -181,36 +180,27 @@
|
|||
}
|
||||
},
|
||||
getEnvironments() {
|
||||
if (this.currentProject) {
|
||||
this.$get('/api/environment/list/' + this.currentProject.id, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
} else {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environment = this.environments[i];
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
this.api.environmentId = '';
|
||||
this.api.environment = undefined;
|
||||
}
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
if (!this.currentProject) {
|
||||
this.$error(this.$t('api_test.select_project'));
|
||||
return;
|
||||
}
|
||||
this.$refs.environmentConfig.open(this.currentProject.id);
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<div v-else style="height: 120px;overflow: auto">
|
||||
<el-menu-item :key="i.id" v-for="i in items" :index="getIndex(i)" :route="getRouter(i)">
|
||||
<el-menu-item :key="i.id" v-for="i in items" @click="change(i.id)">
|
||||
<template slot="title">
|
||||
<div class="title">{{ i.name }}</div>
|
||||
</template>
|
||||
|
@ -23,8 +23,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {hasRoles} from "@/common/js/utils";
|
||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
||||
import {getCurrentUser, hasRoles} from "@/common/js/utils";
|
||||
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "SearchList",
|
||||
|
@ -32,13 +32,18 @@ export default {
|
|||
options: Object
|
||||
},
|
||||
mounted() {
|
||||
console.log('mounted')
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
console.log('beforeDestroy')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
items: [],
|
||||
search_text: ''
|
||||
search_text: '',
|
||||
userId: getCurrentUser().id,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -51,18 +56,18 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
getIndex: function () {
|
||||
return function (item) {
|
||||
return this.options.index(item);
|
||||
}
|
||||
},
|
||||
getRouter: function () {
|
||||
return function (item) {
|
||||
if (this.options.router) {
|
||||
return this.options.router(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
// getIndex: function () {
|
||||
// return function (item) {
|
||||
// return this.options.index(item);
|
||||
// }
|
||||
// },
|
||||
// getRouter: function () {
|
||||
// return function (item) {
|
||||
// if (this.options.router) {
|
||||
// return this.options.router(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -80,6 +85,13 @@ export default {
|
|||
this.items = response.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
change(projectId) {
|
||||
// todo 初始化的时候切换默认项目
|
||||
this.$post("/user/update/current", {id: this.userId, lastProjectId: projectId}, () => {
|
||||
localStorage.setItem(PROJECT_ID, projectId);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-menu-item :index="this.index">
|
||||
<el-menu-item :index="this.index" @click="changeRoute">
|
||||
<font-awesome-icon :icon="['fa', 'list-ul']"/>
|
||||
<span>{{ $t('commons.show_all') }}</span>
|
||||
</el-menu-item>
|
||||
|
@ -10,6 +10,14 @@ export default {
|
|||
name: "MsShowAll",
|
||||
props: {
|
||||
index: String
|
||||
},
|
||||
methods: {
|
||||
changeRoute() {
|
||||
// 解决在列表页面点击 显示全部 无效的问题(点击显示全部后改变路由)
|
||||
if (this.$route.path === this.index) {
|
||||
this.$router.replace({path: this.index, query: {type: 'all'}});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -10,6 +10,7 @@ export const ROLE_TEST_VIEWER = 'test_viewer';
|
|||
|
||||
export const WORKSPACE_ID = 'workspace_id';
|
||||
export const CURRENT_PROJECT = 'current_project';
|
||||
export const PROJECT_ID = 'project_id';
|
||||
|
||||
export const REFRESH_SESSION_USER_URL = 'user/refresh';
|
||||
export const WORKSPACE = 'workspace';
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
ROLE_TEST_VIEWER,
|
||||
TokenKey
|
||||
TokenKey,
|
||||
PROJECT_ID
|
||||
} from "./constants";
|
||||
import axios from "axios";
|
||||
import {jsPDF} from "jspdf";
|
||||
|
@ -88,6 +89,10 @@ export function getCurrentUser() {
|
|||
return JSON.parse(localStorage.getItem(TokenKey));
|
||||
}
|
||||
|
||||
export function getCurrentProjectID() {
|
||||
return localStorage.getItem(PROJECT_ID);
|
||||
}
|
||||
|
||||
export function saveLocalStorage(response) {
|
||||
// 登录信息保存 cookie
|
||||
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
||||
|
|
|
@ -533,23 +533,58 @@ export default {
|
|||
add_module: "Add module",
|
||||
edit_api: "Edit Api",
|
||||
test_plan_select: "Please select test plan",
|
||||
create_info: 'Create',
|
||||
update_info: 'Update',
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
follow_people: "Follow people",
|
||||
create_tag: "Create tag",
|
||||
scenario_step: "Scenario step",
|
||||
scenario_step: "Ccenario step",
|
||||
step_total: "Step total",
|
||||
scenario_total: "Scene public parameters",
|
||||
api_list_import: "Interface list import",
|
||||
scenario_total: "Scenario total",
|
||||
api_list_import: "Api list import",
|
||||
external_import: "External import",
|
||||
wait_controller: "Waiting for controller",
|
||||
if_controller: "Condition controller",
|
||||
scenario_import: "Scene import",
|
||||
customize_script: "Custom script",
|
||||
customize_req: "Custom request",
|
||||
reference_info: "Please select interface or use case",
|
||||
wait_controller: "Wait controller",
|
||||
if_controller: "If controller",
|
||||
scenario_import: "Scenario import",
|
||||
customize_script: "Customize script",
|
||||
customize_req: "Customize req",
|
||||
reference_info: "Reference info",
|
||||
scenario_test: "Scenario test",
|
||||
add_scenario: "Add scenario",
|
||||
scenario_name: "Scenario name",
|
||||
case_level: "Case level",
|
||||
tag: "Tag",
|
||||
creator: "Creator",
|
||||
update_time: "Update time",
|
||||
step: "Step",
|
||||
last_result: "Last result",
|
||||
passing_rate: "Passing rate",
|
||||
success: "Success",
|
||||
fail: "Fail",
|
||||
saved: "Saved",
|
||||
trash: "Trash",
|
||||
edit: "Edit",
|
||||
execute: "Execute",
|
||||
copy: "Copy",
|
||||
remove: "Remove",
|
||||
view_ref: "View ref",
|
||||
case_ref: "Case ref",
|
||||
scenario_ref: "Scenario ref",
|
||||
plan_ref: "Plan ref",
|
||||
batch_add_plan: "Add plan",
|
||||
batch_execute: "Batch execute",
|
||||
scenario: {
|
||||
principal: "principal",
|
||||
select_principal: "Select principal",
|
||||
follow_people: "Follow people",
|
||||
select_table: "Select table",
|
||||
select_all: "Select all"
|
||||
},
|
||||
report_name_info: 'Please enter the registration name',
|
||||
save_case_info: 'Please save the use case first',
|
||||
reference_deleted: 'Reference deleted',
|
||||
},
|
||||
environment: {
|
||||
name: "Environment Name",
|
||||
|
|
|
@ -279,7 +279,7 @@ export default {
|
|||
verified: '验证通过'
|
||||
}
|
||||
},
|
||||
edit: {
|
||||
project: {
|
||||
recent: '最近的项目',
|
||||
create: '创建项目',
|
||||
edit: '编辑项目',
|
||||
|
@ -532,6 +532,8 @@ export default {
|
|||
add_module: "创建模块",
|
||||
edit_api: "编辑接口",
|
||||
test_plan_select: "请选择测试计划",
|
||||
create_info: '创建',
|
||||
update_info: '更新',
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
@ -570,7 +572,7 @@ export default {
|
|||
case_ref: "用例引用",
|
||||
scenario_ref: "场景引用",
|
||||
plan_ref: "测试计划引用",
|
||||
batch_add_plan: "批量添加到测试计划",
|
||||
batch_add_plan: "添加到测试计划",
|
||||
batch_execute: "批量执行",
|
||||
scenario: {
|
||||
principal: "责任人",
|
||||
|
@ -580,6 +582,8 @@ export default {
|
|||
select_all: "选择全部数据"
|
||||
},
|
||||
report_name_info: '请输入报名名称',
|
||||
save_case_info: '请先保存用例',
|
||||
reference_deleted: '引用已删除',
|
||||
},
|
||||
environment: {
|
||||
name: "环境名称",
|
||||
|
|
|
@ -532,6 +532,8 @@ export default {
|
|||
add_module: "創建模塊",
|
||||
edit_api: "编辑接口",
|
||||
test_plan_select: "請選擇測試計劃",
|
||||
create_info: '創建',
|
||||
update_info: '更新',
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
@ -545,10 +547,43 @@ export default {
|
|||
wait_controller: "等待控制器",
|
||||
if_controller: "條件控制器",
|
||||
scenario_import: "場景導入",
|
||||
customize_script: "自定義腳本",
|
||||
customize_script: "自定義脚本",
|
||||
customize_req: "自定義請求",
|
||||
reference_info: "請選擇接口或用例",
|
||||
report_name_info: '请输入报名名称',
|
||||
scenario_test: "場景",
|
||||
add_scenario: "创建場景",
|
||||
scenario_name: "場景名称",
|
||||
case_level: "用例等级",
|
||||
tag: "標簽",
|
||||
creator: "創建人",
|
||||
update_time: "最後更新時間",
|
||||
step: "步驟數",
|
||||
last_result: "最後結果",
|
||||
passing_rate: "通過率",
|
||||
success: "通過",
|
||||
fail: "失敗",
|
||||
saved: "保存",
|
||||
trash: "回收",
|
||||
edit: "編輯",
|
||||
execute: "執行",
|
||||
copy: "復制",
|
||||
remove: "删除",
|
||||
view_ref: "查看引用",
|
||||
case_ref: "用例引用",
|
||||
scenario_ref: "场景引用",
|
||||
plan_ref: "测试计划引用",
|
||||
batch_add_plan: "添加到测试计划",
|
||||
batch_execute: "批量执行",
|
||||
scenario: {
|
||||
principal: "責任人",
|
||||
select_principal: "請選擇責任人",
|
||||
follow_people: "關註人",
|
||||
select_table: "選擇可見數據",
|
||||
select_all: "選擇全部數據"
|
||||
},
|
||||
report_name_info: '請輸入報名名稱',
|
||||
save_case_info: '請先保存用例',
|
||||
reference_deleted: '引用已删除',
|
||||
},
|
||||
environment: {
|
||||
name: "環境名稱",
|
||||
|
|
Loading…
Reference in New Issue