Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
9143b48e05
|
@ -15,6 +15,8 @@ public class RunDefinitionRequest {
|
||||||
|
|
||||||
private String reportId;
|
private String reportId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
|
@ -14,7 +14,9 @@ import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||||
import io.metersphere.api.jmeter.JMeterService;
|
import io.metersphere.api.jmeter.JMeterService;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||||
|
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
|
@ -28,6 +30,9 @@ import io.metersphere.service.ScheduleService;
|
||||||
import io.metersphere.track.dto.TestPlanDTO;
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
|
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
|
||||||
|
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||||
|
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
@ -53,8 +58,8 @@ public class ApiAutomationService {
|
||||||
private ApiDefinitionService apiDefinitionService;
|
private ApiDefinitionService apiDefinitionService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtApiScenarioMapper extApiScenarioMapper;
|
private ExtApiScenarioMapper extApiScenarioMapper;
|
||||||
// @Resource
|
@Resource
|
||||||
// private ApiTagMapper apiTagMapper;
|
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private JMeterService jMeterService;
|
private JMeterService jMeterService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -150,10 +155,48 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String id) {
|
public void delete(String id) {
|
||||||
|
//及连删除外键表
|
||||||
|
this.preDelete(id);
|
||||||
apiScenarioMapper.deleteByPrimaryKey(id);
|
apiScenarioMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void preDelete(String scenarioID){
|
||||||
|
|
||||||
|
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||||
|
example.createCriteria().andApiScenarioIdEqualTo(scenarioID);
|
||||||
|
List<TestPlanApiScenario> testPlanApiScenarioList = testPlanApiScenarioMapper.selectByExample(example);
|
||||||
|
|
||||||
|
List<String> idList = new ArrayList<>(testPlanApiScenarioList.size());
|
||||||
|
for (TestPlanApiScenario api :
|
||||||
|
testPlanApiScenarioList) {
|
||||||
|
idList.add(api.getId());
|
||||||
|
}
|
||||||
|
example = new TestPlanApiScenarioExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andIdIn(idList);
|
||||||
|
testPlanApiScenarioMapper.deleteByExample(example);
|
||||||
|
}
|
||||||
|
public void preDelete(List<String> scenarioIDList){
|
||||||
|
List<String> idList = new ArrayList<>();
|
||||||
|
for (String id :scenarioIDList) {
|
||||||
|
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||||
|
example.createCriteria().andApiScenarioIdEqualTo(id);
|
||||||
|
List<TestPlanApiScenario> testPlanApiScenarioList = testPlanApiScenarioMapper.selectByExample(example);
|
||||||
|
|
||||||
|
for (TestPlanApiScenario api :testPlanApiScenarioList) {
|
||||||
|
if(!idList.contains(api.getId())){
|
||||||
|
idList.add(api.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andIdIn(idList);
|
||||||
|
testPlanApiScenarioMapper.deleteByExample(example);
|
||||||
|
}
|
||||||
public void deleteBatch(List<String> ids) {
|
public void deleteBatch(List<String> ids) {
|
||||||
|
//及连删除外键表
|
||||||
|
preDelete(ids);;
|
||||||
ApiScenarioExample example = new ApiScenarioExample();
|
ApiScenarioExample example = new ApiScenarioExample();
|
||||||
example.createCriteria().andIdIn(ids);
|
example.createCriteria().andIdIn(ids);
|
||||||
apiScenarioMapper.deleteByExample(example);
|
apiScenarioMapper.deleteByExample(example);
|
||||||
|
@ -246,6 +289,7 @@ public class ApiAutomationService {
|
||||||
});
|
});
|
||||||
scenario.setVariables(variables);
|
scenario.setVariables(variables);
|
||||||
}
|
}
|
||||||
|
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||||
scenarios.add(scenario);
|
scenarios.add(scenario);
|
||||||
group.setHashTree(scenarios);
|
group.setHashTree(scenarios);
|
||||||
|
@ -301,7 +345,7 @@ public class ApiAutomationService {
|
||||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||||
planRequest.setScenarioId(request.getId());
|
planRequest.setScenarioId(request.getId());
|
||||||
planRequest.setProjectId(request.getProjectId());
|
planRequest.setProjectId(request.getProjectId());
|
||||||
dto.setTestPlanList(extTestPlanMapper.selectReference(planRequest));
|
dto.setTestPlanList(extTestPlanMapper.selectTestPlanByRelevancy(planRequest));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,37 +356,66 @@ public class ApiAutomationService {
|
||||||
List<TestPlanDTO> list = extTestPlanMapper.selectByIds(request.getPlanIds());
|
List<TestPlanDTO> list = extTestPlanMapper.selectByIds(request.getPlanIds());
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
ExtTestPlanMapper mapper = sqlSession.getMapper(ExtTestPlanMapper.class);
|
ExtTestPlanMapper mapper = sqlSession.getMapper(ExtTestPlanMapper.class);
|
||||||
list.forEach(item -> {
|
ExtTestPlanScenarioCaseMapper scenarioBatchMapper = sqlSession.getMapper(ExtTestPlanScenarioCaseMapper.class);
|
||||||
if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
ExtTestPlanApiCaseMapper apiCaseBatchMapper = sqlSession.getMapper(ExtTestPlanApiCaseMapper.class);
|
||||||
if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
|
||||||
if (StringUtils.isEmpty(item.getApiIds())) {
|
for (TestPlanDTO testPlan:list) {
|
||||||
item.setApiIds(JSON.toJSONString(request.getApiIds()));
|
if(request.getScenarioIds()!=null){
|
||||||
} else {
|
for (String scenarioId : request.getScenarioIds()) {
|
||||||
// 合并api
|
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||||
List<String> dbApiIDs = JSON.parseArray(item.getApiIds(), String.class);
|
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
||||||
List<String> result = Stream.of(request.getApiIds(), dbApiIDs)
|
testPlanApiScenario.setApiScenarioId(scenarioId);
|
||||||
.flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
testPlanApiScenario.setTestPlanId(testPlan.getId());
|
||||||
item.setApiIds(JSON.toJSONString(result));
|
testPlanApiScenario.setCreateTime(System.currentTimeMillis());
|
||||||
}
|
testPlanApiScenario.setUpdateTime(System.currentTimeMillis());
|
||||||
item.setScenarioIds(null);
|
scenarioBatchMapper.insertIfNotExists(testPlanApiScenario);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
if(request.getApiIds()!=null){
|
||||||
if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
for (String caseId : request.getApiIds()) {
|
||||||
if (StringUtils.isEmpty(item.getScenarioIds())) {
|
TestPlanApiCase testPlanApiCase = new TestPlanApiCase();
|
||||||
item.setScenarioIds(JSON.toJSONString(request.getScenarioIds()));
|
testPlanApiCase.setId(UUID.randomUUID().toString());
|
||||||
} else {
|
testPlanApiCase.setApiCaseId(caseId);
|
||||||
// 合并场景ID
|
testPlanApiCase.setTestPlanId(testPlan.getId());
|
||||||
List<String> dbScenarioIDs = JSON.parseArray(item.getScenarioIds(), String.class);
|
testPlanApiCase.setCreateTime(System.currentTimeMillis());
|
||||||
List<String> result = Stream.of(request.getScenarioIds(), dbScenarioIDs)
|
testPlanApiCase.setUpdateTime(System.currentTimeMillis());
|
||||||
.flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
apiCaseBatchMapper.insertIfNotExists(testPlanApiCase);
|
||||||
item.setScenarioIds(JSON.toJSONString(result));
|
|
||||||
}
|
|
||||||
item.setApiIds(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapper.updatePlan(item);
|
|
||||||
});
|
}
|
||||||
|
// testPlan的ID先不存储
|
||||||
|
// list.forEach(item -> {
|
||||||
|
// if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
||||||
|
// if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
||||||
|
// if (StringUtils.isEmpty(item.getApiIds())) {
|
||||||
|
// item.setApiIds(JSON.toJSONString(request.getApiIds()));
|
||||||
|
// } else {
|
||||||
|
// // 合并api
|
||||||
|
// List<String> dbApiIDs = JSON.parseArray(item.getApiIds(), String.class);
|
||||||
|
// List<String> result = Stream.of(request.getApiIds(), dbApiIDs)
|
||||||
|
// .flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||||
|
// item.setApiIds(JSON.toJSONString(result));
|
||||||
|
// }
|
||||||
|
// item.setScenarioIds(null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
||||||
|
// if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
||||||
|
// if (StringUtils.isEmpty(item.getScenarioIds())) {
|
||||||
|
// item.setScenarioIds(JSON.toJSONString(request.getScenarioIds()));
|
||||||
|
// } else {
|
||||||
|
// // 合并场景ID
|
||||||
|
// List<String> dbScenarioIDs = JSON.parseArray(item.getScenarioIds(), String.class);
|
||||||
|
// List<String> result = Stream.of(request.getScenarioIds(), dbScenarioIDs)
|
||||||
|
// .flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||||
|
// item.setScenarioIds(JSON.toJSONString(result));
|
||||||
|
// }
|
||||||
|
// item.setApiIds(null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// mapper.updatePlan(item);
|
||||||
|
// });
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,7 +392,7 @@ public class ApiDefinitionService {
|
||||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||||
planRequest.setApiId(request.getId());
|
planRequest.setApiId(request.getId());
|
||||||
planRequest.setProjectId(request.getProjectId());
|
planRequest.setProjectId(request.getProjectId());
|
||||||
dto.setTestPlanList(extTestPlanMapper.selectReference(planRequest));
|
dto.setTestPlanList(extTestPlanMapper.selectTestPlanByRelevancy(planRequest));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,13 @@ import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||||
import io.metersphere.commons.constants.APITestStatus;
|
import io.metersphere.commons.constants.APITestStatus;
|
||||||
import io.metersphere.commons.constants.ApiRunMode;
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -28,10 +31,7 @@ import sun.security.util.Cache;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -55,6 +55,13 @@ public class ApiScenarioReportService {
|
||||||
MSException.throwException(Translator.get("api_report_is_null"));
|
MSException.throwException(Translator.get("api_report_is_null"));
|
||||||
}
|
}
|
||||||
APIScenarioReportResult report = (APIScenarioReportResult) obj;
|
APIScenarioReportResult report = (APIScenarioReportResult) obj;
|
||||||
|
if (CollectionUtils.isNotEmpty(result.getScenarios())) {
|
||||||
|
try {
|
||||||
|
report.setName(result.getScenarios().get(0).getName() + "-" + DateUtils.getTimeString(System.currentTimeMillis()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
// report detail
|
// report detail
|
||||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||||
detail.setReportId(result.getTestId());
|
detail.setReportId(result.getTestId());
|
||||||
|
@ -72,7 +79,9 @@ public class ApiScenarioReportService {
|
||||||
}
|
}
|
||||||
report.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
|
report.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
|
||||||
this.save(report, runMode);
|
this.save(report, runMode);
|
||||||
cache.put(report.getId(), report);
|
if (!report.getTriggerMode().equals(ReportTriggerMode.SCHEDULE.name())) {
|
||||||
|
cache.put(report.getId(), report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,6 +13,7 @@ import io.metersphere.base.mapper.ApiTestFileMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
@ -48,6 +49,8 @@ public class ApiTestCaseService {
|
||||||
@Resource
|
@Resource
|
||||||
private ApiTestFileMapper apiTestFileMapper;
|
private ApiTestFileMapper apiTestFileMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
|
||||||
|
@Resource
|
||||||
private FileService fileService;
|
private FileService fileService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
||||||
|
@ -131,8 +134,12 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String testId) {
|
public void delete(String testId) {
|
||||||
|
|
||||||
|
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
|
||||||
|
|
||||||
deleteFileByTestId(testId);
|
deleteFileByTestId(testId);
|
||||||
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
|
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
|
||||||
|
|
||||||
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
||||||
deleteBodyFiles(testId);
|
deleteBodyFiles(testId);
|
||||||
}
|
}
|
||||||
|
@ -253,6 +260,9 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteBatch(List<String> ids) {
|
public void deleteBatch(List<String> ids) {
|
||||||
|
for (String testId:ids) {
|
||||||
|
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
|
||||||
|
}
|
||||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||||
example.createCriteria().andIdIn(ids);
|
example.createCriteria().andIdIn(ids);
|
||||||
apiTestCaseMapper.deleteByExample(example);
|
apiTestCaseMapper.deleteByExample(example);
|
||||||
|
|
|
@ -21,5 +21,12 @@ public interface ExtTestPlanMapper {
|
||||||
|
|
||||||
List<TestPlanDTO> selectReference(@Param("request") QueryTestPlanRequest params);
|
List<TestPlanDTO> selectReference(@Param("request") QueryTestPlanRequest params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过关联表(test_plan_api_case/test_plan_api_scenario)查询testPlan
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TestPlanDTO> selectTestPlanByRelevancy(@Param("request") QueryTestPlanRequest params);
|
||||||
|
|
||||||
int checkIsHave(@Param("planId") String planId, @Param("workspaceIds") Set<String> workspaceIds);
|
int checkIsHave(@Param("planId") String planId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,4 +227,16 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
<if test="request.apiId != null">
|
||||||
|
AND p.id IN (SELECT test_plan_id FROM test_plan_api_case WHERE api_case_id = #{request.apiId})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -7,6 +7,8 @@ import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||||
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
||||||
import io.metersphere.base.domain.TestPlanApiCase;
|
import io.metersphere.base.domain.TestPlanApiCase;
|
||||||
import io.metersphere.base.domain.TestPlanApiScenario;
|
import io.metersphere.base.domain.TestPlanApiScenario;
|
||||||
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
|
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,4 +17,5 @@ public interface ExtTestPlanScenarioCaseMapper {
|
||||||
void insertIfNotExists(@Param("request") TestPlanApiScenario request);
|
void insertIfNotExists(@Param("request") TestPlanApiScenario request);
|
||||||
|
|
||||||
List<ApiScenarioDTO> list(@Param("request") TestPlanScenarioRequest request);
|
List<ApiScenarioDTO> list(@Param("request") TestPlanScenarioRequest request);
|
||||||
|
|
||||||
}
|
}
|
|
@ -40,4 +40,5 @@ public interface ExtTestPlanTestCaseMapper {
|
||||||
|
|
||||||
TestPlanCaseDTO get(String testPlanTestCaseId);
|
TestPlanCaseDTO get(String testPlanTestCaseId);
|
||||||
|
|
||||||
|
void deleteByTestCaseID(String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,4 +342,8 @@
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteByTestCaseID" parameterType="java.lang.String">
|
||||||
|
delete from test_plan_api_case where api_case_id = #{id,jdbcType=VARCHAR}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,9 +1,7 @@
|
||||||
package io.metersphere.job.sechedule;
|
package io.metersphere.job.sechedule;
|
||||||
|
|
||||||
import io.metersphere.api.dto.SaveAPITestRequest;
|
|
||||||
import io.metersphere.api.dto.automation.ExecuteType;
|
import io.metersphere.api.dto.automation.ExecuteType;
|
||||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||||
import io.metersphere.api.service.APITestService;
|
|
||||||
import io.metersphere.api.service.ApiAutomationService;
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.constants.ScheduleGroup;
|
import io.metersphere.commons.constants.ScheduleGroup;
|
||||||
|
@ -56,7 +54,7 @@ public class ApiScenarioTestJob extends MsScheduleJob {
|
||||||
request.setId(id);
|
request.setId(id);
|
||||||
request.setReportId(id);
|
request.setReportId(id);
|
||||||
request.setProjectId(projectID);
|
request.setProjectId(projectID);
|
||||||
request.setTriggerMode(ReportTriggerMode.MANUAL.name());
|
request.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||||
request.setExecuteType(ExecuteType.Completed.name());
|
request.setExecuteType(ExecuteType.Completed.name());
|
||||||
request.setScenarioIds(this.scenarioIds);
|
request.setScenarioIds(this.scenarioIds);
|
||||||
request.setReportUserID(this.userId);
|
request.setReportUserID(this.userId);
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
import MsContainer from "../../../common/components/MsContainer";
|
import MsContainer from "../../../common/components/MsContainer";
|
||||||
import MsMainContainer from "../../../common/components/MsMainContainer";
|
import MsMainContainer from "../../../common/components/MsMainContainer";
|
||||||
import MsApiReportStatus from "./ApiReportStatus";
|
import MsApiReportStatus from "./ApiReportStatus";
|
||||||
import {_filter, _sort} from "@/common/js/utils";
|
import {_filter, _sort,getCurrentProjectID} from "@/common/js/utils";
|
||||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||||
import ReportTriggerModeItem from "../../../common/tableItem/ReportTriggerModeItem";
|
import ReportTriggerModeItem from "../../../common/tableItem/ReportTriggerModeItem";
|
||||||
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
|
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
|
||||||
|
@ -130,6 +130,7 @@
|
||||||
if (this.testId !== 'all') {
|
if (this.testId !== 'all') {
|
||||||
this.condition.testId = this.testId;
|
this.condition.testId = this.testId;
|
||||||
}
|
}
|
||||||
|
this.condition.projectId = getCurrentProjectID();
|
||||||
let url = "/api/scenario/report/list/" + this.currentPage + "/" + this.pageSize;
|
let url = "/api/scenario/report/list/" + this.currentPage + "/" + this.pageSize;
|
||||||
this.result = this.$post(url, this.condition, response => {
|
this.result = this.$post(url, this.condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
|
|
|
@ -19,19 +19,14 @@
|
||||||
<el-tabs v-model="activeName" v-show="isActive" v-if="hasSub">
|
<el-tabs v-model="activeName" v-show="isActive" v-if="hasSub">
|
||||||
<el-tab-pane :label="$t('api_report.sub_result')" name="sub">
|
<el-tab-pane :label="$t('api_report.sub_result')" name="sub">
|
||||||
<ms-request-sub-result class="sub-result" v-for="(sub, index) in request.subRequestResults"
|
<ms-request-sub-result class="sub-result" v-for="(sub, index) in request.subRequestResults"
|
||||||
:key="index" :request="sub"/>
|
:key="index" :indexNumber="index" :request="sub"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_report.request_result')" name="result">
|
<el-tab-pane :label="$t('api_report.request_result')" name="result">
|
||||||
<ms-request-metric :request="request"/>
|
<ms-response-text :request-type="requestType" :response="request.responseResult" :request="request"/>
|
||||||
<ms-request-text :request="request"/>
|
|
||||||
<br>
|
|
||||||
<ms-response-text :request-type="requestType" :response="request.responseResult"/>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<ms-request-text v-if="isCodeEditAlive" :request="request"/>
|
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult" :request="request"/>
|
||||||
<br>
|
|
||||||
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<p class="el-divider--horizontal"></p>
|
<p class="el-divider--horizontal"></p>
|
||||||
<div @click="active">
|
<div @click="active">
|
||||||
<el-row :gutter="10" type="flex" align="middle" class="info">
|
<el-row :gutter="10" type="flex" align="middle" class="info">
|
||||||
<el-col :span="14" v-if="indexNumber!=undefined">
|
<el-col :span="6" v-if="indexNumber!=undefined">
|
||||||
<div class="method">
|
<div class="method">
|
||||||
<div class="el-step__icon is-text ms-api-col" v-if="indexNumber%2 ==0">
|
<div class="el-step__icon is-text ms-api-col" v-if="indexNumber%2 ==0">
|
||||||
<div class="el-step__icon-inner"> {{ indexNumber+1 }}</div>
|
<div class="el-step__icon-inner"> {{ indexNumber+1 }}</div>
|
||||||
|
@ -14,7 +14,16 @@
|
||||||
{{ request.name }}
|
{{ request.name }}
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<div>
|
||||||
|
{{ request.method }}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="url">
|
||||||
|
{{ request.url }}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
<el-col :span="5">
|
<el-col :span="5">
|
||||||
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
|
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
|
||||||
<div class="url" style="color: #5daf34">{{ request.responseResult.responseCode }}</div>
|
<div class="url" style="color: #5daf34">{{ request.responseResult.responseCode }}</div>
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="text-container">
|
<div class="text-container">
|
||||||
<div @click="active" class="collapse">
|
|
||||||
<i class="icon el-icon-arrow-right" :class="{'is-active': isActive}"/>
|
|
||||||
{{ $t('api_report.response') }}
|
|
||||||
</div>
|
|
||||||
<el-collapse-transition>
|
<el-collapse-transition>
|
||||||
<el-tabs v-model="activeName" v-show="isActive">
|
<el-tabs v-model="activeName" v-show="isActive">
|
||||||
<el-tab-pane :class="'body-pane'" label="Body" name="body" class="pane">
|
<el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane">
|
||||||
|
<pre>{{ response.headers }}</pre>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane :class="'body-pane'" :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
|
||||||
<ms-sql-result-table v-if="isSqlType" :body="response.body"/>
|
<ms-sql-result-table v-if="isSqlType" :body="response.body"/>
|
||||||
<ms-code-edit v-if="!isSqlType" :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/>
|
<ms-code-edit v-if="!isSqlType" :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="Headers" name="headers" class="pane">
|
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||||
<pre>{{ response.headers }}</pre>
|
<pre>{{response.console}}</pre>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions">
|
<el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions">
|
||||||
<ms-assertion-results :assertions="response.assertions"/>
|
<ms-assertion-results :assertions="response.assertions"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
@ -21,79 +22,97 @@
|
||||||
<pre>{{response.vars}}</pre>
|
<pre>{{response.vars}}</pre>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane">
|
||||||
|
<div class="ms-div">
|
||||||
|
{{$t('api_test.request.address')}} :
|
||||||
|
<pre>{{ request.url }}</pre>
|
||||||
|
</div>
|
||||||
|
<div class="ms-div">
|
||||||
|
{{$t('api_test.scenario.headers')}} :
|
||||||
|
<pre>{{ request.headers }}</pre>
|
||||||
|
</div>
|
||||||
|
<div class="ms-div">
|
||||||
|
Cookies :
|
||||||
|
<pre>{{request.cookies}}</pre>
|
||||||
|
</div>
|
||||||
|
<div class="ms-div">
|
||||||
|
Body :
|
||||||
|
<pre>{{request.body}}</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
<ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/>
|
<ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/>
|
||||||
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
|
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
|
||||||
</template>
|
</template>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
|
||||||
<pre>{{response.console}}</pre>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsAssertionResults from "./AssertionResults";
|
import MsAssertionResults from "./AssertionResults";
|
||||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||||
import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../../definition/model/ApiTestModel";
|
import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../../definition/model/ApiTestModel";
|
||||||
import MsSqlResultTable from "./SqlResultTable";
|
import MsSqlResultTable from "./SqlResultTable";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsResponseText",
|
name: "MsResponseText",
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
MsSqlResultTable,
|
MsSqlResultTable,
|
||||||
MsDropdown,
|
MsDropdown,
|
||||||
MsCodeEdit,
|
MsCodeEdit,
|
||||||
MsAssertionResults,
|
MsAssertionResults,
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
|
||||||
requestType: String,
|
|
||||||
response: Object
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isActive: true,
|
|
||||||
activeName: "body",
|
|
||||||
modes: ['text', 'json', 'xml', 'html'],
|
|
||||||
sqlModes: ['text', 'table'],
|
|
||||||
mode: BODY_FORMAT.TEXT
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
active() {
|
|
||||||
this.isActive = !this.isActive;
|
|
||||||
},
|
},
|
||||||
modeChange(mode) {
|
|
||||||
this.mode = mode;
|
props: {
|
||||||
|
requestType: String,
|
||||||
|
request: {},
|
||||||
|
response: Object
|
||||||
},
|
},
|
||||||
sqlModeChange(mode) {
|
|
||||||
this.mode = mode;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
data() {
|
||||||
if (!this.response.headers) {
|
return {
|
||||||
return;
|
isActive: true,
|
||||||
}
|
activeName: "body",
|
||||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
modes: ['text', 'json', 'xml', 'html'],
|
||||||
this.mode = BODY_FORMAT.JSON;
|
sqlModes: ['text', 'table'],
|
||||||
}
|
mode: BODY_FORMAT.TEXT
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
methods: {
|
||||||
isSqlType() {
|
active() {
|
||||||
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
|
this.isActive = !this.isActive;
|
||||||
|
},
|
||||||
|
modeChange(mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
},
|
||||||
|
sqlModeChange(mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
if (!this.response.headers) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||||
|
this.mode = BODY_FORMAT.JSON;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
isSqlType() {
|
||||||
|
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -134,4 +153,7 @@ export default {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-div {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -5,15 +5,22 @@
|
||||||
<div class="el-step__icon is-text ms-api-col" v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'">
|
<div class="el-step__icon is-text ms-api-col" v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'">
|
||||||
<div class="el-step__icon-inner">{{request.index}}</div>
|
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="el-step__icon is-text ms-api-col-ot-import" v-else-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'">
|
||||||
|
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||||
|
</div>
|
||||||
<div class="el-step__icon is-text ms-api-col-create" v-else>
|
<div class="el-step__icon is-text ms-api-col-create" v-else>
|
||||||
<div class="el-step__icon-inner">{{request.index}}</div>
|
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'" class="ms-left-buttion" size="small">
|
<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'" class="ms-left-button" size="small">
|
||||||
{{$t('api_test.automation.api_list_import')}}
|
{{$t('api_test.automation.api_list_import')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button v-if="request.referenced==undefined || request.referenced==='Created' " class="ms-create-buttion" size="small">
|
<el-button v-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'" class="ms-api-col-ot-import-button" size="small">
|
||||||
|
{{$t('api_test.automation.external_import')}}
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<el-button v-if="request.referenced==undefined || request.referenced==='Created' " class="ms-create-button" size="small">
|
||||||
{{$t('api_test.automation.customize_req')}}
|
{{$t('api_test.automation.customize_req')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
@ -196,7 +203,7 @@
|
||||||
color: #F56C6C;
|
color: #F56C6C;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-left-buttion {
|
.ms-left-button {
|
||||||
color: #F56C6C;
|
color: #F56C6C;
|
||||||
background-color: #FCF1F1;
|
background-color: #FCF1F1;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
@ -209,6 +216,19 @@
|
||||||
color: #008080;
|
color: #008080;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-api-col-ot-import {
|
||||||
|
background-color: #EEF5FE;
|
||||||
|
border-color: #409EFF;
|
||||||
|
margin-right: 10px;
|
||||||
|
color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-api-col-ot-import-button {
|
||||||
|
background-color: #EEF5FE;
|
||||||
|
margin-right: 20px;
|
||||||
|
color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
/deep/ .el-card__body {
|
/deep/ .el-card__body {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +237,7 @@
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-create-buttion {
|
.ms-create-button {
|
||||||
color: #008080;
|
color: #008080;
|
||||||
background-color: #EBF2F2;
|
background-color: #EBF2F2;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
|
|
@ -782,7 +782,7 @@
|
||||||
apiImport(importData) {
|
apiImport(importData) {
|
||||||
if (importData && importData.data) {
|
if (importData && importData.data) {
|
||||||
importData.data.forEach(item => {
|
importData.data.forEach(item => {
|
||||||
this.setApiParameter(item, "API", "Copy");
|
this.setApiParameter(item, "API", "OT_IMPORT");
|
||||||
})
|
})
|
||||||
this.sort();
|
this.sort();
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
|
@ -110,16 +110,19 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- <notice-template v-xpack ref="noticeTemplate"/>-->
|
<notice-template v-xpack ref="noticeTemplate"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {hasLicense} from "@/common/js/utils";
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ScheduleNotification",
|
name: "ScheduleNotification",
|
||||||
components: {
|
components: {
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
testId: String,
|
testId: String,
|
||||||
|
|
|
@ -78,10 +78,10 @@
|
||||||
|
|
||||||
<!-- 测试-->
|
<!-- 测试-->
|
||||||
<div v-else-if="item.type=== 'TEST'" class="ms-api-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" v-if="currentProtocol==='HTTP'"/>
|
<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" v-if="currentProtocol==='TCP'"/>
|
<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" v-if="currentProtocol==='SQL'"/>
|
<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" v-if="currentProtocol==='DUBBO'"/>
|
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='DUBBO'"/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
|
@ -172,9 +172,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.apiCaseList = response.data;
|
this.apiCaseList = response.data;
|
||||||
// if (this.apiCaseList.length == 0) {
|
if (this.apiCaseList.length == 0 && !this.loaded) {
|
||||||
// this.addCase();
|
this.addCase();
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<!-- 请求参数 -->
|
<!-- 请求参数 -->
|
||||||
<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"/>
|
<ms-basis-parameters :showScript="false" :request="request"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
<!-- 请求参数 -->
|
<!-- 请求参数 -->
|
||||||
<div>
|
<div>
|
||||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||||
<ms-api-request-form :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
<ms-api-request-form :showScript="false" :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
<!-- 请求参数 -->
|
<!-- 请求参数 -->
|
||||||
<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"/>
|
<ms-basis-parameters :showScript="false" :request="request"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3" class="ms-left-cell">
|
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||||
|
|
||||||
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -120,6 +120,10 @@
|
||||||
request: {},
|
request: {},
|
||||||
basisData: {},
|
basisData: {},
|
||||||
moduleOptions: Array,
|
moduleOptions: Array,
|
||||||
|
showScript: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
@ -172,7 +176,7 @@
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
copyRow(row) {
|
copyRow(row) {
|
||||||
let obj =JSON.parse(JSON.stringify(row));
|
let obj = JSON.parse(JSON.stringify(row));
|
||||||
obj.id = getUUID();
|
obj.id = getUUID();
|
||||||
this.request.hashTree.push(obj);
|
this.request.hashTree.push(obj);
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="3" class="ms-left-cell">
|
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||||
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||||
<br/>
|
<br/>
|
||||||
<el-button class="ms-left-buttion" size="small" style="color: #783887;background-color: #F2ECF3" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
<el-button class="ms-left-buttion" size="small" style="color: #783887;background-color: #F2ECF3" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||||
|
@ -105,6 +105,10 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
showScript: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -141,7 +145,7 @@
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
copyRow(row) {
|
copyRow(row) {
|
||||||
let obj =JSON.parse(JSON.stringify(row));
|
let obj = JSON.parse(JSON.stringify(row));
|
||||||
obj.id = getUUID();
|
obj.id = getUUID();
|
||||||
this.request.hashTree.push(obj);
|
this.request.hashTree.push(obj);
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--操作按钮-->
|
<!--操作按钮-->
|
||||||
<el-col :span="3" class="ms-left-cell" v-if="!referenced">
|
<el-col :span="3" class="ms-left-cell" v-if="!referenced && showScript">
|
||||||
<el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
<el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||||
<br/>
|
<br/>
|
||||||
<el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
<el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||||
|
@ -131,6 +131,7 @@
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
request: {},
|
request: {},
|
||||||
|
showScript: Boolean,
|
||||||
headers: {
|
headers: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="request-form">
|
<div class="request-form">
|
||||||
<component :is="component" :is-read-only="isReadOnly" :referenced="referenced" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
<component :is="component" :showScript="showScript" :is-read-only="isReadOnly" :referenced="referenced" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
showScript: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
referenced: {
|
referenced: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api"
|
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api"
|
||||||
:loaded="loaded" :refreshSign="refreshSign" :createCase="createCase"
|
:loaded="loaded" :refreshSign="refreshSign" :createCase="createCase"
|
||||||
ref="caseList"/>
|
ref="caseList"/>
|
||||||
|
|
||||||
|
@ -104,6 +104,9 @@
|
||||||
return this.runTest();
|
return this.runTest();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
refresh(){
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
runTest() {
|
runTest() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.api.request.name = this.api.id;
|
this.api.request.name = this.api.id;
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
<ms-api-case-list @selectTestCase="selectTestCase"
|
<ms-api-case-list @selectTestCase="selectTestCase" @refresh="refresh"
|
||||||
:loaded="loaded"
|
:loaded="loaded"
|
||||||
:refreshSign="refreshSign"
|
:refreshSign="refreshSign"
|
||||||
:createCase="createCase"
|
:createCase="createCase"
|
||||||
|
@ -273,6 +273,9 @@
|
||||||
environmentConfigClose() {
|
environmentConfigClose() {
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
},
|
},
|
||||||
|
refresh(){
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
getResult() {
|
getResult() {
|
||||||
let url = "/api/definition/report/getReport/" + this.api.id;
|
let url = "/api/definition/report/getReport/" + this.api.id;
|
||||||
this.$get(url, response => {
|
this.$get(url, response => {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||||
:loaded="loaded" :createCase="createCase"
|
:loaded="loaded" :createCase="createCase"
|
||||||
ref="caseList"/>
|
ref="caseList"/>
|
||||||
|
|
||||||
|
@ -103,6 +103,9 @@
|
||||||
return this.$refs['requestForm'].validate();
|
return this.$refs['requestForm'].validate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
refresh(){
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
runTest() {
|
runTest() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.api.request.name = this.api.id;
|
this.api.request.name = this.api.id;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||||
:loaded="loaded" :createCase="createCase"
|
:loaded="loaded" :createCase="createCase"
|
||||||
ref="caseList"/>
|
ref="caseList"/>
|
||||||
<!-- 环境 -->
|
<!-- 环境 -->
|
||||||
|
@ -103,6 +103,9 @@
|
||||||
return this.$refs['requestForm'].validate();
|
return this.$refs['requestForm'].validate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
refresh(){
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
runTest() {
|
runTest() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.api.request.name = this.api.id;
|
this.api.request.name = this.api.id;
|
||||||
|
|
|
@ -47,14 +47,14 @@
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:title="$t('test_resource_pool.create_resource_pool')"
|
:title="form.id ? $t('test_resource_pool.update_resource_pool') : $t('test_resource_pool.create_resource_pool')"
|
||||||
:visible.sync="createVisible" width="70%"
|
:visible.sync="dialogVisible" width="70%"
|
||||||
@closed="closeFunc"
|
@closed="closeFunc"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
>
|
>
|
||||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
|
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
|
||||||
ref="createTestResourcePoolForm">
|
ref="testResourcePoolForm">
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -137,105 +137,15 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<ms-dialog-footer
|
<ms-dialog-footer
|
||||||
@cancel="createVisible = false"
|
v-if="form.id"
|
||||||
@confirm="createTestResourcePool('createTestResourcePoolForm')"/>
|
@cancel="dialogVisible = false"
|
||||||
</template>
|
@confirm="updateTestResourcePool()"/>
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<el-dialog
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
v-loading="result.loading"
|
|
||||||
:title="$t('test_resource_pool.update_resource_pool')" :visible.sync="updateVisible" width="70%"
|
|
||||||
:destroy-on-close="true"
|
|
||||||
@close="closeFunc">
|
|
||||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
|
|
||||||
ref="updateTestResourcePoolForm">
|
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="$t('commons.description')" prop="description">
|
|
||||||
<el-input v-model="form.description" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="$t('commons.image')" prop="image">
|
|
||||||
<el-input v-model="form.image" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="$t('test_resource_pool.type')" prop="type">
|
|
||||||
<el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
|
|
||||||
@change="changeResourceType()">
|
|
||||||
<el-option key="NODE" value="NODE" label="Node">Node</el-option>
|
|
||||||
<el-option key="K8S" value="K8S" label="Kubernetes" v-xpack>Kubernetes</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<div v-for="(item,index) in infoList " :key="index">
|
|
||||||
<div class="node-line" v-if="form.type === 'K8S'" v-xpack>
|
|
||||||
<el-row>
|
|
||||||
<el-col>
|
|
||||||
<el-form-item label="Master URL"
|
|
||||||
:rules="requiredRules">
|
|
||||||
<el-input v-model="item.masterUrl" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col>
|
|
||||||
<el-form-item label="Token"
|
|
||||||
:rules="requiredRules">
|
|
||||||
<el-input v-model="item.token" type="password" show-password autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col>
|
|
||||||
<el-form-item :label="$t('test_resource_pool.max_threads')"
|
|
||||||
:rules="requiredRules">
|
|
||||||
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
<div class="node-line" v-if="form.type === 'NODE'">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="IP" :rules="requiredRules">
|
|
||||||
<el-input v-model="item.ip" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-form-item label="Port" style="padding-left: 20px"
|
|
||||||
:rules="requiredRules">
|
|
||||||
<el-input-number v-model="item.port" :min="1" :max="65535"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-form-item :label="$t('test_resource_pool.max_threads')"
|
|
||||||
:rules="requiredRules"
|
|
||||||
style="padding-left: 20px">
|
|
||||||
<el-input-number v-model="item.maxConcurrency" :min="1" :max="1000000000"></el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :offset="2" :span="2">
|
|
||||||
<span class="box">
|
|
||||||
<el-button @click="addResourceInfo()" type="success" size="mini" circle>
|
|
||||||
<font-awesome-icon :icon="['fas', 'plus']"/>
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
<span class="box">
|
|
||||||
<el-button @click="removeResourceInfo(index)" type="danger" size="mini" circle>
|
|
||||||
<font-awesome-icon :icon="['fas', 'minus']"/>
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-form>
|
|
||||||
<template v-slot:footer>
|
|
||||||
<ms-dialog-footer
|
<ms-dialog-footer
|
||||||
@cancel="updateVisible = false"
|
v-else
|
||||||
@confirm="updateTestResourcePool('updateTestResourcePoolForm')"/>
|
@cancel="dialogVisible = false"
|
||||||
|
@confirm="createTestResourcePool()"/>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -245,7 +155,7 @@ import MsTablePagination from "../../common/pagination/TablePagination";
|
||||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsTestResourcePool",
|
name: "MsTestResourcePool",
|
||||||
|
@ -253,9 +163,8 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
createVisible: false,
|
dialogVisible: false,
|
||||||
infoList: [],
|
infoList: [],
|
||||||
updateVisible: false,
|
|
||||||
queryPath: "testresourcepool/list",
|
queryPath: "testresourcepool/list",
|
||||||
condition: {},
|
condition: {},
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -340,11 +249,11 @@ export default {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
create() {
|
create() {
|
||||||
this.createVisible = true;
|
this.dialogVisible = true;
|
||||||
listenGoBack(this.closeFunc);
|
listenGoBack(this.closeFunc);
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
this.updateVisible = true;
|
this.dialogVisible = true;
|
||||||
this.form = JSON.parse(JSON.stringify(row));
|
this.form = JSON.parse(JSON.stringify(row));
|
||||||
this.convertResources();
|
this.convertResources();
|
||||||
listenGoBack(this.closeFunc);
|
listenGoBack(this.closeFunc);
|
||||||
|
@ -374,8 +283,8 @@ export default {
|
||||||
this.$info(this.$t('commons.delete_cancel'));
|
this.$info(this.$t('commons.delete_cancel'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
createTestResourcePool(createTestResourcePoolForm) {
|
createTestResourcePool() {
|
||||||
this.$refs[createTestResourcePoolForm].validate(valid => {
|
this.$refs.testResourcePoolForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let vri = this.validateResourceInfo();
|
let vri = this.validateResourceInfo();
|
||||||
if (vri.validate) {
|
if (vri.validate) {
|
||||||
|
@ -385,7 +294,7 @@ export default {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('commons.save_success')
|
message: this.$t('commons.save_success')
|
||||||
},
|
},
|
||||||
this.createVisible = false,
|
this.dialogVisible = false,
|
||||||
this.initTableData());
|
this.initTableData());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -411,8 +320,8 @@ export default {
|
||||||
});
|
});
|
||||||
this.form.resources = resources;
|
this.form.resources = resources;
|
||||||
},
|
},
|
||||||
updateTestResourcePool(updateTestResourcePoolForm) {
|
updateTestResourcePool() {
|
||||||
this.$refs[updateTestResourcePoolForm].validate(valid => {
|
this.$refs.testResourcePoolForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let vri = this.validateResourceInfo();
|
let vri = this.validateResourceInfo();
|
||||||
if (vri.validate) {
|
if (vri.validate) {
|
||||||
|
@ -422,7 +331,7 @@ export default {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('commons.modify_success')
|
message: this.$t('commons.modify_success')
|
||||||
},
|
},
|
||||||
this.updateVisible = false,
|
this.dialogVisible = false,
|
||||||
this.initTableData(),
|
this.initTableData(),
|
||||||
self.loading = false);
|
self.loading = false);
|
||||||
});
|
});
|
||||||
|
@ -437,8 +346,7 @@ export default {
|
||||||
},
|
},
|
||||||
closeFunc() {
|
closeFunc() {
|
||||||
this.form = {};
|
this.form = {};
|
||||||
this.updateVisible = false;
|
this.dialogVisible = false;
|
||||||
this.createVisible = false;
|
|
||||||
removeGoBackListener(this.closeFunc);
|
removeGoBackListener(this.closeFunc);
|
||||||
},
|
},
|
||||||
changeSwitch(row) {
|
changeSwitch(row) {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
@testCaseDetail="showTestCaseDetail"
|
@testCaseDetail="showTestCaseDetail"
|
||||||
@batchMove="batchMove"
|
@batchMove="batchMove"
|
||||||
@refresh="refresh"
|
@refresh="refresh"
|
||||||
|
@refreshAll="refreshAll"
|
||||||
@moveToNode="moveToNode"
|
@moveToNode="moveToNode"
|
||||||
ref="testCaseList">
|
ref="testCaseList">
|
||||||
</test-case-list>
|
</test-case-list>
|
||||||
|
@ -131,6 +132,10 @@ export default {
|
||||||
this.selectNode = {};
|
this.selectNode = {};
|
||||||
this.refreshTable();
|
this.refreshTable();
|
||||||
},
|
},
|
||||||
|
refreshAll() {
|
||||||
|
this.$refs.nodeTree.list();
|
||||||
|
this.refresh();
|
||||||
|
},
|
||||||
openRecentTestCaseEditDialog(caseId) {
|
openRecentTestCaseEditDialog(caseId) {
|
||||||
if (caseId) {
|
if (caseId) {
|
||||||
// this.getProjectByCaseId(caseId);
|
// this.getProjectByCaseId(caseId);
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$success(this.$t('test_track.case.import.success'));
|
this.$success(this.$t('test_track.case.import.success'));
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$emit("refresh");
|
this.$emit("refreshAll");
|
||||||
} else {
|
} else {
|
||||||
this.errList = res.errList;
|
this.errList = res.errList;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$success(this.$t('test_track.case.import.success'));
|
this.$success(this.$t('test_track.case.import.success'));
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$emit("refresh");
|
this.$emit("refreshAll");
|
||||||
} else {
|
} else {
|
||||||
this.xmindErrList = res.errList;
|
this.xmindErrList = res.errList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<test-case-import @refresh="refresh" ref="testCaseImport"/>
|
<test-case-import @refreshAll="refreshAll" ref="testCaseImport"/>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
border
|
border
|
||||||
|
@ -374,6 +374,10 @@ export default {
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
},
|
},
|
||||||
|
refreshAll() {
|
||||||
|
this.selectRows.clear();
|
||||||
|
this.$emit('refreshAll');
|
||||||
|
},
|
||||||
showDetail(row, event, column) {
|
showDetail(row, event, column) {
|
||||||
this.$emit('testCaseDetail', row);
|
this.$emit('testCaseDetail', row);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue