Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e937b3d949
|
@ -285,17 +285,17 @@ public class APITestController {
|
|||
|
||||
long taskCountInThisWeek = scheduleService.countTaskByProjectIdInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(taskCountInThisWeek);
|
||||
long api_executedInThisWeekCountNumber = apiReportService.countByProjectIdAndCreateInThisWeek(projectId);
|
||||
long scene_executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId);
|
||||
long executedInThisWeekCountNumber = api_executedInThisWeekCountNumber+scene_executedInThisWeekCountNumber;
|
||||
// long api_executedInThisWeekCountNumber = apiReportService.countByProjectIdAndCreateInThisWeek(projectId);
|
||||
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId);
|
||||
// long executedInThisWeekCountNumber = api_executedInThisWeekCountNumber+scene_executedInThisWeekCountNumber;
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
|
||||
//统计 失败 成功 以及总数
|
||||
List<ApiDataCountResult> api_allExecuteResult = apiReportService.countByProjectIdGroupByExecuteResult(projectId);
|
||||
List<ApiDataCountResult> scene_allExecuteResult = apiScenarioReportService.countByProjectIdGroupByExecuteResult(projectId);
|
||||
List<ApiDataCountResult> allExecuteResult = new ArrayList<>();
|
||||
allExecuteResult.addAll(api_allExecuteResult);
|
||||
allExecuteResult.addAll(scene_allExecuteResult);
|
||||
// List<ApiDataCountResult> api_allExecuteResult = apiReportService.countByProjectIdGroupByExecuteResult(projectId);
|
||||
List<ApiDataCountResult> allExecuteResult = apiScenarioReportService.countByProjectIdGroupByExecuteResult(projectId);
|
||||
// List<ApiDataCountResult> allExecuteResult = new ArrayList<>();
|
||||
// allExecuteResult.addAll(api_allExecuteResult);
|
||||
// allExecuteResult.addAll(scene_allExecuteResult);
|
||||
apiCountResult.countScheduleExecute(allExecuteResult);
|
||||
|
||||
long allCount = apiCountResult.getExecutedCount();
|
||||
|
@ -322,11 +322,12 @@ public class APITestController {
|
|||
|
||||
if(dataIndex<selectDataList.size()){
|
||||
ExecutedCaseInfoResult selectData = selectDataList.get(dataIndex);
|
||||
|
||||
dataDTO.setCaseID(selectData.getTestCaseID());
|
||||
dataDTO.setCaseName(selectData.getCaseName());
|
||||
dataDTO.setTestPlan(selectData.getTestPlan());
|
||||
dataDTO.setFailureTimes(selectData.getFailureTimes());
|
||||
dataDTO.setCaseType(selectData.getCaseType());
|
||||
dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList());
|
||||
}else {
|
||||
dataDTO.setCaseName("");
|
||||
dataDTO.setTestPlan("");
|
||||
|
@ -340,8 +341,10 @@ public class APITestController {
|
|||
public List<TaskInfoResult> runningTask(@PathVariable String projectID) {
|
||||
|
||||
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID);
|
||||
int dataIndex = 1;
|
||||
for (TaskInfoResult taskInfo :
|
||||
resultList) {
|
||||
taskInfo.setIndex(dataIndex++);
|
||||
Date nextExecutionTime = CronUtils.getNextTriggerTime(taskInfo.getRule());
|
||||
if(nextExecutionTime!=null){
|
||||
taskInfo.setNextExecutionTime(nextExecutionTime.getTime());
|
||||
|
|
|
@ -24,4 +24,7 @@ public class ApiScenarioRequest {
|
|||
private List<String> filters;
|
||||
private Map<String, Object> combine;
|
||||
private List<String> ids;
|
||||
private boolean isSelectThisWeedData;
|
||||
private long createTime = 0;
|
||||
private String executeStatus;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package io.metersphere.api.dto.datacount;
|
||||
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 已执行的案例
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ExecutedCaseInfoResult {
|
||||
private String testCaseID;
|
||||
//案例名称
|
||||
private String caseName;
|
||||
//所属测试计划
|
||||
|
@ -17,4 +21,5 @@ public class ExecutedCaseInfoResult {
|
|||
private Long failureTimes;
|
||||
//案例类型
|
||||
private String caseType;
|
||||
private List<TestPlanDTO> testPlanDTOList;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package io.metersphere.api.dto.datacount.response;
|
||||
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 已执行的案例
|
||||
*/
|
||||
|
@ -19,4 +22,8 @@ public class ExecutedCaseInfoDTO {
|
|||
private Long failureTimes;
|
||||
//案例类型
|
||||
private String caseType;
|
||||
//案例ID
|
||||
private String caseID;
|
||||
//测试计划集合
|
||||
private List<TestPlanDTO> testPlanDTOList;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ public class TaskInfoResult {
|
|||
private String taskID;
|
||||
//场景名称
|
||||
private String scenario;
|
||||
//场景ID
|
||||
private String scenarioId;
|
||||
//规则
|
||||
private String rule;
|
||||
//任务状态
|
||||
|
|
|
@ -26,4 +26,8 @@ public class ApiDefinitionRequest {
|
|||
private List<String> filters;
|
||||
private Map<String, Object> combine;
|
||||
private List<String> ids;
|
||||
private boolean isSelectThisWeedData = false;
|
||||
private long createTime = 0;
|
||||
private String status;
|
||||
private String apiCaseCoverage;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -32,6 +29,10 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
|
|||
|
||||
private String name;
|
||||
|
||||
private String method;
|
||||
|
||||
private String path;
|
||||
|
||||
private List<String> moduleIds;
|
||||
|
||||
private List<String> unSelectIds;
|
||||
|
@ -39,13 +40,4 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
|
|||
private String protocol;
|
||||
|
||||
private String status;
|
||||
|
||||
public void cleanSelectParam() {
|
||||
filters = new HashMap<>();
|
||||
name = null;
|
||||
moduleIds = new ArrayList<>();
|
||||
protocol = null;
|
||||
status = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public class ApiTestCaseRequest {
|
|||
private List<String> moduleIds;
|
||||
private List<OrderRequest> orders;
|
||||
private Map<String, List<String>> filters;
|
||||
private boolean isSelectThisWeedData;
|
||||
private long createTime = 0;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
|||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
|
@ -75,6 +76,13 @@ public class ApiAutomationService {
|
|||
|
||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
if(request.isSelectThisWeedData()){
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if(weekFirstTime!=null){
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
||||
return list;
|
||||
}
|
||||
|
@ -316,8 +324,12 @@ public class ApiAutomationService {
|
|||
boolean isFirst = true;
|
||||
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||
if (item.getStepTotal() == 0) {
|
||||
MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info"));
|
||||
break;
|
||||
// 只有一个场景且没有测试步骤,则提示
|
||||
if (apiScenarios.size() == 1) {
|
||||
MSException.throwException((item.getName() + "," + Translator.get("automation_exec_info")));
|
||||
}
|
||||
LogUtil.warn(item.getName() + "," + Translator.get("automation_exec_info"));
|
||||
continue;
|
||||
}
|
||||
MsThreadGroup group = new MsThreadGroup();
|
||||
group.setLabel(item.getName());
|
||||
|
@ -335,14 +347,12 @@ public class ApiAutomationService {
|
|||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
new TypeReference<LinkedList<MsTestElement>>() {});
|
||||
scenario.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||
new TypeReference<LinkedList<KeyValue>>() {
|
||||
});
|
||||
new TypeReference<LinkedList<KeyValue>>() {});
|
||||
scenario.setVariables(variables);
|
||||
}
|
||||
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||
|
|
|
@ -10,7 +10,10 @@ import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
|||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -31,6 +34,8 @@ public class ApiDefinitionExecResultService {
|
|||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
||||
@Resource
|
||||
private TestPlanApiCaseService testPlanApiCaseService;
|
||||
@Resource
|
||||
private TestPlanService testPlanService;
|
||||
|
||||
|
||||
public void saveApiResult(TestResult result, String type) {
|
||||
|
@ -104,9 +109,22 @@ public class ApiDefinitionExecResultService {
|
|||
List<ExecutedCaseInfoResult>list = extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime());
|
||||
|
||||
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
|
||||
|
||||
for(int i = 0;i<list.size();i++){
|
||||
if(i<limitNumber){
|
||||
returnList.add(list.get(i));
|
||||
//开始遍历查询TestPlan信息 --> 提供前台做超链接
|
||||
ExecutedCaseInfoResult item = list.get(i);
|
||||
|
||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||
planRequest.setProjectId(projectId);
|
||||
if("scenario".equals(item.getCaseType())){
|
||||
planRequest.setScenarioId(item.getTestCaseID());
|
||||
}else if("apiCase".equals(item.getCaseType())){
|
||||
planRequest.setApiId(item.getTestCaseID());
|
||||
}
|
||||
List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest);
|
||||
item.setTestPlanDTOList(dtoList);
|
||||
returnList.add(item);
|
||||
}else {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,16 @@ public class ApiDefinitionService {
|
|||
|
||||
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
||||
//判断是否查询本周数据
|
||||
if(request.isSelectThisWeedData()){
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if(weekFirstTime!=null){
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
|
||||
calculateResult(resList);
|
||||
return resList;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
|
@ -11,6 +12,8 @@ import io.metersphere.api.dto.definition.request.MsTestElement;
|
|||
import io.metersphere.api.dto.definition.request.MsTestPlan;
|
||||
import io.metersphere.api.dto.definition.request.MsThreadGroup;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiDefinitionMapper;
|
||||
|
@ -78,6 +81,13 @@ public class ApiTestCaseService {
|
|||
|
||||
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
if(request.isSelectThisWeedData()){
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if(weekFirstTime!=null){
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
|
||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||
return apiTestCases;
|
||||
|
@ -373,14 +383,34 @@ public class ApiTestCaseService {
|
|||
if (request.isSelectAllDate()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus());
|
||||
}
|
||||
request.cleanSelectParam();
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andIdIn(ids);
|
||||
if (StringUtils.isNotEmpty(request.getPriority())) {
|
||||
ApiTestCaseWithBLOBs apiDefinitionWithBLOBs = new ApiTestCaseWithBLOBs();
|
||||
BeanUtils.copyBean(apiDefinitionWithBLOBs, request);
|
||||
apiDefinitionWithBLOBs.setPriority(request.getPriority());
|
||||
apiDefinitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestCaseMapper.updateByExampleSelective(apiDefinitionWithBLOBs, apiDefinitionExample);
|
||||
}
|
||||
if ((StringUtils.isNotEmpty(request.getMethod()) || StringUtils.isNotEmpty(request.getPath())) && request.getProtocol().equals(RequestType.HTTP)) {
|
||||
List<ApiTestCaseWithBLOBs> bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
|
||||
bloBs.forEach(apiTestCase -> {
|
||||
MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class);
|
||||
if (StringUtils.isNotEmpty(request.getMethod())) {
|
||||
req.setMethod(request.getMethod());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getPath())) {
|
||||
req.setPath(request.getPath());
|
||||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
apiTestCase.setRequest(requestStr);
|
||||
batchMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status) {
|
||||
ApiTestCaseRequest selectRequest = new ApiTestCaseRequest();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
<select id="findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber" resultType="io.metersphere.api.dto.datacount.ExecutedCaseInfoResult">
|
||||
SELECT * FROM (
|
||||
SELECT testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType
|
||||
SELECT testCase.testCaseID,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType
|
||||
FROM (
|
||||
SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName FROM api_test_case apiCase
|
||||
INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id
|
||||
|
@ -50,17 +50,13 @@
|
|||
) caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID
|
||||
WHERE caseErrorCountData.executeTime >= #{startTimestamp}
|
||||
UNION
|
||||
SELECT scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
|
||||
SELECT scene.id AS testCaseID,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
|
||||
FROM api_scenario_report report
|
||||
INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id
|
||||
INNER JOIN api_scenario scene ON report.scenario_id = scene.id
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
apiScene.api_scenario_id,
|
||||
group_concat(testPlan.`name`) AS testPlanName
|
||||
FROM
|
||||
test_plan_api_scenario apiScene
|
||||
INNER JOIN(
|
||||
SELECT apiScene.api_scenario_id, group_concat(testPlan.`name`) AS testPlanName
|
||||
FROM test_plan_api_scenario apiScene
|
||||
INNER JOIN test_plan testPlan ON testPlan.id = apiScene.test_plan_id
|
||||
GROUP BY apiScene.api_scenario_id
|
||||
)apiScene ON apiScene.api_scenario_id = scene.id
|
||||
|
|
|
@ -227,6 +227,9 @@
|
|||
<if test="request.userId != null">
|
||||
AND api_definition.user_id = #{request.userId}
|
||||
</if>
|
||||
<if test="request.createTime >0">
|
||||
AND api_definition.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.moduleId != null">
|
||||
AND api_definition.module_id = #{request.moduleId}
|
||||
</if>
|
||||
|
@ -245,6 +248,16 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiCaseCoverage == 'uncoverage' ">
|
||||
and api_definition.id not in
|
||||
(SELECT api_definition_id FROM api_test_case)
|
||||
</if>
|
||||
<if test="request.apiCaseCoverage == 'coverage' ">
|
||||
and api_definition.id in
|
||||
(SELECT api_definition_id FROM api_test_case)
|
||||
</if>
|
||||
|
||||
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
<if test="request.projectId != null">
|
||||
AND api_scenario.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.createTime >0 ">
|
||||
AND api_scenario.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.ids != null and request.ids.size() > 0">
|
||||
AND api_scenario.id in
|
||||
<foreach collection="request.ids" item="itemId" separator="," open="(" close=")">
|
||||
|
@ -58,6 +61,16 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.executeStatus == 'unExecute'">
|
||||
and api_scenario.last_result IS NULL
|
||||
</if>
|
||||
<if test="request.executeStatus == 'executeFailed'">
|
||||
and api_scenario.last_result = 'Fail'
|
||||
</if>
|
||||
<if test="request.executeStatus == 'executePass'">
|
||||
and api_scenario.last_result = 'Success'
|
||||
</if>
|
||||
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
|
|
|
@ -228,6 +228,9 @@
|
|||
<if test="request.projectId != null and request.projectId!=''">
|
||||
c.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.id != null and request.id!=''">
|
||||
and c.id = #{request.id}
|
||||
</if>
|
||||
<if test="request.ids != null and request.ids.size() > 0">
|
||||
<if test="request.projectId != null and request.projectId!=''">
|
||||
and
|
||||
|
@ -240,6 +243,9 @@
|
|||
<if test="request.name != null and request.name!=''">
|
||||
and c.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<if test="request.createTime > 0">
|
||||
and c.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and a.module_id in
|
||||
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
|
||||
|
|
|
@ -38,30 +38,19 @@
|
|||
|
||||
<select id="countTaskByProjectId" resultType="java.lang.Long">
|
||||
SELECT COUNT(id) AS countNumber FROM `schedule` WHERE resource_id IN (
|
||||
SELECT id FROM api_test WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash'
|
||||
UNION
|
||||
SELECT id FROM api_scenario WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash'
|
||||
)
|
||||
</select>
|
||||
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
||||
SELECT COUNT(id) AS countNumber FROM `schedule`
|
||||
WHERE resource_id IN (
|
||||
SELECT atest.id FROM api_test atest
|
||||
WHERE atest.project_id = #{projectId,jdbcType=VARCHAR} AND atest.status != 'Trash'
|
||||
UNION
|
||||
SELECT scene.id FROM api_scenario scene
|
||||
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR} AND scene.status != 'Trash'
|
||||
)
|
||||
AND create_time BETWEEN #{startTime} and #{endTime}
|
||||
</select>
|
||||
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
|
||||
SELECT apiTest.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime
|
||||
FROM api_test apiTest
|
||||
INNER JOIN `schedule` sch ON apiTest.id = sch.resource_id
|
||||
INNER JOIN `user` u ON u.id = sch.user_id
|
||||
WHERE sch.`enable` = true AND apiTest.project_id = #{0,jdbcType=VARCHAR}
|
||||
UNION
|
||||
SELECT apiScene.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime
|
||||
SELECT apiScene.id AS scenarioId,apiScene.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime
|
||||
FROM api_scenario apiScene
|
||||
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
|
||||
INNER JOIN `user` u ON u.id = sch.user_id
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
|
||||
select
|
||||
t.id, t.environment_id, t.create_time, t.update_time,
|
||||
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id,
|
||||
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num,
|
||||
a.module_id, a.path, a.protocol, t.status execResult
|
||||
from
|
||||
test_plan_api_case t
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
<select id="selectTestPlanByRelevancy" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
||||
SELECT * FROM TEST_PLAN p LEFT JOIN test_plan_project t ON t.test_plan_id=p.id
|
||||
<where>
|
||||
AND t.project_id = #{request.projectId}
|
||||
AND (t.project_id = #{request.projectId} or p.project_id = #{request.projectId})
|
||||
<if test="request.scenarioId != null">
|
||||
AND p.id IN (SELECT test_plan_id FROM test_plan_api_scenario WHERE api_scenario_id = #{request.scenarioId} )
|
||||
</if>
|
||||
|
|
|
@ -88,28 +88,22 @@ public interface ParamConstants {
|
|||
}
|
||||
}
|
||||
|
||||
enum MAIL {
|
||||
SERVER("smtp.server", 1),
|
||||
PORT("smtp.port", 2),
|
||||
ACCOUNT("smtp.account", 3),
|
||||
PASSWORD("smtp.password", 4),
|
||||
SSL("smtp.ssl", 5),
|
||||
TLS("smtp.tls", 6),
|
||||
ANON("smtp.anon", 7);
|
||||
enum MAIL implements ParamConstants{
|
||||
SERVER("smtp.host"),
|
||||
PORT("smtp.port"),
|
||||
ACCOUNT("smtp.account"),
|
||||
PASSWORD("smtp.password"),
|
||||
SSL("smtp.ssl"),
|
||||
TLS("smtp.tls"),
|
||||
RECIPIENTS("smtp.recipient");
|
||||
|
||||
private String key;
|
||||
private Integer value;
|
||||
private String value;
|
||||
|
||||
private MAIL(String key, Integer value) {
|
||||
this.key = key;
|
||||
private MAIL(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.commons.constants.ParamConstants;
|
|||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
import io.metersphere.notice.domain.MailInfo;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -38,7 +39,7 @@ public class SystemParameterController {
|
|||
|
||||
@GetMapping("/mail/info")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public Object mailInfo() {
|
||||
public MailInfo mailInfo() {
|
||||
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package io.metersphere.notice.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MailInfo {
|
||||
private String host;
|
||||
private String port;
|
||||
private String account;
|
||||
private String password;
|
||||
private String ssl;
|
||||
private String tls;
|
||||
private String recipient;
|
||||
|
||||
}
|
|
@ -11,15 +11,18 @@ import io.metersphere.commons.utils.LogUtil;
|
|||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
import io.metersphere.notice.domain.MailInfo;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
@ -56,7 +59,7 @@ public class SystemParameterService {
|
|||
|
||||
parameters.forEach(parameter -> {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
|
||||
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
if (!StringUtils.isBlank(parameter.getParamValue())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
|
@ -82,23 +85,16 @@ public class SystemParameterService {
|
|||
public void testConnection(HashMap<String, String> hashMap) {
|
||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||
javaMailSender.setDefaultEncoding("UTF-8");
|
||||
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.SERVER.getKey()));
|
||||
javaMailSender.setPort(Integer.valueOf(hashMap.get(ParamConstants.MAIL.PORT.getKey())));
|
||||
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey()));
|
||||
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey()));
|
||||
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.SERVER.getValue()));
|
||||
javaMailSender.setPort(Integer.valueOf(hashMap.get(ParamConstants.MAIL.PORT.getValue())));
|
||||
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getValue()));
|
||||
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getValue()));
|
||||
Properties props = new Properties();
|
||||
boolean isAnon = Boolean.parseBoolean(hashMap.get(ParamConstants.MAIL.ANON.getKey()));
|
||||
if (isAnon) {
|
||||
props.put("mail.smtp.auth", "false");
|
||||
javaMailSender.setUsername(null);
|
||||
javaMailSender.setPassword(null);
|
||||
} else {
|
||||
props.put("mail.smtp.auth", "true");
|
||||
}
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) {
|
||||
String recipients = hashMap.get(ParamConstants.MAIL.RECIPIENTS.getValue());
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getValue()))) {
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
}
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.TLS.getKey()))) {
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.TLS.getValue()))) {
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
}
|
||||
props.put("mail.smtp.timeout", "30000");
|
||||
|
@ -110,39 +106,53 @@ public class SystemParameterService {
|
|||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
if(!StringUtils.isBlank(recipients)){
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
try {
|
||||
helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setFrom(javaMailSender.getUsername());
|
||||
helper.setSubject("MeterSphere测试邮件 " );
|
||||
helper.setText("这是一封测试邮件,邮件发送成功", true);
|
||||
helper.setTo(recipients);
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return System.getenv("MS_VERSION");
|
||||
}
|
||||
|
||||
public Object mailInfo(String type) {
|
||||
public MailInfo mailInfo(String type) {
|
||||
List<SystemParameter> paramList = this.getParamList(type);
|
||||
if (CollectionUtils.isEmpty(paramList)) {
|
||||
paramList = new ArrayList<>();
|
||||
ParamConstants.MAIL[] values = ParamConstants.MAIL.values();
|
||||
for (ParamConstants.MAIL value : values) {
|
||||
SystemParameter systemParameter = new SystemParameter();
|
||||
if (value.equals(ParamConstants.MAIL.PASSWORD)) {
|
||||
systemParameter.setType(ParamConstants.Type.PASSWORD.getValue());
|
||||
} else {
|
||||
systemParameter.setType(ParamConstants.Type.TEXT.getValue());
|
||||
MailInfo mailInfo=new MailInfo ();
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
for (SystemParameter param : paramList) {
|
||||
if (StringUtils.equals(param.getParamKey(),ParamConstants.MAIL.SERVER.getValue() )) {
|
||||
mailInfo.setHost(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PORT.getValue())) {
|
||||
mailInfo.setPort(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.ACCOUNT.getValue())) {
|
||||
mailInfo.setAccount(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
String password = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
mailInfo.setPassword(password);
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.SSL.getValue())) {
|
||||
mailInfo.setSsl(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.TLS.getValue())) {
|
||||
mailInfo.setTls(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.RECIPIENTS.getValue())) {
|
||||
mailInfo.setRecipient(param.getParamValue());
|
||||
}
|
||||
systemParameter.setParamKey(value.getKey());
|
||||
systemParameter.setSort(value.getValue());
|
||||
paramList.add(systemParameter);
|
||||
}
|
||||
} else {
|
||||
paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> {
|
||||
if (!StringUtils.isBlank(param.getParamValue())) {
|
||||
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
param.setParamValue(string);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
paramList.sort(Comparator.comparingInt(SystemParameter::getSort));
|
||||
return paramList;
|
||||
return mailInfo;
|
||||
}
|
||||
|
||||
public void saveLdap(List<SystemParameter> parameters) {
|
||||
|
|
|
@ -46,11 +46,11 @@ public class TestPlanController {
|
|||
|
||||
/*jenkins测试计划*/
|
||||
@GetMapping("/list/all/{projectId}/{workspaceId}")
|
||||
public List<TestPlanDTO> listByProjectId(@PathVariable String projectId, @PathVariable String workspaceId) {
|
||||
public List<TestPlanDTOWithMetric> listByProjectId(@PathVariable String projectId, @PathVariable String workspaceId) {
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
request.setProjectId(projectId);
|
||||
return testPlanService.listTestPlanByProject(request);
|
||||
return testPlanService.listTestPlan(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/all")
|
||||
|
|
|
@ -35,6 +35,7 @@ import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
|||
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
|
@ -702,4 +703,7 @@ public class TestPlanService {
|
|||
}
|
||||
return issues;
|
||||
}
|
||||
public List<TestPlanDTO> selectTestPlanByRelevancy(QueryTestPlanRequest params){
|
||||
return extTestPlanMapper.selectTestPlanByRelevancy(params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ public class TestPlanTestCaseService {
|
|||
}
|
||||
public List<TestPlanCaseDTO> listByPlanId(QueryTestPlanCaseRequest request) {
|
||||
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByPlanId(request);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-container v-if="renderComponent">
|
||||
<ms-aside-container>
|
||||
<ms-api-scenario-module
|
||||
@nodeSelectEvent="nodeChange"
|
||||
|
@ -17,7 +17,10 @@
|
|||
<ms-api-scenario-list
|
||||
:select-node-ids="selectNodeIds"
|
||||
:trash-enable="trashEnable"
|
||||
:checkRedirectID="checkRedirectID"
|
||||
:isRedirectEdit="isRedirectEdit"
|
||||
@edit="editScenario"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
ref="apiScenarioList"/>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -28,7 +31,8 @@
|
|||
:name="item.name"
|
||||
closable>
|
||||
<div class="ms-api-scenario-div">
|
||||
<ms-edit-api-scenario @refresh="refresh" :currentScenario="item.currentScenario" :moduleOptions="moduleOptions"/>
|
||||
<ms-edit-api-scenario @refresh="refresh" :currentScenario="item.currentScenario"
|
||||
:moduleOptions="moduleOptions"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -44,21 +48,42 @@
|
|||
|
||||
<script>
|
||||
|
||||
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
import MsApiScenarioList from "@/business/components/api/automation/scenario/ApiScenarioList";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
|
||||
import MsEditApiScenario from "./scenario/EditApiScenario";
|
||||
import {getCurrentProjectID} from "../../../../common/js/utils";
|
||||
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
import MsApiScenarioList from "@/business/components/api/automation/scenario/ApiScenarioList";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
|
||||
import MsEditApiScenario from "./scenario/EditApiScenario";
|
||||
import {getCurrentProjectID} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "ApiAutomation",
|
||||
components: {MsApiScenarioModule, MsApiScenarioList, MsMainContainer, MsAsideContainer, MsContainer, MsEditApiScenario},
|
||||
components: {
|
||||
MsApiScenarioModule,
|
||||
MsApiScenarioList,
|
||||
MsMainContainer,
|
||||
MsAsideContainer,
|
||||
MsContainer,
|
||||
MsEditApiScenario
|
||||
},
|
||||
comments: {},
|
||||
computed: {
|
||||
checkRedirectID: function () {
|
||||
let redirectIDParam = this.$route.params.redirectID;
|
||||
this.changeRedirectParam(redirectIDParam);
|
||||
return redirectIDParam;
|
||||
},
|
||||
isRedirectEdit: function () {
|
||||
let redirectParam = this.$route.params.dataSelectRange;
|
||||
this.checkRedirectEditPage(redirectParam);
|
||||
return redirectParam;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
redirectID: '',
|
||||
renderComponent: true,
|
||||
isHide: true,
|
||||
activeName: 'default',
|
||||
currentModule: null,
|
||||
|
@ -68,8 +93,37 @@
|
|||
selectNodeIds: [],
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
watch: {
|
||||
redirectID() {
|
||||
this.renderComponent = false;
|
||||
this.$nextTick(() => {
|
||||
// 在 DOM 中添加 my-component 组件
|
||||
this.renderComponent = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkRedirectEditPage(redirectParam) {
|
||||
if(redirectParam!=null){
|
||||
let selectParamArr = redirectParam.split("edit:");
|
||||
if (selectParamArr.length == 2) {
|
||||
let scenarioId = selectParamArr[1];
|
||||
let projectId = getCurrentProjectID();
|
||||
//查找单条数据,跳转修改页面
|
||||
let url = "/api/automation/list/" + 1 + "/" + 1;
|
||||
this.$post(url, {id:scenarioId,projectId:projectId}, response => {
|
||||
let data = response.data;
|
||||
if(data!=null){
|
||||
let row = data.listObject[0];
|
||||
this.editScenario(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
changeRedirectParam(redirectIDParam) {
|
||||
this.redirectID = redirectIDParam;
|
||||
},
|
||||
addTab(tab) {
|
||||
if (!getCurrentProjectID()) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
|
@ -125,11 +179,14 @@
|
|||
setModuleOptions(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
changeSelectDataRangeAll(tableType) {
|
||||
this.$route.params.dataSelectRange = 'all';
|
||||
},
|
||||
enableTrash(data) {
|
||||
this.trashEnable = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<el-card class="table-card" v-loading="loading">
|
||||
<template v-slot:header>
|
||||
<ms-table-header :condition.sync="condition" @search="search" title=""
|
||||
<ms-table-header :condition.sync="condition" @search="selectByParam" title=""
|
||||
:show-create="false"/>
|
||||
</template>
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
|||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
|
||||
{{$t('api_test.batch_menus.select_all_data',[total])}}
|
||||
{{ $t('api_test.batch_menus.select_all_data', [total]) }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
|
||||
{{$t('api_test.batch_menus.select_show_data',[tableData.length])}}
|
||||
{{ $t('api_test.batch_menus.select_show_data', [tableData.length]) }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
@ -143,6 +143,7 @@ export default {
|
|||
schedule: {},
|
||||
selection: [],
|
||||
tableData: [],
|
||||
selectDataRange: 'all',
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
|
@ -193,8 +194,11 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
selectByParam() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.search();
|
||||
},
|
||||
search() {
|
||||
|
||||
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (this.trashEnable) {
|
||||
|
@ -205,6 +209,25 @@ export default {
|
|||
if (this.projectId != null) {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
|
||||
//检查是否只查询本周数据
|
||||
this.condition.selectThisWeedData = false;
|
||||
this.condition.executeStatus = null;
|
||||
this.isSelectThissWeekData();
|
||||
switch (this.selectDataRange){
|
||||
case 'thisWeekCount':
|
||||
this.condition.selectThisWeedData = true;
|
||||
break;
|
||||
case 'unExecute':
|
||||
this.condition.executeStatus = 'unExecute';
|
||||
break;
|
||||
case 'executeFailed':
|
||||
this.condition.executeStatus = 'executeFailed';
|
||||
break;
|
||||
case 'executePass':
|
||||
this.condition.executeStatus = 'executePass';
|
||||
break;
|
||||
}
|
||||
this.selection = [];
|
||||
|
||||
this.selectAll = false;
|
||||
|
@ -366,6 +389,14 @@ export default {
|
|||
this.selectDataCounts = this.selection.length;
|
||||
}
|
||||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isSelectThissWeekData() {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
this.selectDataRange = dataRange;
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll");
|
||||
},
|
||||
remove(row) {
|
||||
if (this.trashEnable) {
|
||||
this.$get('/api/automation/delete/' + row.id, () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-container v-if="renderComponent">
|
||||
<ms-aside-container>
|
||||
<ms-api-module
|
||||
@nodeSelectEvent="nodeChange"
|
||||
|
@ -18,11 +18,12 @@
|
|||
<el-dropdown size="small" split-button type="primary" class="ms-api-buttion"
|
||||
@click="handleCommand('ADD')"
|
||||
@command="handleCommand" v-tester>
|
||||
{{$t('commons.add')}}
|
||||
{{ $t('commons.add') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="debug">{{$t('api_test.definition.request.fast_debug')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="ADD">{{$t('api_test.definition.request.title')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="CLOSE_ALL">{{$t('api_test.definition.request.close_all_label')}}</el-dropdown-item>
|
||||
<el-dropdown-item command="debug">{{ $t('api_test.definition.request.fast_debug') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="ADD">{{ $t('api_test.definition.request.title') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="CLOSE_ALL">{{ $t('api_test.definition.request.close_all_label') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
@ -42,6 +43,9 @@
|
|||
:select-node-ids="selectNodeIds"
|
||||
:trash-enable="trashEnable"
|
||||
:is-api-list-enable="isApiListEnable"
|
||||
:queryDataType="queryDataType"
|
||||
:selectDataRange="selectDataRange"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@editApi="editApi"
|
||||
@handleCase="handleCase"
|
||||
@showExecResult="showExecResult"
|
||||
|
@ -56,6 +60,8 @@
|
|||
:select-node-ids="selectNodeIds"
|
||||
:trash-enable="trashEnable"
|
||||
:is-api-list-enable="isApiListEnable"
|
||||
:queryDataType="queryDataType"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@isApiListEnableChange="isApiListEnableChange"
|
||||
@handleCase="handleCase"
|
||||
@showExecResult="showExecResult"
|
||||
|
@ -70,18 +76,26 @@
|
|||
</div>
|
||||
<!-- 快捷调试 -->
|
||||
<div v-else-if="item.type=== 'debug'" class="ms-api-div">
|
||||
<ms-debug-http-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-debug-http-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
|
||||
v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
|
||||
v-if="currentProtocol==='SQL'"/>
|
||||
<ms-debug-tcp-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
|
||||
v-if="currentProtocol==='TCP'"/>
|
||||
<ms-debug-dubbo-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
|
||||
v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
|
||||
<!-- 测试-->
|
||||
<div v-else-if="item.type=== 'TEST'" class="ms-api-div">
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi"
|
||||
@refresh="refresh" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi"
|
||||
@refresh="refresh" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi"
|
||||
@refresh="refresh" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi"
|
||||
@refresh="refresh" v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -89,27 +103,40 @@
|
|||
</ms-container>
|
||||
</template>
|
||||
<script>
|
||||
import MsApiList from './components/list/ApiList';
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsApiConfig from "./components/ApiConfig";
|
||||
import MsDebugHttpPage from "./components/debug/DebugHttpPage";
|
||||
import MsDebugJdbcPage from "./components/debug/DebugJdbcPage";
|
||||
import MsDebugTcpPage from "./components/debug/DebugTcpPage";
|
||||
import MsDebugDubboPage from "./components/debug/DebugDubboPage";
|
||||
import MsApiList from './components/list/ApiList';
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsApiConfig from "./components/ApiConfig";
|
||||
import MsDebugHttpPage from "./components/debug/DebugHttpPage";
|
||||
import MsDebugJdbcPage from "./components/debug/DebugJdbcPage";
|
||||
import MsDebugTcpPage from "./components/debug/DebugTcpPage";
|
||||
import MsDebugDubboPage from "./components/debug/DebugDubboPage";
|
||||
|
||||
import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
|
||||
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
|
||||
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
|
||||
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
|
||||
import {downloadFile, getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiModule from "./components/module/ApiModule";
|
||||
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
|
||||
import {PROJECT_NAME} from "../../../../common/js/constants";
|
||||
import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
|
||||
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
|
||||
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
|
||||
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
|
||||
import {downloadFile, getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsApiModule from "./components/module/ApiModule";
|
||||
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
|
||||
import {PROJECT_NAME} from "../../../../common/js/constants";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "ApiDefinition",
|
||||
computed: {
|
||||
queryDataType: function () {
|
||||
let routeParam = this.$route.params.dataType;
|
||||
let redirectIDParam = this.$route.params.redirectID;
|
||||
this.changeRedirectParam(redirectIDParam);
|
||||
if (routeParam === 'apiTestCase') {
|
||||
this.isApiListEnableChange(false);
|
||||
} else {
|
||||
this.isApiListEnableChange(true);
|
||||
}
|
||||
return routeParam;
|
||||
},
|
||||
},
|
||||
components: {
|
||||
ApiCaseSimpleList,
|
||||
MsApiModule,
|
||||
|
@ -138,6 +165,9 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
redirectID: '',
|
||||
renderComponent: true,
|
||||
selectDataRange: 'all',
|
||||
showCasePage: true,
|
||||
apiDefaultTab: 'default',
|
||||
currentProtocol: null,
|
||||
|
@ -158,9 +188,19 @@
|
|||
watch: {
|
||||
currentProtocol() {
|
||||
this.handleCommand("CLOSE_ALL");
|
||||
},
|
||||
redirectID() {
|
||||
this.renderComponent = false;
|
||||
this.$nextTick(() => {
|
||||
// 在 DOM 中添加 my-component 组件
|
||||
this.renderComponent = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeRedirectParam(redirectIDParam) {
|
||||
this.redirectID = redirectIDParam;
|
||||
},
|
||||
isApiListEnableChange(data) {
|
||||
this.isApiListEnable = data;
|
||||
},
|
||||
|
@ -216,7 +256,7 @@
|
|||
this.refresh();
|
||||
},
|
||||
//创建左侧树的根目录模块
|
||||
createRootModel(){
|
||||
createRootModel() {
|
||||
this.$refs.nodeTree.createRootModel();
|
||||
},
|
||||
handleTabsEdit(targetName, action, api) {
|
||||
|
@ -310,7 +350,6 @@
|
|||
showExecResult(row) {
|
||||
this.debug(row);
|
||||
},
|
||||
|
||||
nodeChange(node, nodeIds, pNodes) {
|
||||
this.selectNodeIds = nodeIds;
|
||||
},
|
||||
|
@ -320,15 +359,18 @@
|
|||
setModuleOptions(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
changeSelectDataRangeAll(tableType) {
|
||||
this.$route.params.dataSelectRange = 'all';
|
||||
},
|
||||
enableTrash(data) {
|
||||
this.trashEnable = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-api-buttion {
|
||||
.ms-api-buttion {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
right: 4px;
|
||||
|
@ -339,26 +381,26 @@
|
|||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-api-div {
|
||||
.ms-api-div {
|
||||
overflow-y: auto;
|
||||
height: calc(100vh - 155px)
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .el-tabs__header {
|
||||
/deep/ .el-tabs__header {
|
||||
margin: 0 0 5px;
|
||||
width: calc(100% - 90px);
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .el-main {
|
||||
/deep/ .el-main {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .el-card {
|
||||
/deep/ .el-card {
|
||||
/*border: 1px solid #EBEEF5;*/
|
||||
/*border-style: none;*/
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
<el-option v-for="(type, index) in typeArr" :key="index" :value="type.id" :label="type.name"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('test_track.case.updated_attr_value')" prop="value">
|
||||
<el-form-item v-if="form.type ==='path'" :label="$t('test_track.case.updated_attr_value')" prop="value">
|
||||
<el-input size="small" v-model="form.value"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-else :label="$t('test_track.case.updated_attr_value')" prop="value">
|
||||
<el-select v-model="form.value" style="width: 80%" :filterable="filterable">
|
||||
<el-option v-for="(option, index) in options" :key="index" :value="option.id" :label="option.label">
|
||||
<div v-if="option.email">
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
<el-option :key="0" :value="''">
|
||||
<div style="margin-left: 40px">
|
||||
<span style="font-size: 14px;color: #606266;font-weight: 48.93">{{$t('api_test.definition.select_comp.no_data')}},
|
||||
</span><el-link type="primary" @click="createModules">{{$t('api_test.definition.select_comp.add_data')}}</el-link>
|
||||
</span>
|
||||
<el-link type="primary" @click="createModules">{{$t('api_test.definition.select_comp.add_data')}}</el-link>
|
||||
</div>
|
||||
</el-option>
|
||||
</div>
|
||||
|
@ -106,7 +107,6 @@
|
|||
import {REQ_METHOD, API_STATUS} from "../../model/JsonData";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import {KeyValue} from "../../model/ApiTestModel";
|
||||
// import {append} from "./../../../../track/common/NodeTree";
|
||||
|
||||
export default {
|
||||
name: "MsAddCompleteHttpApi",
|
||||
|
@ -172,7 +172,7 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
createModules(){
|
||||
createModules() {
|
||||
this.$emit("createRootModelInTree");
|
||||
},
|
||||
getPath(id) {
|
||||
|
@ -185,7 +185,7 @@
|
|||
return path[0].path;
|
||||
},
|
||||
urlChange() {
|
||||
if (!this.httpForm.path) return;
|
||||
if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return;
|
||||
let url = this.getURL(this.addProtocol(this.httpForm.path));
|
||||
if (url) {
|
||||
this.httpForm.path = decodeURIComponent("/" + url.hostname + url.pathname);
|
||||
|
@ -202,7 +202,6 @@
|
|||
getURL(urlStr) {
|
||||
try {
|
||||
let url = new URL(urlStr);
|
||||
console.log(urlStr)
|
||||
url.searchParams.forEach((value, key) => {
|
||||
if (key && value) {
|
||||
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
||||
|
|
|
@ -101,14 +101,12 @@
|
|||
import MsBottomContainer from "../BottomContainer";
|
||||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../model/JsonData";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import ApiListContainer from "./ApiListContainer";
|
||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
import ApiCaseList from "../case/ApiCaseList";
|
||||
import {_filter, _sort} from "../../../../../../common/js/utils";
|
||||
import TestPlanCaseListHeader from "../../../../track/plan/view/comonents/api/TestPlanCaseListHeader";
|
||||
import MsEnvironmentSelect from "../case/MsEnvironmentSelect";
|
||||
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
|
||||
|
||||
export default {
|
||||
|
@ -133,6 +131,7 @@
|
|||
selectCase: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
selectDataRange: "all",
|
||||
deletePath: "/test/case/delete",
|
||||
selectRows: new Set(),
|
||||
buttons: [
|
||||
|
@ -141,6 +140,8 @@
|
|||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
|
@ -150,6 +151,7 @@
|
|||
],
|
||||
valueArr: {
|
||||
priority: CASE_PRIORITY,
|
||||
method: REQ_METHOD,
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
tableData: [],
|
||||
|
@ -159,8 +161,8 @@
|
|||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||
environmentId: undefined,
|
||||
selectAll: false,
|
||||
unSelection:[],
|
||||
selectDataCounts:0,
|
||||
unSelection: [],
|
||||
selectDataCounts: 0,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -241,11 +243,26 @@
|
|||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
}
|
||||
|
||||
//检查是否只查询本周数据
|
||||
this.isSelectThissWeekData();
|
||||
this.condition.selectThisWeedData = false;
|
||||
this.condition.id = null;
|
||||
if (this.selectDataRange == 'thisWeekCount') {
|
||||
this.condition.selectThisWeedData = true;
|
||||
} else if (this.selectDataRange != null) {
|
||||
let selectParamArr = this.selectDataRange.split("single:");
|
||||
|
||||
if (selectParamArr.length == 2) {
|
||||
this.condition.id = selectParamArr[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.condition.projectId) {
|
||||
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
this.unSelection = response.data.listObject.map(s=>s.id);
|
||||
this.unSelection = response.data.listObject.map(s => s.id);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -280,6 +297,7 @@
|
|||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
search() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.initTable();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
|
@ -322,7 +340,7 @@
|
|||
obj.unSelectIds = this.unSelection;
|
||||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
obj = Object.assign(obj, this.condition);
|
||||
this.$post('/api/testcase/deleteBatchByParam/', obj , () => {
|
||||
this.$post('/api/testcase/deleteBatchByParam/', obj, () => {
|
||||
this.selectRows.clear();
|
||||
this.initTable();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
|
@ -355,7 +373,6 @@
|
|||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
|
@ -389,16 +406,16 @@
|
|||
setEnvironment(data) {
|
||||
this.environmentId = data.id;
|
||||
},
|
||||
selectRowsCount(selection){
|
||||
selectRowsCount(selection) {
|
||||
let selectedIDs = this.getIds(selection);
|
||||
let allIDs = this.tableData.map(s=>s.id);
|
||||
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 =selection.size;
|
||||
if (this.isSelectAllDate) {
|
||||
this.selectDataCounts = this.total - this.unSelection.length;
|
||||
} else {
|
||||
this.selectDataCounts = selection.size;
|
||||
}
|
||||
},
|
||||
isSelectDataAll(dataType) {
|
||||
|
@ -409,9 +426,21 @@
|
|||
this.$refs.caseTable.toggleAllSelection(true);
|
||||
}
|
||||
},
|
||||
getIds(rowSets){
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isSelectThissWeekData() {
|
||||
this.selectDataRange = "all";
|
||||
let routeParam = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataType === 'apiTestCase') {
|
||||
this.selectDataRange = routeParam;
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||
},
|
||||
getIds(rowSets) {
|
||||
let rowArray = Array.from(rowSets)
|
||||
let ids = rowArray.map(s=>s.id);
|
||||
let ids = rowArray.map(s => s.id);
|
||||
return ids;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
:is-api-list-enable="isApiListEnable"
|
||||
@isApiListEnableChange="isApiListEnableChange">
|
||||
|
||||
<el-input placeholder="搜索" @blur="search" class="search-input" size="small" @keyup.enter.native="search" v-model="condition.name"/>
|
||||
<el-input placeholder="搜索" @blur="search" class="search-input" size="small" @keyup.enter.native="search"
|
||||
v-model="condition.name"/>
|
||||
|
||||
<el-table v-loading="result.loading"
|
||||
ref="apiDefinitionTable"
|
||||
|
@ -146,6 +147,7 @@
|
|||
selectApi: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
selectDataRange: "all",
|
||||
deletePath: "/test/case/delete",
|
||||
selectRows: new Set(),
|
||||
buttons: [
|
||||
|
@ -177,6 +179,7 @@
|
|||
props: {
|
||||
currentProtocol: String,
|
||||
selectNodeIds: Array,
|
||||
isSelectThisWeek: String,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -235,11 +238,36 @@
|
|||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
}
|
||||
|
||||
//检查是否只查询本周数据
|
||||
this.getSelectDataRange();
|
||||
this.condition.selectThisWeedData = false;
|
||||
this.condition.apiCaseCoverage = null;
|
||||
switch (this.selectDataRange){
|
||||
case 'thisWeekCount':
|
||||
this.condition.selectThisWeedData = true;
|
||||
break;
|
||||
case 'Prepare':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'Completed':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'Underway':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'uncoverage':
|
||||
this.condition.apiCaseCoverage = 'uncoverage';
|
||||
break;
|
||||
case 'coverage':
|
||||
this.condition.apiCaseCoverage = 'coverage';
|
||||
break;
|
||||
}
|
||||
if (this.condition.projectId) {
|
||||
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
this.unSelection = response.data.listObject.map(s=>s.id);
|
||||
this.unSelection = response.data.listObject.map(s => s.id);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -290,6 +318,7 @@
|
|||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
search() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.initTable();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
|
@ -416,16 +445,16 @@
|
|||
showExecResult(row) {
|
||||
this.$emit('showExecResult', row);
|
||||
},
|
||||
selectRowsCount(selection){
|
||||
selectRowsCount(selection) {
|
||||
let selectedIDs = this.getIds(selection);
|
||||
let allIDs = this.tableData.map(s=>s.id);
|
||||
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 =selection.size;
|
||||
if (this.isSelectAllDate) {
|
||||
this.selectDataCounts = this.total - this.unSelection.length;
|
||||
} else {
|
||||
this.selectDataCounts = selection.size;
|
||||
}
|
||||
},
|
||||
isSelectDataAll(dataType) {
|
||||
|
@ -436,13 +465,26 @@
|
|||
this.$refs.apiDefinitionTable.toggleAllSelection(true);
|
||||
}
|
||||
},
|
||||
getIds(rowSets){
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
getSelectDataRange() {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataType === 'api') {
|
||||
this.selectDataRange = dataRange;
|
||||
} else {
|
||||
this.selectDataRange = 'all';
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "api");
|
||||
},
|
||||
getIds(rowSets) {
|
||||
let rowArray = Array.from(rowSets)
|
||||
let ids = rowArray.map(s=>s.id);
|
||||
let ids = rowArray.map(s => s.id);
|
||||
return ids;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -466,4 +508,32 @@
|
|||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.api-list >>> th:first-child {
|
||||
/*border: 1px solid #DCDFE6;*/
|
||||
/*border-right: 0px;*/
|
||||
/*border-top-left-radius:5px;*/
|
||||
/*border-bottom-left-radius:5px;*/
|
||||
/*width: 20px;*/
|
||||
|
||||
}
|
||||
|
||||
.api-list >>> th:nth-child(2) {
|
||||
/*border: 1px solid #DCDFE6;*/
|
||||
/*border-left: 0px;*/
|
||||
/*border-top-right-radius:5px;*/
|
||||
/*border-bottom-right-radius:5px;*/
|
||||
}
|
||||
|
||||
.api-list >>> th:first-child>.cell {
|
||||
padding: 5px;
|
||||
width: 30px;
|
||||
}
|
||||
.api-list >>> th:nth-child(2)>.cell {
|
||||
/*background-color: black;*/
|
||||
}
|
||||
|
||||
.api-list >>> .el-dropdown {
|
||||
float: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
<el-row :gutter="0"></el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6">
|
||||
<ms-api-info-card :api-count-data="apiCountData"/>
|
||||
<ms-api-info-card @redirectPage="redirectPage" :api-count-data="apiCountData"/>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<ms-test-case-info-card :test-case-count-data="testCaseCountData"/>
|
||||
<ms-test-case-info-card @redirectPage="redirectPage" :test-case-count-data="testCaseCountData"/>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<ms-scene-info-card :scene-count-data="sceneCountData"/>
|
||||
<ms-scene-info-card @redirectPage="redirectPage" :scene-count-data="sceneCountData"/>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<ms-schedule-task-info-card :schedule-task-count-data="scheduleTaskCountData"/>
|
||||
|
@ -43,10 +43,10 @@
|
|||
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<ms-failure-test-case-list/>
|
||||
<ms-failure-test-case-list @redirectPage="redirectPage"/>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<ms-running-task-list/>
|
||||
<ms-running-task-list @redirectPage="redirectPage"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
@ -64,7 +64,7 @@ import MsTestCaseInfoCard from "./components/TestCaseInfoCard";
|
|||
|
||||
import MsFailureTestCaseList from "./components/FailureTestCaseList";
|
||||
import MsRunningTaskList from "./components/RunningTaskList"
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentProjectID,getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiTestHomePage",
|
||||
|
@ -117,6 +117,22 @@ export default {
|
|||
this.scheduleTaskCountData = response.data;
|
||||
});
|
||||
},
|
||||
redirectPage(page,dataType,selectType){
|
||||
//api页面跳转
|
||||
//传入UUID是为了进行页面重新加载判断
|
||||
let uuid = getUUID();
|
||||
switch (page){
|
||||
case "api":
|
||||
this.$router.push({name:'ApiDefinition',params:{redirectID:uuid,dataType:dataType,dataSelectRange:selectType}});
|
||||
break;
|
||||
case "scenario":
|
||||
this.$router.push({name:'ApiAutomation',params:{redirectID:uuid,dataType:dataType,dataSelectRange:selectType}});
|
||||
break;
|
||||
case "testPlanEdit":
|
||||
this.$router.push('/track/plan/view/'+selectType)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -54,7 +54,10 @@
|
|||
<el-header style="height:20px;padding: 0px;margin-bottom: 10px;">
|
||||
<el-row>
|
||||
<el-col>
|
||||
{{$t('api_test.home_page.api_details_card.this_week_add',[apiCountData.thisWeekAddedCount])}}
|
||||
{{$t('api_test.home_page.api_details_card.this_week_add')}}
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{apiCountData.thisWeekAddedCount}}
|
||||
</el-link>
|
||||
{{$t('api_test.home_page.unit_of_measurement')}}
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-header>
|
||||
|
@ -80,21 +83,27 @@
|
|||
<span class="default-property">
|
||||
{{$t('api_test.home_page.detail_card.running')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000">
|
||||
{{apiCountData.runningCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="default-property">
|
||||
{{$t('api_test.home_page.detail_card.not_started')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
|
||||
{{apiCountData.notStartedCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="main-property">
|
||||
{{$t('api_test.home_page.detail_card.finished')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('Completed')" target="_blank" style="color: #000000">
|
||||
{{apiCountData.finishedCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -123,6 +132,11 @@ export default {
|
|||
props:{
|
||||
apiCountData:{},
|
||||
},
|
||||
methods:{
|
||||
redirectPage(clickType){
|
||||
this.$emit("redirectPage","api","api",clickType);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
|
|
@ -7,7 +7,13 @@
|
|||
</template>
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300px">
|
||||
<el-table-column prop="sortIndex" :label="$t('api_test.home_page.failed_case_list.table_coloum.index')" width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')" width="150" show-overflow-tooltip/>
|
||||
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')" width="150">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.caseType,row.caseID)">
|
||||
{{ row.caseName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="caseType"
|
||||
column-key="caseType"
|
||||
|
@ -19,7 +25,15 @@
|
|||
<ms-tag v-if="scope.row.caseType == 'scenario'" type="warning" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')" show-overflow-tooltip/>
|
||||
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">
|
||||
<template v-slot:default="{row}">
|
||||
<div v-for="testPlan in row.testPlanDTOList" :key="testPlan.id">
|
||||
<el-link type="info" @click="redirect('testPlanEdit',testPlan.id)">
|
||||
{{ testPlan.name }};
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="failureTimes" :label="$t('api_test.home_page.failed_case_list.table_coloum.failure_times')" width="100" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
@ -51,6 +65,19 @@ export default {
|
|||
this.tableData = response.data;
|
||||
});
|
||||
},
|
||||
redirect(pageType,param){
|
||||
switch (pageType){
|
||||
case "testPlanEdit":
|
||||
this.$emit('redirectPage','testPlanEdit',null, param);
|
||||
break;
|
||||
case "apiCase":
|
||||
this.$emit('redirectPage','api','apiTestCase', 'single:'+param);
|
||||
break;
|
||||
case "scenario":
|
||||
this.$emit('redirectPage','scenario','scenario', 'edit:'+param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,13 @@
|
|||
</template>
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300px">
|
||||
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80" show-overflow-tooltip/>
|
||||
<el-table-column prop="scenario" :label="$t('api_test.home_page.running_task_list.table_coloum.scenario')" width="200" show-overflow-tooltip/>
|
||||
<el-table-column prop="scenario" :label="$t('api_test.home_page.running_task_list.table_coloum.scenario')" width="200" >
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.scenarioId)">
|
||||
{{ row.scenario }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120" show-overflow-tooltip/>
|
||||
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
|
||||
<template v-slot:default="scope">
|
||||
|
@ -80,6 +86,9 @@ export default {
|
|||
this.result = this.$post('/api/schedule/updateEnableByPrimyKey', taskRow, response => {
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
redirect(param){
|
||||
this.$emit('redirectPage','scenario','scenario', 'edit:'+param);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
<el-header style="height:20px;padding: 0px;margin-bottom: 10px;">
|
||||
<el-row :gutter="20" class="hidden-lg-and-down ">
|
||||
<el-col :span="8">
|
||||
{{$t('api_test.home_page.test_scene_details_card.this_week_add',[sceneCountData.thisWeekAddedCount])}}
|
||||
{{$t('api_test.home_page.test_scene_details_card.this_week_add')}}
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{sceneCountData.thisWeekAddedCount}}
|
||||
</el-link>
|
||||
{{$t('api_test.home_page.unit_of_measurement')}}
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
{{$t('api_test.home_page.test_scene_details_card.this_week_execute',[sceneCountData.thisWeekExecutedCount])}}
|
||||
|
@ -32,7 +35,11 @@
|
|||
</el-row>
|
||||
<el-row :gutter="20" class="hidden-xl-only">
|
||||
<el-col :span="8">
|
||||
<div class="count-info-div" v-html="$t('api_test.home_page.test_scene_details_card.this_week_add_sm',[sceneCountData.thisWeekAddedCount])"></div>
|
||||
{{$t('api_test.home_page.test_scene_details_card.this_week_add_sm')}}
|
||||
<br/>
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{sceneCountData.thisWeekAddedCount}}
|
||||
</el-link>
|
||||
{{$t('api_test.home_page.unit_of_measurement')}}
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
<div class="count-info-div" v-html="$t('api_test.home_page.test_scene_details_card.this_week_execute_sm',[sceneCountData.thisWeekExecutedCount])"></div>
|
||||
|
@ -64,21 +71,27 @@
|
|||
<span class="defaultProperty">
|
||||
{{$t('api_test.home_page.detail_card.unexecute')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('unExecute')" target="_blank" style="color: #000000">
|
||||
{{sceneCountData.unexecuteCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="defaultProperty">
|
||||
{{$t('api_test.home_page.detail_card.execution_failed')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('executeFailed')" target="_blank" style="color: #000000">
|
||||
{{sceneCountData.executionFailedCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="main-property">
|
||||
{{$t('api_test.home_page.detail_card.execution_pass')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('executePass')" target="_blank" style="color: #000000">
|
||||
{{sceneCountData.executionPassCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -110,6 +123,9 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
redirectPage(clickType){
|
||||
this.$emit("redirectPage","scenario","scenario",clickType);
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -53,7 +53,10 @@
|
|||
<el-header style="height:20px;padding: 0px;margin-bottom: 10px;">
|
||||
<el-row :gutter="20" class="hidden-lg-and-down ">
|
||||
<el-col :span="8">
|
||||
{{$t('api_test.home_page.test_case_details_card.this_week_add',[testCaseCountData.thisWeekAddedCount])}}
|
||||
{{$t('api_test.home_page.test_case_details_card.this_week_add')}}
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{testCaseCountData.thisWeekAddedCount}}
|
||||
</el-link>
|
||||
{{$t('api_test.home_page.unit_of_measurement')}}
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
{{$t('api_test.home_page.test_case_details_card.this_week_execute',[testCaseCountData.thisWeekExecutedCount])}}
|
||||
|
@ -64,7 +67,11 @@
|
|||
</el-row>
|
||||
<el-row :gutter="20" class="hidden-xl-only">
|
||||
<el-col :span="8">
|
||||
<div class="count-info-div" v-html="$t('api_test.home_page.test_case_details_card.this_week_add_sm',[testCaseCountData.thisWeekAddedCount])"></div>
|
||||
{{$t('api_test.home_page.test_case_details_card.this_week_add_sm')}}
|
||||
<br/>
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{testCaseCountData.thisWeekAddedCount}}
|
||||
</el-link>
|
||||
{{$t('api_test.home_page.unit_of_measurement')}}
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
<div class="count-info-div" v-html="$t('api_test.home_page.test_case_details_card.this_week_execute_sm',[testCaseCountData.thisWeekExecutedCount])"></div>
|
||||
|
@ -96,7 +103,9 @@
|
|||
<span class="default-property">
|
||||
{{$t('api_test.home_page.detail_card.uncoverage')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('uncoverage')" target="_blank" style="color: #000000">
|
||||
{{testCaseCountData.uncoverageCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style=" height: 20px;margin-top: 3px;">
|
||||
|
@ -105,7 +114,9 @@
|
|||
<span class="main-property">
|
||||
{{$t('api_test.home_page.detail_card.coverage')}}
|
||||
{{"\xa0\xa0"}}
|
||||
<el-link type="info" @click="redirectPage('coverage')" target="_blank" style="color: #000000">
|
||||
{{testCaseCountData.coverageCount}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -135,6 +146,16 @@ export default {
|
|||
testCaseCountData:{},
|
||||
},
|
||||
methods: {
|
||||
redirectPage(clickType){
|
||||
if(clickType === 'thisWeekCount'){
|
||||
//这里业务逻辑应当跳转接口案例列表
|
||||
this.$emit("redirectPage","api","apiTestCase",clickType);
|
||||
}else{
|
||||
//这里业务逻辑应当跳转接口列表
|
||||
this.$emit("redirectPage","api","api",clickType);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
|
|
@ -36,16 +36,23 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item :label="$t('system_parameter_setting.test_recipients')">
|
||||
<el-input v-model="formInline.recipient" :placeholder="$t('system_parameter_setting.test_recipients')"
|
||||
autocomplete="new-password" show-password type="text" ref="input">
|
||||
</el-input>
|
||||
<p style="color: #8a8b8d">({{ $t('system_parameter_setting.tip') }})</p>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!---->
|
||||
<div style="border: 0px;margin-bottom: 20px;margin-top: 20px">
|
||||
<el-checkbox v-model="formInline.SSL" :label="$t('system_parameter_setting.SSL')"></el-checkbox>
|
||||
<div style="border: 0px;margin-bottom: 20px">
|
||||
<el-checkbox v-model="formInline.ssl" :label="$t('system_parameter_setting.SSL')"></el-checkbox>
|
||||
</div>
|
||||
<div style="border: 0px;margin-bottom: 20px">
|
||||
<el-checkbox v-model="formInline.TLS" :label="$t('system_parameter_setting.TLS')"></el-checkbox>
|
||||
</div>
|
||||
<div style="border: 0px;margin-bottom: 20px">
|
||||
<el-checkbox v-model="formInline.ANON" :label="$t('system_parameter_setting.SMTP')"></el-checkbox>
|
||||
<el-checkbox v-model="formInline.tls" :label="$t('system_parameter_setting.TLS')"></el-checkbox>
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
</template>
|
||||
|
@ -114,13 +121,10 @@ export default {
|
|||
},
|
||||
query() {
|
||||
this.result = this.$get("/system/mail/info", response => {
|
||||
this.$set(this.formInline, "host", response.data[0].paramValue);
|
||||
this.$set(this.formInline, "port", response.data[1].paramValue);
|
||||
this.$set(this.formInline, "account", response.data[2].paramValue);
|
||||
this.$set(this.formInline, "password", response.data[3].paramValue);
|
||||
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
|
||||
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
|
||||
this.$set(this.formInline, "ANON", JSON.parse(response.data[6].paramValue));
|
||||
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();
|
||||
})
|
||||
|
@ -137,13 +141,13 @@ export default {
|
|||
},
|
||||
testConnection(formInline) {
|
||||
let param = {
|
||||
"smtp.server": this.formInline.host,
|
||||
"smtp.host": this.formInline.host,
|
||||
"smtp.port": this.formInline.port,
|
||||
"smtp.account": this.formInline.account,
|
||||
"smtp.password": this.formInline.password,
|
||||
"smtp.ssl": this.formInline.SSL,
|
||||
"smtp.tls": this.formInline.TLS,
|
||||
"smtp.anon": this.formInline.ANON,
|
||||
"smtp.ssl": this.formInline.ssl,
|
||||
"smtp.tls": this.formInline.tls,
|
||||
"smtp.recipient": this.formInline.recipient,
|
||||
};
|
||||
this.$refs[formInline].validate((valid) => {
|
||||
if (valid) {
|
||||
|
@ -171,9 +175,10 @@ export default {
|
|||
{paramKey: "smtp.port", paramValue: this.formInline.port, type: "text", sort: 2},
|
||||
{paramKey: "smtp.account", paramValue: this.formInline.account, type: "text", sort: 3},
|
||||
{paramKey: "smtp.password", paramValue: this.formInline.password, type: "password", sort: 4},
|
||||
{paramKey: "smtp.ssl", paramValue: this.formInline.SSL, type: "text", sort: 5},
|
||||
{paramKey: "smtp.tls", paramValue: this.formInline.TLS, type: "text", sort: 6},
|
||||
{paramKey: "smtp.anon", paramValue: this.formInline.ANON, type: "text", sort: 7}
|
||||
{paramKey: "smtp.ssl", paramValue: this.formInline.ssl, type: "text", sort: 5},
|
||||
{paramKey: "smtp.tls", paramValue: this.formInline.tls, type: "text", sort: 6},
|
||||
{paramKey: "smtp.recipient", paramValue: this.formInline.recipient, type: "text", sort: 8}
|
||||
|
||||
]
|
||||
|
||||
this.$refs[formInline].validate(valid => {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="num" label="ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
|
||||
|
||||
<el-table-column
|
||||
|
|
|
@ -808,6 +808,8 @@ export default {
|
|||
},
|
||||
home_page: {
|
||||
unit_of_measurement: "",
|
||||
unit_of_count: "",
|
||||
unit_of_times: "times",
|
||||
api_count_card: {
|
||||
title: "API count",
|
||||
},
|
||||
|
@ -840,23 +842,23 @@ export default {
|
|||
},
|
||||
api_details_card: {
|
||||
title: "API",
|
||||
this_week_add: "Added {0} this week",
|
||||
this_week_add: "This week add:",
|
||||
},
|
||||
test_case_details_card: {
|
||||
title: "Test case",
|
||||
this_week_add: "Added {0} this week",
|
||||
this_week_add: "This week add:",
|
||||
this_week_execute: "Executed {0} this week",
|
||||
executed: "Executed {0} in history",
|
||||
this_week_add_sm: "Added {0}<br/> this week",
|
||||
this_week_add_sm: "This week add:",
|
||||
this_week_execute_sm: "Executed {0}<br/> this week",
|
||||
executed_sm: "Executed {0}<br/> in history",
|
||||
},
|
||||
test_scene_details_card: {
|
||||
title: "Scene",
|
||||
this_week_add: "Added {0} this week",
|
||||
this_week_add: "This week add:",
|
||||
this_week_execute: "Executed {0} this week",
|
||||
executed: "Executed {0} in history",
|
||||
this_week_add_sm: "Added {0}<br/> this week",
|
||||
this_week_add_sm: "This week add:",
|
||||
this_week_execute_sm: "Executed {0}<br/> this week",
|
||||
executed_sm: "Executed {0}<br/> in history",
|
||||
},
|
||||
|
@ -1252,6 +1254,8 @@ export default {
|
|||
host: 'Host number cannot be empty',
|
||||
port: 'Port cannot be empty',
|
||||
account: 'Account cannot be empty',
|
||||
test_recipients:'Test recipients',
|
||||
tip:'Tip: use as test mail recipient only',
|
||||
|
||||
},
|
||||
i18n: {
|
||||
|
|
|
@ -809,6 +809,8 @@ export default {
|
|||
},
|
||||
home_page: {
|
||||
unit_of_measurement: "个",
|
||||
unit_of_count: "个",
|
||||
unit_of_times: "次",
|
||||
api_count_card: {
|
||||
title: "接口数量统计",
|
||||
},
|
||||
|
@ -841,23 +843,23 @@ export default {
|
|||
},
|
||||
api_details_card: {
|
||||
title: "接口",
|
||||
this_week_add: "本周新增: {0}个",
|
||||
this_week_add: "本周新增:",
|
||||
},
|
||||
test_case_details_card: {
|
||||
title: "用例",
|
||||
this_week_add: "本周新增: {0}个",
|
||||
this_week_add: "本周新增:",
|
||||
this_week_execute: "本周执行: {0}次",
|
||||
executed: "历史总执行: {0}次",
|
||||
this_week_add_sm: "本周新增:<br/>{0}个",
|
||||
this_week_add_sm: "本周新增:",
|
||||
this_week_execute_sm: "本周执行:<br/>{0}次",
|
||||
executed_sm: "历史总执行:<br/>{0}次",
|
||||
},
|
||||
test_scene_details_card: {
|
||||
title: "场景",
|
||||
this_week_add: "本周新增: {0}个",
|
||||
this_week_add: "本周新增:",
|
||||
this_week_execute: "本周执行: {0}次",
|
||||
executed: "历史总执行: {0}次",
|
||||
this_week_add_sm: "本周新增:<br/>{0}个",
|
||||
this_week_add_sm: "本周新增:",
|
||||
this_week_execute_sm: "本周执行:<br/>{0}次",
|
||||
executed_sm: "历史总执行:<br/>{0}次",
|
||||
},
|
||||
|
@ -1253,6 +1255,8 @@ export default {
|
|||
host: '主机号不能为空',
|
||||
port: '端口号不能为空',
|
||||
account: '账户不能为空',
|
||||
test_recipients:'测试收件人',
|
||||
tip:'提示:仅用来作为测试邮件收件人',
|
||||
},
|
||||
i18n: {
|
||||
home: '首页',
|
||||
|
|
|
@ -808,6 +808,8 @@ export default {
|
|||
},
|
||||
home_page: {
|
||||
unit_of_measurement: "個",
|
||||
unit_of_count: "個",
|
||||
unit_of_times: "次",
|
||||
api_count_card: {
|
||||
title: "接口數量統計",
|
||||
},
|
||||
|
@ -840,23 +842,23 @@ export default {
|
|||
},
|
||||
api_details_card: {
|
||||
title: "接口",
|
||||
this_week_add: "本週新增: {0}个",
|
||||
this_week_add: "本週新增:",
|
||||
},
|
||||
test_case_details_card: {
|
||||
title: "用例",
|
||||
this_week_add: "本週新增: {0}个",
|
||||
this_week_add: "本週新增:",
|
||||
this_week_execute: "本週執行: {0}次",
|
||||
executed: "歷史總執行: {0}次",
|
||||
this_week_add_sm: "本週新增:<br/>{0}个",
|
||||
this_week_add_sm: "本週新增:",
|
||||
this_week_execute_sm: "本週執行:<br/>{0}次",
|
||||
executed_sm: "歷史總執行:<br/>{0}次",
|
||||
},
|
||||
test_scene_details_card: {
|
||||
title: "場景",
|
||||
this_week_add: "本週新增: {0}个",
|
||||
this_week_add: "本週新增:",
|
||||
this_week_execute: "本週執行: {0}次",
|
||||
executed: "歷史總執行: {0}次",
|
||||
this_week_add_sm: "本週新增:<br/>{0}个",
|
||||
this_week_add_sm: "本週新增:",
|
||||
this_week_execute_sm: "本週執行:<br/>{0}次",
|
||||
executed_sm: "歷史總執行:<br/>{0}次",
|
||||
},
|
||||
|
@ -1252,6 +1254,8 @@ export default {
|
|||
host: '主機號不能為空',
|
||||
port: '端口號不能為空',
|
||||
account: '賬戶不能為空',
|
||||
test_recipients:'測試收件人',
|
||||
tip:'提示:僅用來作為測試郵件收件人',
|
||||
},
|
||||
i18n: {
|
||||
home: '首頁',
|
||||
|
|
Loading…
Reference in New Issue