Merge branch 'master' of https://github.com/metersphere/metersphere
# Conflicts: # backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java # backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java # backend/src/main/java/io/metersphere/base/mapper/SwaggerUrlProjectMapper.xml # frontend/src/business/components/api/automation/ApiAutomation.vue # frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue
This commit is contained in:
commit
b0486b6faf
|
@ -161,5 +161,18 @@ public class ApiAutomationController {
|
|||
return apiAutomationService.scenarioImport(file, request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/import", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public ApiDefinitionImport testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) {
|
||||
return apiAutomationService.scenarioImport(file, request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/export")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public ApiScenrioExportResult export(@RequestBody ApiScenarioBatchRequest request) {
|
||||
return apiAutomationService.export(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ public class ApiDocumentInfoDTO {
|
|||
private String requestBodyParamType;
|
||||
private String requestBodyFormData;
|
||||
private String requestBodyStrutureData;
|
||||
private Object requestPreviewData;
|
||||
private Object jsonSchemaBody;
|
||||
|
||||
private String responseHead;
|
||||
private String responseBody;
|
||||
|
|
|
@ -16,4 +16,7 @@ public class ApiDocumentRequest {
|
|||
private String projectId;
|
||||
private List<String> moduleIds;
|
||||
private String shareId;
|
||||
private String name;
|
||||
private String type;
|
||||
private String orderCondition;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ public class ApiTestImportRequest {
|
|||
private String projectId;
|
||||
private String platform;
|
||||
private Boolean useEnvironment;
|
||||
// 来自场景的导入不需要存储
|
||||
private boolean saved = true;
|
||||
private String swaggerUrl;
|
||||
//导入策略
|
||||
private String modeId;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiScenarioBatchRequest extends ApiScenarioWithBLOBs {
|
||||
private List<String> ids;
|
||||
private String projectId;
|
||||
private String environmentId;
|
||||
|
||||
private ApiScenarioRequest condition;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.controller.request.BaseQueryRequest;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -9,21 +10,14 @@ import java.util.Map;
|
|||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiScenarioRequest {
|
||||
public class ApiScenarioRequest extends BaseQueryRequest {
|
||||
private String id;
|
||||
private String excludeId;
|
||||
private String projectId;
|
||||
private String moduleId;
|
||||
private List<String> moduleIds;
|
||||
private String name;
|
||||
private String workspaceId;
|
||||
private String userId;
|
||||
private String planId;
|
||||
private boolean recent = false;
|
||||
private List<OrderRequest> orders;
|
||||
private Map<String, List<String>> filters;
|
||||
private Map<String, Object> combine;
|
||||
private List<String> ids;
|
||||
private boolean isSelectThisWeedData;
|
||||
private long createTime = 0;
|
||||
private String executeStatus;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiScenrioExportResult {
|
||||
private String projectId;
|
||||
private String version;
|
||||
private List<ApiScenarioWithBLOBs> data;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -8,14 +9,10 @@ import java.util.Map;
|
|||
|
||||
@Setter
|
||||
@Getter
|
||||
public class RunScenarioRequest {
|
||||
|
||||
private String id;
|
||||
public class RunScenarioRequest extends ApiScenarioWithBLOBs {
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String environmentId;
|
||||
|
||||
private String triggerMode;
|
||||
|
@ -29,28 +26,12 @@ public class RunScenarioRequest {
|
|||
|
||||
private List<String> planCaseIds;
|
||||
|
||||
private String reportUserID;
|
||||
private List<String> ids;
|
||||
|
||||
private List<String> scenarioIds;
|
||||
private String reportUserID;
|
||||
|
||||
private Map<String,String> scenarioTestPlanIdMap;
|
||||
|
||||
/**
|
||||
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||
* filters: 数据状态
|
||||
* name:如果是全部数据,那么表格如果历经查询,查询参数是什么
|
||||
* moduleIds: 哪些模块的数据
|
||||
* unSelectIds:是否在页面上有未勾选的数据,有的话他们的ID是哪些。
|
||||
* filters/name/moduleIds/unSeelctIds 只在isSelectAllDate为true时需要。为了让程序能明确批量的范围。
|
||||
*/
|
||||
private boolean isSelectAllDate;
|
||||
|
||||
private Map<String, List<String>> filters;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<String> moduleIds;
|
||||
|
||||
private List<String> unSelectIds;
|
||||
private ApiScenarioRequest condition;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package io.metersphere.api.dto.definition.parse;
|
||||
|
||||
import io.metersphere.api.dto.definition.request.MsScenario;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -12,6 +14,10 @@ public class ApiDefinitionImport {
|
|||
private String protocol;
|
||||
private List<ApiDefinitionWithBLOBs> data;
|
||||
|
||||
//导入场景
|
||||
private MsScenario scenarioDefinition;
|
||||
private List<ApiScenarioWithBLOBs> scenarioDefinitionData;
|
||||
|
||||
// 新版本带用例导出
|
||||
private List<ApiTestCaseWithBLOBs> cases;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ import lombok.EqualsAndHashCode;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.protocol.http.control.Header;
|
||||
import org.apache.jmeter.protocol.http.control.HeaderManager;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
@ -108,6 +110,9 @@ public class MsScenario extends MsTestElement {
|
|||
el.toHashTree(tree, el.getHashTree(), config);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||
setHeader(tree, this.headers);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOldVariables(List<KeyValue> oldVariables) {
|
||||
|
@ -117,6 +122,20 @@ public class MsScenario extends MsTestElement {
|
|||
}
|
||||
}
|
||||
|
||||
public void setHeader(HashTree tree, List<KeyValue> headers) {
|
||||
if (CollectionUtils.isNotEmpty(headers)) {
|
||||
HeaderManager headerManager = new HeaderManager();
|
||||
headerManager.setEnabled(true);
|
||||
headerManager.setName(this.getName() + "场景Headers");
|
||||
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
|
||||
headerManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HeaderPanel"));
|
||||
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
headerManager.add(new Header(keyValue.getName(), keyValue.getValue()))
|
||||
);
|
||||
tree.add(headerManager);
|
||||
}
|
||||
}
|
||||
|
||||
private Arguments arguments(ParameterConfig config) {
|
||||
Arguments arguments = new Arguments();
|
||||
arguments.setEnabled(true);
|
||||
|
@ -142,11 +161,6 @@ public class MsScenario extends MsTestElement {
|
|||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||
);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||
this.headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||
);
|
||||
}
|
||||
|
||||
return arguments;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected ApiModule buildModule(ApiModule parentModule, String name, boolean isSaved) {
|
||||
protected ApiModule buildModule(ApiModule parentModule, String name) {
|
||||
apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
ApiModule module;
|
||||
if (parentModule != null) {
|
||||
|
@ -84,9 +84,7 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
|||
} else {
|
||||
module = apiModuleService.getNewModule(name, this.projectId, 1);
|
||||
}
|
||||
if (isSaved) {
|
||||
createModule(module);
|
||||
}
|
||||
createModule(module);
|
||||
return module;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package io.metersphere.api.parse;
|
||||
|
||||
import io.metersphere.commons.constants.ApiImportPlatform;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class ApiScenarioImportParserFactory {
|
||||
public static ApiImportParser getApiImportParser(String platform) {
|
||||
if (StringUtils.equals(ApiImportPlatform.Metersphere.name(), platform)) {
|
||||
return new MsParser();
|
||||
} else if (StringUtils.equals(ApiImportPlatform.Postman.name(), platform)) {
|
||||
return new ScenarioPostmanParser();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
return parseMsFormat(testStr, request);
|
||||
} else {
|
||||
request.setPlatform(ApiImportPlatform.Plugin.name());
|
||||
return parsePluginFormat(testObject, request);
|
||||
return parsePluginFormat(testObject, request, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,17 +65,20 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
apiDefinition.setRequest(JSONObject.toJSONString(requestObj));
|
||||
}
|
||||
|
||||
private ApiDefinitionImport parsePluginFormat(JSONObject testObject, ApiTestImportRequest importRequest) {
|
||||
protected ApiDefinitionImport parsePluginFormat(JSONObject testObject, ApiTestImportRequest importRequest, Boolean isCreateModule) {
|
||||
List<ApiDefinitionWithBLOBs> results = new ArrayList<>();
|
||||
ApiDefinitionImport apiImport = new ApiDefinitionImport();
|
||||
apiImport.setProtocol(RequestType.HTTP);
|
||||
apiImport.setData(results);
|
||||
testObject.keySet().forEach(tag -> {
|
||||
|
||||
ApiModule parentModule = getSelectModule(importRequest.getModuleId());
|
||||
ApiModule module = buildModule(parentModule, tag, importRequest.isSaved());
|
||||
|
||||
ApiModule module = null;
|
||||
if (isCreateModule) {
|
||||
module = buildModule(getSelectModule(importRequest.getModuleId()), tag);
|
||||
}
|
||||
JSONObject requests = testObject.getJSONObject(tag);
|
||||
String moduleId = module.getId();
|
||||
|
||||
requests.keySet().forEach(requestName -> {
|
||||
|
||||
JSONObject requestObject = requests.getJSONObject(requestName);
|
||||
|
@ -84,7 +87,7 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
|
||||
MsHTTPSamplerProxy request = buildRequest(requestName, path, method);
|
||||
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), requestName, path, method,importRequest);
|
||||
apiDefinition.setModuleId(module.getId());
|
||||
apiDefinition.setModuleId(moduleId);
|
||||
apiDefinition.setProjectId(this.projectId);
|
||||
parseBody(requestObject, request.getBody());
|
||||
parseHeader(requestObject, request.getHeaders());
|
||||
|
@ -181,7 +184,7 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
Iterator<String> iterator = modules.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String item = iterator.next();
|
||||
parent = buildModule(parent, item, importRequest.isSaved());
|
||||
parent = buildModule(parent, item);
|
||||
if (!iterator.hasNext()) {
|
||||
apiDefinition.setModuleId(parent.getId());
|
||||
}
|
||||
|
|
|
@ -33,17 +33,20 @@ public class PostmanParser extends ApiImportAbstractParser {
|
|||
List<PostmanKeyValue> variables = postmanCollection.getVariable();
|
||||
ApiDefinitionImport apiImport = new ApiDefinitionImport();
|
||||
List<ApiDefinitionWithBLOBs> results = new ArrayList<>();
|
||||
parseItem(postmanCollection.getItem(), variables, results, buildModule(getSelectModule(request.getModuleId()), postmanCollection.getInfo().getName(), request.isSaved()), request.isSaved());
|
||||
parseItem(postmanCollection.getItem(), variables, results, buildModule(getSelectModule(request.getModuleId()), postmanCollection.getInfo().getName()), true);
|
||||
apiImport.setData(results);
|
||||
return apiImport;
|
||||
}
|
||||
|
||||
private void parseItem(List<PostmanItem> items, List<PostmanKeyValue> variables, List<ApiDefinitionWithBLOBs> results, ApiModule parentModule, boolean isSaved) {
|
||||
protected void parseItem(List<PostmanItem> items, List<PostmanKeyValue> variables, List<ApiDefinitionWithBLOBs> results, ApiModule parentModule, Boolean isCreateModule) {
|
||||
for (PostmanItem item : items) {
|
||||
List<PostmanItem> childItems = item.getItem();
|
||||
if (childItems != null) {
|
||||
ApiModule module = buildModule(parentModule, item.getName() , isSaved);
|
||||
parseItem(childItems, variables, results, module, isSaved);
|
||||
ApiModule module = null;
|
||||
if (isCreateModule) {
|
||||
module = buildModule(parentModule, item.getName());
|
||||
}
|
||||
parseItem(childItems, variables, results, module, isCreateModule);
|
||||
} else {
|
||||
ApiDefinitionWithBLOBs request = parsePostman(item);
|
||||
if (request != null) {
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package io.metersphere.api.parse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenrioExportResult;
|
||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||
import io.metersphere.api.dto.definition.request.MsScenario;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
||||
import io.metersphere.api.service.ApiModuleService;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.commons.constants.ApiImportPlatform;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ScenarioMsParser extends MsParser {
|
||||
|
||||
@Override
|
||||
public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) {
|
||||
String testStr = getApiTestStr(source);
|
||||
JSONObject testObject = JSONObject.parseObject(testStr, Feature.OrderedField);
|
||||
apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
this.projectId = request.getProjectId();
|
||||
if (testObject.get("projectId") != null) {
|
||||
return parseMsFormat(testStr, request);
|
||||
} else {
|
||||
request.setPlatform(ApiImportPlatform.Plugin.name());
|
||||
ApiDefinitionImport apiDefinitionImport = parsePluginFormat(testObject, request, false);
|
||||
MsScenario msScenario = new MsScenario();
|
||||
LinkedList<MsTestElement> msHTTPSamplerProxies = new LinkedList<>();
|
||||
apiDefinitionImport.getData().forEach(res -> {
|
||||
msHTTPSamplerProxies.add(JSONObject.parseObject(res.getRequest(), MsHTTPSamplerProxy.class));
|
||||
});
|
||||
msScenario.setHashTree(msHTTPSamplerProxies);
|
||||
msScenario.setType("scenario");
|
||||
msScenario.setName("test");
|
||||
apiDefinitionImport.setScenarioDefinition(msScenario);
|
||||
return apiDefinitionImport;
|
||||
}
|
||||
}
|
||||
|
||||
private ApiDefinitionImport parseMsFormat(String testStr, ApiTestImportRequest importRequest) {
|
||||
ApiScenrioExportResult apiScenrioExportResult = JSON.parseObject(testStr, ApiScenrioExportResult.class);
|
||||
apiScenrioExportResult.getData().forEach(scenario -> {
|
||||
parseApiDefinition(scenario, importRequest);
|
||||
});
|
||||
ApiDefinitionImport apiDefinitionImport = new ApiDefinitionImport();
|
||||
apiDefinitionImport.setScenarioDefinitionData(apiScenrioExportResult.getData());
|
||||
return apiDefinitionImport;
|
||||
}
|
||||
|
||||
private void parseApiDefinition(ApiScenarioWithBLOBs scenario, ApiTestImportRequest importRequest) {
|
||||
String id = UUID.randomUUID().toString();
|
||||
if (StringUtils.isBlank(scenario.getModulePath())) {
|
||||
scenario.setApiScenarioModuleId(null);
|
||||
}
|
||||
// parseModule(scenario, importRequest);
|
||||
scenario.setId(id);
|
||||
scenario.setProjectId(this.projectId);
|
||||
String scenarioDefinition = scenario.getScenarioDefinition();
|
||||
JSONObject scenarioDefinitionObj = JSONObject.parseObject(scenarioDefinition);
|
||||
scenarioDefinitionObj.put("id", id);
|
||||
scenario.setScenarioDefinition(JSONObject.toJSONString(scenarioDefinitionObj));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package io.metersphere.api.parse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||
import io.metersphere.api.dto.definition.request.MsScenario;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
||||
import io.metersphere.api.dto.parse.postman.PostmanCollection;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiModule;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ScenarioPostmanParser extends PostmanParser {
|
||||
|
||||
@Override
|
||||
public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) {
|
||||
this.projectId = request.getProjectId();
|
||||
ApiDefinitionImport apiImport = new ApiDefinitionImport();
|
||||
List<ApiDefinitionWithBLOBs> results = new ArrayList<>();
|
||||
PostmanCollection postmanCollection = JSON.parseObject(getApiTestStr(source), PostmanCollection.class);
|
||||
parseItem(postmanCollection.getItem(), postmanCollection.getVariable(), results, null, false);
|
||||
|
||||
MsScenario msScenario = new MsScenario();
|
||||
LinkedList<MsTestElement> msHTTPSamplerProxies = new LinkedList<>();
|
||||
results.forEach(res -> {
|
||||
msHTTPSamplerProxies.add(JSONObject.parseObject(res.getRequest(), MsHTTPSamplerProxy.class));
|
||||
});
|
||||
msScenario.setHashTree(msHTTPSamplerProxies);
|
||||
msScenario.setType("scenario");
|
||||
msScenario.setName(postmanCollection.getInfo().getName());
|
||||
apiImport.setScenarioDefinition(msScenario);
|
||||
return apiImport;
|
||||
}
|
||||
}
|
|
@ -71,7 +71,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
addBodyHeader(request);
|
||||
apiDefinition.setRequest(JSON.toJSONString(request));
|
||||
apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation, operation.getResponses())));
|
||||
buildModule(parentNode, apiDefinition, operation.getTags(), importRequest.isSaved());
|
||||
buildModule(parentNode, apiDefinition, operation.getTags());
|
||||
results.add(apiDefinition);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
addBodyHeader(request);
|
||||
apiDefinition.setRequest(JSON.toJSONString(request));
|
||||
apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation.getResponses())));
|
||||
buildModule(parentNode, apiDefinition, operation.getTags(), importRequest.isSaved());
|
||||
buildModule(parentNode, apiDefinition, operation.getTags());
|
||||
results.add(apiDefinition);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import java.util.List;
|
|||
|
||||
public abstract class SwaggerAbstractParser extends ApiImportAbstractParser {
|
||||
|
||||
protected void buildModule(ApiModule parentModule, ApiDefinitionWithBLOBs apiDefinition, List<String> tags, boolean isSaved) {
|
||||
protected void buildModule(ApiModule parentModule, ApiDefinitionWithBLOBs apiDefinition, List<String> tags) {
|
||||
if (tags != null) {
|
||||
tags.forEach(tag -> {
|
||||
ApiModule module = buildModule(parentModule, tag, isSaved);
|
||||
ApiModule module = buildModule(parentModule, tag);
|
||||
apiDefinition.setModuleId(module.getId());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,10 +14,13 @@ import io.metersphere.api.dto.automation.parse.ScenarioImportParser;
|
|||
import io.metersphere.api.dto.automation.parse.ScenarioImportParserFactory;
|
||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||
import io.metersphere.api.dto.definition.request.*;
|
||||
import io.metersphere.api.dto.definition.request.variable.ScenarioVariable;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.api.parse.ApiImportParser;
|
||||
import io.metersphere.api.parse.ApiScenarioImportParserFactory;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
|
@ -147,32 +150,11 @@ public class ApiAutomationService {
|
|||
request.setId(UUID.randomUUID().toString());
|
||||
checkNameExist(request);
|
||||
|
||||
final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
|
||||
scenario.setId(request.getId());
|
||||
scenario.setName(request.getName());
|
||||
scenario.setProjectId(request.getProjectId());
|
||||
scenario.setTags(request.getTags());
|
||||
scenario.setApiScenarioModuleId(request.getApiScenarioModuleId());
|
||||
scenario.setModulePath(request.getModulePath());
|
||||
scenario.setLevel(request.getLevel());
|
||||
scenario.setFollowPeople(request.getFollowPeople());
|
||||
scenario.setPrincipal(request.getPrincipal());
|
||||
scenario.setStepTotal(request.getStepTotal());
|
||||
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
||||
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
|
||||
|
||||
scenario.setCreateTime(System.currentTimeMillis());
|
||||
scenario.setUpdateTime(System.currentTimeMillis());
|
||||
scenario.setNum(getNextNum(request.getProjectId()));
|
||||
if (StringUtils.isNotEmpty(request.getStatus())) {
|
||||
scenario.setStatus(request.getStatus());
|
||||
} else {
|
||||
scenario.setStatus(ScenarioStatus.Underway.name());
|
||||
}
|
||||
if (request.getUserId() == null) {
|
||||
scenario.setUserId(SessionUtils.getUserId());
|
||||
} else {
|
||||
scenario.setUserId(request.getUserId());
|
||||
}
|
||||
scenario.setDescription(request.getDescription());
|
||||
|
||||
apiScenarioMapper.insert(scenario);
|
||||
|
||||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
|
@ -194,7 +176,12 @@ public class ApiAutomationService {
|
|||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
FileUtils.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
|
||||
final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
|
||||
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
|
||||
}
|
||||
|
||||
public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {
|
||||
ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
|
||||
scenario.setId(request.getId());
|
||||
scenario.setName(request.getName());
|
||||
scenario.setProjectId(request.getProjectId());
|
||||
|
@ -205,16 +192,19 @@ public class ApiAutomationService {
|
|||
scenario.setFollowPeople(request.getFollowPeople());
|
||||
scenario.setPrincipal(request.getPrincipal());
|
||||
scenario.setStepTotal(request.getStepTotal());
|
||||
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
||||
scenario.setUpdateTime(System.currentTimeMillis());
|
||||
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
||||
if (StringUtils.isNotEmpty(request.getStatus())) {
|
||||
scenario.setStatus(request.getStatus());
|
||||
} else {
|
||||
scenario.setStatus(ScenarioStatus.Underway.name());
|
||||
}
|
||||
scenario.setUserId(request.getUserId());
|
||||
scenario.setDescription(request.getDescription());
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
|
||||
if (request.getUserId() == null) {
|
||||
scenario.setUserId(SessionUtils.getUserId());
|
||||
} else {
|
||||
scenario.setUserId(request.getUserId());
|
||||
}
|
||||
return scenario;
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
|
@ -456,11 +446,11 @@ public class ApiAutomationService {
|
|||
* @return
|
||||
*/
|
||||
public String run(RunScenarioRequest request) {
|
||||
List<String> ids = request.getScenarioIds();
|
||||
if (request.isSelectAllDate()) {
|
||||
ids = this.getAllScenarioIdsByFontedSelect(
|
||||
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||
}
|
||||
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
|
||||
|
||||
List<String> ids = request.getIds();
|
||||
//检查是否有正在执行中的情景
|
||||
this.checkScenarioIsRunnng(ids);
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(ids);
|
||||
|
@ -670,11 +660,7 @@ public class ApiAutomationService {
|
|||
|
||||
public JmxInfoDTO genPerformanceTestJmx(RunScenarioRequest request) throws Exception {
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = null;
|
||||
List<String> ids = request.getScenarioIds();
|
||||
if (request.isSelectAllDate()) {
|
||||
ids = this.getAllScenarioIdsByFontedSelect(
|
||||
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||
}
|
||||
List<String> ids = request.getIds();
|
||||
apiScenarios = extApiScenarioMapper.selectIds(ids);
|
||||
String testName = "";
|
||||
if (!apiScenarios.isEmpty()) {
|
||||
|
@ -702,20 +688,17 @@ public class ApiAutomationService {
|
|||
return dto;
|
||||
}
|
||||
|
||||
public void bathEdit(SaveApiScenarioRequest request) {
|
||||
if (CollectionUtils.isEmpty(request.getScenarioIds())) {
|
||||
return;
|
||||
}
|
||||
if (request.isSelectAllDate()) {
|
||||
request.setScenarioIds(this.getAllScenarioIdsByFontedSelect(
|
||||
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds()));
|
||||
}
|
||||
public void bathEdit(ApiScenarioBatchRequest request) {
|
||||
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
|
||||
|
||||
if (StringUtils.isNotBlank(request.getEnvironmentId())) {
|
||||
bathEditEnv(request);
|
||||
return;
|
||||
}
|
||||
ApiScenarioExample apiScenarioExample = new ApiScenarioExample();
|
||||
apiScenarioExample.createCriteria().andIdIn(request.getScenarioIds());
|
||||
apiScenarioExample.createCriteria().andIdIn(request.getIds());
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = new ApiScenarioWithBLOBs();
|
||||
BeanUtils.copyBean(apiScenarioWithBLOBs, request);
|
||||
apiScenarioWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -724,9 +707,9 @@ public class ApiAutomationService {
|
|||
apiScenarioExample);
|
||||
}
|
||||
|
||||
public void bathEditEnv(SaveApiScenarioRequest request) {
|
||||
public void bathEditEnv(ApiScenarioBatchRequest request) {
|
||||
if (StringUtils.isNotBlank(request.getEnvironmentId())) {
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = selectByIdsWithBLOBs(request.getScenarioIds());
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = selectByIdsWithBLOBs(request.getIds());
|
||||
apiScenarios.forEach(item -> {
|
||||
JSONObject object = JSONObject.parseObject(item.getScenarioDefinition());
|
||||
object.put("environmentId", request.getEnvironmentId());
|
||||
|
@ -832,4 +815,40 @@ public class ApiAutomationService {
|
|||
}
|
||||
return apiImport;
|
||||
}
|
||||
|
||||
public ApiDefinitionImport scenarioImport(MultipartFile file, ApiTestImportRequest request) {
|
||||
ApiImportParser apiImportParser = ApiScenarioImportParserFactory.getApiImportParser(request.getPlatform());
|
||||
ApiDefinitionImport apiImport = null;
|
||||
try {
|
||||
apiImport = apiImportParser.parse(file == null ? null : file.getInputStream(), request);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(Translator.get("parse_data_error"));
|
||||
}
|
||||
SaveApiScenarioRequest saveReq = new SaveApiScenarioRequest();
|
||||
saveReq.setScenarioDefinition(apiImport.getScenarioDefinition());
|
||||
saveReq.setName(saveReq.getScenarioDefinition().getName());
|
||||
saveReq.setProjectId(request.getProjectId());
|
||||
saveReq.setApiScenarioModuleId(request.getModuleId());
|
||||
if (StringUtils.isNotBlank(request.getUserId())) {
|
||||
saveReq.setPrincipal(request.getUserId());
|
||||
} else {
|
||||
saveReq.setPrincipal(SessionUtils.getUserId());
|
||||
}
|
||||
create(saveReq, new ArrayList<>());
|
||||
return apiImport;
|
||||
}
|
||||
|
||||
public ApiScenrioExportResult export(ApiScenarioBatchRequest request) {
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
|
||||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(request.getIds());
|
||||
List<ApiScenarioWithBLOBs> apiScenarioWithBLOBs = apiScenarioMapper.selectByExampleWithBLOBs(example);
|
||||
ApiScenrioExportResult result = new ApiScenrioExportResult();
|
||||
result.setData(apiScenarioWithBLOBs);
|
||||
result.setProjectId(request.getProjectId());
|
||||
result.setVersion(System.getenv("MS_VERSION"));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import sun.security.util.Cache;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -498,9 +498,7 @@ public class ApiDefinitionService {
|
|||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(Translator.get("parse_data_error"));
|
||||
}
|
||||
if (request.isSaved()) {
|
||||
importApi(request, apiImport);
|
||||
}
|
||||
importApi(request, apiImport);
|
||||
return apiImport;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ApiDocumentService {
|
|||
|
||||
public ApiDocumentInfoDTO conversionModelToDTO(ApiDefinitionWithBLOBs apiModel) {
|
||||
ApiDocumentInfoDTO apiInfoDTO = new ApiDocumentInfoDTO();
|
||||
JSONObject previewObj = new JSONObject();
|
||||
if (apiModel != null) {
|
||||
apiInfoDTO.setId(apiModel.getId());
|
||||
apiInfoDTO.setName(apiModel.getName());
|
||||
|
@ -43,7 +44,6 @@ public class ApiDocumentService {
|
|||
apiInfoDTO.setStatus(apiModel.getStatus());
|
||||
|
||||
JSONObject requestJsonObj = JSONObject.parseObject(apiModel.getRequest());
|
||||
|
||||
//head赋值
|
||||
if (requestJsonObj.containsKey("headers")) {
|
||||
JSONArray requestHeadDataArr = new JSONArray();
|
||||
|
@ -55,9 +55,8 @@ public class ApiDocumentService {
|
|||
requestHeadDataArr.add(headObj);
|
||||
}
|
||||
}
|
||||
apiInfoDTO.setRequestHead(requestHeadDataArr.toJSONString());
|
||||
apiInfoDTO.setRequestHead(requestHeadDataArr.toJSONString());
|
||||
}
|
||||
|
||||
//url参数赋值
|
||||
JSONArray urlParamArr = new JSONArray();
|
||||
if (requestJsonObj.containsKey("arguments")) {
|
||||
|
@ -81,17 +80,43 @@ public class ApiDocumentService {
|
|||
}
|
||||
}
|
||||
apiInfoDTO.setUrlParams(urlParamArr.toJSONString());
|
||||
|
||||
//请求体参数类型
|
||||
if (requestJsonObj.containsKey("body")) {
|
||||
JSONObject bodyObj = requestJsonObj.getJSONObject("body");
|
||||
if (bodyObj.containsKey("type")) {
|
||||
String type = bodyObj.getString("type");
|
||||
apiInfoDTO.setRequestBodyParamType(type);
|
||||
if (StringUtils.equalsAny(type, "JSON", "XML", "Raw")) {
|
||||
if(StringUtils.equals(type,"WWW_FORM")){
|
||||
apiInfoDTO.setRequestBodyParamType("x-www-from-urlencoded");
|
||||
}else if(StringUtils.equals(type,"Form Data")) {
|
||||
apiInfoDTO.setRequestBodyParamType("form-data");
|
||||
}else {
|
||||
apiInfoDTO.setRequestBodyParamType(type);
|
||||
}
|
||||
|
||||
if (StringUtils.equals(type, "JSON")) {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if(bodyObj.containsKey("format")){
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if(StringUtils.equals("JSON-SCHEMA",foramtValue)){
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
if(isJsonSchema){
|
||||
apiInfoDTO.setRequestBodyParamType("JSON-SCHEMA");
|
||||
apiInfoDTO.setJsonSchemaBody(bodyObj);
|
||||
}else {
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
previewObj = JSONObject.parseObject(raw);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "XML", "Raw")) {
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
previewObj = JSONObject.parseObject(raw);
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) {
|
||||
if (bodyObj.containsKey("kvs")) {
|
||||
|
@ -99,8 +124,9 @@ public class ApiDocumentService {
|
|||
JSONArray kvsArr = bodyObj.getJSONArray("kvs");
|
||||
for (int i = 0; i < kvsArr.size(); i++) {
|
||||
JSONObject kv = kvsArr.getJSONObject(i);
|
||||
if (kv.containsKey("name")) {
|
||||
if (kv.containsKey("name")&&kv.containsKey("value")) {
|
||||
bodyParamArr.add(kv);
|
||||
previewObj.put(String.valueOf(kv.get("name")),String.valueOf(kv.get("value")));
|
||||
}
|
||||
}
|
||||
apiInfoDTO.setRequestBodyFormData(bodyParamArr.toJSONString());
|
||||
|
@ -108,12 +134,11 @@ public class ApiDocumentService {
|
|||
} else if (StringUtils.equals(type, "BINARY")) {
|
||||
if (bodyObj.containsKey("binary")) {
|
||||
List<Map<String, String>> bodyParamList = new ArrayList<>();
|
||||
JSONArray kvsArr = bodyObj.getJSONArray("kvs");
|
||||
JSONArray kvsArr = bodyObj.getJSONArray("binary");
|
||||
for (int i = 0; i < kvsArr.size(); i++) {
|
||||
JSONObject kv = kvsArr.getJSONObject(i);
|
||||
if (kv.containsKey("description") && kv.containsKey("files")) {
|
||||
Map<String, String> bodyMap = new HashMap<>();
|
||||
|
||||
String name = kv.getString("description");
|
||||
JSONArray fileArr = kv.getJSONArray("files");
|
||||
String value = "";
|
||||
|
@ -123,11 +148,12 @@ public class ApiDocumentService {
|
|||
value += fileObj.getString("name") + " ;";
|
||||
}
|
||||
}
|
||||
|
||||
bodyMap.put("name", name);
|
||||
bodyMap.put("value", value);
|
||||
|
||||
bodyMap.put("contentType", "File");
|
||||
bodyParamList.add(bodyMap);
|
||||
|
||||
previewObj.put(String.valueOf(name),String.valueOf(value));
|
||||
}
|
||||
}
|
||||
apiInfoDTO.setRequestBodyFormData(JSONArray.toJSONString(bodyParamList));
|
||||
|
@ -135,7 +161,6 @@ public class ApiDocumentService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject responseJsonObj = JSONObject.parseObject(apiModel.getResponse());
|
||||
//赋值响应头
|
||||
if (responseJsonObj.containsKey("headers")) {
|
||||
|
@ -149,13 +174,18 @@ public class ApiDocumentService {
|
|||
}
|
||||
apiInfoDTO.setResponseHead(responseHeadDataArr.toJSONString());
|
||||
}
|
||||
|
||||
// 赋值响应体
|
||||
if (responseJsonObj.containsKey("body")) {
|
||||
JSONObject bodyObj = responseJsonObj.getJSONObject("body");
|
||||
if (bodyObj.containsKey("type")) {
|
||||
String type = bodyObj.getString("type");
|
||||
apiInfoDTO.setResponseBodyParamType(type);
|
||||
if(StringUtils.equals(type,"WWW_FORM")){
|
||||
apiInfoDTO.setResponseBodyParamType("x-www-from-urlencoded");
|
||||
}else if(StringUtils.equals(type,"Form Data")) {
|
||||
apiInfoDTO.setResponseBodyParamType("form-data");
|
||||
}else {
|
||||
apiInfoDTO.setResponseBodyParamType(type);
|
||||
}
|
||||
if (StringUtils.equalsAny(type, "JSON", "XML", "Raw")) {
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
|
@ -191,10 +221,8 @@ public class ApiDocumentService {
|
|||
value += fileObj.getString("name") + " ;";
|
||||
}
|
||||
}
|
||||
|
||||
bodyMap.put("name", name);
|
||||
bodyMap.put("value", value);
|
||||
|
||||
bodyParamList.add(bodyMap);
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +231,6 @@ public class ApiDocumentService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 赋值响应码
|
||||
if (responseJsonObj.containsKey("statusCode")) {
|
||||
JSONArray responseStatusDataArr = new JSONArray();
|
||||
|
@ -217,6 +244,7 @@ public class ApiDocumentService {
|
|||
apiInfoDTO.setResponseCode(responseStatusDataArr.toJSONString());
|
||||
}
|
||||
}
|
||||
apiInfoDTO.setRequestPreviewData(previewObj);
|
||||
return apiInfoDTO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,10 +46,6 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
|||
@Resource
|
||||
TestPlanProjectService testPlanProjectService;
|
||||
@Resource
|
||||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
public ApiScenarioModuleService() {
|
||||
|
|
|
@ -29,6 +29,7 @@ import io.metersphere.service.FileService;
|
|||
import io.metersphere.service.QuotaService;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
@ -38,11 +39,10 @@ import org.apache.jorphan.collections.ListedHashTree;
|
|||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserHeader implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String props;
|
||||
|
||||
private String type;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,480 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserHeaderExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public UserHeaderExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNull() {
|
||||
addCriterion("user_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNotNull() {
|
||||
addCriterion("user_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdEqualTo(String value) {
|
||||
addCriterion("user_id =", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotEqualTo(String value) {
|
||||
addCriterion("user_id <>", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThan(String value) {
|
||||
addCriterion("user_id >", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("user_id >=", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThan(String value) {
|
||||
addCriterion("user_id <", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("user_id <=", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLike(String value) {
|
||||
addCriterion("user_id like", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotLike(String value) {
|
||||
addCriterion("user_id not like", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIn(List<String> values) {
|
||||
addCriterion("user_id in", values, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotIn(List<String> values) {
|
||||
addCriterion("user_id not in", values, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdBetween(String value1, String value2) {
|
||||
addCriterion("user_id between", value1, value2, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotBetween(String value1, String value2) {
|
||||
addCriterion("user_id not between", value1, value2, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsIsNull() {
|
||||
addCriterion("props is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsIsNotNull() {
|
||||
addCriterion("props is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsEqualTo(String value) {
|
||||
addCriterion("props =", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsNotEqualTo(String value) {
|
||||
addCriterion("props <>", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsGreaterThan(String value) {
|
||||
addCriterion("props >", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("props >=", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsLessThan(String value) {
|
||||
addCriterion("props <", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsLessThanOrEqualTo(String value) {
|
||||
addCriterion("props <=", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsLike(String value) {
|
||||
addCriterion("props like", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsNotLike(String value) {
|
||||
addCriterion("props not like", value, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsIn(List<String> values) {
|
||||
addCriterion("props in", values, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsNotIn(List<String> values) {
|
||||
addCriterion("props not in", values, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsBetween(String value1, String value2) {
|
||||
addCriterion("props between", value1, value2, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPropsNotBetween(String value1, String value2) {
|
||||
addCriterion("props not between", value1, value2, "props");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("`type` like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("`type` not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,12 +2,12 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.SwaggerUrlProjectMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.SwaggerUrlProject">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="swagger_url" jdbcType="VARCHAR" property="swaggerUrl" />
|
||||
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
|
||||
<result column="module_path" jdbcType="VARCHAR" property="modulePath" />
|
||||
<result column="mode_id" jdbcType="VARCHAR" property="modeId" />
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
|
||||
<result column="swagger_url" jdbcType="VARCHAR" property="swaggerUrl"/>
|
||||
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
|
||||
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
|
||||
<result column="mode_id" jdbcType="VARCHAR" property="modeId"/>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -70,43 +70,43 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, project_id, swagger_url, module_id, module_path, mode_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample" resultMap="BaseResultMap">
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
|
||||
resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
<include refid="Base_Column_List"/>
|
||||
from swagger_url_project
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from swagger_url_project
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from swagger_url_project
|
||||
delete
|
||||
from swagger_url_project
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample">
|
||||
delete from swagger_url_project
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
|
||||
insert into swagger_url_project (id, project_id, swagger_url,
|
||||
module_id, module_path, mode_id
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{swaggerUrl,jdbcType=VARCHAR},
|
||||
#{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{modeId,jdbcType=VARCHAR}
|
||||
)
|
||||
insert into swagger_url_project (id, project_id, swagger_url,
|
||||
module_id, module_path, mode_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{swaggerUrl,jdbcType=VARCHAR},
|
||||
#{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{modeId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
|
||||
insert into swagger_url_project
|
||||
|
@ -151,10 +151,11 @@
|
|||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample" resultType="java.lang.Long">
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
|
||||
resultType="java.lang.Long">
|
||||
select count(*) from swagger_url_project
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
|
@ -180,19 +181,19 @@
|
|||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update swagger_url_project
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
|
||||
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
||||
module_path = #{record.modulePath,jdbcType=VARCHAR},
|
||||
mode_id = #{record.modeId,jdbcType=VARCHAR}
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
|
||||
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
||||
module_path = #{record.modulePath,jdbcType=VARCHAR},
|
||||
mode_id = #{record.modeId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
|
||||
|
@ -218,11 +219,11 @@
|
|||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
|
||||
update swagger_url_project
|
||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
|
||||
module_id = #{moduleId,jdbcType=VARCHAR},
|
||||
module_path = #{modulePath,jdbcType=VARCHAR},
|
||||
mode_id = #{modeId,jdbcType=VARCHAR}
|
||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
|
||||
module_id = #{moduleId,jdbcType=VARCHAR},
|
||||
module_path = #{modulePath,jdbcType=VARCHAR},
|
||||
mode_id = #{modeId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,30 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.UserHeader;
|
||||
import io.metersphere.base.domain.UserHeaderExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface UserHeaderMapper {
|
||||
long countByExample(UserHeaderExample example);
|
||||
|
||||
int deleteByExample(UserHeaderExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(UserHeader record);
|
||||
|
||||
int insertSelective(UserHeader record);
|
||||
|
||||
List<UserHeader> selectByExample(UserHeaderExample example);
|
||||
|
||||
UserHeader selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") UserHeader record, @Param("example") UserHeaderExample example);
|
||||
|
||||
int updateByExample(@Param("record") UserHeader record, @Param("example") UserHeaderExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(UserHeader record);
|
||||
|
||||
int updateByPrimaryKey(UserHeader record);
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.UserHeaderMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UserHeader">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="props" jdbcType="VARCHAR" property="props" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, props, `type`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserHeaderExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from user_header
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user_header
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from user_header
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UserHeaderExample">
|
||||
delete from user_header
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.UserHeader">
|
||||
insert into user_header (id, user_id, props,
|
||||
`type`)
|
||||
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{props,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UserHeader">
|
||||
insert into user_header
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="props != null">
|
||||
props,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="props != null">
|
||||
#{props,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.UserHeaderExample" resultType="java.lang.Long">
|
||||
select count(*) from user_header
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update user_header
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userId != null">
|
||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.props != null">
|
||||
props = #{record.props,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update user_header
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
props = #{record.props,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UserHeader">
|
||||
update user_header
|
||||
<set>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="props != null">
|
||||
props = #{props,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UserHeader">
|
||||
update user_header
|
||||
set user_id = #{userId,jdbcType=VARCHAR},
|
||||
props = #{props,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -7,6 +7,13 @@
|
|||
<if test="request.projectId != null">
|
||||
api.project_Id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.name != null">
|
||||
api.project_Id like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<if test="request.type != null">
|
||||
api.method = #{request.type}
|
||||
</if>
|
||||
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
AND api.module_id in
|
||||
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
|
||||
|
@ -14,6 +21,14 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY api.create_time DESC
|
||||
<if test="request.orderCondition == 'createTimeDesc'">
|
||||
ORDER BY api.create_time DESC
|
||||
</if>
|
||||
<if test="request.orderCondition == 'editTimeAsc'">
|
||||
ORDER BY api.update_time
|
||||
</if>
|
||||
<if test="request.orderCondition == 'editTimeDesc'">
|
||||
ORDER BY api.update_time DESC
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
|
@ -6,6 +6,7 @@ import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
|||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioExample;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.controller.request.BaseQueryRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -34,4 +35,6 @@ public interface ExtApiScenarioMapper {
|
|||
List<String> selectIdsNotExistsInPlan(String projectId, String planId);
|
||||
|
||||
ApiScenario getNextNum(@Param("projectId") String projectId);
|
||||
|
||||
List<String> selectIdsByQuery(@Param("request") ApiScenarioRequest request);
|
||||
}
|
||||
|
|
|
@ -134,6 +134,11 @@
|
|||
from api_scenario
|
||||
left join project on api_scenario.project_id = project.id
|
||||
left join user on api_scenario.user_id = user.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
</select>
|
||||
|
||||
<sql id="queryWhereCondition">
|
||||
<where>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
|
@ -144,8 +149,8 @@
|
|||
|
||||
<if test="request.name != null">
|
||||
and (api_scenario.name like CONCAT('%', #{request.name},'%')
|
||||
or api_scenario.tags like CONCAT('%', #{request.name},'%')
|
||||
or api_scenario.num like CONCAT('%', #{request.name},'%'))
|
||||
or api_scenario.tags like CONCAT('%', #{request.name},'%')
|
||||
or api_scenario.num like CONCAT('%', #{request.name},'%'))
|
||||
</if>
|
||||
<if test="request.workspaceId != null">
|
||||
AND project.workspace_id = #{request.workspaceId}
|
||||
|
@ -223,19 +228,13 @@
|
|||
</if>
|
||||
<if test="request.notInTestPlan == true ">
|
||||
and api_scenario.id not in (
|
||||
select pc.api_scenario_id
|
||||
from test_plan_api_scenario pc
|
||||
where pc.test_plan_id = #{request.planId}
|
||||
select pc.api_scenario_id
|
||||
from test_plan_api_scenario pc
|
||||
where pc.test_plan_id = #{request.planId}
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
api_scenario.${order.name} ${order.type}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</sql>
|
||||
|
||||
<select id="selectByTagId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
select * from api_scenario where tags like CONCAT('%', #{id},'%')
|
||||
|
@ -321,4 +320,12 @@
|
|||
SELECT * FROM api_scenario WHERE api_scenario.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
|
||||
</select>
|
||||
|
||||
<select id="selectIdsByQuery" resultType="java.lang.String">
|
||||
select api_scenario.id
|
||||
from api_scenario
|
||||
left join project on api_scenario.project_id = project.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -1,8 +1,10 @@
|
|||
package io.metersphere.controller;
|
||||
|
||||
import io.metersphere.base.domain.SystemParameter;
|
||||
import io.metersphere.base.domain.UserHeader;
|
||||
import io.metersphere.commons.constants.ParamConstants;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.controller.request.HeaderRequest;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
import io.metersphere.notice.domain.MailInfo;
|
||||
|
@ -67,4 +69,13 @@ public class SystemParameterController {
|
|||
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
|
||||
}
|
||||
|
||||
@PostMapping("save/header")
|
||||
public void saveHeader(@RequestBody UserHeader userHeader) {
|
||||
SystemParameterService.saveHeader(userHeader);
|
||||
}
|
||||
|
||||
@PostMapping("/header/info")
|
||||
public UserHeader getHeaderInfo(@RequestBody HeaderRequest headerRequest) {
|
||||
return SystemParameterService.queryUserHeader(headerRequest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.controller.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class HeaderRequest {
|
||||
private String userId;
|
||||
private String type;
|
||||
}
|
|
@ -56,7 +56,7 @@ public class ApiScenarioTestJob extends MsScheduleJob {
|
|||
request.setProjectId(projectID);
|
||||
request.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||
request.setExecuteType(ExecuteType.Saved.name());
|
||||
request.setScenarioIds(this.scenarioIds);
|
||||
request.setIds(this.scenarioIds);
|
||||
request.setReportUserID(this.userId);
|
||||
|
||||
apiAutomationService.run(request);
|
||||
|
|
|
@ -29,7 +29,6 @@ public class SwaggerUrlImportJob extends MsScheduleJob {
|
|||
request.setSwaggerUrl(swaggerUrlProject.getSwaggerUrl());
|
||||
request.setModuleId(swaggerUrlProject.getModuleId());
|
||||
request.setPlatform("Swagger2");
|
||||
request.setSaved(true);
|
||||
request.setUserId(jobDataMap.getString("userId"));
|
||||
request.setType("schedule");
|
||||
apiDefinitionService.apiTestImport(null, request);
|
||||
|
|
|
@ -2,12 +2,16 @@ package io.metersphere.service;
|
|||
|
||||
import io.metersphere.base.domain.SystemParameter;
|
||||
import io.metersphere.base.domain.SystemParameterExample;
|
||||
import io.metersphere.base.domain.UserHeader;
|
||||
import io.metersphere.base.domain.UserHeaderExample;
|
||||
import io.metersphere.base.mapper.SystemParameterMapper;
|
||||
import io.metersphere.base.mapper.UserHeaderMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtSystemParameterMapper;
|
||||
import io.metersphere.commons.constants.ParamConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.controller.request.HeaderRequest;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
|
@ -29,7 +33,8 @@ import java.util.*;
|
|||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SystemParameterService {
|
||||
|
||||
@Resource
|
||||
private UserHeaderMapper userHeaderMapper;
|
||||
@Resource
|
||||
private SystemParameterMapper systemParameterMapper;
|
||||
@Resource
|
||||
|
@ -233,4 +238,29 @@ public class SystemParameterService {
|
|||
example.clear();
|
||||
});
|
||||
}
|
||||
|
||||
//保存表头
|
||||
public void saveHeader(UserHeader userHeader) {
|
||||
UserHeaderExample example=new UserHeaderExample();
|
||||
example.createCriteria().andUserIdEqualTo(userHeader.getUserId()).andTypeEqualTo(userHeader.getType());
|
||||
if(userHeaderMapper.countByExample(example)>0){
|
||||
userHeaderMapper.deleteByExample(example);
|
||||
userHeader.setId(UUID.randomUUID().toString());
|
||||
userHeaderMapper.insert(userHeader);
|
||||
}else{
|
||||
userHeader.setId(UUID.randomUUID().toString());
|
||||
userHeaderMapper.insert(userHeader);
|
||||
}
|
||||
example.clear();
|
||||
}
|
||||
|
||||
public UserHeader queryUserHeader(HeaderRequest headerRequest) {
|
||||
UserHeaderExample example = new UserHeaderExample();
|
||||
example.createCriteria().andUserIdEqualTo(headerRequest.getUserId()).andTypeEqualTo(headerRequest.getType());
|
||||
List<UserHeader> list = userHeaderMapper.selectByExample(example);
|
||||
if (list.size() > 0) {
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,14 +91,14 @@ public class TestCaseReviewController {
|
|||
|
||||
@PostMapping("/projects")
|
||||
public List<Project> getProjectByReviewId(@RequestBody TestReviewRelevanceRequest request) {
|
||||
List<String> projectIds = testReviewProjectService.getProjectIdsByReviewId(request.getReviewId());
|
||||
List<String> projectIds = testReviewProjectService.getProjectIdsByReviewId();
|
||||
request.setProjectIds(projectIds);
|
||||
return testReviewProjectService.getProject(request);
|
||||
}
|
||||
|
||||
@PostMapping("/project/{goPage}/{pageSize}")
|
||||
public Pager<List<Project>> getProjectByReviewId(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody TestReviewRelevanceRequest request) {
|
||||
List<String> projectIds = testReviewProjectService.getProjectIdsByReviewId(request.getReviewId());
|
||||
List<String> projectIds = testReviewProjectService.getProjectIdsByReviewId();
|
||||
request.setProjectIds(projectIds);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testReviewProjectService.getProject(request));
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.base.mapper.ext.ExtTestCaseNodeMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
||||
import io.metersphere.commons.constants.TestCaseConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.exception.ExcelException;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.service.NodeTreeService;
|
||||
|
@ -197,10 +198,11 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
|
||||
public List<TestCaseNodeDTO> getNodeByReviewId(String reviewId) {
|
||||
List<TestCaseNodeDTO> list = new ArrayList<>();
|
||||
TestCaseReview testCaseReview = new TestCaseReview();
|
||||
testCaseReview.setId(reviewId);
|
||||
List<Project> project = testCaseReviewService.getProjectByReviewId(testCaseReview);
|
||||
List<String> projectIds = project.stream().map(Project::getId).collect(Collectors.toList());
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId());
|
||||
List<Project> projects = projectMapper.selectByExample(example);
|
||||
List<String> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList());
|
||||
|
||||
projectIds.forEach(id -> {
|
||||
String name = projectMapper.selectByPrimaryKey(id).getName();
|
||||
|
||||
|
@ -405,6 +407,10 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
|
||||
TestCaseNodeDTO nodeTree = request.getNodeTree();
|
||||
|
||||
if (nodeTree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<TestCaseNode> updateNodes = new ArrayList<>();
|
||||
|
||||
buildUpdateTestCase(nodeTree, testCases, updateNodes, "/", "0", 1);
|
||||
|
|
|
@ -81,19 +81,7 @@ public class TestCaseReviewService {
|
|||
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
|
||||
checkCaseReviewExist(reviewRequest);
|
||||
String reviewId = UUID.randomUUID().toString();
|
||||
List<String> projectIds = reviewRequest.getProjectIds();
|
||||
List<String> userIds = reviewRequest.getUserIds();//执行人
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
List<String> ids = projectIds.stream().distinct().collect(Collectors.toList());
|
||||
// 如果关联项目id中包含当前项目id进行移除
|
||||
ids.remove(SessionUtils.getCurrentProjectId());
|
||||
ids.forEach(projectId -> {
|
||||
TestCaseReviewProject testCaseReviewProject = new TestCaseReviewProject();
|
||||
testCaseReviewProject.setProjectId(projectId);
|
||||
testCaseReviewProject.setReviewId(reviewId);
|
||||
testCaseReviewProjectMapper.insertSelective(testCaseReviewProject);
|
||||
});
|
||||
}
|
||||
|
||||
userIds.forEach(userId -> {
|
||||
TestCaseReviewUsers testCaseReviewUsers = new TestCaseReviewUsers();
|
||||
|
@ -216,7 +204,6 @@ public class TestCaseReviewService {
|
|||
|
||||
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
|
||||
editCaseReviewer(testCaseReview);
|
||||
editCaseReviewProject(testCaseReview);
|
||||
testCaseReview.setUpdateTime(System.currentTimeMillis());
|
||||
checkCaseReviewExist(testCaseReview);
|
||||
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
||||
|
@ -259,56 +246,6 @@ public class TestCaseReviewService {
|
|||
testCaseReviewUsersMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
private void editCaseReviewProject(SaveTestCaseReviewRequest testCaseReview) {
|
||||
List<String> projectIds = testCaseReview.getProjectIds();
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
projectIds.remove(testCaseReview.getProjectId());
|
||||
}
|
||||
String id = testCaseReview.getId();
|
||||
if (StringUtils.isNotBlank(testCaseReview.getProjectId())) {
|
||||
TestCaseReviewProjectExample testCaseReviewProjectExample = new TestCaseReviewProjectExample();
|
||||
testCaseReviewProjectExample.createCriteria().andReviewIdEqualTo(id);
|
||||
List<TestCaseReviewProject> testCaseReviewProjects = testCaseReviewProjectMapper.selectByExample(testCaseReviewProjectExample);
|
||||
List<String> dbProjectIds = testCaseReviewProjects.stream().map(TestCaseReviewProject::getProjectId).collect(Collectors.toList());
|
||||
projectIds.forEach(projectId -> {
|
||||
if (!dbProjectIds.contains(projectId)) {
|
||||
TestCaseReviewProject testCaseReviewProject = new TestCaseReviewProject();
|
||||
testCaseReviewProject.setReviewId(id);
|
||||
testCaseReviewProject.setProjectId(projectId);
|
||||
testCaseReviewProjectMapper.insert(testCaseReviewProject);
|
||||
}
|
||||
});
|
||||
|
||||
TestCaseReviewProjectExample example = new TestCaseReviewProjectExample();
|
||||
TestCaseReviewProjectExample.Criteria criteria1 = example.createCriteria().andReviewIdEqualTo(id);
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
criteria1.andProjectIdNotIn(projectIds);
|
||||
}
|
||||
testCaseReviewProjectMapper.deleteByExample(example);
|
||||
|
||||
|
||||
// 关联的项目下的用例idList
|
||||
List<String> caseIds = null;
|
||||
// 测试计划所属项目下的用例不解除关联
|
||||
projectIds.add(testCaseReview.getProjectId());
|
||||
// 关联的项目下的用例idList
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria().andProjectIdIn(projectIds);
|
||||
List<TestCase> caseList = testCaseMapper.selectByExample(testCaseExample);
|
||||
caseIds = caseList.stream().map(TestCase::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
TestCaseReviewTestCaseExample testCaseReviewTestCaseExample = new TestCaseReviewTestCaseExample();
|
||||
TestCaseReviewTestCaseExample.Criteria criteria = testCaseReviewTestCaseExample.createCriteria().andReviewIdEqualTo(id);
|
||||
if (!CollectionUtils.isEmpty(caseIds)) {
|
||||
criteria.andCaseIdNotIn(caseIds);
|
||||
}
|
||||
testCaseReviewTestCaseMapper.deleteByExample(testCaseReviewTestCaseExample);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkCaseReviewExist(TestCaseReview testCaseReview) {
|
||||
if (testCaseReview.getName() != null) {
|
||||
TestCaseReviewExample example = new TestCaseReviewExample();
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -26,23 +27,15 @@ public class TestPlanProjectService {
|
|||
private TestPlanMapper testPlanMapper;
|
||||
|
||||
public List<String> getProjectIdsByPlanId(String planId) {
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(planId);
|
||||
TestPlanProjectExample example = new TestPlanProjectExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(planId);
|
||||
List<String> projectIds = testPlanProjectMapper.selectByExample(example)
|
||||
.stream()
|
||||
.map(TestPlanProject::getProjectId)
|
||||
.collect(Collectors.toList());
|
||||
if (testPlan != null && StringUtils.isNotBlank(testPlan.getProjectId())) {
|
||||
if (!projectIds.contains(testPlan.getProjectId())) {
|
||||
projectIds.add(testPlan.getProjectId());
|
||||
}
|
||||
TestPlan plan = testPlanMapper.selectByPrimaryKey(planId);
|
||||
String workspaceId = plan.getWorkspaceId();
|
||||
if (StringUtils.isNotBlank(workspaceId)) {
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria().andWorkspaceIdEqualTo(workspaceId);
|
||||
List<Project> projects = projectMapper.selectByExample(example);
|
||||
return projects.stream().map(Project::getId).collect(Collectors.toList());
|
||||
}
|
||||
if (projectIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return projectIds;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<Project> getProjectByPlanId(TestCaseRelevanceRequest request) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class TestPlanScenarioCaseService {
|
|||
scenarioIds.add(apiScenario.getApiScenarioId());
|
||||
scenarioIdApiScarionMap.put(apiScenario.getApiScenarioId(),apiScenario.getId());
|
||||
}
|
||||
request.setScenarioIds(scenarioIds);
|
||||
request.setIds(scenarioIds);
|
||||
request.setScenarioTestPlanIdMap(scenarioIdApiScarionMap);
|
||||
request.setRunMode(ApiRunMode.SCENARIO_PLAN.name());
|
||||
return apiAutomationService.run(request);
|
||||
|
|
|
@ -119,15 +119,6 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
String testPlanId = UUID.randomUUID().toString();
|
||||
|
||||
List<String> projectIds = testPlan.getProjectIds();
|
||||
projectIds.forEach(id -> {
|
||||
TestPlanProject testPlanProject = new TestPlanProject();
|
||||
testPlanProject.setProjectId(id);
|
||||
testPlanProject.setTestPlanId(testPlanId);
|
||||
testPlanProjectMapper.insertSelective(testPlanProject);
|
||||
});
|
||||
|
||||
testPlan.setId(testPlanId);
|
||||
testPlan.setStatus(TestPlanStatus.Prepare.name());
|
||||
testPlan.setCreateTime(System.currentTimeMillis());
|
||||
|
@ -166,7 +157,6 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
public int editTestPlan(TestPlanDTO testPlan) {
|
||||
editTestPlanProject(testPlan);
|
||||
checkTestPlanExist(testPlan);
|
||||
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
|
||||
if (!res.getStatus().equals(testPlan.getStatus())) { // 若有改变才更新时间
|
||||
|
@ -213,70 +203,6 @@ public class TestPlanService {
|
|||
return i;
|
||||
}
|
||||
|
||||
private void editTestPlanProject(TestPlanDTO testPlan) {
|
||||
// 将要进行关联的项目ID
|
||||
List<String> projectIds = testPlan.getProjectIds();
|
||||
// 如果将要关联的项目ID中包含测试计划所属ID则进行剔除
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
if (projectIds.contains(testPlan.getProjectId())) {
|
||||
projectIds.remove(testPlan.getProjectId());
|
||||
}
|
||||
}
|
||||
// todo 优化; TestPlanList intoPlan 方法会触发此更新
|
||||
if (StringUtils.isNotBlank(testPlan.getProjectId())) {
|
||||
TestPlanProjectExample testPlanProjectExample1 = new TestPlanProjectExample();
|
||||
testPlanProjectExample1.createCriteria().andTestPlanIdEqualTo(testPlan.getId());
|
||||
List<TestPlanProject> testPlanProjects = testPlanProjectMapper.selectByExample(testPlanProjectExample1);
|
||||
// 已经关联的项目idList
|
||||
List<String> dbProjectIds = testPlanProjects.stream().map(TestPlanProject::getProjectId).collect(Collectors.toList());
|
||||
// 修改后传过来的项目idList,如果还未关联,进行关联
|
||||
projectIds.forEach(projectId -> {
|
||||
if (!dbProjectIds.contains(projectId)) {
|
||||
TestPlanProject testPlanProject = new TestPlanProject();
|
||||
testPlanProject.setTestPlanId(testPlan.getId());
|
||||
testPlanProject.setProjectId(projectId);
|
||||
testPlanProjectMapper.insert(testPlanProject);
|
||||
}
|
||||
});
|
||||
|
||||
TestPlanProjectExample testPlanProjectExample = new TestPlanProjectExample();
|
||||
TestPlanProjectExample.Criteria criteria1 = testPlanProjectExample.createCriteria();
|
||||
criteria1.andTestPlanIdEqualTo(testPlan.getId());
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
criteria1.andProjectIdNotIn(projectIds);
|
||||
}
|
||||
testPlanProjectMapper.deleteByExample(testPlanProjectExample);
|
||||
|
||||
// 关联的项目下的用例idList
|
||||
List<String> caseIds = null;
|
||||
// 测试计划所属项目下的用例不解除关联
|
||||
projectIds.add(testPlan.getProjectId());
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
TestCaseExample example = new TestCaseExample();
|
||||
example.createCriteria().andProjectIdIn(projectIds);
|
||||
List<TestCase> caseList = testCaseMapper.selectByExample(example);
|
||||
caseIds = caseList.stream().map(TestCase::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 取消关联项目下的用例和计划的关系
|
||||
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
||||
TestPlanTestCaseExample.Criteria criteria = testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlan.getId());
|
||||
if (!CollectionUtils.isEmpty(caseIds)) {
|
||||
criteria.andCaseIdNotIn(caseIds);
|
||||
}
|
||||
testPlanTestCaseMapper.deleteByExample(testPlanTestCaseExample);
|
||||
|
||||
List<String> relevanceProjectIds = new ArrayList<>();
|
||||
relevanceProjectIds.add(testPlan.getProjectId());
|
||||
if (!CollectionUtils.isEmpty(testPlan.getProjectIds())) {
|
||||
relevanceProjectIds.addAll(testPlan.getProjectIds());
|
||||
}
|
||||
testPlanApiCaseService.deleteByRelevanceProjectIds(testPlan.getId(), relevanceProjectIds);
|
||||
testPlanScenarioCaseService.deleteByRelevanceProjectIds(testPlan.getId(), relevanceProjectIds);
|
||||
testPlanLoadCaseService.deleteByRelevanceProjectIds(testPlan.getId(), relevanceProjectIds);
|
||||
}
|
||||
}
|
||||
|
||||
//计划内容
|
||||
private Map<String, Object> getTestPlanParamMap(TestPlan testPlan) {
|
||||
Long startTime = testPlan.getPlannedStartTime();
|
||||
|
@ -331,7 +257,6 @@ public class TestPlanService {
|
|||
public int deleteTestPlan(String planId) {
|
||||
TestPlan testPlan = getTestPlan(planId);
|
||||
deleteTestCaseByPlanId(planId);
|
||||
testPlanProjectService.deleteTestPlanProjectByPlanId(planId);
|
||||
testPlanApiCaseService.deleteByPlanId(planId);
|
||||
testPlanScenarioCaseService.deleteByPlanId(planId);
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ package io.metersphere.track.service;
|
|||
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.TestCaseReviewMapper;
|
||||
import io.metersphere.base.mapper.TestCaseReviewProjectMapper;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.track.request.testreview.TestReviewRelevanceRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -19,32 +18,14 @@ public class TestReviewProjectService {
|
|||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
@Resource
|
||||
private TestCaseReviewProjectMapper testCaseReviewProjectMapper;
|
||||
@Resource
|
||||
private TestCaseReviewMapper testCaseReviewMapper;
|
||||
|
||||
public List<String> getProjectIdsByReviewId(String reviewId) {
|
||||
TestCaseReviewProjectExample example = new TestCaseReviewProjectExample();
|
||||
example.createCriteria().andReviewIdEqualTo(reviewId);
|
||||
List<String> projectIds = testCaseReviewProjectMapper.selectByExample(example)
|
||||
.stream()
|
||||
.map(TestCaseReviewProject::getProjectId)
|
||||
.collect(Collectors.toList());
|
||||
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
if (caseReview != null && StringUtils.isNotBlank(caseReview.getProjectId())) {
|
||||
if (!projectIds.contains(caseReview.getProjectId())) {
|
||||
projectIds.add(caseReview.getProjectId());
|
||||
}
|
||||
}
|
||||
if (projectIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return projectIds;
|
||||
public List<String> getProjectIdsByReviewId() {
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId());
|
||||
List<Project> projects = projectMapper.selectByExample(example);
|
||||
return projects.stream().map(Project::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public List<Project> getProject(TestReviewRelevanceRequest request) {
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
ProjectExample.Criteria criteria = projectExample.createCriteria();
|
||||
|
|
|
@ -276,22 +276,19 @@ public class XmindCaseParser {
|
|||
testCase.setType("functional");
|
||||
|
||||
String tc = title.replace(":", ":");
|
||||
String[] tcArr = tc.split(":");
|
||||
if (tcArr.length < 1) {
|
||||
String[] tcArrs = tc.split(":");
|
||||
if (tcArrs.length < 1) {
|
||||
process.add(Translator.get("test_case_name") + Translator.get("incorrect_format"), title);
|
||||
return;
|
||||
}
|
||||
// 用例名称
|
||||
StringBuffer name = new StringBuffer();
|
||||
for (int i = 1; i < tcArr.length; i++) {
|
||||
name.append(tcArr[i]);
|
||||
}
|
||||
testCase.setName(name.toString());
|
||||
String name = title.replace(tcArrs[0] + ":", "").replace(tcArrs[0] + ":", "");
|
||||
testCase.setName(name);
|
||||
testCase.setNodePath(nodePath);
|
||||
|
||||
// 用例等级和用例性质处理
|
||||
if (tcArr[0].indexOf("-") != -1) {
|
||||
for (String item : tcArr[0].split("-")) {
|
||||
if (tcArrs[0].indexOf("-") != -1) {
|
||||
for (String item : tcArrs[0].split("-")) {
|
||||
if (isAvailable(item, TC_REGEX)) {
|
||||
continue;
|
||||
} else if (item.toUpperCase().startsWith("P")) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ALTER TABLE schedule
|
||||
MODIFY COLUMN id VARCHAR(255);
|
||||
MODIFY COLUMN id VARCHAR (255);
|
||||
ALTER TABLE message_task
|
||||
MODIFY COLUMN id VARCHAR(255);
|
||||
MODIFY COLUMN id VARCHAR (255);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ALTER TABLE schedule
|
||||
MODIFY COLUMN resource_id VARCHAR(255);
|
||||
MODIFY COLUMN resource_id VARCHAR (255);
|
||||
ALTER TABLE message_task
|
||||
MODIFY COLUMN test_id VARCHAR(255);
|
||||
MODIFY COLUMN test_id VARCHAR (255);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
create table user_header
|
||||
(
|
||||
id varchar(50) not null,
|
||||
user_id varchar(50) null,
|
||||
props varchar(1000) null,
|
||||
type varchar(150) null,
|
||||
constraint user_header_pk
|
||||
primary key (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
|
@ -66,6 +66,7 @@
|
|||
|
||||
<table tableName="auth_source"/>
|
||||
<table tableName="swagger_url_project"/>
|
||||
<table tableName="user_header"/>
|
||||
<!--<table tableName="test_plan_api_scenario"/>-->
|
||||
<!--<table tableName="test_plan"/>-->
|
||||
<!--<table tableName="api_scenario_report"/>-->
|
||||
|
|
|
@ -184,4 +184,5 @@ automation_exec_info=There are no test steps to execute
|
|||
authsource_name_already_exists=Authentication source name already exists
|
||||
authsource_name_is_null=Authentication source name cannot be empty
|
||||
authsource_configuration_is_null=Authentication source configuration cannot be empty
|
||||
mobile_phone_number_cannot_be_empty=When the receiving mode is pin and enterprise wechat: the user's mobile phone number cannot be empty
|
||||
|
||||
|
|
|
@ -185,4 +185,4 @@ automation_exec_info=沒有測試步驟,無法執行
|
|||
#authsource
|
||||
authsource_name_already_exists=認證源名稱已經存在
|
||||
authsource_name_is_null=認證源名稱不能為空
|
||||
authsource_configuration_is_null=認證源配置不能為空
|
||||
authsource_configuration_is_null=認證源配置不能為空
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table ms-select-all-fixed"
|
||||
@sort-change="sort"
|
||||
@filter-change="filter"
|
||||
@select-all="select" @select="select"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelect"
|
||||
@header-dragend="headerDragend"
|
||||
:height="screenHeight"
|
||||
v-loading="loading">
|
||||
|
@ -24,95 +25,109 @@
|
|||
|
||||
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="isSelect(scope.row)" :buttons="buttons" :size="selectDataCounts"/>
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID"
|
||||
sortable="custom"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip :key="index">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'name'" prop="name"
|
||||
sortable="custom"
|
||||
:label="$t('api_test.automation.scenario_name')"
|
||||
show-overflow-tooltip
|
||||
min-width="120px"
|
||||
:key="index"
|
||||
/>
|
||||
<el-table-column v-if="item.prop == 'level'" prop="level"
|
||||
sortable="custom"
|
||||
column-key="level"
|
||||
:filters="levelFilters"
|
||||
min-width="120px"
|
||||
:label="$t('api_test.automation.case_level')"
|
||||
show-overflow-tooltip :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.level"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'status'" prop="status" :label="$t('test_track.plan.plan_status')"
|
||||
sortable="custom"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
show-overflow-tooltip min-width="120px" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<plan-status-table-item :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'tags'" prop="tags" min-width="120px"
|
||||
:label="$t('api_test.automation.tag')" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'userId'" prop="userId" min-width="120px"
|
||||
:label="$t('api_test.automation.creator')"
|
||||
:filters="userFilters"
|
||||
column-key="user_id"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
|
||||
:label="$t('api_test.automation.update_time')" sortable="custom" min-width="180px"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
|
||||
:label="$t('api_test.automation.last_result')"
|
||||
:filters="resultFilters"
|
||||
|
||||
<el-table-column prop="num" label="ID"
|
||||
sortable="custom"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name"
|
||||
sortable="custom"
|
||||
:label="$t('api_test.automation.scenario_name')"
|
||||
show-overflow-tooltip
|
||||
min-width="120px"/>
|
||||
<el-table-column prop="level"
|
||||
sortable="custom"
|
||||
column-key="level"
|
||||
:filters="levelFilters"
|
||||
min-width="120px"
|
||||
|
||||
:label="$t('api_test.automation.case_level')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.level"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="$t('test_track.plan.plan_status')"
|
||||
sortable="custom"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
|
||||
show-overflow-tooltip min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<plan-status-table-item :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="tags" min-width="120px"
|
||||
:label="$t('api_test.automation.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userId" min-width="120px"
|
||||
:label="$t('api_test.automation.creator')"
|
||||
:filters="userFilters"
|
||||
column-key="user_id"
|
||||
sortable="custom"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="updateTime" :label="$t('api_test.automation.update_time')" sortable="custom" min-width="180px"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')"
|
||||
:filters="resultFilters"
|
||||
|
||||
sortable="custom" column-key="last_result" min-width="120px">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
|
||||
{{ $t('api_test.automation.success') }}
|
||||
</el-link>
|
||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
|
||||
{{ $t('api_test.automation.fail') }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
|
||||
min-width="120px"
|
||||
|
||||
show-overflow-tooltip/>
|
||||
sortable="custom" column-key="last_result" min-width="120px" :key="index">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
|
||||
{{ $t('api_test.automation.success') }}
|
||||
</el-link>
|
||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
|
||||
{{ $t('api_test.automation.fail') }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
|
||||
:label="$t('api_test.automation.passing_rate')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
</template>
|
||||
<el-table-column fixed="right" :label="$t('commons.operating')" width="190px" v-if="!referenced">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="{row}">
|
||||
<div v-if="trashEnable">
|
||||
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left" @exec="reductionApi(row)" v-tester/>
|
||||
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete" @exec="remove(row)" type="danger" v-tester/>
|
||||
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left"
|
||||
@exec="reductionApi(row)" v-tester/>
|
||||
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete"
|
||||
@exec="remove(row)" type="danger" v-tester/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<ms-table-operator-button :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)" v-tester/>
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.automation.execute')"
|
||||
<ms-table-operator-button :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)"
|
||||
v-tester/>
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true"
|
||||
:tip="$t('api_test.automation.execute')"
|
||||
icon="el-icon-video-play"
|
||||
@exec="execute(row)" v-tester/>
|
||||
<ms-table-operator-button :tip="$t('api_test.automation.copy')" icon="el-icon-document-copy" type=""
|
||||
|
@ -123,6 +138,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="search" :optionalFields=headerItems :type=type></header-custom>
|
||||
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
<div>
|
||||
|
@ -155,7 +171,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import MsTag from "../../../common/components/MsTag";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {downloadFile, getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "./TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -166,14 +182,25 @@ import MsTableOperatorButton from "@/business/components/common/components/MsTab
|
|||
import PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
|
||||
import BatchEdit from "../../../track/case/components/BatchEdit";
|
||||
import {WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
import {API_SCENARIO_LIST, TEST_CASE_LIST, TEST_PLAN_LIST, WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
import {PROJECT_NAME} from "../../../../../common/js/constants";
|
||||
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
|
||||
import BatchMove from "../../../track/case/components/BatchMove";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import {_sort} from "@/common/js/tableUtils";
|
||||
import {Api_Scenario_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {
|
||||
_filter,
|
||||
_handleSelect,
|
||||
_handleSelectAll,
|
||||
getSelectDataCounts,
|
||||
setUnSelectIds, toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
|
||||
export default {
|
||||
name: "MsApiScenarioList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
BatchMove,
|
||||
EnvironmentSelect,
|
||||
BatchEdit,
|
||||
|
@ -182,8 +209,8 @@ export default {
|
|||
MsTableHeaderSelectPopover,
|
||||
MsTablePagination,
|
||||
MsTableMoreBtn,
|
||||
ShowMoreBtn,
|
||||
MsTableHeader,
|
||||
ShowMoreBtn,
|
||||
MsTableHeader,
|
||||
MsTag,
|
||||
MsApiReportDetail,
|
||||
MsScenarioExtendButtons,
|
||||
|
@ -215,6 +242,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: API_SCENARIO_LIST,
|
||||
headerItems: Api_Scenario_List,
|
||||
tableLabel: Api_Scenario_List,
|
||||
loading: false,
|
||||
screenHeight: document.documentElement.clientHeight - 280,//屏幕高度,
|
||||
condition: {
|
||||
|
@ -255,7 +285,7 @@ export default {
|
|||
}
|
||||
],
|
||||
isSelectAllDate: false,
|
||||
unSelection: [],
|
||||
selectRows: new Set(),
|
||||
selectDataCounts: 0,
|
||||
typeArr: [
|
||||
{id: 'level', name: this.$t('test_track.case.priority')},
|
||||
|
@ -326,11 +356,16 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
selectByParam() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.search();
|
||||
},
|
||||
search() {
|
||||
this.selectRows = new Set();
|
||||
this.getLabel()
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (this.trashEnable) {
|
||||
this.condition.filters = {status: ["Trash"]};
|
||||
|
@ -380,6 +415,24 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = API_SCENARIO_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCommand(cmd) {
|
||||
let table = this.$refs.scenarioTable;
|
||||
switch (cmd) {
|
||||
|
@ -481,11 +534,9 @@ export default {
|
|||
}
|
||||
},
|
||||
buildBatchParam(param) {
|
||||
param.scenarioIds = this.selection;
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
param = Object.assign(param, this.condition);
|
||||
param.condition = this.condition;
|
||||
},
|
||||
handleBatchExecute() {
|
||||
this.infoDb = false;
|
||||
|
@ -499,16 +550,21 @@ export default {
|
|||
this.batchReportId = run.id;
|
||||
});
|
||||
},
|
||||
select(selection) {
|
||||
this.selection = selection.map(s => s.id);
|
||||
|
||||
//统计应当展示选择了多少行
|
||||
this.selectRowsCount(this.selection)
|
||||
|
||||
this.$emit('selection', selection);
|
||||
handleSelectAll(selection) {
|
||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||
},
|
||||
isSelect(row) {
|
||||
return this.selection.includes(row.id)
|
||||
handleSelect(selection, row) {
|
||||
_handleSelect(this, selection, row, this.selectRows);
|
||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||
},
|
||||
isSelectDataAll(data) {
|
||||
this.condition.selectAll = data;
|
||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||
toggleAllSelection(this.$refs.scenarioTable, this.tableData, this.selectRows);
|
||||
},
|
||||
edit(row) {
|
||||
let data = JSON.parse(JSON.stringify(row));
|
||||
|
@ -549,28 +605,6 @@ export default {
|
|||
this.infoDb = true;
|
||||
this.reportId = row.reportId;
|
||||
},
|
||||
//是否选择了全部数据
|
||||
isSelectDataAll(dataType) {
|
||||
this.isSelectAllDate = dataType;
|
||||
this.selectRowsCount(this.selection);
|
||||
//如果已经全选,不需要再操作了
|
||||
if (this.selection.length != this.tableData.length) {
|
||||
this.$refs.scenarioTable.toggleAllSelection(true);
|
||||
}
|
||||
},
|
||||
//选择数据数量统计
|
||||
selectRowsCount(selection) {
|
||||
let selectedIDs = selection;
|
||||
let allIDs = this.tableData.map(s => s.id);
|
||||
this.unSelection = allIDs.filter(function (val) {
|
||||
return selectedIDs.indexOf(val) === -1
|
||||
});
|
||||
if (this.isSelectAllDate) {
|
||||
this.selectDataCounts = this.total - this.unSelection.length;
|
||||
} else {
|
||||
this.selectDataCounts = this.selection.length;
|
||||
}
|
||||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isSelectThissWeekData() {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
|
@ -623,6 +657,20 @@ export default {
|
|||
openScenario(item) {
|
||||
this.$emit('openScenario', item)
|
||||
},
|
||||
exportApi() {
|
||||
let param = {};
|
||||
this.buildBatchParam(param);
|
||||
this.loading = true;
|
||||
if (param.ids === undefined || param.ids.length < 1) {
|
||||
this.$warning(this.$t("api_test.automation.scenario.check_case"));
|
||||
return;
|
||||
}
|
||||
this.result = this.$post("/api/automation/export", param, response => {
|
||||
this.loading = false;
|
||||
let obj = response.data;
|
||||
downloadFile("Metersphere_Scenario_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -31,6 +31,15 @@
|
|||
</template>
|
||||
</el-input>
|
||||
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>
|
||||
<api-scenario-module-header
|
||||
:condition="condition"
|
||||
:current-module="currentModule"
|
||||
:is-read-only="isReadOnly"
|
||||
:project-id="projectId"
|
||||
@exportAPI="exportAPI"
|
||||
@addScenario="addScenario"
|
||||
@refreshTable="$emit('refreshTable')"
|
||||
@refresh="refresh"/>
|
||||
</template>
|
||||
|
||||
</ms-node-tree>
|
||||
|
@ -46,26 +55,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {buildNodePath} from "../../definition/model/NodeTree";
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import MsNodeTree from "../../../track/common/NodeTree";
|
||||
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
|
||||
import ApiImport from "./common/ScenarioImport";
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsNodeTree from "../../../track/common/NodeTree";
|
||||
import {buildNodePath} from "../../definition/model/NodeTree";
|
||||
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
|
||||
import ApiScenarioModuleHeader from "@/business/components/api/automation/scenario/module/ApiScenarioModuleHeader";
|
||||
|
||||
export default {
|
||||
name: 'MsApiScenarioModule',
|
||||
components: {
|
||||
ModuleTrashButton,
|
||||
MsNodeTree,
|
||||
MsAddBasisScenario,
|
||||
SelectMenu,
|
||||
ApiImport
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
export default {
|
||||
name: 'MsApiScenarioModule',
|
||||
components: {
|
||||
ApiScenarioModuleHeader,
|
||||
ModuleTrashButton,
|
||||
MsNodeTree,
|
||||
MsAddBasisScenario,
|
||||
SelectMenu,
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false
|
||||
}
|
||||
|
@ -211,9 +220,9 @@
|
|||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||
}
|
||||
},
|
||||
// exportAPI() {
|
||||
// this.$emit('exportAPI');
|
||||
// },
|
||||
exportAPI() {
|
||||
this.$emit('exportAPI');
|
||||
},
|
||||
// debug() {
|
||||
// this.$emit('debug');
|
||||
// },
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
</el-col>
|
||||
<el-col :span="3" class="ms-col-one ms-font">
|
||||
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
|
||||
:{{getVariableSize()}}
|
||||
:{{ getVariableSize() }}
|
||||
</el-col>
|
||||
<el-col :span="3" class="ms-col-one ms-font">
|
||||
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
|
||||
|
@ -204,37 +204,44 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {API_STATUS, PRIORITY} from "../../definition/model/JsonData";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {Assertions, Extract, IfController, JSR223Processor, ConstantTimer, LoopController} from "../../definition/model/ApiTestModel";
|
||||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||
import {ELEMENTS, ELEMENT_TYPE} from "./Setting";
|
||||
import MsApiCustomize from "./ApiCustomize";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "./MsInputTag";
|
||||
import MsRun from "./DebugRun";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsVariableList from "./variable/VariableList";
|
||||
import ApiImport from "../../definition/components/import/ApiImport";
|
||||
import "@/common/css/material-icons.css"
|
||||
import OutsideClick from "@/common/js/outside-click";
|
||||
import ScenarioApiRelevance from "./api/ApiRelevance";
|
||||
import ScenarioRelevance from "./api/ScenarioRelevance";
|
||||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
import {API_STATUS, PRIORITY} from "../../definition/model/JsonData";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {
|
||||
Assertions,
|
||||
ConstantTimer,
|
||||
Extract,
|
||||
IfController,
|
||||
JSR223Processor,
|
||||
LoopController
|
||||
} from "../../definition/model/ApiTestModel";
|
||||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
||||
import MsApiCustomize from "./ApiCustomize";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "./MsInputTag";
|
||||
import MsRun from "./DebugRun";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsVariableList from "./variable/VariableList";
|
||||
import ApiImport from "../../definition/components/import/ApiImport";
|
||||
import "@/common/css/material-icons.css"
|
||||
import OutsideClick from "@/common/js/outside-click";
|
||||
import ScenarioApiRelevance from "./api/ApiRelevance";
|
||||
import ScenarioRelevance from "./api/ScenarioRelevance";
|
||||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "EditApiScenario",
|
||||
props: {
|
||||
moduleOptions: Array,
|
||||
currentScenario: {},
|
||||
},
|
||||
components: {
|
||||
MsVariableList,
|
||||
ScenarioRelevance,
|
||||
ScenarioApiRelevance,
|
||||
ApiEnvironmentConfig,
|
||||
export default {
|
||||
name: "EditApiScenario",
|
||||
props: {
|
||||
moduleOptions: Array,
|
||||
currentScenario: {},
|
||||
},
|
||||
components: {
|
||||
MsVariableList,
|
||||
ScenarioRelevance,
|
||||
ScenarioApiRelevance,
|
||||
ApiEnvironmentConfig,
|
||||
MsApiReportDetail,
|
||||
MsInputTag, MsRun,
|
||||
MsApiCustomize,
|
||||
|
@ -679,9 +686,15 @@
|
|||
if (valid) {
|
||||
this.editScenario();
|
||||
this.debugData = {
|
||||
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
|
||||
variables: this.currentScenario.variables, referenced: 'Created', enableCookieShare: this.enableCookieShare, headers: this.currentScenario.headers,
|
||||
environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
||||
id: this.currentScenario.id,
|
||||
name: this.currentScenario.name,
|
||||
type: "scenario",
|
||||
variables: this.currentScenario.variables,
|
||||
referenced: 'Created',
|
||||
enableCookieShare: this.enableCookieShare,
|
||||
headers: this.currentScenario.headers,
|
||||
environmentId: this.currentEnvironmentId,
|
||||
hashTree: this.scenarioDefinition
|
||||
};
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
}
|
||||
|
@ -912,9 +925,15 @@
|
|||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
id: this.currentScenario.id, enableCookieShare: this.enableCookieShare, name: this.currentScenario.name, type: "scenario",
|
||||
variables: this.currentScenario.variables, headers: this.currentScenario.headers,
|
||||
referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
||||
id: this.currentScenario.id,
|
||||
enableCookieShare: this.enableCookieShare,
|
||||
name: this.currentScenario.name,
|
||||
type: "scenario",
|
||||
variables: this.currentScenario.variables,
|
||||
headers: this.currentScenario.headers,
|
||||
referenced: 'Created',
|
||||
environmentId: this.currentEnvironmentId,
|
||||
hashTree: this.scenarioDefinition
|
||||
};
|
||||
this.currentScenario.scenarioDefinition = scenario;
|
||||
if (this.currentScenario.tags instanceof Array) {
|
||||
|
@ -1084,6 +1103,7 @@
|
|||
content: "\e722";
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.ms-sc-variable-header >>> .el-dialog__body {
|
||||
padding: 0px 20px;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
let scenarioIds = [];
|
||||
scenarioIds.push(row.id);
|
||||
run.projectId = getCurrentProjectID();
|
||||
run.scenarioIds = scenarioIds;
|
||||
run.ids = scenarioIds;
|
||||
run.id = getUUID();
|
||||
run.name = row.name;
|
||||
this.$post(url, run, response => {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-if="request.protocol === 'HTTP'">
|
||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-if="request.url" v-model="request.url" style="width: 85%;margin-top: 10px" size="small" @blur="urlChange">
|
||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-if="request.url" v-model="request.url"
|
||||
style="width: 85%;margin-top: 10px" size="small" @blur="urlChange">
|
||||
<el-select v-model="request.method" slot="prepend" style="width: 100px" size="small">
|
||||
<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-input>
|
||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-else v-model="request.path" style="width: 85%;margin-top: 10px" size="small" @blur="pathChange">
|
||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-else v-model="request.path"
|
||||
style="width: 85%;margin-top: 10px" size="small" @blur="pathChange">
|
||||
<el-select v-model="request.method" slot="prepend" style="width: 100px" size="small">
|
||||
<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
|
@ -33,55 +35,55 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {REQ_METHOD} from "@/business/components/api/definition/model/JsonData";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
import {REQ_METHOD} from "@/business/components/api/definition/model/JsonData";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
|
||||
export default {
|
||||
name: "CustomizeReqInfo",
|
||||
props: ['request', 'isCustomizeReq'],
|
||||
data() {
|
||||
return {
|
||||
reqOptions: REQ_METHOD,
|
||||
export default {
|
||||
name: "CustomizeReqInfo",
|
||||
props: ['request', 'isCustomizeReq'],
|
||||
data() {
|
||||
return {
|
||||
reqOptions: REQ_METHOD,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pathChange() {
|
||||
if (!this.request.path || this.request.path.indexOf('?') === -1) return;
|
||||
let url = this.getURL(this.addProtocol(this.request.path));
|
||||
if (url) {
|
||||
this.request.path = decodeURIComponent(this.request.path.substr(0, this.request.path.indexOf("?")));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pathChange() {
|
||||
if (!this.request.path || this.request.path.indexOf('?') === -1) return;
|
||||
let url = this.getURL(this.addProtocol(this.request.path));
|
||||
if (url) {
|
||||
this.request.path = decodeURIComponent(this.request.path.substr(0, this.request.path.indexOf("?")));
|
||||
urlChange() {
|
||||
if (!this.request.url || this.request.url.indexOf('?') === -1) return;
|
||||
let url = this.getURL(this.addProtocol(this.request.url));
|
||||
if (url) {
|
||||
this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?")));
|
||||
}
|
||||
},
|
||||
addProtocol(url) {
|
||||
if (url) {
|
||||
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
|
||||
return "https://" + url;
|
||||
}
|
||||
},
|
||||
urlChange() {
|
||||
if (!this.request.url || this.request.url.indexOf('?') === -1) return;
|
||||
let url = this.getURL(this.addProtocol(this.request.url));
|
||||
if (url) {
|
||||
this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?")));
|
||||
}
|
||||
},
|
||||
addProtocol(url) {
|
||||
if (url) {
|
||||
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
|
||||
return "https://" + url;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
getURL(urlStr) {
|
||||
try {
|
||||
let url = new URL(urlStr);
|
||||
url.searchParams.forEach((value, key) => {
|
||||
if (key && value) {
|
||||
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
||||
}
|
||||
}
|
||||
});
|
||||
return url;
|
||||
},
|
||||
getURL(urlStr) {
|
||||
try {
|
||||
let url = new URL(urlStr);
|
||||
url.searchParams.forEach((value, key) => {
|
||||
if (key && value) {
|
||||
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
||||
}
|
||||
});
|
||||
return url;
|
||||
} catch (e) {
|
||||
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||
}
|
||||
},
|
||||
}
|
||||
} catch (e) {
|
||||
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -28,13 +28,17 @@
|
|||
|
||||
<customize-req-info :is-customize-req="isCustomizeReq" :request="request"/>
|
||||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-api-request-form :isShowEnable="true" :referenced="true" :headers="request.headers " :request="request" v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"/>
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
<ms-api-request-form :isShowEnable="true" :referenced="true" :headers="request.headers " :request="request"
|
||||
v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"/>
|
||||
<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'|| request.type==='TCPSampler'"/>
|
||||
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'" :showScript="false"/>
|
||||
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/>
|
||||
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
|
||||
:showScript="false"/>
|
||||
<ms-dubbo-basis-parameters :request="request"
|
||||
v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
|
||||
:showScript="false"/>
|
||||
|
||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
|
||||
<div v-if="request.result">
|
||||
<el-tabs v-model="request.activeName" closable class="ms-tabs">
|
||||
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in request.result.scenarios" :key="index">
|
||||
|
@ -47,37 +51,37 @@
|
|||
<api-response-component :currentProtocol="request.protocol" :result="request.requestResult" v-else/>
|
||||
|
||||
<!-- 保存操作 -->
|
||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">
|
||||
{{$t('commons.save')}}
|
||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)"
|
||||
v-if="!request.referenced">
|
||||
{{ $t('commons.save') }}
|
||||
</el-button>
|
||||
|
||||
</api-base-component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsSqlBasisParameters from "../../../definition/components/request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../../../definition/components/request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import {REQ_METHOD} from "../../../definition/model/JsonData";
|
||||
import MsRequestResultTail from "../../../definition/components/response/RequestResultTail";
|
||||
import MsRun from "../../../definition/components/Run";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
|
||||
import MsSqlBasisParameters from "../../../definition/components/request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../../../definition/components/request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import MsRequestResultTail from "../../../definition/components/response/RequestResultTail";
|
||||
import MsRun from "../../../definition/components/Run";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
|
||||
|
||||
export default {
|
||||
name: "MsApiComponent",
|
||||
props: {
|
||||
request: {},
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
currentEnvironmentId: String,
|
||||
export default {
|
||||
name: "MsApiComponent",
|
||||
props: {
|
||||
request: {},
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
currentEnvironmentId: String,
|
||||
},
|
||||
components: {
|
||||
CustomizeReqInfo,
|
||||
|
|
|
@ -22,23 +22,23 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsSqlBasisParameters from "../../../definition/components/request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../../../definition/components/request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import MsSqlBasisParameters from "../../../definition/components/request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../../../definition/components/request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "ApiScenarioComponent",
|
||||
props: {
|
||||
scenario: {},
|
||||
node: {},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
export default {
|
||||
name: "ApiScenarioComponent",
|
||||
props: {
|
||||
scenario: {},
|
||||
node: {},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
watch: {},
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) {
|
||||
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
|
||||
|
|
|
@ -19,59 +19,59 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import Jsr233ProcessorContent from "../common/Jsr233ProcessorContent";
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import Jsr233ProcessorContent from "../common/Jsr233ProcessorContent";
|
||||
|
||||
export default {
|
||||
name: "MsJsr233Processor",
|
||||
components: {Jsr233ProcessorContent, ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
props: {
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
export default {
|
||||
name: "MsJsr233Processor",
|
||||
components: {Jsr233ProcessorContent, ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
props: {
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
},
|
||||
jsr223Processor: {
|
||||
type: Object,
|
||||
},
|
||||
isPreProcessor: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
},
|
||||
title: String,
|
||||
color: String,
|
||||
backgroundColor: String,
|
||||
node: {},
|
||||
isPreProcessor: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
},
|
||||
data() {
|
||||
return {loading: false}
|
||||
title: String,
|
||||
color: String,
|
||||
backgroundColor: String,
|
||||
node: {},
|
||||
},
|
||||
data() {
|
||||
return {loading: false}
|
||||
},
|
||||
methods: {
|
||||
remove() {
|
||||
this.$emit('remove', this.jsr223Processor, this.node);
|
||||
},
|
||||
methods: {
|
||||
remove() {
|
||||
this.$emit('remove', this.jsr223Processor, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223Processor, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
active() {
|
||||
this.jsr223Processor.active = !this.jsr223Processor.active;
|
||||
this.reload();
|
||||
},
|
||||
}
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223Processor, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
active() {
|
||||
this.jsr223Processor.active = !this.jsr223Processor.active;
|
||||
this.reload();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -97,22 +97,22 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import MsRun from "../DebugRun";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import MsRun from "../DebugRun";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsLoopController",
|
||||
components: {ApiBaseComponent, ApiResponseComponent, MsRun},
|
||||
props: {
|
||||
controller: {},
|
||||
currentEnvironmentId: String,
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
export default {
|
||||
name: "MsLoopController",
|
||||
components: {ApiBaseComponent, ApiResponseComponent, MsRun},
|
||||
props: {
|
||||
controller: {},
|
||||
currentEnvironmentId: String,
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
@ -204,9 +204,15 @@
|
|||
}
|
||||
this.loading = true;
|
||||
this.debugData = {
|
||||
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
|
||||
variables: this.currentScenario.variables, headers: this.currentScenario.headers,
|
||||
referenced: 'Created', enableCookieShare: this.enableCookieShare, environmentId: this.currentEnvironmentId, hashTree: [this.controller]
|
||||
id: this.currentScenario.id,
|
||||
name: this.currentScenario.name,
|
||||
type: "scenario",
|
||||
variables: this.currentScenario.variables,
|
||||
headers: this.currentScenario.headers,
|
||||
referenced: 'Created',
|
||||
enableCookieShare: this.enableCookieShare,
|
||||
environmentId: this.currentEnvironmentId,
|
||||
hashTree: [this.controller]
|
||||
};
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
},
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-input :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small">
|
||||
<template v-slot:append>
|
||||
<el-dropdown v-if="!isReadOnly" size="small" split-button type="primary" class="ms-api-button" @click="handleCommand('add-api')"
|
||||
v-tester
|
||||
@command="handleCommand">
|
||||
<el-button icon="el-icon-folder-add" @click="addScenario"></el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="import">{{ $t('api_test.api_import.label') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="export">{{ $t('report.export') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
</el-input>
|
||||
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>
|
||||
|
||||
<api-import :model="'scenario'" ref="apiImport" :moduleOptions="moduleOptions" @refresh="$emit('refresh')"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import ModuleTrashButton from "@/business/components/api/definition/components/module/ModuleTrashButton";
|
||||
import ApiImport from "@/business/components/api/definition/components/import/ApiImport";
|
||||
|
||||
export default {
|
||||
name: "ApiScenarioModuleHeader",
|
||||
components: {ApiImport, ModuleTrashButton},
|
||||
data() {
|
||||
return {
|
||||
moduleOptions: {}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
condition: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
currentModule: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false
|
||||
}
|
||||
},
|
||||
projectId: String
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
case "import":
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.result = this.$get("/api/automation/module/list/" + this.projectId + "/", response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data = response.data;
|
||||
let moduleOptions = [];
|
||||
this.data.forEach(node => {
|
||||
buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.moduleOptions = moduleOptions
|
||||
}
|
||||
});
|
||||
this.$refs.apiImport.open(this.currentModule);
|
||||
break;
|
||||
default:
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.$emit('exportAPI');
|
||||
break;
|
||||
}
|
||||
},
|
||||
addScenario() {
|
||||
this.$emit('addScenario');
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
enableTrash() {
|
||||
this.condition.trashEnable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.read-only {
|
||||
width: 150px !important;
|
||||
}
|
||||
|
||||
.filter-input {
|
||||
width: 174px;
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -7,7 +7,8 @@
|
|||
<div style="margin-top: 10px">
|
||||
<el-row style="margin-bottom: 10px">
|
||||
<el-col :span="8">
|
||||
<el-input placeholder="变量名称搜索" v-model="selectVariable" size="small" @change="filter" @keyup.enter="filter">
|
||||
<el-input placeholder="变量名称搜索" v-model="selectVariable" size="small" @change="filter"
|
||||
@keyup.enter="filter">
|
||||
<el-select v-model="searchType" slot="prepend" placeholder="类型" style="width: 90px" @change="filter">
|
||||
<el-option value="CONSTANT" label="常量"></el-option>
|
||||
<el-option value="LIST" label="列表"></el-option>
|
||||
|
@ -19,8 +20,9 @@
|
|||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-dropdown split-button type="primary" @command="handleClick" @click="handleClick('CONSTANT')" size="small" style="margin-left: 10px">
|
||||
{{$t('commons.add')}}
|
||||
<el-dropdown split-button type="primary" @command="handleClick" @click="handleClick('CONSTANT')"
|
||||
size="small" style="margin-left: 10px">
|
||||
{{ $t('commons.add') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="CONSTANT">常量</el-dropdown-item>
|
||||
<el-dropdown-item command="LIST">列表</el-dropdown-item>
|
||||
|
@ -29,21 +31,23 @@
|
|||
<el-dropdown-item command="RANDOM">随机数</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button size="small" style="margin-left: 10px" @click="deleteVariable">{{$t('commons.delete')}}</el-button>
|
||||
<el-button size="small" style="margin-left: 10px" @click="deleteVariable">{{ $t('commons.delete') }}
|
||||
</el-button>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
|
||||
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select" @select="select"
|
||||
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select"
|
||||
@select="select"
|
||||
v-loading="loading" @row-click="edit" height="400px" :row-class-name="tableRowClassName">
|
||||
<el-table-column type="selection" width="38"/>
|
||||
<el-table-column prop="num" label="ID" sortable/>
|
||||
<el-table-column prop="name" :label="$t('api_test.variable_name')" sortable show-overflow-tooltip/>
|
||||
<el-table-column prop="type" :label="$t('test_track.case.type')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{types.get(scope.row.type)}}</span>
|
||||
<span>{{ types.get(scope.row.type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value" :label="$t('api_test.value')" show-overflow-tooltip/>
|
||||
|
@ -64,15 +68,17 @@
|
|||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
||||
<!-- 请求头-->
|
||||
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start" slot="label">
|
||||
<span>{{$t('api_test.request.headers')}}
|
||||
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start"
|
||||
slot="label">
|
||||
<span>{{ $t('api_test.request.headers') }}
|
||||
<div class="el-step__icon is-text ms-api-col ms-variable-header" v-if="headers.length>1">
|
||||
<div class="el-step__icon-inner">{{headers.length-1}}</div>
|
||||
<div class="el-step__icon-inner">{{ headers.length - 1 }}</div>
|
||||
</div>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-row>
|
||||
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887"> {{$t("commons.batch_add")}}</el-link>
|
||||
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887"> {{ $t("commons.batch_add") }}
|
||||
</el-link>
|
||||
</el-row>
|
||||
<div style="min-height: 400px">
|
||||
<ms-api-key-value :items="headers"/>
|
||||
|
@ -82,40 +88,40 @@
|
|||
</el-tabs>
|
||||
<template v-slot:footer>
|
||||
<div>
|
||||
<el-button type="primary" @click="save">{{$t('commons.confirm')}}</el-button>
|
||||
<el-button type="primary" @click="save">{{ $t('commons.confirm') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsEditConstant from "./EditConstant";
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsEditCounter from "./EditCounter";
|
||||
import MsEditRandom from "./EditRandom";
|
||||
import MsEditListValue from "./EditListValue";
|
||||
import MsEditCsv from "./EditCsv";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiKeyValue from "../../../definition/components/ApiKeyValue";
|
||||
import BatchAddParameter from "../../../definition/components/basis/BatchAddParameter";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
import MsEditConstant from "./EditConstant";
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsEditCounter from "./EditCounter";
|
||||
import MsEditRandom from "./EditRandom";
|
||||
import MsEditListValue from "./EditListValue";
|
||||
import MsEditCsv from "./EditCsv";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiKeyValue from "../../../definition/components/ApiKeyValue";
|
||||
import BatchAddParameter from "../../../definition/components/basis/BatchAddParameter";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
|
||||
export default {
|
||||
name: "MsVariableList",
|
||||
components: {
|
||||
MsEditConstant,
|
||||
MsDialogFooter,
|
||||
MsTableHeader,
|
||||
MsTablePagination,
|
||||
MsEditCounter,
|
||||
MsEditRandom,
|
||||
MsEditListValue,
|
||||
MsEditCsv,
|
||||
MsApiKeyValue,
|
||||
BatchAddParameter
|
||||
},
|
||||
export default {
|
||||
name: "MsVariableList",
|
||||
components: {
|
||||
MsEditConstant,
|
||||
MsDialogFooter,
|
||||
MsTableHeader,
|
||||
MsTablePagination,
|
||||
MsEditCounter,
|
||||
MsEditRandom,
|
||||
MsEditListValue,
|
||||
MsEditCsv,
|
||||
MsApiKeyValue,
|
||||
BatchAddParameter
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
variables: [],
|
||||
|
@ -154,7 +160,18 @@
|
|||
if (line[1] === '必填' || line[1] === 'true') {
|
||||
required = true;
|
||||
}
|
||||
keyValues.push(new KeyValue({name: line[0], required: required, value: line[2], description: line[3], type: "text", valid: false, file: false, encode: true, enable: true, contentType: "text/plain"}));
|
||||
keyValues.push(new KeyValue({
|
||||
name: line[0],
|
||||
required: required,
|
||||
value: line[2],
|
||||
description: line[3],
|
||||
type: "text",
|
||||
valid: false,
|
||||
file: false,
|
||||
encode: true,
|
||||
enable: true,
|
||||
contentType: "text/plain"
|
||||
}));
|
||||
})
|
||||
keyValues.forEach(item => {
|
||||
this.headers.unshift(item);
|
||||
|
@ -268,19 +285,19 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
.ms-variable-hidden-row {
|
||||
display: none;
|
||||
}
|
||||
.ms-variable-hidden-row {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ms-variable-header {
|
||||
background: #783887;
|
||||
color: white;
|
||||
height: 18px;
|
||||
border-radius: 42%;
|
||||
}
|
||||
.ms-variable-header {
|
||||
background: #783887;
|
||||
color: white;
|
||||
height: 18px;
|
||||
border-radius: 42%;
|
||||
}
|
||||
|
||||
.ms-variable-link {
|
||||
float: right;
|
||||
margin-right: 45px;
|
||||
}
|
||||
.ms-variable-link {
|
||||
float: right;
|
||||
margin-right: 45px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -52,31 +52,31 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsApiAssertionText from "./ApiAssertionText";
|
||||
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
||||
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
||||
import {ASSERTION_TYPE, JSONPath} from "../../model/ApiTestModel";
|
||||
import MsApiAssertionsEdit from "./ApiAssertionsEdit";
|
||||
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
||||
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
||||
import MsApiJsonpathSuggestList from "./ApiJsonpathSuggestList";
|
||||
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "./ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "./ApiJsonpathSuggest";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
import MsApiAssertionText from "./ApiAssertionText";
|
||||
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
||||
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
||||
import {ASSERTION_TYPE, JSONPath} from "../../model/ApiTestModel";
|
||||
import MsApiAssertionsEdit from "./ApiAssertionsEdit";
|
||||
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
||||
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
||||
import MsApiJsonpathSuggestList from "./ApiJsonpathSuggestList";
|
||||
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "./ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "./ApiJsonpathSuggest";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "MsApiAssertions",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiAssertionXPath2,
|
||||
MsApiAssertionJsr223,
|
||||
MsApiJsonpathSuggestList,
|
||||
MsApiAssertionJsonPath,
|
||||
MsApiAssertionsEdit, MsApiAssertionDuration, MsApiAssertionRegex, MsApiAssertionText
|
||||
export default {
|
||||
name: "MsApiAssertions",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiAssertionXPath2,
|
||||
MsApiAssertionJsr223,
|
||||
MsApiJsonpathSuggestList,
|
||||
MsApiAssertionJsonPath,
|
||||
MsApiAssertionsEdit, MsApiAssertionDuration, MsApiAssertionRegex, MsApiAssertionText
|
||||
},
|
||||
props: {
|
||||
draggable: {
|
||||
|
|
|
@ -2,16 +2,18 @@
|
|||
|
||||
<div class="card-container" v-loading="loading">
|
||||
<el-card class="card-content">
|
||||
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary" @click="handleCommand"> {{$t('commons.test')}}</el-button>
|
||||
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary"
|
||||
@click="handleCommand"> {{ $t('commons.test') }}
|
||||
</el-button>
|
||||
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
|
||||
{{$t('commons.test')}}
|
||||
{{ $t('commons.test') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as_case')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
<!-- 请求参数 -->
|
||||
<ms-basis-parameters :request="request" ref="requestForm"/>
|
||||
|
||||
|
@ -34,29 +36,38 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID, getCurrentUser} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters, MsJmxStep, MsApiCaseList},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {
|
||||
MsRequestResultTail,
|
||||
MsResponseResult,
|
||||
MsRequestMetric,
|
||||
MsResponseText,
|
||||
MsRun,
|
||||
MsBasisParameters,
|
||||
MsJmxStep,
|
||||
MsApiCaseList
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
url: [{required: true, message: this.$t('api_test.definition.request.path_all_info'), trigger: 'blur'}],
|
||||
},
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand"> {{$t('commons.test')}}</el-button>
|
||||
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand"> {{ $t('commons.test') }}
|
||||
</el-button>
|
||||
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small" v-if="testCase===undefined && !scenario">
|
||||
{{$t('commons.test')}}
|
||||
|
@ -48,30 +49,39 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID, getCurrentUser} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import {KeyValue} from "../../model/ApiTestModel";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import {KeyValue} from "../../model/ApiTestModel";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsJmxStep, MsApiCaseList},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
testCase: {},
|
||||
scenario: Boolean,
|
||||
},
|
||||
data() {
|
||||
let validateURL = (rule, value, callback) => {
|
||||
try {
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {
|
||||
MsRequestResultTail,
|
||||
MsResponseResult,
|
||||
MsApiRequestForm,
|
||||
MsRequestMetric,
|
||||
MsResponseText,
|
||||
MsRun,
|
||||
MsJmxStep,
|
||||
MsApiCaseList
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
testCase: {},
|
||||
scenario: Boolean,
|
||||
},
|
||||
data() {
|
||||
let validateURL = (rule, value, callback) => {
|
||||
try {
|
||||
new URL(this.debugForm.url);
|
||||
callback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -2,17 +2,19 @@
|
|||
|
||||
<div class="card-container" v-loading="loading">
|
||||
<el-card class="card-content">
|
||||
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary" @click="handleCommand"> {{$t('commons.test')}}</el-button>
|
||||
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary"
|
||||
@click="handleCommand"> {{ $t('commons.test') }}
|
||||
</el-button>
|
||||
|
||||
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
|
||||
{{$t('commons.test')}}
|
||||
{{ $t('commons.test') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as_case')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
<!-- JDBC 请求参数 -->
|
||||
<ms-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
|
||||
|
||||
|
@ -37,31 +39,40 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID, getCurrentUser} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsBasisParameters from "../request/database/BasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsBasisParameters from "../request/database/BasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters, MsJmxStep, MsApiCaseList},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
url: [{required: true, message: this.$t('api_test.definition.request.path_all_info'), trigger: 'blur'}],
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {
|
||||
MsRequestResultTail,
|
||||
MsResponseResult,
|
||||
MsRequestMetric,
|
||||
MsResponseText,
|
||||
MsRun,
|
||||
MsBasisParameters,
|
||||
MsJmxStep,
|
||||
MsApiCaseList
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
url: [{required: true, message: this.$t('api_test.definition.request.path_all_info'), trigger: 'blur'}],
|
||||
},
|
||||
debugForm: {method: REQ_METHOD[0].id},
|
||||
options: [],
|
||||
|
|
|
@ -11,13 +11,15 @@
|
|||
<el-input-number v-model="request.port" controls-position="right" :min="0" :max="65535" size="small"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand"> {{$t('commons.test')}}</el-button>
|
||||
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand"> {{ $t('commons.test') }}
|
||||
</el-button>
|
||||
|
||||
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
|
||||
{{$t('commons.test')}}
|
||||
{{ $t('commons.test') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as_case')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-form-item>
|
||||
|
@ -47,30 +49,30 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID, getCurrentUser} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import TcpBasisParameters from "../request/tcp/TcpBasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import MsResponseResult from "../response/ResponseResult";
|
||||
import MsRequestMetric from "../response/RequestMetric";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsResponseText from "../response/ResponseText";
|
||||
import MsRun from "../Run";
|
||||
import {createComponent} from "../jmeter/components";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import TcpBasisParameters from "../request/tcp/TcpBasisParameters";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {
|
||||
MsJmxStep,
|
||||
TcpBasisParameters,
|
||||
MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsApiCaseList
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {
|
||||
MsJmxStep,
|
||||
TcpBasisParameters,
|
||||
MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsApiCaseList
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
scenario: Boolean,
|
||||
testCase: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -1,17 +1,44 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<div>
|
||||
<el-container>
|
||||
<el-main style="padding-top: 0px">
|
||||
<el-row>
|
||||
<el-select size="small" :placeholder="$t('api_test.definition.document.order')" v-model="apiSearch.orderCondition" style="float: right;width: 180px;margin-right: 5px"
|
||||
class="ms-api-header-select" @change="initApiDocSimpleList" clearable>
|
||||
<el-option key="createTimeDesc" :label="$t('api_test.definition.document.create_time_sort')" value="createTimeDesc" />
|
||||
<el-option key="editTimeAsc" :label="$t('api_test.definition.document.edit_time_positive_sequence')" value="editTimeAsc"/>
|
||||
<el-option key="editTimeDesc" :label="$t('api_test.definition.document.edit_time_Reverse_order')" value="editTimeDesc"/>
|
||||
</el-select>
|
||||
|
||||
<el-select size="small" :placeholder="$t('api_test.definition.document.request_method')" v-model="apiSearch.type" style="float: right;width: 180px;margin-right: 5px"
|
||||
class="ms-api-header-select" @change="initApiDocSimpleList" clearable>
|
||||
<el-option key="ALL" :label="$t('api_test.definition.document.data_set.all')" value="ALL"/>
|
||||
<el-option key="GET" :label="'GET '+$t('api_test.definition.document.request_interface')" value="GET"/>
|
||||
<el-option key="POST" :label="'POST '+$t('api_test.definition.document.request_interface')" value="POST"/>
|
||||
<el-option key="PUT" :label="'PUT '+$t('api_test.definition.document.request_interface')" value="PUT"/>
|
||||
<el-option key="DELETE" :label="'DELETE '+$t('api_test.definition.document.request_interface')" value="DELETE"/>
|
||||
<el-option key="PATCH" :label="'PATCH '+$t('api_test.definition.document.request_interface')" value="PATCH"/>
|
||||
<el-option key="OPTIONS" :label="'OPTIONS '+$t('api_test.definition.document.request_interface')" value="OPTIONS"/>
|
||||
<el-option key="HEAD" :label="'HEAD '+$t('api_test.definition.document.request_interface')" value="HEAD"/>
|
||||
<el-option key="CONNECT" :label="'CONNECT '+$t('api_test.definition.document.request_interface')" value="CONNECT"/>
|
||||
</el-select>
|
||||
<el-input :placeholder="$t('api_test.definition.document.search_by_api_name')" @blur="initApiDocSimpleList()" style="float: right;width: 180px;margin-right: 5px" size="small"
|
||||
@keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/>
|
||||
</el-row>
|
||||
<el-divider></el-divider>
|
||||
<div ref="apiDocInfoDiv">
|
||||
<div style="margin-bottom: 50px">
|
||||
<div style="font-size: 17px">
|
||||
{{apiInfo.name}}
|
||||
<i class="el-icon-share"></i>{{ apiInfo.name }}
|
||||
<span class="apiStatusTag">
|
||||
<api-status :value="apiInfo.status"/>
|
||||
</span>
|
||||
</div>
|
||||
<!--api请求信息-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="tip">请求信息</div>
|
||||
<div class="tip">
|
||||
{{ $t('api_test.definition.document.request_info') }}
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="simpleFontClass">
|
||||
|
@ -19,25 +46,25 @@
|
|||
:style="{'background-color': getColor(apiInfo.method), border: getColor(apiInfo.method),borderRadius:'0px', marginRight:'20px'}">
|
||||
{{ apiInfo.method }}
|
||||
</el-tag>
|
||||
{{apiInfo.uri}}
|
||||
{{ apiInfo.uri }}
|
||||
</div>
|
||||
</el-row>
|
||||
<!--api请求头-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
请求头:
|
||||
{{ $t('api_test.definition.document.request_head') }}:
|
||||
<div v-if="getJsonArr(apiInfo.requestHead).length==0">
|
||||
无
|
||||
{{ $t('api_test.definition.document.data_set.none') }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-table border :show-header="false"
|
||||
:data="getJsonArr(apiInfo.requestHead)" row-key="name" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
label="值"
|
||||
show-overflow-tooltip/>
|
||||
:data="getJsonArr(apiInfo.requestHead)" row-key="name" class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.value')"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -45,29 +72,29 @@
|
|||
<!--URL参数-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
URL参数:
|
||||
URL{{ $t('api_test.definition.document.request_param') }}:
|
||||
<div v-if="getJsonArr(apiInfo.urlParams).length==0">
|
||||
无
|
||||
{{ $t('api_test.definition.document.data_set.none') }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-table border
|
||||
:data="getJsonArr(apiInfo.urlParams)" row-key="name" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="isEnable"
|
||||
label="是否必填"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
label="值"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
label="描述"
|
||||
min-width="450px"
|
||||
show-overflow-tooltip/>
|
||||
:data="getJsonArr(apiInfo.urlParams)" row-key="name" class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="isEnable"
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.value')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
:label="$t('api_test.definition.document.table_coloum.desc')"
|
||||
min-width="280px"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -75,57 +102,67 @@
|
|||
<!--api请求体 以及表格-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
请求体
|
||||
{{ $t('api_test.definition.document.request_body') }}
|
||||
</div>
|
||||
<div class="smallFontClass">
|
||||
类型:{{apiInfo.requestBodyParamType}}
|
||||
{{ $t('api_test.definition.document.table_coloum.type') }}:{{ apiInfo.requestBodyParamType }}
|
||||
</div>
|
||||
<div>
|
||||
<el-table border v-if="apiInfo.requestBodyParamType=='kv'"
|
||||
:data="getJsonArr(apiInfo.requestBodyFormData)" row-key="id" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
label="类型"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
label="描述"
|
||||
min-width="450px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column label="必需"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<div v-if="scope.enable">是</div>
|
||||
<div v-else-if="!scope.enable">否</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value"
|
||||
label="默认值"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table border v-if="formParamTypes.includes(apiInfo.requestBodyParamType)"
|
||||
:data="getJsonArr(apiInfo.requestBodyFormData)" row-key="name"
|
||||
class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
:label="$t('api_test.definition.document.table_coloum.type')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
:label="$t('api_test.definition.document.table_coloum.desc')"
|
||||
min-width="280px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="required"
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:formatter="formatBoolean"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.default_value')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<div v-else-if="apiInfo.requestBodyParamType == 'JSON-SCHEMA'">
|
||||
<ms-json-code-edit :body="apiInfo.jsonSchemaBody" ref="jsonCodeEdit"/>
|
||||
</div>
|
||||
<div v-else class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;"
|
||||
v-html="formatRowData(apiInfo.requestBodyParamType,apiInfo.requestBodyStrutureData)">
|
||||
</p>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<!--范例展示-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
范例展示
|
||||
{{ $t('api_test.definition.document.example_presentation') }}
|
||||
</div>
|
||||
<div class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;">
|
||||
{{ apiInfo.requestBodyStrutureData }}
|
||||
<p style="margin: 0px 20px;"
|
||||
v-html="genPreviewData(apiInfo.requestPreviewData)">
|
||||
</p>
|
||||
<br/>
|
||||
</div>
|
||||
</el-row>
|
||||
<!--响应信息-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="tip">响应信息</div>
|
||||
<div class="tip">
|
||||
{{ $t('api_test.definition.document.response_info') }}
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row class="apiInfoRow">
|
||||
|
||||
|
@ -133,133 +170,153 @@
|
|||
<!--响应头-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
响应头:
|
||||
{{ $t('api_test.definition.document.response_head') }}:
|
||||
<el-table border :show-header="false"
|
||||
:data="getJsonArr(apiInfo.responseHead)" row-key="name" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
label="值"
|
||||
show-overflow-tooltip/>
|
||||
:data="getJsonArr(apiInfo.responseHead)" row-key="name" class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.value')"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-row>
|
||||
<!--响应体-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
响应体
|
||||
{{ $t('api_test.definition.document.response_body') }}
|
||||
</div>
|
||||
<div class="smallFontClass">
|
||||
类型:{{apiInfo.responseBodyParamType}}
|
||||
{{ $t('api_test.definition.document.table_coloum.type') }}:{{ apiInfo.responseBodyParamType }}
|
||||
</div>
|
||||
<div>
|
||||
<el-table border v-if="apiInfo.responseBodyParamType=='kv'"
|
||||
:data="getJsonArr(apiInfo.responseBodyFormData)" row-key="id" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
label="类型"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
label="描述"
|
||||
min-width="450px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column label="必需"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<div v-if="scope.enable">是</div>
|
||||
<div v-else-if="!scope.enable">否</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value"
|
||||
label="默认值"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table border v-if="formParamTypes.includes(apiInfo.responseBodyParamType)"
|
||||
:data="getJsonArr(apiInfo.responseBodyFormData)" row-key="id"
|
||||
class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
:label="$t('api_test.definition.document.table_coloum.type')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
:label="$t('api_test.definition.document.table_coloum.desc')"
|
||||
min-width="280px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="required"
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:formatter="formatBoolean"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.default_value')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<div v-else class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;"
|
||||
v-html="formatRowData(apiInfo.responseBodyParamType,apiInfo.responseBodyStrutureData)">
|
||||
</p>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<!--响应状态码-->
|
||||
<el-row class="apiInfoRow">
|
||||
<div class="blackFontClass">
|
||||
响应状态码:
|
||||
{{ $t('api_test.definition.document.response_code') }}:
|
||||
<el-table border :show-header="false"
|
||||
:data="getJsonArr(apiInfo.responseCode)" row-key="name" class="test-content adjust-table">
|
||||
<el-table-column prop="name"
|
||||
label="名称"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
label="值"
|
||||
show-overflow-tooltip/>
|
||||
:data="getJsonArr(apiInfo.responseCode)" row-key="name" class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.value')"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-main>
|
||||
<!-- 右侧列表 -->
|
||||
<el-aside width="200px">
|
||||
<div ref="apiDocList">
|
||||
<el-steps style="height: 40%" direction="vertical" :active="apiStepIndex">
|
||||
</el-main>
|
||||
<!-- 右侧列表 -->
|
||||
<el-aside width="200px" style="margin-top: 70px;">
|
||||
<div ref="apiDocList" >
|
||||
<el-steps style="height: 40%" direction="vertical" :active="apiStepIndex">
|
||||
<el-step v-for="(apiInfo) in apiSimpleInfoArray" :key="apiInfo.id" @click.native="clickStep(apiInfo.id)">
|
||||
<el-link slot="title">{{apiInfo.name}}</el-link>
|
||||
<el-link slot="title">{{ apiInfo.name }}</el-link>
|
||||
</el-step>
|
||||
</el-steps>
|
||||
</div>
|
||||
</el-aside>
|
||||
</el-container>
|
||||
</el-steps>
|
||||
</div>
|
||||
</el-aside>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsAnchor from "./Anchor";
|
||||
import {API_METHOD_COLOUR} from "@/business/components/api/definition/model/JsonData";
|
||||
import {jsonToMap} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
import {formatJson,} from "@/common/js/format-utils";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import {calculate} from "@/business/components/api/definition/model/ApiTestModel";
|
||||
import MsJsonCodeEdit from "@/business/components/common/json-schema/JsonSchemaEditor";
|
||||
|
||||
|
||||
export default {
|
||||
name: "ApiDocumentItem",
|
||||
components: {
|
||||
MsAnchor,ApiStatus,
|
||||
MsJsonCodeEdit,
|
||||
MsAnchor, ApiStatus, MsCodeEdit,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
apiStepIndex:0,
|
||||
apiSimpleInfoArray:[],
|
||||
apiInfo:{
|
||||
method:"无",
|
||||
uri:"无",
|
||||
name:"无",
|
||||
id:"",
|
||||
requestHead:"无",
|
||||
urlParams:"无",
|
||||
requestBodyParamType:"无",
|
||||
requestBodyFormData:'[]',
|
||||
requestBodyStrutureData:"",
|
||||
responseHead:"无",
|
||||
responseBody:"",
|
||||
responseBodyParamType:"无",
|
||||
responseBodyFormData:"无",
|
||||
responseBodyStrutureData:"无",
|
||||
responseCode:"无",
|
||||
apiStepIndex: 0,
|
||||
apiSimpleInfoArray: [],
|
||||
modes: ['text', 'json', 'xml', 'html'],
|
||||
formParamTypes: ['form-data', 'x-www-from-urlencoded', 'BINARY'],
|
||||
mockVariableFuncs: [],
|
||||
apiSearch:{
|
||||
name:"",
|
||||
type:"ALL",
|
||||
orderCondition:"createTimeDesc",
|
||||
},
|
||||
apiInfo: {
|
||||
method: "无",
|
||||
uri: "无",
|
||||
name: "无",
|
||||
id: "",
|
||||
requestHead: "无",
|
||||
urlParams: "无",
|
||||
requestBodyParamType: "无",
|
||||
requestBodyFormData: '[]',
|
||||
requestBodyStrutureData: "",
|
||||
jsonSchemaBody: {},
|
||||
responseHead: "无",
|
||||
responseBody: "",
|
||||
responseBodyParamType: "无",
|
||||
responseBodyFormData: "无",
|
||||
responseBodyStrutureData: "无",
|
||||
responseCode: "无",
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
clientHeight:'',//坚挺浏览器高度
|
||||
clientHeight: '',//坚挺浏览器高度
|
||||
}
|
||||
},
|
||||
props: {
|
||||
projectId:String,
|
||||
moduleIds:Array,
|
||||
projectId: String,
|
||||
moduleIds: Array,
|
||||
},
|
||||
activated() {
|
||||
this.initApiDocSimpleList();
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;//获取浏览器可视区域高度
|
||||
let that = this;
|
||||
window.onresize = function(){
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
window.onresize = function () {
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
this.changeFixed(this.clientHeight);
|
||||
}
|
||||
},
|
||||
|
@ -267,16 +324,16 @@ export default {
|
|||
this.initApiDocSimpleList();
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;//获取浏览器可视区域高度
|
||||
let that = this;
|
||||
window.onresize = function(){
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
window.onresize = function () {
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
this.changeFixed(this.clientHeight);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
window.onresize = function(){
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
if(that.$refs.apiDocInfoDiv){
|
||||
window.onresize = function () {
|
||||
this.clientHeight = `${document.documentElement.clientHeight}`;
|
||||
if (that.$refs.apiDocInfoDiv) {
|
||||
that.$refs.apiDocInfoDiv.style.minHeight = this.clientHeight - 300 + 'px';
|
||||
that.$refs.apiDocList.style.minHeight = this.clientHeight - 300 + 'px';
|
||||
|
||||
|
@ -291,109 +348,172 @@ export default {
|
|||
watch: {
|
||||
'$route.params.documentId'() {
|
||||
},
|
||||
moduleIds(){
|
||||
moduleIds() {
|
||||
this.initApiDocSimpleList();
|
||||
},
|
||||
clientHeight(){ //如果clientHeight 发生改变,这个函数就会运行
|
||||
clientHeight() { //如果clientHeight 发生改变,这个函数就会运行
|
||||
this.changeFixed(this.clientHeight);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeFixed(clientHeight){
|
||||
if(this.$refs.apiDocInfoDiv){
|
||||
this.$refs.apiDocInfoDiv.style.height = clientHeight -300 + 'px';
|
||||
formatRowData(dataType, data) {
|
||||
var returnData = data;
|
||||
if (data) {
|
||||
returnData = data.replace(/\n/g, '<br>');
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
changeFixed(clientHeight) {
|
||||
if (this.$refs.apiDocInfoDiv) {
|
||||
this.$refs.apiDocInfoDiv.style.height = clientHeight - 350 + 'px';
|
||||
this.$refs.apiDocInfoDiv.style.overflow = 'auto';
|
||||
this.$refs.apiDocList.style.height = clientHeight -300 + 'px';
|
||||
this.$refs.apiDocList.style.height = clientHeight - 350 + 'px';
|
||||
|
||||
}
|
||||
},
|
||||
initApiDocSimpleList(){
|
||||
let simpleRequest = {};
|
||||
if(this.projectId!=null && this.projectId!= ""){
|
||||
simpleRequest.projectId=this.projectId;
|
||||
initApiDocSimpleList() {
|
||||
let simpleRequest = this.apiSearch;
|
||||
if (this.projectId != null && this.projectId != "") {
|
||||
simpleRequest.projectId = this.projectId;
|
||||
}
|
||||
if(this.documentId!=null && this.documentId!= ""){
|
||||
simpleRequest.documentId=this.documentId;
|
||||
if (this.documentId != null && this.documentId != "") {
|
||||
simpleRequest.documentId = this.documentId;
|
||||
}
|
||||
if(this.moduleIds.length>0){
|
||||
simpleRequest.moduleIds=this.moduleIds;
|
||||
if (this.moduleIds.length > 0) {
|
||||
simpleRequest.moduleIds = this.moduleIds;
|
||||
}
|
||||
|
||||
let simpleInfoUrl = "/api/document/selectApiSimpleInfo";
|
||||
this.$post(simpleInfoUrl, simpleRequest, response => {
|
||||
this.apiSimpleInfoArray = response.data;
|
||||
this.apiStepIndex = 0;
|
||||
if(this.apiSimpleInfoArray.length>0){
|
||||
if (this.apiSimpleInfoArray.length > 0) {
|
||||
this.selectApiInfo(this.apiSimpleInfoArray[0].id);
|
||||
}
|
||||
});
|
||||
},
|
||||
selectApiInfo(apiId){
|
||||
let simpleInfoUrl = "/api/document/selectApiInfoById/"+apiId;
|
||||
selectApiInfo(apiId) {
|
||||
let simpleInfoUrl = "/api/document/selectApiInfoById/" + apiId;
|
||||
this.$get(simpleInfoUrl, response => {
|
||||
this.apiInfo = response.data;
|
||||
});
|
||||
},
|
||||
clickStep(apiId){
|
||||
clickStep(apiId) {
|
||||
for (let index = 0; index < this.apiSimpleInfoArray.length; index++) {
|
||||
if(apiId == this.apiSimpleInfoArray[index].id){
|
||||
if (apiId == this.apiSimpleInfoArray[index].id) {
|
||||
this.apiStepIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.selectApiInfo(apiId);
|
||||
},
|
||||
stepClick(stepIndex){
|
||||
stepClick(stepIndex) {
|
||||
this.apiStepIndex = stepIndex;
|
||||
},
|
||||
getColor(enable, method) {
|
||||
return this.methodColorMap.get(method);
|
||||
},
|
||||
getJsonArr(jsonString){
|
||||
formatBoolean(row, column, cellValue) {
|
||||
var ret = '' //你想在页面展示的值
|
||||
if (cellValue) {
|
||||
ret = "是" //根据自己的需求设定
|
||||
} else {
|
||||
ret = "否"
|
||||
}
|
||||
return ret;
|
||||
|
||||
},
|
||||
getJsonArr(jsonString) {
|
||||
let returnJsonArr = [];
|
||||
if(jsonString == '无'){
|
||||
if (jsonString == '无') {
|
||||
return returnJsonArr;
|
||||
}
|
||||
|
||||
let jsonArr = JSON.parse(jsonString);
|
||||
//遍历,把必填项空的数据去掉
|
||||
for(var index = 0;index < jsonArr.length;index++){
|
||||
for (var index = 0; index < jsonArr.length; index++) {
|
||||
var item = jsonArr[index];
|
||||
if(item.name!="" && item.name!=null){
|
||||
if (item.name != "" && item.name != null) {
|
||||
returnJsonArr.push(item);
|
||||
}
|
||||
}
|
||||
return returnJsonArr;
|
||||
}
|
||||
},
|
||||
//构建预览数据
|
||||
genPreviewData(previewData) {
|
||||
if (previewData != null && previewData != '') {
|
||||
let showDataObj = {};
|
||||
for (var key in previewData) {
|
||||
// showDataObj.set(key,previewData[key]);
|
||||
let value = previewData[key];
|
||||
if (value.indexOf("@") >= 0) {
|
||||
value = this.showPreview(value);
|
||||
}
|
||||
showDataObj[key] = value;
|
||||
}
|
||||
showDataObj = JSON.stringify(showDataObj);
|
||||
previewData = formatJson(showDataObj);
|
||||
}
|
||||
return previewData;
|
||||
},
|
||||
showPreview(itemValue) {
|
||||
// 找到变量本身
|
||||
if (!itemValue) {
|
||||
return;
|
||||
}
|
||||
let index = itemValue.indexOf("|");
|
||||
if (index > -1) {
|
||||
itemValue = itemValue.substring(0, index).trim();
|
||||
}
|
||||
|
||||
this.mockVariableFuncs.forEach(f => {
|
||||
if (!f.name) {
|
||||
return;
|
||||
}
|
||||
itemValue += "|" + f.name;
|
||||
if (f.params) {
|
||||
itemValue += ":" + f.params.map(p => p.value).join(",");
|
||||
}
|
||||
});
|
||||
|
||||
itemValue = calculate(itemValue);
|
||||
return itemValue;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.simpleFontClass{
|
||||
.simpleFontClass {
|
||||
font-size: 14px;
|
||||
}
|
||||
.blackFontClass{
|
||||
|
||||
.blackFontClass {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
.smallFontClass{
|
||||
|
||||
.smallFontClass {
|
||||
font-size: 13px;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
padding: 3px 5px;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid #783887;
|
||||
}
|
||||
.apiInfoRow{
|
||||
|
||||
.apiInfoRow {
|
||||
margin: 20px 10px;
|
||||
}
|
||||
.apiStatusTag{
|
||||
|
||||
.apiStatusTag {
|
||||
margin: 20px 5px;
|
||||
}
|
||||
.showDataDiv{
|
||||
|
||||
.showDataDiv {
|
||||
background-color: #F5F7F9;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
|
@ -405,9 +525,11 @@ export default {
|
|||
color: #C0C4CC;
|
||||
border-color: #C0C4CC;
|
||||
}
|
||||
/deep/ .el-step__title.is-finish /deep/ .el-link.el-link--default{
|
||||
|
||||
/deep/ .el-step__title.is-finish /deep/ .el-link.el-link--default {
|
||||
color: #C0C4CC;
|
||||
}
|
||||
|
||||
/*
|
||||
步骤条中,当前节点样式和当前a标签的样式
|
||||
*/
|
||||
|
@ -415,8 +537,35 @@ export default {
|
|||
color: #783887;
|
||||
border-color: #783887;
|
||||
}
|
||||
|
||||
/deep/ .el-step__title.is-process /deep/ .el-link.el-link--default {
|
||||
color: #783887;
|
||||
}
|
||||
|
||||
.document-table {
|
||||
margin: 20px 10px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.document-table /deep/ .el-table__row {
|
||||
font-size: 12px;
|
||||
font-weight: initial;
|
||||
}
|
||||
|
||||
.document-table /deep/ .has-gutter {
|
||||
font-size: 12px;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
.document-table /deep/ td {
|
||||
border-right: 0px solid #EBEEF5
|
||||
}
|
||||
|
||||
.document-table /deep/ th {
|
||||
background-color: #FAFAFA;
|
||||
border-right: 0px solid #EBEEF5
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 12px 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
:title="$t('api_test.definition.request.extract_param')">
|
||||
<div style="margin: 20px" v-loading="loading">
|
||||
<div class="extract-description">
|
||||
{{$t('api_test.request.extract.description')}}
|
||||
{{ $t('api_test.request.extract.description') }}
|
||||
</div>
|
||||
<div class="extract-add">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="2">
|
||||
<el-select :disabled="isReadOnly" class="extract-item" v-model="type" :placeholder="$t('api_test.request.extract.select_type')"
|
||||
<el-select :disabled="isReadOnly" class="extract-item" v-model="type"
|
||||
:placeholder="$t('api_test.request.extract.select_type')"
|
||||
size="small">
|
||||
<el-option :label="$t('api_test.request.extract.regex')" :value="options.REGEX"/>
|
||||
<el-option label="JSONPath" :value="options.JSON_PATH"/>
|
||||
|
@ -26,7 +27,7 @@
|
|||
<ms-api-extract-common :is-read-only="isReadOnly" :extract-type="type" :list="list" v-if="type" :callback="after"/>
|
||||
</el-col>
|
||||
|
||||
<el-button v-if="!type" :disabled="true" type="primary" size="small">{{$t('commons.add')}}</el-button>
|
||||
<el-button v-if="!type" :disabled="true" type="primary" size="small">{{ $t('commons.add') }}</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
|
@ -40,26 +41,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
response: {},
|
||||
node: {},
|
||||
customizeStyle: {
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
<div class="header-bar">
|
||||
<div>{{ $t('api_test.api_import.data_format') }}</div>
|
||||
<el-radio-group v-model="selectedPlatformValue">
|
||||
<el-radio v-for="(item, index) in platforms" :key="index" :label="item.value">{{ item.name }}</el-radio>
|
||||
<span v-for="(item, index) in platforms" :key="index">
|
||||
<el-radio v-if="!isScenarioModel || item.name != 'Swagger'" :label="item.value">{{ item.name }}</el-radio>
|
||||
</span>
|
||||
</el-radio-group>
|
||||
|
||||
<div class="operate-button">
|
||||
|
@ -26,14 +28,14 @@
|
|||
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.import_mode')">
|
||||
<el-form-item v-if="!isScenarioModel" :label="$t('commons.import_mode')">
|
||||
<el-select size="small" v-model="formData.modeId" class="project-select" clearable>
|
||||
<el-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isSwagger2">
|
||||
<el-switch
|
||||
v-model="swaggerUrlEable"
|
||||
v-model="swaggerUrlEnable"
|
||||
:active-text="$t('api_test.api_import.swagger_url_import')">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
|
@ -42,7 +44,7 @@
|
|||
<el-col :span="1">
|
||||
<el-divider direction="vertical"/>
|
||||
</el-col>
|
||||
<el-col :span="12" v-show="isSwagger2 && swaggerUrlEable" style="margin-top: 40px">
|
||||
<el-col :span="12" v-show="isSwagger2 && swaggerUrlEnable" style="margin-top: 40px">
|
||||
<el-form-item :label="'Swagger URL'" prop="swaggerUrl" class="swagger-url">
|
||||
<el-input size="small" v-model="formData.swaggerUrl" clearable show-word-limit/>
|
||||
</el-form-item>
|
||||
|
@ -56,7 +58,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12"
|
||||
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
|
||||
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEnable)">
|
||||
<el-upload
|
||||
class="api-upload"
|
||||
drag
|
||||
|
@ -93,7 +95,6 @@ import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
|||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID} from "../../../../../../common/js/utils";
|
||||
import ScheduleImport from "@/business/components/api/definition/components/import/ImportScheduleEdit";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
|
||||
export default {
|
||||
name: "ApiImport",
|
||||
|
@ -103,12 +104,16 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
moduleOptions: {}
|
||||
moduleOptions: {},
|
||||
model: {
|
||||
type: String,
|
||||
default: 'definition'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
swaggerUrlEable: false,
|
||||
swaggerUrlEnable: false,
|
||||
swaggerSynchronization: false,
|
||||
showEnvironmentSelect: true,
|
||||
modeOptions: [{
|
||||
|
@ -176,6 +181,9 @@ export default {
|
|||
computed: {
|
||||
isSwagger2() {
|
||||
return this.selectedPlatformValue === 'Swagger2';
|
||||
},
|
||||
isScenarioModel() {
|
||||
return this.model === 'scenario';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -222,12 +230,16 @@ export default {
|
|||
save() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if ((this.selectedPlatformValue != 'Swagger2' || (this.selectedPlatformValue == 'Swagger2' && !this.swaggerUrlEable)) && !this.formData.file) {
|
||||
if ((this.selectedPlatformValue != 'Swagger2' || (this.selectedPlatformValue == 'Swagger2' && !this.swaggerUrlEnable)) && !this.formData.file) {
|
||||
this.$warning(this.$t('commons.please_upload'));
|
||||
return;
|
||||
}
|
||||
let url = '/api/definition/import';
|
||||
if (this.isScenarioModel) {
|
||||
url = '/api/automation/import';
|
||||
}
|
||||
let param = this.buildParam();
|
||||
this.result = this.$fileUpload('/api/definition/import', param.file, null, this.buildParam(), response => {
|
||||
this.result = this.$fileUpload(url, param.file, null, this.buildParam(), response => {
|
||||
let res = response.data;
|
||||
this.$success(this.$t('test_track.case.import.success'));
|
||||
this.visible = false;
|
||||
|
@ -243,6 +255,7 @@ export default {
|
|||
Object.assign(param, this.formData);
|
||||
param.platform = this.selectedPlatformValue;
|
||||
param.saved = this.saved;
|
||||
param.model = this.model;
|
||||
if (this.currentModule) {
|
||||
param.moduleId = this.formData.moduleId
|
||||
this.moduleOptions.filter(item => {
|
||||
|
@ -253,7 +266,7 @@ export default {
|
|||
param.modeId = this.formData.modeId
|
||||
}
|
||||
param.projectId = getCurrentProjectID();
|
||||
if (!this.swaggerUrlEable) {
|
||||
if (!this.swaggerUrlEnable) {
|
||||
param.swaggerUrl = undefined;
|
||||
}
|
||||
return param;
|
||||
|
@ -299,6 +312,10 @@ export default {
|
|||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.el-radio {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.header-bar, .format-tip, .el-form {
|
||||
border: solid #E1E1E1 1px;
|
||||
margin: 10px 0;
|
||||
|
|
|
@ -23,82 +23,99 @@
|
|||
<el-table-column type="selection" width="50"/>
|
||||
|
||||
<ms-table-header-select-popover v-show="total>0"
|
||||
:page-size="pageSize>total?total:pageSize"
|
||||
:total="total"
|
||||
@selectPageAll="isSelectDataAll(false)"
|
||||
@selectAll="isSelectDataAll(true)"/>
|
||||
:page-size="pageSize>total?total:pageSize"
|
||||
:total="total"
|
||||
@selectPageAll="isSelectDataAll(false)"
|
||||
@selectAll="isSelectDataAll(true)"/>
|
||||
|
||||
<el-table-column width="30" :resizable="false" min-width="30px" align="center">
|
||||
<el-table-column width="30" :resizable="false" min-width="30px" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID" min-width="120px" show-overflow-tooltip
|
||||
:key="index">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="handleTestCase(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="num" label="ID" min-width="120px" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="handleTestCase(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
<el-table-column v-if="item.prop == 'name'" prop="name" min-width="160px" :label="$t('test_track.case.name')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.prop == 'priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="120px"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.prop == 'custom'"
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
min-width="180px"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column v-if="item.prop=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.prop=='createUser'"
|
||||
prop="createUser"
|
||||
:label="'创建人'"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.prop=='custom'"
|
||||
sortable="custom"
|
||||
min-width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
|
||||
align="center">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" min-width="160px" :label="$t('test_track.case.name')" show-overflow-tooltip/>
|
||||
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="120px"
|
||||
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
|
||||
v-tester/>
|
||||
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)"
|
||||
type="danger" v-tester/>
|
||||
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment"
|
||||
@createPerformance="createPerformance" :row="scope.row" v-tester/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
min-width="180px"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
|
||||
show-overflow-tooltip/>
|
||||
|
||||
<el-table-column prop="tags" min-width="120px" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="createUser"
|
||||
:label="'创建人'"
|
||||
|
||||
show-overflow-tooltip/>
|
||||
|
||||
<el-table-column
|
||||
sortable="custom"
|
||||
min-width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
|
||||
prop="updateTime">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)" v-tester/>
|
||||
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger" v-tester/>
|
||||
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment" @createPerformance="createPerformance" :row="scope.row" v-tester/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</api-list-container-with-doc>
|
||||
|
@ -131,7 +148,8 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
|||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
|
||||
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getBodyUploadFiles, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import ApiListContainer from "./ApiListContainer";
|
||||
// import ApiListContainer from "./ApiListContainer";
|
||||
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
|
||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
|
@ -145,30 +163,38 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
|
|||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils";
|
||||
import {API_CASE_LIST, API_LIST, API_SCENARIO_LIST, TEST_CASE_LIST} from "@/common/js/constants";
|
||||
import {Api_Case_List, Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseSimpleList",
|
||||
components: {
|
||||
MsTableHeaderSelectPopover,
|
||||
MsSetEnvironment,
|
||||
ApiCaseList,
|
||||
PriorityTableItem,
|
||||
ApiListContainerWithDoc,
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
MsTablePagination,
|
||||
MsTag,
|
||||
MsApiCaseList,
|
||||
MsContainer,
|
||||
MsBottomContainer,
|
||||
ShowMoreBtn,
|
||||
MsBatchEdit,
|
||||
MsApiCaseTableExtendBtns,
|
||||
name: "ApiCaseSimpleList",
|
||||
components: {
|
||||
ApiListContainerWithDoc,
|
||||
HeaderCustom,
|
||||
MsTableHeaderSelectPopover,
|
||||
MsSetEnvironment,
|
||||
ApiCaseList,
|
||||
PriorityTableItem,
|
||||
ApiListContainer,
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
MsTablePagination,
|
||||
MsTag,
|
||||
MsApiCaseList,
|
||||
MsContainer,
|
||||
MsBottomContainer,
|
||||
ShowMoreBtn,
|
||||
MsBatchEdit,
|
||||
MsApiCaseTableExtendBtns,
|
||||
MsReferenceView,
|
||||
MsTableAdvSearchBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: API_CASE_LIST,
|
||||
headerItems: Api_Case_List,
|
||||
tableLabel: Api_Case_List,
|
||||
condition: {
|
||||
components: API_CASE_CONFIGS
|
||||
},
|
||||
|
@ -214,7 +240,7 @@ export default {
|
|||
props: {
|
||||
currentProtocol: String,
|
||||
selectNodeIds: Array,
|
||||
activeDom:String,
|
||||
activeDom: String,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -271,13 +297,17 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
isApiListEnableChange(data) {
|
||||
this.$emit('isApiListEnableChange', data);
|
||||
},
|
||||
activeDomChange(tabType){
|
||||
this.$emit("activeDomChange",tabType);
|
||||
activeDomChange(tabType) {
|
||||
this.$emit("activeDomChange", tabType);
|
||||
},
|
||||
initTable() {
|
||||
this.getLabel()
|
||||
this.selectRows = new Set();
|
||||
this.condition.status = "";
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
|
@ -321,6 +351,24 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = API_CASE_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
open() {
|
||||
this.$refs.searchBar.open();
|
||||
},
|
||||
|
@ -417,13 +465,13 @@ export default {
|
|||
// }
|
||||
},
|
||||
handleEditBatch() {
|
||||
if(this.currentProtocol =='HTTP'){
|
||||
if (this.currentProtocol == 'HTTP') {
|
||||
this.valueArr.method = REQ_METHOD;
|
||||
}else if(this.currentProtocol =='TCP'){
|
||||
} else if (this.currentProtocol == 'TCP') {
|
||||
this.valueArr.method = TCP_METHOD;
|
||||
}else if(this.currentProtocol =='SQL'){
|
||||
} else if (this.currentProtocol == 'SQL') {
|
||||
this.valueArr.method = SQL_METHOD;
|
||||
}else if(this.currentProtocol =='DUBBO'){
|
||||
} else if (this.currentProtocol == 'DUBBO') {
|
||||
this.valueArr.method = DUBBO_METHOD;
|
||||
}
|
||||
this.$refs.batchEdit.open();
|
||||
|
@ -513,9 +561,9 @@ export default {
|
|||
this.clickRow = row;
|
||||
this.$refs.setEnvironment.open(row);
|
||||
},
|
||||
headerDragend(newWidth,oldWidth,column,event){
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if(column.minWidth>finalWidth){
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
|
@ -580,7 +628,7 @@ export default {
|
|||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -34,113 +34,142 @@
|
|||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="num" label="ID" show-overflow-tooltip
|
||||
min-width="80px"
|
||||
|
||||
sortable="custom">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" :label="$t('api_test.definition.api_name')"
|
||||
show-overflow-tooltip
|
||||
|
||||
sortable="custom" min-width="120px"/>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
sortable="custom"
|
||||
:filters="statusFilters"
|
||||
|
||||
:label="$t('api_test.definition.api_status')" min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'num'"
|
||||
prop="num"
|
||||
label="ID"
|
||||
show-overflow-tooltip
|
||||
min-width="80px"
|
||||
sortable="custom"
|
||||
:key="index">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="编辑">
|
||||
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'name'"
|
||||
prop="name"
|
||||
:label="$t('api_test.definition.api_name')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="120px"
|
||||
:key="index"/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'status'"
|
||||
prop="status"
|
||||
column-key="status"
|
||||
sortable="custom"
|
||||
:filters="statusFilters"
|
||||
:label="$t('api_test.definition.api_status')"
|
||||
min-width="120px"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span class="el-dropdown-link">
|
||||
<api-status :value="scope.row.status"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="method"
|
||||
sortable="custom"
|
||||
column-key="method"
|
||||
:filters="methodFilters"
|
||||
<el-table-column
|
||||
v-if="item.prop == 'method'"
|
||||
prop="method"
|
||||
sortable="custom"
|
||||
column-key="method"
|
||||
:filters="methodFilters"
|
||||
:label="$t('api_test.definition.api_type')"
|
||||
show-overflow-tooltip min-width="120px"
|
||||
:key="index">
|
||||
<template v-slot:default="scope" class="request-method">
|
||||
<el-tag size="mini"
|
||||
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
|
||||
class="api-el-tag">
|
||||
{{ scope.row.method }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
:label="$t('api_test.definition.api_type')"
|
||||
show-overflow-tooltip min-width="120px">
|
||||
<template v-slot:default="scope" class="request-method">
|
||||
<el-tag size="mini"
|
||||
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
|
||||
class="api-el-tag">
|
||||
{{ scope.row.method }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'userName'"
|
||||
prop="userName"
|
||||
sortable="custom"
|
||||
:filters="userFilters"
|
||||
column-key="user_id"
|
||||
:label="$t('api_test.definition.api_principal')"
|
||||
show-overflow-tooltip
|
||||
min-width="100px"
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
sortable="custom"
|
||||
:filters="userFilters"
|
||||
column-key="user_id"
|
||||
<el-table-column
|
||||
v-if="item.prop == 'path'"
|
||||
prop="path"
|
||||
min-width="120px"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
:label="$t('api_test.definition.api_principal')"
|
||||
show-overflow-tooltip min-width="100px"/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'tags'"
|
||||
prop="tags"
|
||||
:label="$t('commons.tag')"
|
||||
min-width="80px"
|
||||
:key="index"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="path"
|
||||
min-width="120px"
|
||||
<el-table-column
|
||||
v-if="item.prop == 'updateTime'"
|
||||
width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
sortable="custom"
|
||||
min-width="160px"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'caseTotal'"
|
||||
prop="caseTotal"
|
||||
min-width="80px"
|
||||
:label="$t('api_test.definition.api_case_number')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')" min-width="80px"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'caseStatus'"
|
||||
prop="caseStatus"
|
||||
min-width="80px"
|
||||
:label="$t('api_test.definition.api_case_status')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
sortable="custom"
|
||||
min-width="160px"
|
||||
|
||||
prop="updateTime">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="caseTotal"
|
||||
min-width="80px"
|
||||
|
||||
:label="$t('api_test.definition.api_case_number')"
|
||||
show-overflow-tooltip/>
|
||||
|
||||
<el-table-column
|
||||
prop="caseStatus"
|
||||
min-width="80px"
|
||||
|
||||
:label="$t('api_test.definition.api_case_status')"
|
||||
show-overflow-tooltip/>
|
||||
|
||||
<el-table-column
|
||||
prop="casePassingRate"
|
||||
:width="100"
|
||||
min-width="100px"
|
||||
|
||||
:label="$t('api_test.definition.api_case_passing_rate')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'casePassingRate'"
|
||||
prop="casePassingRate"
|
||||
:width="100"
|
||||
min-width="100px"
|
||||
:label="$t('api_test.definition.api_case_passing_rate')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
</template>
|
||||
|
||||
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
|
||||
align="center">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left"
|
||||
@exec="reductionApi(scope.row)" v-if="trashEnable" v-tester/>
|
||||
|
@ -162,6 +191,8 @@
|
|||
type="danger" v-tester/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
</el-table>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
@ -190,8 +221,10 @@ import MsBottomContainer from "../BottomContainer";
|
|||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {downloadFile, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {PROJECT_NAME, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {downloadFile} from "@/common/js/utils";
|
||||
import {PROJECT_NAME} from '@/common/js/constants';
|
||||
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import ApiListContainer from "./ApiListContainer";
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
|
@ -201,18 +234,20 @@ import MsTipButton from "@/business/components/common/components/MsTipButton";
|
|||
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
|
||||
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
|
||||
import {
|
||||
_filter,
|
||||
_handleSelect,
|
||||
_handleSelectAll,
|
||||
_sort,
|
||||
getSelectDataCounts, initCondition,
|
||||
setUnSelectIds, toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import {Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
|
||||
|
||||
export default {
|
||||
name: "ApiList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
CaseBatchMove,
|
||||
ApiStatus,
|
||||
MsTableHeaderSelectPopover,
|
||||
|
@ -233,6 +268,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: API_LIST,
|
||||
headerItems: Api_List,
|
||||
tableLabel: Api_List,
|
||||
condition: {
|
||||
components: API_DEFINITION_CONFIGS
|
||||
},
|
||||
|
@ -352,6 +390,9 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
handleBatchMove() {
|
||||
this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions);
|
||||
},
|
||||
|
@ -362,6 +403,7 @@ export default {
|
|||
this.$emit("activeDomChange",tabType);
|
||||
},
|
||||
initTable() {
|
||||
this.getLabel()
|
||||
this.selectRows = new Set();
|
||||
initCondition(this.condition);
|
||||
this.selectDataCounts = 0;
|
||||
|
@ -408,6 +450,25 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = API_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
genProtocalFilter(protocalType) {
|
||||
if (protocalType === "HTTP") {
|
||||
this.methodFilters = [
|
||||
|
@ -563,6 +624,10 @@ export default {
|
|||
param.projectId = getCurrentProjectID();
|
||||
param.moduleId=param.nodeId;
|
||||
param.condition = this.condition;
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
param = Object.assign(param, this.condition);
|
||||
param.moduleId = param.nodeId;
|
||||
this.$post('/api/definition/batch/editByParams', param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$refs.testCaseBatchMove.close();
|
||||
|
@ -662,9 +727,9 @@ export default {
|
|||
_filter(filters, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
headerDragend(newWidth,oldWidth,column,event){
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if(column.minWidth>finalWidth){
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
|
@ -674,7 +739,7 @@ export default {
|
|||
this.$refs.searchBar.open();
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getUUID, uuid} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -89,25 +89,25 @@ export default {
|
|||
reportId: "",
|
||||
}
|
||||
},
|
||||
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
case "load_case":
|
||||
return this.loadCase();
|
||||
case "save_as_case":
|
||||
return this.saveAsCase();
|
||||
case "update_api":
|
||||
return this.updateApi();
|
||||
case "save_as_api":
|
||||
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
case "load_case":
|
||||
return this.loadCase();
|
||||
case "save_as_case":
|
||||
return this.saveAsCase();
|
||||
case "update_api":
|
||||
return this.updateApi();
|
||||
case "save_as_api":
|
||||
return this.saveAsApi();
|
||||
default:
|
||||
return this.runTest();
|
||||
}
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
runTest() {
|
||||
this.loading = true;
|
||||
this.api.request.name = this.api.id;
|
||||
|
@ -161,8 +161,9 @@ export default {
|
|||
},
|
||||
saveAsApi() {
|
||||
let data = {};
|
||||
this.api.request.id = uuid();
|
||||
data.request = JSON.stringify(this.api.request);
|
||||
let req = this.api.request;
|
||||
req.id = getUUID();
|
||||
data.request = JSON.stringify(req);
|
||||
data.method = this.api.method;
|
||||
data.status = this.api.status;
|
||||
data.userId = this.api.userId;
|
||||
|
|
|
@ -71,27 +71,27 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import EnvironmentSelect from "../environment/EnvironmentSelect";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsRun from "../Run";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import EnvironmentSelect from "../environment/EnvironmentSelect";
|
||||
import MsJmxStep from "../step/JmxStep";
|
||||
|
||||
export default {
|
||||
name: "RunTestHTTPPage",
|
||||
components: {
|
||||
EnvironmentSelect,
|
||||
MsApiRequestForm,
|
||||
MsApiCaseList,
|
||||
MsContainer,
|
||||
MsRequestResultTail,
|
||||
MsRun,
|
||||
MsJmxStep
|
||||
},
|
||||
export default {
|
||||
name: "RunTestHTTPPage",
|
||||
components: {
|
||||
EnvironmentSelect,
|
||||
MsApiRequestForm,
|
||||
MsApiCaseList,
|
||||
MsContainer,
|
||||
MsRequestResultTail,
|
||||
MsRun,
|
||||
MsJmxStep
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getUUID, uuid} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -160,8 +160,9 @@ export default {
|
|||
},
|
||||
saveAsApi() {
|
||||
let data = {};
|
||||
this.api.request.id = uuid();
|
||||
data.request = JSON.stringify(this.api.request);
|
||||
let req = this.api.request;
|
||||
req.id = getUUID();
|
||||
data.request = JSON.stringify(req);
|
||||
data.method = this.api.method;
|
||||
data.status = this.api.status;
|
||||
data.userId = this.api.userId;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
<script>
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
import {getUUID, uuid} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
|
@ -173,8 +173,9 @@ export default {
|
|||
},
|
||||
saveAsApi() {
|
||||
let data = {};
|
||||
this.api.request.id = uuid();
|
||||
data.request = JSON.stringify(this.api.request);
|
||||
let req = this.api.request;
|
||||
req.id = getUUID();
|
||||
data.request = JSON.stringify(req);
|
||||
data.method = this.api.method;
|
||||
data.status = this.api.status;
|
||||
data.userId = this.api.userId;
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<el-dialog title="表头显示字段" :visible.sync="dialogTableVisible" :append-to-body="true">
|
||||
<template>
|
||||
<el-transfer
|
||||
:titles="['待选字段', '已选字段']"
|
||||
v-model="value"
|
||||
:props="{
|
||||
key: 'prop',
|
||||
label: 'label'
|
||||
}"
|
||||
:data="optionalField"
|
||||
style="margin-left: 10%"
|
||||
></el-transfer>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="close"
|
||||
@confirm="saveHeader"
|
||||
/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import {getCurrentUser} from "@/common/js/utils";
|
||||
import {TEST_CASE_LIST} from "@/common/js/constants";
|
||||
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
export default {
|
||||
name: "HeaderCustom",
|
||||
components: {MsDialogFooter},
|
||||
data() {
|
||||
return {
|
||||
dialogTableVisible: false,
|
||||
optionalField: this.optionalFields,
|
||||
value: [],
|
||||
fieldSelected: []
|
||||
}
|
||||
},
|
||||
props: {
|
||||
initTableData: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
optionalFields: Array,
|
||||
type: String
|
||||
},
|
||||
methods: {
|
||||
open(items) {
|
||||
this.dialogTableVisible = true
|
||||
/*this.optionalField = items*/
|
||||
},
|
||||
saveHeader() {
|
||||
console.log(this.type)
|
||||
let param = {
|
||||
userId: getCurrentUser().id,
|
||||
type: this.type,
|
||||
props: JSON.stringify(this.value)
|
||||
}
|
||||
this.$post("/system/save/header", param, response => {
|
||||
this.$success(this.$t("commons.save_success"));
|
||||
this.dialogTableVisible = false
|
||||
this.initTableData()
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.dialogTableVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -67,7 +67,11 @@ export default {
|
|||
if (userLastProjectId) {
|
||||
// id 是否存在
|
||||
if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(userLastProjectId) !== -1) {
|
||||
localStorage.setItem(PROJECT_ID, userLastProjectId);
|
||||
let projectId = localStorage.getItem(PROJECT_ID);
|
||||
if (!projectId || projectId != userLastProjectId) {
|
||||
localStorage.setItem(PROJECT_ID, userLastProjectId);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
let projectId = getCurrentProjectID();
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
import i18n from '../../../../i18n/i18n'
|
||||
//自定义默认表头
|
||||
//测试用例
|
||||
export const Track_Test_Case = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'type', label: i18n.t('test_track.case.type')},
|
||||
{prop: 'method', label: i18n.t('test_track.case.method')},
|
||||
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
|
||||
{prop: 'updateTime', label: i18n.t('commons.update_time')},
|
||||
]
|
||||
//用例评审-测试用例
|
||||
export const Test_Case_Review = [
|
||||
{prop: 'name', label: i18n.t('test_track.review.review_name')},
|
||||
{prop: 'reviewer', label: i18n.t('test_track.review.reviewer')},
|
||||
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
|
||||
{prop: 'creatorName', label: i18n.t('test_track.review.review_creator')},
|
||||
{prop: 'status', label: i18n.t('test_track.review.review_status')},
|
||||
{prop: 'createTime', label: i18n.t('commons.create_time')},
|
||||
{prop: 'endTime', label: i18n.t('test_track.review.end_time')},
|
||||
]
|
||||
//测试计划-测试用例
|
||||
export const Test_Plan_List = [
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'userName', label: i18n.t('test_track.plan.plan_principal')},
|
||||
{prop: 'status', label: i18n.t('test_track.plan.plan_status')},
|
||||
{prop: 'stage', label: i18n.t('test_track.plan.plan_stage')},
|
||||
{prop: 'testRate', label: i18n.t('test_track.home.test_rate')},
|
||||
{prop: 'projectName', label: i18n.t('test_track.plan.plan_project')},
|
||||
{prop: 'plannedStartTime', label: i18n.t('test_track.plan.planned_start_time')},
|
||||
{prop: 'plannedEndTime', label: i18n.t('test_track.plan.planned_end_time')},
|
||||
{prop: 'actualStartTime', label: i18n.t('test_track.plan.actual_start_time')},
|
||||
{prop: 'actualEndTime', label: i18n.t('test_track.plan.actual_end_time')},
|
||||
]
|
||||
//接口定义-api列表
|
||||
export const Api_List = [
|
||||
{prop: 'num', label: "ID"},
|
||||
{prop: 'name', label: i18n.t('api_test.definition.api_name')},
|
||||
{prop: 'method', label: i18n.t('api_test.definition.api_type')},
|
||||
{prop: 'userName', label: i18n.t('api_test.definition.api_principal')},
|
||||
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
|
||||
{prop: 'caseTotal', label: i18n.t('api_test.definition.api_case_number')},
|
||||
{prop: 'caseStatus', label: i18n.t('api_test.definition.api_case_status')},
|
||||
{prop: 'casePassingRate', label: i18n.t('api_test.definition.api_case_passing_rate')},
|
||||
]
|
||||
//接口定义-case列表
|
||||
export const Api_Case_List = [
|
||||
{prop: 'num', label: "ID"},
|
||||
{prop: 'name', label: i18n.t('test_track.case.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'createUser', label: "创建人"},
|
||||
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
|
||||
]
|
||||
//接口自动化-场景列表
|
||||
export const Api_Scenario_List = [
|
||||
{prop: 'num', label: "ID"},
|
||||
{prop: 'name', label: i18n.t('test_track.case.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'createUser', label: '创建人'},
|
||||
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
|
||||
]
|
||||
//测试评审-测试用例
|
||||
export const Test_Case_Review_Case_List = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'type', label: i18n.t('test_track.case.type')},
|
||||
{prop: 'method', label: i18n.t('test_track.case.method')},
|
||||
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
|
||||
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
|
||||
{prop: 'reviewerName', label: i18n.t('test_track.review.reviewer')},
|
||||
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
|
||||
{prop: 'updateTime', label: i18n.t('commons.update_time')},
|
||||
]
|
||||
//测试计划-功能用例
|
||||
export const Test_Plan_Function_Test_Case = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'type', label: i18n.t('test_track.case.type')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'method', label: i18n.t('test_track.case.method')},
|
||||
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
|
||||
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
|
||||
{prop: 'issuesContent', label: i18n.t('test_track.issue.issue')},
|
||||
{prop: 'executorName', label: i18n.t('test_track.plan_view.executor')},
|
||||
{prop: 'status', label: i18n.t('test_track.plan_view.execute_result')},
|
||||
{prop: 'updateTime', label: i18n.t('commons.update_time')},
|
||||
]
|
||||
//测试计划-api用例
|
||||
export const Test_Plan_Api_Case = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
|
||||
{prop: 'createUser', label: '创建人'},
|
||||
{prop: 'custom', label: i18n.t('api_test.definition.api_last_time')},
|
||||
{prop: 'tags', label: i18n.t('commons.tag')},
|
||||
{prop: 'execResult', label: '执行状态'},
|
||||
]
|
||||
//测试计划-性能用例
|
||||
export const Test_Plan_Load_Case = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'caseName', label: i18n.t('commons.name')},
|
||||
{prop: 'projectName', label: i18n.t('load_test.project_name')},
|
||||
{prop: 'userName', label: i18n.t('load_test.user_name')},
|
||||
{prop: 'createTime', label: i18n.t('commons.create_time')},
|
||||
{prop: 'status', label: i18n.t('commons.status')},
|
||||
{prop: 'caseStatus', label: i18n.t('test_track.plan.load_case.execution_status')},
|
||||
{prop: 'loadReportId', label: i18n.t('test_track.plan.load_case.view_report')},
|
||||
]
|
||||
//测试计划-场景用例
|
||||
export const Test_Plan_Scenario_Case = [
|
||||
{prop: 'num', label: i18n.t('commons.id')},
|
||||
{prop: 'name', label: i18n.t('commons.name')},
|
||||
{prop: 'level', label: i18n.t('api_test.automation.case_level')},
|
||||
{prop: 'tagNames', label: i18n.t('api_test.automation.tag')},
|
||||
{prop: 'userId', label: i18n.t('api_test.automation.creator')},
|
||||
{prop: 'updateTime', label: i18n.t('api_test.automation.update_time')},
|
||||
{prop: 'stepTotal', label: i18n.t('api_test.automation.success')},
|
||||
{prop: 'lastResult', label: i18n.t('api_test.automation.fail')},
|
||||
{prop: 'passRate', label: i18n.t('api_test.automation.passing_rate')},
|
||||
]
|
||||
|
|
@ -51,6 +51,7 @@ export default {
|
|||
this.showCancel = false;
|
||||
this.showSave = false;
|
||||
this.$emit("update:show", true);
|
||||
this.$emit("reloadPassInput");
|
||||
this.init();
|
||||
},
|
||||
init() {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<el-input v-model="form.account" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('organization.integration.password')" prop="password">
|
||||
<el-input v-model="form.password" auto-complete="new-password"
|
||||
<el-input v-model="form.password" auto-complete="new-password" v-if="showInput"
|
||||
:placeholder="$t('organization.integration.input_api_password')" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('organization.integration.jira_url')" prop="url">
|
||||
|
@ -23,6 +23,7 @@
|
|||
@init="init"
|
||||
@testConnection="testConnection"
|
||||
@cancelIntegration="cancelIntegration"
|
||||
@reloadPassInput="reloadPassInput"
|
||||
:form="form"
|
||||
:show.sync="show"
|
||||
ref="bugBtn"/>
|
||||
|
@ -56,6 +57,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
show: true,
|
||||
showInput: true,
|
||||
form: {},
|
||||
rules: {
|
||||
account: {
|
||||
|
@ -123,6 +125,7 @@ export default {
|
|||
this.$refs.bugBtn.showEdit = true;
|
||||
this.$refs.bugBtn.showSave = false;
|
||||
this.$refs.bugBtn.showCancel = false;
|
||||
this.reloadPassInput();
|
||||
this.init();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
});
|
||||
|
@ -170,6 +173,12 @@ export default {
|
|||
} else {
|
||||
this.$warning(this.$t('organization.integration.not_integrated'));
|
||||
}
|
||||
},
|
||||
reloadPassInput() {
|
||||
this.showInput = false;
|
||||
this.$nextTick(function () {
|
||||
this.showInput = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<el-input v-model="form.account" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('organization.integration.api_password')" prop="password">
|
||||
<el-input v-model="form.password" auto-complete="new-password"
|
||||
<el-input v-model="form.password" auto-complete="new-password" v-if="showInput"
|
||||
:placeholder="$t('organization.integration.input_api_password')" show-password/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -17,6 +17,7 @@
|
|||
@init="init"
|
||||
@testConnection="testConnection"
|
||||
@cancelIntegration="cancelIntegration"
|
||||
@reloadPassInput="reloadPassInput"
|
||||
:form="form"
|
||||
:show.sync="show"
|
||||
ref="bugBtn"/>
|
||||
|
@ -52,6 +53,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
show: true,
|
||||
showInput: true,
|
||||
form: {},
|
||||
rules: {
|
||||
account: {
|
||||
|
@ -103,6 +105,7 @@ export default {
|
|||
this.$refs.bugBtn.showEdit = true;
|
||||
this.$refs.bugBtn.showSave = false;
|
||||
this.$refs.bugBtn.showCancel = false;
|
||||
this.reloadPassInput();
|
||||
this.init();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
});
|
||||
|
@ -148,6 +151,12 @@ export default {
|
|||
} else {
|
||||
this.$warning(this.$t('organization.integration.not_integrated'));
|
||||
}
|
||||
},
|
||||
reloadPassInput() {
|
||||
this.showInput = false;
|
||||
this.$nextTick(function () {
|
||||
this.showInput = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<el-input v-model="form.account" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('organization.integration.password')" prop="password">
|
||||
<el-input v-model="form.password" auto-complete="new-password"
|
||||
<el-input v-model="form.password" auto-complete="new-password" v-if="showInput"
|
||||
:placeholder="$t('organization.integration.input_api_password')" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('organization.integration.zentao_url')" prop="url">
|
||||
|
@ -20,6 +20,7 @@
|
|||
@init="init"
|
||||
@testConnection="testConnection"
|
||||
@cancelIntegration="cancelIntegration"
|
||||
@reloadPassInput="reloadPassInput"
|
||||
:form="form"
|
||||
:show.sync="show"
|
||||
ref="bugBtn"/>
|
||||
|
@ -55,6 +56,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
show: true,
|
||||
showInput: true,
|
||||
form: {},
|
||||
rules: {
|
||||
account: {
|
||||
|
@ -99,6 +101,7 @@ export default {
|
|||
this.$refs.bugBtn.showEdit = true;
|
||||
this.$refs.bugBtn.showSave = false;
|
||||
this.$refs.bugBtn.showCancel = false;
|
||||
this.reloadPassInput();
|
||||
this.init();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
});
|
||||
|
@ -168,6 +171,12 @@ export default {
|
|||
} else {
|
||||
this.$warning(this.$t('organization.integration.not_integrated'));
|
||||
}
|
||||
},
|
||||
reloadPassInput() {
|
||||
this.showInput = false;
|
||||
this.$nextTick(function () {
|
||||
this.showInput = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ export default {
|
|||
this.formInline = response.data;
|
||||
this.formInline.ssl = this.formInline.ssl === 'true';
|
||||
this.formInline.tls = this.formInline.tls === 'true';
|
||||
console.log(this.formInline)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formInline.clearValidate();
|
||||
})
|
||||
|
|
|
@ -105,6 +105,13 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="nodeSelector">
|
||||
<el-input v-model="item.nodeSelector" placeholder='{"disktype": "ssd",...}'/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="node-line" v-if="form.type === 'NODE'">
|
||||
<el-row>
|
||||
|
@ -243,9 +250,9 @@ export default {
|
|||
if (this.infoList.length <= 0) {
|
||||
return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')}
|
||||
}
|
||||
|
||||
let resourcePoolType = this.form.type;
|
||||
let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')};
|
||||
this.infoList.forEach(function (info) {
|
||||
this.infoList.forEach(info => {
|
||||
for (let key in info) {
|
||||
if (info[key] != '0' && !info[key]) {
|
||||
resultValidate.validate = false
|
||||
|
@ -257,6 +264,13 @@ export default {
|
|||
resultValidate.validate = false
|
||||
return false;
|
||||
}
|
||||
if (resourcePoolType === 'K8S' && info.nodeSelector) {
|
||||
let validate = this.isJsonString(info.nodeSelector);
|
||||
if (!validate) {
|
||||
resultValidate.validate = false;
|
||||
resultValidate.msg = this.$t('test_resource_pool.node_selector_invalid');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return resultValidate;
|
||||
|
@ -380,6 +394,16 @@ export default {
|
|||
row.status = 'INVALID';
|
||||
this.result.loading = false;
|
||||
})
|
||||
},
|
||||
isJsonString(str) {
|
||||
try {
|
||||
if (typeof JSON.parse(str) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('json invalid');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,135 +34,157 @@
|
|||
row-key="id"
|
||||
class="test-content adjust-table ms-select-all-fixed"
|
||||
ref="table" @row-click="handleEdit">
|
||||
|
||||
<el-table-column
|
||||
width="50"
|
||||
type="selection"/>
|
||||
|
||||
<ms-table-header-select-popover v-show="total>0"
|
||||
:page-size="pageSize > total ? total : pageSize"
|
||||
:total="total"
|
||||
@selectPageAll="isSelectDataAll(false)"
|
||||
@selectAll="isSelectDataAll(true)"/>
|
||||
:page-size="pageSize > total ? total : pageSize"
|
||||
:total="total"
|
||||
@selectPageAll="isSelectDataAll(false)"
|
||||
@selectAll="isSelectDataAll(true)"/>
|
||||
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<!--<div @mouseover="showDetail(scope.row)">
|
||||
<p>{{ scope.row.name }}</p>
|
||||
</div>-->
|
||||
<el-popover
|
||||
placement="right-end"
|
||||
:title="$t('test_track.case.view_case')"
|
||||
trigger="hover"
|
||||
>
|
||||
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>
|
||||
<span slot="reference">{{ scope.row.name }}</span>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="method"
|
||||
column-key="method"
|
||||
:filters="methodFilters"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.method')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
|
||||
<el-table-column
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.status')">
|
||||
<template v-slot:default="scope">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'num'"
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'name'"
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<!--<div @mouseover="showDetail(scope.row)">
|
||||
<p>{{ scope.row.name }}</p>
|
||||
</div>-->
|
||||
<el-popover
|
||||
placement="right-end"
|
||||
:title="$t('test_track.case.view_case')"
|
||||
trigger="hover"
|
||||
>
|
||||
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>
|
||||
<span slot="reference">{{ scope.row.name }}</span>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'type'"
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='method'"
|
||||
prop="method"
|
||||
column-key="method"
|
||||
:filters="methodFilters"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.method')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.prop=='status'"
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
min-width="100px"
|
||||
:label="$t('test_track.case.status')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span class="el-dropdown-link">
|
||||
<review-status :value="scope.row.reviewStatus"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
min-width="150px"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='nodePath'"
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
min-width="150px"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
sortable="custom"
|
||||
:label="$t('commons.update_time')"
|
||||
min-width="150px"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
<el-table-column
|
||||
v-if="item.prop=='updateTime'"
|
||||
prop="updateTime"
|
||||
sortable="custom"
|
||||
:label="$t('commons.update_time')"
|
||||
min-width="150px"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column fixed="right" min-width="150">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right"
|
||||
:label="$t('commons.operating')" min-width="150">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
|
||||
icon="el-icon-document-copy"
|
||||
type="success" @exec="handleCopy(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
</el-table-column>
|
||||
icon="el-icon-document-copy"
|
||||
type="success" @exec="handleCopy(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</el-table>
|
||||
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
||||
</el-card>
|
||||
|
||||
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
|
||||
|
@ -170,6 +192,7 @@
|
|||
|
||||
<batch-move @refresh="refresh" @moveSave="moveSave" ref="testBatchMove"/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -190,12 +213,12 @@ import MsTableButton from "../../../common/components/MsTableButton";
|
|||
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import ShowMoreBtn from "./ShowMoreBtn";
|
||||
import BatchEdit from "./BatchEdit";
|
||||
import {WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {TEST_CASE_LIST, WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
||||
import TestCaseDetail from "./TestCaseDetail";
|
||||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentUser} from "../../../../../common/js/utils";
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {
|
||||
_filter,
|
||||
|
@ -207,10 +230,14 @@ import {
|
|||
toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
import BatchMove from "./BatchMove";
|
||||
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import i18n from "@/i18n/i18n";
|
||||
|
||||
export default {
|
||||
name: "TestCaseList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
BatchMove,
|
||||
MsTableHeaderSelectPopover,
|
||||
MsTableButton,
|
||||
|
@ -234,6 +261,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_CASE_LIST,
|
||||
headerItems: Track_Test_Case,
|
||||
tableLabel: Track_Test_Case,
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
|
@ -331,6 +361,9 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
initTableData() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.condition.planId = "";
|
||||
|
@ -345,8 +378,27 @@ export default {
|
|||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.getLabel()
|
||||
this.getData();
|
||||
},
|
||||
getLabel(){
|
||||
let param={}
|
||||
param.userId=getCurrentUser().id;
|
||||
param.type=TEST_CASE_LIST
|
||||
this.result=this.$post('/system/header/info',param,response=> {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
if (this.projectId) {
|
||||
this.condition.projectId = this.projectId;
|
||||
|
@ -556,9 +608,9 @@ export default {
|
|||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
|
||||
},
|
||||
headerDragend(newWidth,oldWidth,column,event){
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if(column.minWidth>finalWidth){
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||
|
||||
<span v-if="data.isEdit" @click.stop>
|
||||
<el-input @blur.stop="save(node, data)" v-model="data.name" class="name-input" size="mini" ref="nameInput"/>
|
||||
<el-input @blur.stop="save(node, data)" @keyup.enter.native.stop="$event.target.blur" v-model="data.name" class="name-input" size="mini" ref="nameInput"/>
|
||||
</span>
|
||||
|
||||
<span v-if="!data.isEdit" class="node-icon">
|
||||
|
|
|
@ -19,30 +19,6 @@
|
|||
<el-input v-model="form.name" :placeholder="$t('test_track.plan.input_plan_name')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-form-item :label-width="formLabelWidth" prop="projectIds">
|
||||
<template slot="label">
|
||||
<el-tooltip class="item" effect="dark" :content="$t('test_track.plan.related_tip')" placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
{{ $t('test_track.plan.related_project') }}
|
||||
</template>
|
||||
<el-select
|
||||
v-model="form.projectIds"
|
||||
:placeholder="$t('test_track.plan.input_related_project')"
|
||||
multiple
|
||||
style="width: 100%"
|
||||
filterable>
|
||||
<el-option
|
||||
v-for="item in projects"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
|
@ -164,21 +140,18 @@ export default {
|
|||
{required: true, message: this.$t('test_track.plan.input_plan_name'), trigger: 'blur'},
|
||||
{max: 30, message: this.$t('test_track.length_less_than') + '30', trigger: 'blur'}
|
||||
],
|
||||
// projectIds: [{required: true, message: this.$t('test_track.plan.input_plan_project'), trigger: 'change'}],
|
||||
principal: [{required: true, message: this.$t('test_track.plan.input_plan_principal'), trigger: 'change'}],
|
||||
stage: [{required: true, message: this.$t('test_track.plan.input_plan_stage'), trigger: 'change'}],
|
||||
description: [{max: 200, message: this.$t('test_track.length_less_than') + '200', trigger: 'blur'}]
|
||||
},
|
||||
formLabelWidth: "120px",
|
||||
operationType: '',
|
||||
projects: [],
|
||||
principalOptions: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openTestPlanEditDialog(testPlan) {
|
||||
this.resetForm();
|
||||
this.getProjects();
|
||||
this.setPrincipalOptions();
|
||||
this.operationType = 'add';
|
||||
if (testPlan) {
|
||||
|
@ -198,34 +171,18 @@ export default {
|
|||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
param.name = param.name.trim();
|
||||
if (!this.validate(param)) {
|
||||
if (param.name === '') {
|
||||
this.$warning(this.$t('test_track.plan.input_plan_name'));
|
||||
return;
|
||||
}
|
||||
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
|
||||
if (this.operationType === 'edit') {
|
||||
const nowIds = param.projectIds;
|
||||
let sign = true;
|
||||
this.dbProjectIds.forEach(dbId => {
|
||||
if (nowIds.indexOf(dbId) === -1 && sign) {
|
||||
sign = false;
|
||||
this.$confirm(this.$t('test_track.case.cancel_relevance_project'), this.$t('commons.prompt'), {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.editTestPlan(param);
|
||||
}).catch(() => {
|
||||
this.$info(this.$t('commons.cancel'))
|
||||
});
|
||||
}
|
||||
});
|
||||
if (sign) {
|
||||
this.editTestPlan(param);
|
||||
}
|
||||
} else {
|
||||
this.editTestPlan(param);
|
||||
}
|
||||
this.$post('/test/plan/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -242,24 +199,6 @@ export default {
|
|||
}
|
||||
return true;
|
||||
},
|
||||
editTestPlan(param) {
|
||||
this.$post('/test/plan/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
if (response.success) {
|
||||
this.projects = response.data.filter(da => da.id !== getCurrentProjectID());
|
||||
} else {
|
||||
this.$warning()(response.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
setPrincipalOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
|
|
|
@ -14,23 +14,30 @@
|
|||
@filter-change="filter"
|
||||
@sort-change="sort"
|
||||
@row-click="intoPlan">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
:label="$t('test_track.plan.plan_principal')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
:label="$t('test_track.plan.plan_status')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'name'"
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'userName'"
|
||||
prop="userName"
|
||||
:label="$t('test_track.plan.plan_principal')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'status'"
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
:label="$t('test_track.plan.plan_status')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span @click.stop="clickt = 'stop'">
|
||||
<el-dropdown class="test-case-status" @command="statusChange">
|
||||
<span class="el-dropdown-link">
|
||||
|
@ -51,76 +58,98 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="stage"
|
||||
column-key="stage"
|
||||
:filters="stageFilters"
|
||||
:label="$t('test_track.plan.plan_stage')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<plan-stage-table-item :stage="scope.row.stage"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('test_track.home.test_rate')"
|
||||
min-width="100"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<el-progress :percentage="scope.row.testRate"></el-progress>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="plannedStartTime"
|
||||
:label="$t('test_track.plan.planned_start_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="plannedEndTime"
|
||||
:label="$t('test_track.plan.planned_end_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="actualStartTime"
|
||||
:label="$t('test_track.plan.actual_start_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="actualEndTime"
|
||||
:label="$t('test_track.plan.actual_end_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'stage'"
|
||||
prop="stage"
|
||||
column-key="stage"
|
||||
:filters="stageFilters"
|
||||
:label="$t('test_track.plan.plan_stage')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<plan-stage-table-item :stage="scope.row.stage"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'testRate'"
|
||||
prop="testRate"
|
||||
:label="$t('test_track.home.test_rate')"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<el-progress :percentage="scope.row.testRate"></el-progress>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-colum
|
||||
v-if="item.prop == 'projectName'"
|
||||
prop="projectName"
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-colum>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'plannedStartTime'"
|
||||
sortable
|
||||
prop="plannedStartTime"
|
||||
:label="$t('test_track.plan.planned_start_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'plannedEndTime'"
|
||||
sortable
|
||||
prop="plannedEndTime"
|
||||
:label="$t('test_track.plan.planned_end_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'actualStartTime'"
|
||||
sortable
|
||||
prop="actualStartTime"
|
||||
:label="$t('test_track.plan.actual_start_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'actualEndTime'"
|
||||
sortable
|
||||
prop="actualEndTime"
|
||||
:label="$t('test_track.plan.actual_end_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column
|
||||
min-width="150"
|
||||
:label="$t('commons.operating')">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button :isTesterPermission="true" style="background-color: #85888E;border-color: #85888E" v-if="!scope.row.reportId"
|
||||
<ms-table-operator-button :isTesterPermission="true"
|
||||
style="background-color: #85888E;border-color: #85888E"
|
||||
v-if="!scope.row.reportId"
|
||||
:tip="$t('test_track.plan_view.create_report')" icon="el-icon-s-data"
|
||||
@exec="openTestReportTemplate(scope.row)"/>
|
||||
<ms-table-operator-button v-if="scope.row.reportId"
|
||||
|
@ -128,24 +157,30 @@
|
|||
@exec="openReport(scope.row.id, scope.row.reportId)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;" v-if="!scope.row.scheduleOpen" type="text"
|
||||
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;"
|
||||
v-if="!scope.row.scheduleOpen" type="text"
|
||||
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
|
||||
@exec="scheduleTask(scope.row)"/>
|
||||
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;" v-if="scope.row.scheduleOpen" type="text"
|
||||
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;"
|
||||
v-if="scope.row.scheduleOpen" type="text"
|
||||
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
|
||||
@exec="scheduleTask(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
|
||||
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
|
||||
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
|
||||
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
|
||||
{{$t('test_track.plan.plan_delete_tip')}}
|
||||
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
|
||||
:with-tip="enableDeleteTip">
|
||||
{{ $t('test_track.plan.plan_delete_tip') }}
|
||||
</ms-delete-confirm>
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData" />
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData"/>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
|
@ -158,7 +193,7 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
|
|||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
|
||||
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
|
||||
import {checkoutTestManagerOrTestUser, getCurrentUser} from "@/common/js/utils";
|
||||
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
||||
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
||||
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||
|
@ -167,11 +202,15 @@ import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEve
|
|||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants";
|
||||
import {Test_Plan_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
|
||||
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
MsDeleteConfirm,
|
||||
TestCaseReportView,
|
||||
TestReportTemplateList,
|
||||
|
@ -182,6 +221,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_LIST,
|
||||
headerItems: Test_Plan_List,
|
||||
tableLabel: Test_Plan_List,
|
||||
result: {},
|
||||
enableDeleteTip: false,
|
||||
queryPath: "/test/plan/list",
|
||||
|
@ -219,7 +261,11 @@ export default {
|
|||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
initTableData() {
|
||||
this.getLabel()
|
||||
if (this.planId) {
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
|
@ -235,7 +281,7 @@ export default {
|
|||
this.tableData = data.listObject;
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
let path = "/test/plan/project";
|
||||
this.$post(path,{planId: this.tableData[i].id}, res => {
|
||||
this.$post(path, {planId: this.tableData[i].id}, res => {
|
||||
let arr = res.data;
|
||||
let projectIds = arr.filter(d => d.id !== this.tableData[i].projectId).map(data => data.id);
|
||||
this.$set(this.tableData[i], "projectIds", projectIds);
|
||||
|
@ -243,6 +289,24 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_PLAN_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
|
|
|
@ -25,76 +25,96 @@
|
|||
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column v-if="item.prop == 'num'" prop="num" sortable="custom" label="ID" show-overflow-tooltip
|
||||
:key="index"/>
|
||||
<el-table-column v-if="item.prop == 'name'" prop="name" sortable="custom"
|
||||
:label="$t('api_test.definition.api_name')" show-overflow-tooltip :key="index"/>
|
||||
|
||||
<el-table-column prop="num" sortable="custom" label="ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="name" sortable="custom" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
sortable="custom"
|
||||
column-key="priority"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
sortable="custom"
|
||||
column-key="priority"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'path'"
|
||||
prop="path"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
prop="path"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'createUser'"
|
||||
prop="createUser"
|
||||
column-key="user_id"
|
||||
sortable="custom"
|
||||
:filters="userFilters"
|
||||
:label="'创建人'"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
prop="createUser"
|
||||
column-key="user_id"
|
||||
sortable="custom"
|
||||
:filters="userFilters"
|
||||
:label="'创建人'"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'custom'"
|
||||
sortable="custom"
|
||||
width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
sortable="custom"
|
||||
width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="'执行状态'" min-width="130" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<div v-loading="rowLoading === scope.row.id">
|
||||
<el-link type="danger"
|
||||
v-if="scope.row.execResult && scope.row.execResult === 'error'"
|
||||
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)"/>
|
||||
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'"
|
||||
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
|
||||
|
||||
</el-link>
|
||||
<div v-else v-text="getResult(scope.row.execResult)"/>
|
||||
|
||||
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
|
||||
<span> {{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
{{ scope.row.updateUser }}
|
||||
<el-table-column
|
||||
v-if="item.prop == 'tags'"
|
||||
prop="tags"
|
||||
:label="$t('commons.tag')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="item.prop == 'execResult'" :label="'执行状态'" min-width="130" align="center" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-loading="rowLoading === scope.row.id">
|
||||
<el-link type="danger"
|
||||
v-if="scope.row.execResult && scope.row.execResult === 'error'"
|
||||
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)"/>
|
||||
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'"
|
||||
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
|
||||
|
||||
</el-link>
|
||||
<div v-else v-text="getResult(scope.row.execResult)"/>
|
||||
|
||||
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
|
||||
<span> {{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
{{ scope.row.updateUser }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
|
||||
icon="el-icon-video-play"
|
||||
@exec="singleRun(scope.row)" v-tester/>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
|
||||
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)" v-tester/>
|
||||
|
@ -102,6 +122,8 @@
|
|||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
||||
|
@ -129,7 +151,7 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
|
|||
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
|
||||
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
|
||||
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
|
||||
|
@ -138,13 +160,16 @@ import MsRun from "../../../../../api/definition/components/Run";
|
|||
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
|
||||
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
|
||||
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
|
||||
import {WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {TEST_CASE_LIST, TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {Test_Plan_Api_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
|
||||
|
||||
export default {
|
||||
name: "TestPlanApiCaseList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
TestPlanApiCaseResult,
|
||||
MsRun,
|
||||
TestPlanCaseListHeader,
|
||||
|
@ -163,11 +188,14 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_API_CASE,
|
||||
headerItems: Test_Plan_Api_Case,
|
||||
tableLabel: Test_Plan_Api_Case,
|
||||
condition: {},
|
||||
selectCase: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
status:'default',
|
||||
status: 'default',
|
||||
deletePath: "/test/case/delete",
|
||||
selectRows: new Set(),
|
||||
buttons: [
|
||||
|
@ -228,14 +256,14 @@ export default {
|
|||
}
|
||||
},
|
||||
planId: String,
|
||||
clickType:String
|
||||
clickType: String
|
||||
},
|
||||
created: function () {
|
||||
this.getMaintainerOptions();
|
||||
this.initTable();
|
||||
},
|
||||
activated() {
|
||||
this.status ='default'
|
||||
this.status = 'default'
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
|
@ -263,6 +291,9 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
|
@ -276,6 +307,7 @@ export default {
|
|||
this.$emit('isApiListEnableChange', data);
|
||||
},
|
||||
initTable() {
|
||||
this.getLabel()
|
||||
this.selectRows = new Set();
|
||||
this.condition.status = "";
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
|
@ -285,10 +317,10 @@ export default {
|
|||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
}
|
||||
if(this.clickType){
|
||||
if(this.status =='default'){
|
||||
if (this.clickType) {
|
||||
if (this.status == 'default') {
|
||||
this.condition.status = this.clickType;
|
||||
}else{
|
||||
} else {
|
||||
this.condition.status = null;
|
||||
}
|
||||
this.status = 'all';
|
||||
|
@ -303,6 +335,25 @@ export default {
|
|||
})
|
||||
});
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_PLAN_API_CASE
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
row.hashTree = [];
|
||||
if (this.selectRows.has(row)) {
|
||||
|
|
|
@ -8,62 +8,87 @@
|
|||
@relevanceCase="$emit('relevanceCase', 'scenario')"/>
|
||||
</template>
|
||||
|
||||
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect">
|
||||
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll"
|
||||
@select="handleSelect">
|
||||
<el-table-column type="selection"/>
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
<template v-slot:default="{row}">
|
||||
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectRows.length"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="ID"/>
|
||||
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="level" :label="$t('api_test.automation.case_level')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.level == 'P0'" type="info" effect="plain" content="P0"/>
|
||||
<ms-tag v-if="scope.row.level == 'P1'" type="warning" effect="plain" content="P1"/>
|
||||
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
|
||||
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
|
||||
</template>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'num'"
|
||||
prop="num"
|
||||
label="ID"
|
||||
:key="index"/>
|
||||
<el-table-column v-if="item.prop == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
<el-table-column v-if="item.prop == 'level'" prop="level" :label="$t('api_test.automation.case_level')"
|
||||
show-overflow-tooltip :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.level == 'P0'" type="info" effect="plain" content="P0"/>
|
||||
<ms-tag v-if="scope.row.level == 'P1'" type="warning" effect="plain" content="P1"/>
|
||||
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
|
||||
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateTime" :label="$t('api_test.automation.update_time')" width="180">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
|
||||
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">{{ $t('api_test.automation.success') }}</el-link>
|
||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">{{ $t('api_test.automation.fail') }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
|
||||
show-overflow-tooltip/>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'tagNames'" prop="tagNames" :label="$t('api_test.automation.tag')"
|
||||
width="200px" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
|
||||
:label="$t('api_test.automation.update_time')" width="180" :key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
|
||||
:label="$t('api_test.automation.last_result')" :key="index">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
|
||||
{{ $t('api_test.automation.success') }}
|
||||
</el-link>
|
||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
|
||||
{{ $t('api_test.automation.fail') }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
|
||||
:label="$t('api_test.automation.passing_rate')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
</template>
|
||||
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="{row}">
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
|
||||
icon="el-icon-video-play"
|
||||
@exec="execute(row)" v-tester/>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
|
||||
icon="el-icon-unlock" type="danger" @exec="remove(row)" v-tester/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="search" :optionalFields=headerItems :type=type></header-custom>
|
||||
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
<div>
|
||||
<!-- 执行结果 -->
|
||||
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
|
||||
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
|
||||
size="90%">
|
||||
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
||||
</el-drawer>
|
||||
</div>
|
||||
|
@ -73,182 +98,220 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
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, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
|
||||
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
||||
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
|
||||
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
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, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
|
||||
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
||||
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
|
||||
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
|
||||
import {Test_Plan_Scenario_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
|
||||
export default {
|
||||
name: "MsTestPlanApiScenarioList",
|
||||
components: {
|
||||
MsTableOperatorButton,
|
||||
TestPlanScenarioListHeader,
|
||||
MsTablePagination, MsTableMoreBtn, ShowMoreBtn, MsTableHeader, MsTag, MsApiReportDetail, MsScenarioExtendButtons, MsTestPlanList},
|
||||
props: {
|
||||
referenced: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
selectNodeIds: Array,
|
||||
planId: String,
|
||||
clickType:String
|
||||
export default {
|
||||
name: "MsTestPlanApiScenarioList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
MsTableOperatorButton,
|
||||
TestPlanScenarioListHeader,
|
||||
MsTablePagination,
|
||||
MsTableMoreBtn,
|
||||
ShowMoreBtn,
|
||||
MsTableHeader,
|
||||
MsTag,
|
||||
MsApiReportDetail,
|
||||
MsScenarioExtendButtons,
|
||||
MsTestPlanList
|
||||
},
|
||||
props: {
|
||||
referenced: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
condition: {},
|
||||
currentScenario: {},
|
||||
schedule: {},
|
||||
selectAll: false,
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
reportId: "",
|
||||
status:'default',
|
||||
infoDb: false,
|
||||
runVisible: false,
|
||||
projectId: "",
|
||||
runData: [],
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
|
||||
},
|
||||
{
|
||||
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
|
||||
}
|
||||
],
|
||||
selectRows: new Set()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
selectNodeIds: Array,
|
||||
planId: String,
|
||||
clickType: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_SCENARIO_CASE,
|
||||
headerItems: Test_Plan_Scenario_Case,
|
||||
tableLabel: Test_Plan_Scenario_Case,
|
||||
loading: false,
|
||||
condition: {},
|
||||
currentScenario: {},
|
||||
schedule: {},
|
||||
selectAll: false,
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
reportId: "",
|
||||
status: 'default',
|
||||
infoDb: false,
|
||||
runVisible: false,
|
||||
projectId: "",
|
||||
runData: [],
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
|
||||
},
|
||||
{
|
||||
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
|
||||
}
|
||||
],
|
||||
selectRows: new Set()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.search();
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
this.search();
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
this.search();
|
||||
},
|
||||
planId() {
|
||||
this.search();
|
||||
}
|
||||
planId() {
|
||||
this.search();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.selectRows = new Set();
|
||||
this.loading = true;
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
this.condition.planId = this.planId;
|
||||
if(this.clickType){
|
||||
if(this.status =='default'){
|
||||
this.condition.status = this.clickType;
|
||||
}else{
|
||||
this.condition.status = null;
|
||||
}
|
||||
this.status = 'all';
|
||||
search() {
|
||||
this.getLabel()
|
||||
this.selectRows = new Set();
|
||||
this.loading = true;
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
this.condition.planId = this.planId;
|
||||
if (this.clickType) {
|
||||
if (this.status == 'default') {
|
||||
this.condition.status = this.clickType;
|
||||
} else {
|
||||
this.condition.status = null;
|
||||
}
|
||||
let url = "/test/plan/scenario/case/list/" + this.currentPage + "/" + this.pageSize;
|
||||
this.$post(url, this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
});
|
||||
this.loading = false;
|
||||
this.status = 'all';
|
||||
}
|
||||
let url = "/test/plan/scenario/case/list/" + this.currentPage + "/" + this.pageSize;
|
||||
this.$post(url, this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
});
|
||||
},
|
||||
reductionApi(row) {
|
||||
row.scenarioDefinition = null;
|
||||
let rows = [row];
|
||||
this.$post("/api/automation/reduction", rows, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
})
|
||||
},
|
||||
handleBatchExecute() {
|
||||
this.selectRows.forEach(row => {
|
||||
let param = this.buildExecuteParam(row);
|
||||
this.$post("/test/plan/scenario/case/run", param, response => {
|
||||
});
|
||||
});
|
||||
this.$message('任务执行中,请稍后刷新查看结果');
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_PLAN_SCENARIO_CASE
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
reductionApi(row) {
|
||||
row.scenarioDefinition = null;
|
||||
let rows = [row];
|
||||
this.$post("/api/automation/reduction", rows, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
},
|
||||
execute(row) {
|
||||
this.infoDb = false;
|
||||
})
|
||||
},
|
||||
handleBatchExecute() {
|
||||
this.selectRows.forEach(row => {
|
||||
let param = this.buildExecuteParam(row);
|
||||
this.$post("/test/plan/scenario/case/run", param, response => {
|
||||
this.runVisible = true;
|
||||
this.reportId = response.data;
|
||||
});
|
||||
},
|
||||
buildExecuteParam(row) {
|
||||
let param = {};
|
||||
// param.id = row.id;
|
||||
param.id = getUUID();
|
||||
param.planScenarioId = row.id;
|
||||
param.projectId = row.projectId;
|
||||
param.planCaseIds = [];
|
||||
param.planCaseIds.push(row.id);
|
||||
return param;
|
||||
},
|
||||
showReport(row) {
|
||||
});
|
||||
this.$message('任务执行中,请稍后刷新查看结果');
|
||||
this.search();
|
||||
},
|
||||
execute(row) {
|
||||
this.infoDb = false;
|
||||
let param = this.buildExecuteParam(row);
|
||||
this.$post("/test/plan/scenario/case/run", param, response => {
|
||||
this.runVisible = true;
|
||||
this.infoDb = true;
|
||||
this.reportId = row.reportId;
|
||||
},
|
||||
remove(row) {
|
||||
this.$get('/test/plan/scenario/case/delete/' + row.id, () => {
|
||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||
this.$emit('refresh');
|
||||
this.search();
|
||||
});
|
||||
return;
|
||||
},
|
||||
isSelect(row) {
|
||||
return this.selectRows.has(row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
_handleSelect(this, selection, row, this.selectRows);
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let param = {};
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.planId = this.planId;
|
||||
this.$post('/test/plan/scenario/case/batch/delete', param, () => {
|
||||
this.selectRows.clear();
|
||||
this.search();
|
||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||
this.$emit('refresh');
|
||||
});
|
||||
}
|
||||
this.reportId = response.data;
|
||||
});
|
||||
},
|
||||
buildExecuteParam(row) {
|
||||
let param = {};
|
||||
// param.id = row.id;
|
||||
param.id = getUUID();
|
||||
param.planScenarioId = row.id;
|
||||
param.projectId = row.projectId;
|
||||
param.planCaseIds = [];
|
||||
param.planCaseIds.push(row.id);
|
||||
return param;
|
||||
},
|
||||
showReport(row) {
|
||||
this.runVisible = true;
|
||||
this.infoDb = true;
|
||||
this.reportId = row.reportId;
|
||||
},
|
||||
remove(row) {
|
||||
this.$get('/test/plan/scenario/case/delete/' + row.id, () => {
|
||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||
this.$emit('refresh');
|
||||
this.search();
|
||||
});
|
||||
return;
|
||||
},
|
||||
isSelect(row) {
|
||||
return this.selectRows.has(row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
_handleSelect(this, selection, row, this.selectRows);
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let param = {};
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.planId = this.planId;
|
||||
this.$post('/test/plan/scenario/case/batch/delete', param, () => {
|
||||
this.selectRows.clear();
|
||||
this.search();
|
||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||
this.$emit('refresh');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .el-drawer__header {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
/deep/ .el-drawer__header {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -45,134 +45,146 @@
|
|||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
min-width="120px"
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'num'"
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='name'"
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
min-width="120px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="100px"
|
||||
:key="index"
|
||||
:label="$t('test_track.case.priority')">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
min-width="120px"
|
||||
<el-table-column
|
||||
v-if="item.prop=='type'"
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
min-width="80px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
min-width="100px"
|
||||
<el-table-column v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" min-width="120px"
|
||||
:key="index"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index">
|
||||
<ms-tag type="success" effect="plain" :content="tag"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
:label="$t('test_track.case.priority')">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='method'"
|
||||
prop="method"
|
||||
:filters="methodFilters"
|
||||
column-key="method"
|
||||
:label="$t('test_track.case.method')"
|
||||
min-width="100px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
min-width="80px"
|
||||
<el-table-column
|
||||
v-if="item.prop=='nodePath'"
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
min-width="120px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='projectName'"
|
||||
prop="projectName"
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
min-width="120px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')" min-width="120px"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<div v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index">
|
||||
<ms-tag type="success" effect="plain" :content="tag"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="method"
|
||||
:filters="methodFilters"
|
||||
column-key="method"
|
||||
:label="$t('test_track.case.method')"
|
||||
min-width="100px"
|
||||
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
min-width="120px"
|
||||
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
min-width="120px"
|
||||
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:label="$t('test_track.issue.issue')"
|
||||
min-width="80px"
|
||||
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="400"
|
||||
trigger="hover">
|
||||
<el-table border class="adjust-table" :data="scope.row.issuesContent" style="width: 100%">
|
||||
<el-table-column prop="title" :label="$t('test_track.issue.title')" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" :label="$t('test_track.issue.description')">
|
||||
<template v-slot:default="scope">
|
||||
<el-popover
|
||||
placement="left"
|
||||
width="400"
|
||||
trigger="hover"
|
||||
>
|
||||
<ckeditor :editor="editor" disabled :config="editorConfig"
|
||||
v-model="scope.row.description"/>
|
||||
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="platform" :label="$t('test_track.issue.platform')"/>
|
||||
</el-table>
|
||||
<el-button slot="reference" type="text">{{ scope.row.issuesSize }}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='issuesContent'"
|
||||
:label="$t('test_track.issue.issue')"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="400"
|
||||
trigger="hover">
|
||||
<el-table border class="adjust-table" :data="scope.row.issuesContent" style="width: 100%">
|
||||
<el-table-column prop="title" :label="$t('test_track.issue.title')" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" :label="$t('test_track.issue.description')">
|
||||
<template v-slot:default="scope">
|
||||
<el-popover
|
||||
placement="left"
|
||||
width="400"
|
||||
trigger="hover"
|
||||
>
|
||||
<ckeditor :editor="editor" disabled :config="editorConfig"
|
||||
v-model="scope.row.description"/>
|
||||
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="platform" :label="$t('test_track.issue.platform')"/>
|
||||
</el-table>
|
||||
<el-button slot="reference" type="text">{{ scope.row.issuesSize }}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
prop="executorName"
|
||||
:filters="executorFilters"
|
||||
min-width="100px"
|
||||
<el-table-column
|
||||
v-if="item.prop == 'executorName'"
|
||||
prop="executorName"
|
||||
:filters="executorFilters"
|
||||
min-width="100px"
|
||||
:key="index"
|
||||
column-key="executor"
|
||||
:label="$t('test_track.plan_view.executor')">
|
||||
</el-table-column>
|
||||
|
||||
column-key="executor"
|
||||
:label="$t('test_track.plan_view.executor')">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="status"
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
min-width="100px"
|
||||
|
||||
:label="$t('test_track.plan_view.execute_result')">
|
||||
<template v-slot:default="scope">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'status'"
|
||||
prop="status"
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
min-width="100px"
|
||||
:key="index"
|
||||
:label="$t('test_track.plan_view.execute_result')">
|
||||
<template v-slot:default="scope">
|
||||
<span @click.stop="clickt = 'stop'">
|
||||
<el-dropdown class="test-case-status" @command="statusChange">
|
||||
<span class="el-dropdown-link">
|
||||
|
@ -196,24 +208,32 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="updateTime"
|
||||
:label="$t('commons.update_time')"
|
||||
min-width="120px"
|
||||
<el-table-column
|
||||
v-if="item.prop == 'updateTime'"
|
||||
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
sortable
|
||||
prop="updateTime"
|
||||
:label="$t('commons.update_time')"
|
||||
min-width="120px"
|
||||
:key="index"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
min-width="100"
|
||||
:label="$t('commons.operating')">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
|
||||
@exec="handleEdit(scope.row)"/>
|
||||
|
@ -222,7 +242,8 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
||||
|
@ -249,8 +270,15 @@ import MsTableHeader from '../../../../../common/components/MsTableHeader';
|
|||
import MsTableButton from '../../../../../common/components/MsTableButton';
|
||||
import NodeBreadcrumb from '../../../../common/NodeBreadcrumb';
|
||||
|
||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {checkoutTestManagerOrTestUser, hasRoles} from "@/common/js/utils";
|
||||
import {
|
||||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
TEST_CASE_LIST,
|
||||
TEST_PLAN_FUNCTION_TEST_CASE,
|
||||
TokenKey,
|
||||
WORKSPACE_ID
|
||||
} from "@/common/js/constants";
|
||||
import {checkoutTestManagerOrTestUser, getCurrentUser, hasRoles} from "@/common/js/utils";
|
||||
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
|
||||
import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem";
|
||||
import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem";
|
||||
|
@ -264,11 +292,14 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
|||
import {hub} from "@/business/components/track/plan/event-bus";
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
|
||||
|
||||
export default {
|
||||
name: "FunctionalTestCaseList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
FunctionalTestCaseEdit,
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
|
@ -281,6 +312,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_FUNCTION_TEST_CASE,
|
||||
headerItems: Test_Plan_Function_Test_Case,
|
||||
tableLabel: Test_Plan_Function_Test_Case,
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
|
@ -383,7 +417,12 @@ export default {
|
|||
hub.$off("openFailureTestCase");
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
|
||||
initTableData() {
|
||||
this.getLabel()
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
|
@ -428,6 +467,24 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_PLAN_FUNCTION_TEST_CASE
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.isReadOnly = true;
|
||||
this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row);
|
||||
|
@ -596,9 +653,9 @@ export default {
|
|||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
headerDragend(newWidth,oldWidth,column,event){
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if(column.minWidth>finalWidth){
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<el-card class="card-content" v-loading="result.loading">
|
||||
<template v-slot:header>
|
||||
<test-plan-load-case-list-header
|
||||
:condition="condition"
|
||||
:plan-id="planId"
|
||||
@refresh="initTable"
|
||||
@relevanceCase="$emit('relevanceCase')"
|
||||
:condition="condition"
|
||||
:plan-id="planId"
|
||||
@refresh="initTable"
|
||||
@relevanceCase="$emit('relevanceCase')"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
@ -23,69 +23,89 @@
|
|||
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="num" label="ID" show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
prop="caseName"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('load_test.project_name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
:label="$t('load_test.user_name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="createTime"
|
||||
:label="$t('commons.create_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
:label="$t('commons.status')">
|
||||
<template v-slot:default="{row}">
|
||||
<ms-performance-test-status :row="row"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="caseStatus"
|
||||
:label="$t('test_track.plan.load_case.execution_status')">
|
||||
<template v-slot:default="{row}">
|
||||
<el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" v-else-if="row.caseStatus === 'run'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('test_track.plan.load_case.report')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<div v-loading="loading === scope.row.id">
|
||||
<el-link type="info" @click="getReport(scope.row)" v-if="scope.row.loadReportId">
|
||||
{{ $t('test_track.plan.load_case.view_report') }}
|
||||
</el-link>
|
||||
<span v-else> - </span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID" show-overflow-tooltip :key="index"/>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'caseName'"
|
||||
prop="caseName"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'projectName'"
|
||||
prop="projectName"
|
||||
:label="$t('load_test.project_name')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'userName'"
|
||||
prop="userName"
|
||||
:label="$t('load_test.user_name')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'createTime'"
|
||||
sortable
|
||||
prop="createTime"
|
||||
:label="$t('commons.create_time')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'status'"
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:filters="statusFilters"
|
||||
:label="$t('commons.status')"
|
||||
:key="index">
|
||||
<template v-slot:default="{row}">
|
||||
<ms-performance-test-status :row="row"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'caseStatus'"
|
||||
prop="caseStatus"
|
||||
:label="$t('test_track.plan.load_case.execution_status')"
|
||||
:key="index">
|
||||
<template v-slot:default="{row}">
|
||||
<el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" v-else-if="row.caseStatus === 'run'">
|
||||
{{ row.caseStatus }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'loadReportId'"
|
||||
:label="$t('test_track.plan.load_case.report')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<div v-loading="loading === scope.row.id">
|
||||
<el-link type="info" @click="getReport(scope.row)" v-if="scope.row.loadReportId">
|
||||
{{ $t('test_track.plan.load_case.view_report') }}
|
||||
</el-link>
|
||||
<span v-else> - </span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
|
||||
icon="el-icon-video-play"
|
||||
|
@ -95,6 +115,8 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</el-card>
|
||||
|
@ -112,10 +134,15 @@ import MsPerformanceTestStatus from "@/business/components/performance/test/Perf
|
|||
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
|
||||
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
|
||||
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import {getCurrentUser} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestPlanLoadCaseList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
LoadCaseReport,
|
||||
TestPlanLoadCaseListHeader,
|
||||
ShowMoreBtn,
|
||||
|
@ -125,6 +152,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_LOAD_CASE,
|
||||
headerItems: Test_Plan_Load_Case,
|
||||
tableLabel: Test_Plan_Load_Case,
|
||||
condition: {},
|
||||
result: {},
|
||||
tableData: [],
|
||||
|
@ -177,7 +207,11 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
initTable() {
|
||||
this.getLabel()
|
||||
this.selectRows = new Set();
|
||||
this.condition.testPlanId = this.planId;
|
||||
if (this.selectProjectId && this.selectProjectId !== 'root') {
|
||||
|
@ -186,7 +220,7 @@ export default {
|
|||
if (this.clickType) {
|
||||
if (this.status == 'default') {
|
||||
this.condition.status = this.clickType;
|
||||
}else{
|
||||
} else {
|
||||
this.condition.status = null;
|
||||
}
|
||||
this.status = 'all';
|
||||
|
@ -198,6 +232,24 @@ export default {
|
|||
this.tableData = listObject;
|
||||
})
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_PLAN_LOAD_CASE
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
refreshStatus() {
|
||||
this.refreshScheduler = setInterval(() => {
|
||||
// 如果有状态不是最终状态则定时查询
|
||||
|
|
|
@ -21,30 +21,6 @@
|
|||
<el-input v-model="form.name"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-form-item :label-width="formLabelWidth" prop="projectIds">
|
||||
<template slot="label">
|
||||
<el-tooltip class="item" effect="dark" :content="$t('test_track.review.related_tip')" placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
{{ $t('test_track.review.related_project') }}
|
||||
</template>
|
||||
<el-select
|
||||
v-model="form.projectIds"
|
||||
:placeholder="$t('test_track.review.input_review_project')"
|
||||
multiple
|
||||
style="width: 100%"
|
||||
filterable>
|
||||
<el-option
|
||||
v-for="item in projects"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
|
@ -148,14 +124,12 @@ export default {
|
|||
},
|
||||
formLabelWidth: "120px",
|
||||
operationType: '',
|
||||
projects: [],
|
||||
reviewerOptions: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openCaseReviewEditDialog(caseReview) {
|
||||
this.resetForm();
|
||||
this.getProjects();
|
||||
this.setReviewerOptions();
|
||||
this.operationType = 'save';
|
||||
if (caseReview) {
|
||||
|
@ -184,52 +158,17 @@ export default {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (this.operationType === 'edit') {
|
||||
const nowIds = param.projectIds;
|
||||
let sign = true;
|
||||
this.dbProjectIds.forEach(dbId => {
|
||||
if (nowIds.indexOf(dbId) === -1 && sign) {
|
||||
sign = false;
|
||||
this.$confirm(this.$t('test_track.case.cancel_relevance_project'), this.$t('commons.prompt'), {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.editTestReview(param);
|
||||
}).catch(() => {
|
||||
this.$info(this.$t('commons.cancel'))
|
||||
});
|
||||
}
|
||||
});
|
||||
if (sign) {
|
||||
this.editTestReview(param);
|
||||
}
|
||||
} else {
|
||||
this.editTestReview(param);
|
||||
}
|
||||
|
||||
this.result = this.$post('/test/case/review/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
});
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
editTestReview(param) {
|
||||
this.result = this.$post('/test/case/review/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
});
|
||||
},
|
||||
getProjects() {
|
||||
this.result = this.$get("/project/listAll", (response) => {
|
||||
if (response.success) {
|
||||
this.projects = response.data.filter(da => da.id !== getCurrentProjectID());
|
||||
} else {
|
||||
this.$warning(response.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
setReviewerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.result = this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
|
|
|
@ -14,62 +14,88 @@
|
|||
@filter-change="filter"
|
||||
@sort-change="sort"
|
||||
@row-click="intoReview">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('test_track.review.review_name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="reviewer"
|
||||
:label="$t('test_track.review.reviewer')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('test_track.review.review_project')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="creatorName"
|
||||
:label="$t('test_track.review.review_creator')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:label="$t('test_track.review.review_status')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop=='name'"
|
||||
prop="name"
|
||||
:label="$t('test_track.review.review_name')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='reviewer'"
|
||||
prop="reviewer"
|
||||
:label="$t('test_track.review.reviewer')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='projectName'"
|
||||
prop="projectName"
|
||||
:label="$t('test_track.review.review_project')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='creatorName'"
|
||||
prop="creatorName"
|
||||
:label="$t('test_track.review.review_creator')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='status'"
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:label="$t('test_track.review.review_status')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<span class="el-dropdown-link">
|
||||
<plan-status-table-item :value="scope.row.status"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
:label="$t('commons.create_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="endTime"
|
||||
:label="$t('test_track.review.end_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='createTime'"
|
||||
prop="createTime"
|
||||
:label="$t('commons.create_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='endTime'"
|
||||
prop="endTime"
|
||||
:label="$t('test_track.review.end_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column
|
||||
min-width="100"
|
||||
:label="$t('commons.operating')">
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
</el-table>
|
||||
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
|
@ -89,15 +115,19 @@ import MsCreateBox from "../../../settings/CreateBox";
|
|||
import MsTablePagination from "../../../common/pagination/TablePagination";
|
||||
import {
|
||||
checkoutTestManagerOrTestUser,
|
||||
getCurrentProjectID,
|
||||
getCurrentProjectID, getCurrentUser,
|
||||
getCurrentWorkspaceId
|
||||
} from "../../../../../common/js/utils";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
|
||||
import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
|
||||
export default {
|
||||
name: "TestCaseReviewList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
MsDeleteConfirm,
|
||||
MsTableOperator,
|
||||
MsTableOperatorButton,
|
||||
|
@ -109,6 +139,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_CASE_REVIEW_LIST,
|
||||
headerItems: Test_Case_Review,
|
||||
tableLabel: Test_Case_Review,
|
||||
result: {},
|
||||
condition: {},
|
||||
tableData: [],
|
||||
|
@ -135,7 +168,12 @@ export default {
|
|||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
|
||||
initTableData() {
|
||||
this.getLabel()
|
||||
let lastWorkspaceId = getCurrentWorkspaceId();
|
||||
this.condition.workspaceId = lastWorkspaceId;
|
||||
if (!getCurrentProjectID()) {
|
||||
|
@ -163,6 +201,24 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_CASE_REVIEW_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
intoReview(row) {
|
||||
this.$router.push('/track/review/view/' + row.id);
|
||||
},
|
||||
|
|
|
@ -41,91 +41,122 @@
|
|||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
:label="$t('test_track.case.priority')">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
<el-table-column
|
||||
v-if="item.prop == 'num'"
|
||||
prop="num"
|
||||
sortable="custom"
|
||||
:label="$t('commons.id')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'name'"
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
:label="$t('test_track.case.priority')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop == 'type'"
|
||||
prop="type"
|
||||
:filters="typeFilters"
|
||||
column-key="type"
|
||||
:label="$t('test_track.case.type')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="method"
|
||||
:filters="methodFilters"
|
||||
column-key="method"
|
||||
:label="$t('test_track.case.method')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='method'"
|
||||
prop="method"
|
||||
:filters="methodFilters"
|
||||
column-key="method"
|
||||
:label="$t('test_track.case.method')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<method-table-item :value="scope.row.method"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='nodePath'"
|
||||
prop="nodePath"
|
||||
:label="$t('test_track.case.module')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
:label="$t('test_track.review.review_project')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='projectName'"
|
||||
prop="projectName"
|
||||
:label="$t('test_track.review.review_project')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="reviewerName"
|
||||
:label="$t('test_track.review.reviewer')"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='reviewerName'"
|
||||
prop="reviewerName"
|
||||
:label="$t('test_track.review.reviewer')"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
:label="$t('test_track.review_view.execute_result')">
|
||||
<template v-slot:default="scope">
|
||||
<el-table-column
|
||||
v-if="item.prop=='reviewStatus'"
|
||||
:filters="statusFilters"
|
||||
column-key="status"
|
||||
:label="$t('test_track.review_view.execute_result')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span class="el-dropdown-link">
|
||||
<review-status :value="scope.row.reviewStatus"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
sortable
|
||||
prop="updateTime"
|
||||
:label="$t('commons.update_time')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="item.prop=='updateTime'"
|
||||
sortable
|
||||
prop="updateTime"
|
||||
:label="$t('commons.update_time')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column
|
||||
min-width="100"
|
||||
:label="$t('commons.operating')">
|
||||
:label="$t('commons.operating')"
|
||||
>
|
||||
<template slot="header">
|
||||
<span>{{ $t('commons.operating') }}
|
||||
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
|
||||
@exec="handleEdit(scope.row)"/>
|
||||
|
@ -134,6 +165,8 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
|
||||
:type=type></header-custom>
|
||||
|
||||
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
@ -169,16 +202,24 @@ import MsTableButton from "../../../../common/components/MsTableButton";
|
|||
import ShowMoreBtn from "../../../case/components/ShowMoreBtn";
|
||||
import BatchEdit from "../../../case/components/BatchEdit";
|
||||
import MsTablePagination from '../../../../common/pagination/TablePagination';
|
||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../../../common/js/utils";
|
||||
import {checkoutTestManagerOrTestUser, getCurrentUser, hasRoles} from "../../../../../../common/js/utils";
|
||||
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
|
||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../../../common/js/constants";
|
||||
import {
|
||||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
TEST_CASE_LIST,
|
||||
TEST_CASE_REVIEW_CASE_LIST, TEST_PLAN_LIST
|
||||
} from "../../../../../../common/js/constants";
|
||||
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
|
||||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
|
||||
export default {
|
||||
name: "TestReviewTestCaseList",
|
||||
components: {
|
||||
HeaderCustom,
|
||||
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
|
||||
StatusTableItem, PriorityTableItem, StatusEdit,
|
||||
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
|
||||
|
@ -186,6 +227,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_CASE_REVIEW_CASE_LIST,
|
||||
headerItems: Test_Case_Review_Case_List,
|
||||
tableLabel: Test_Case_Review_Case_List,
|
||||
result: {},
|
||||
condition: {},
|
||||
tableData: [],
|
||||
|
@ -261,7 +305,11 @@ export default {
|
|||
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
this.$refs.headerCustom.open(this.tableLabel)
|
||||
},
|
||||
initTableData() {
|
||||
this.getLabel()
|
||||
if (this.reviewId) {
|
||||
this.condition.reviewId = this.reviewId;
|
||||
}
|
||||
|
@ -275,6 +323,24 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
getLabel() {
|
||||
let param = {}
|
||||
param.userId = getCurrentUser().id;
|
||||
param.type = TEST_CASE_REVIEW_CASE_LIST
|
||||
this.result = this.$post('/system/header/info', param, response => {
|
||||
if (response.data != null) {
|
||||
let arry = eval(response.data.props);
|
||||
let obj = {};
|
||||
for (let key in arry) {
|
||||
obj[key] = arry[key];
|
||||
}
|
||||
let newObj = Object.keys(obj).map(val => ({
|
||||
prop: obj[val]
|
||||
}))
|
||||
this.tableLabel = newObj
|
||||
}
|
||||
})
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.isReadOnly = true;
|
||||
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
export const TEST_CASE_LIST = 'test_case_list'
|
||||
export const TEST_CASE_REVIEW_LIST = 'test_case_review_list'
|
||||
export const API_LIST = 'api_list'
|
||||
export const API_CASE_LIST = 'api_case_list'
|
||||
export const API_SCENARIO_LIST = 'api_scenario_list'
|
||||
export const TEST_CASE_REVIEW_CASE_LIST = 'test_case_review_case_list'
|
||||
export const TEST_PLAN_LIST = 'test_plan_list'
|
||||
export const TEST_PLAN_FUNCTION_TEST_CASE = 'test_plan_function_test_case'
|
||||
export const TEST_PLAN_API_CASE = 'test_plan_api_case'
|
||||
export const TEST_PLAN_LOAD_CASE = 'test_plan_load_case'
|
||||
export const TEST_PLAN_SCENARIO_CASE = 'test_plan_scenario_case'
|
||||
|
||||
export const TokenKey = 'Admin-Token';
|
||||
export const LicenseKey = 'License';
|
||||
export const DEFAULT_LANGUAGE = 'default_language';
|
||||
|
|
|
@ -596,6 +596,36 @@ export default {
|
|||
other_config: "Other Config",
|
||||
message_template: "Message Template",
|
||||
tcp_parameter_tip: "The request parameters can be referenced in the request template ${XXX}",
|
||||
},
|
||||
document: {
|
||||
order: "Order",
|
||||
create_time_sort: "From back to front by create time",
|
||||
edit_time_positive_sequence: "From front to back by update time",
|
||||
edit_time_Reverse_order: "From back to front by update time",
|
||||
request_method: "Request method",
|
||||
request_interface: "Request interface",
|
||||
search_by_api_name : "Search by api name",
|
||||
request_info: "Request info",
|
||||
request_head: "Request head",
|
||||
request_param: "Param",
|
||||
request_body: "Request body",
|
||||
example_presentation: "Example presentation",
|
||||
response_info: "Response info",
|
||||
response_head: "Response head",
|
||||
response_body: "Response body",
|
||||
response_code: "Response code",
|
||||
table_coloum:{
|
||||
name: "name",
|
||||
value: "value",
|
||||
is_required: "Is it required",
|
||||
desc: "Description",
|
||||
type: "Type",
|
||||
default_value: "Default value",
|
||||
},
|
||||
data_set: {
|
||||
all: "All",
|
||||
none: "None"
|
||||
},
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
@ -644,7 +674,8 @@ export default {
|
|||
select_principal: "Select principal",
|
||||
follow_people: "Follow people",
|
||||
select_table: "Select table",
|
||||
select_all: "Select all"
|
||||
select_all: "Select all",
|
||||
check_case: "Please check the Scene Use Case"
|
||||
},
|
||||
report_name_info: 'Please enter the registration name',
|
||||
save_case_info: 'Please save the use case first',
|
||||
|
@ -1325,6 +1356,7 @@ export default {
|
|||
status_change_success: 'Successfully changed the status!',
|
||||
status_change_failed: 'Failed to change the status, resource pool is invalid!',
|
||||
check_in: 'Check in',
|
||||
node_selector_invalid: 'nodeSelector must be JSON'
|
||||
},
|
||||
system_parameter_setting: {
|
||||
mailbox_service_settings: 'Mailbox Settings',
|
||||
|
|
|
@ -592,11 +592,41 @@ export default {
|
|||
create_info: '创建',
|
||||
update_info: '更新',
|
||||
batch_edit: "批量编辑",
|
||||
batch_move:"批量移动",
|
||||
batch_move: "批量移动",
|
||||
path_valid_info: "请求路径无效",
|
||||
other_config: "其他设置",
|
||||
message_template: "报文模版",
|
||||
tcp_parameter_tip: "请求参数可以在请求模版通过${xxx}引用",
|
||||
},
|
||||
document: {
|
||||
order: "排序方式",
|
||||
create_time_sort: "按创建时间从后到前",
|
||||
edit_time_positive_sequence: "按更新时间从前到后",
|
||||
edit_time_Reverse_order: "按更新时间从后到前",
|
||||
request_method: "请求方式",
|
||||
request_interface: "请求接口",
|
||||
search_by_api_name : "名称搜索",
|
||||
request_info: "请求信息",
|
||||
request_head: "请求头",
|
||||
request_param: "参数",
|
||||
request_body: "请求体",
|
||||
example_presentation: "范例展示",
|
||||
response_info: "响应信息",
|
||||
response_head: "响应头",
|
||||
response_body: "响应体",
|
||||
response_code: "响应码",
|
||||
table_coloum:{
|
||||
name: "名称",
|
||||
value: "值",
|
||||
is_required: "是否必填",
|
||||
desc: "描述",
|
||||
type: "类型",
|
||||
default_value: "默认值",
|
||||
},
|
||||
data_set: {
|
||||
all: "全部",
|
||||
none: "无"
|
||||
},
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
@ -645,7 +675,8 @@ export default {
|
|||
select_principal: "请选择责任人",
|
||||
follow_people: "关注人",
|
||||
select_table: "选择可见数据",
|
||||
select_all: "选择全部数据"
|
||||
select_all: "选择全部数据",
|
||||
check_case: "请勾选场景用例"
|
||||
},
|
||||
report_name_info: '请输入报告名称',
|
||||
save_case_info: '请先保存用例',
|
||||
|
@ -714,7 +745,7 @@ export default {
|
|||
jmeter_func: "Jmeter 方法",
|
||||
parameters_filter_example: "示例",
|
||||
parameters_filter_tips: "只支持 MockJs 函数结果预览",
|
||||
parameters_advance: "高级参数设置",
|
||||
parameters_advance: "return",
|
||||
parameters_preview: "预览",
|
||||
parameters_mock_filter_tips: "请输入关键字进行过滤",
|
||||
parameters_pre_request: "前置请求提取",
|
||||
|
@ -1329,6 +1360,7 @@ export default {
|
|||
status_change_success: '状态修改成功!',
|
||||
status_change_failed: '状态修改失败, 校验不通过!',
|
||||
check_in: '校验中',
|
||||
node_selector_invalid: 'nodeSelector 必须是有效的JSON'
|
||||
},
|
||||
system_parameter_setting: {
|
||||
mailbox_service_settings: '邮件设置',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export default {
|
||||
commons: {
|
||||
cover:'覆蓋',
|
||||
not_cover:'不覆蓋',
|
||||
cover: '覆蓋',
|
||||
not_cover: '不覆蓋',
|
||||
import_mode: '導入模式',
|
||||
import_module: '導入模塊',
|
||||
please_fill_in_the_template: '請填寫模版內容',
|
||||
|
@ -591,11 +591,41 @@ export default {
|
|||
create_info: '創建',
|
||||
update_info: '更新',
|
||||
batch_edit: "批量編輯",
|
||||
batch_move:"批量移動",
|
||||
batch_move: "批量移動",
|
||||
path_valid_info: "請求路徑無效",
|
||||
other_config: "其他設置",
|
||||
message_template: "報文模版",
|
||||
tcp_parameter_tip: "請求參數可以在請求模版通過${xxx}引用",
|
||||
},
|
||||
document: {
|
||||
order: "排序方式",
|
||||
create_time_sort: "按創建時間從後到前",
|
||||
edit_time_positive_sequence: "按更新時間從前到後",
|
||||
edit_time_Reverse_order: "按更新時間從後到前",
|
||||
request_method: "請求方式",
|
||||
request_interface: "請求接口e",
|
||||
search_by_api_name : "API名稱搜索",
|
||||
request_info: "請求信息",
|
||||
request_head: "請求頭",
|
||||
request_param: "參數",
|
||||
request_body: "請求體",
|
||||
example_presentation: "範例展示",
|
||||
response_info: "響應信息",
|
||||
response_head: "響應頭",
|
||||
response_body: "響應體",
|
||||
response_code: "響應碼",
|
||||
table_coloum:{
|
||||
name: "名稱",
|
||||
value: "值",
|
||||
is_required: "是否必填",
|
||||
desc: "描述",
|
||||
type: "類型",
|
||||
default_value: "默認值",
|
||||
},
|
||||
data_set: {
|
||||
all: "全部",
|
||||
none: "無"
|
||||
},
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
@ -644,7 +674,8 @@ export default {
|
|||
select_principal: "請選擇責任人",
|
||||
follow_people: "關註人",
|
||||
select_table: "選擇可見數據",
|
||||
select_all: "選擇全部數據"
|
||||
select_all: "選擇全部數據",
|
||||
check_case: "請勾選場景用例"
|
||||
},
|
||||
report_name_info: '請輸入報告名稱',
|
||||
save_case_info: '請先保存用例',
|
||||
|
@ -1327,6 +1358,7 @@ export default {
|
|||
status_change_success: '狀態修改成功!',
|
||||
status_change_failed: '狀態修改失敗, 校驗不通過!',
|
||||
check_in: '校驗中',
|
||||
node_selector_invalid: 'nodeSelector 必須是有效的JSON'
|
||||
},
|
||||
system_parameter_setting: {
|
||||
mailbox_service_settings: '郵件設置',
|
||||
|
|
Loading…
Reference in New Issue