This commit is contained in:
wenyann 2020-12-10 17:33:30 +08:00
commit cfa0489e59
33 changed files with 580 additions and 384 deletions

View File

@ -12,6 +12,7 @@ import io.metersphere.api.dto.definition.request.auth.MsAuthManager;
import io.metersphere.api.dto.definition.request.configurations.MsHeaderManager;
import io.metersphere.api.dto.definition.request.controller.MsIfController;
import io.metersphere.api.dto.definition.request.extract.MsExtract;
import io.metersphere.api.dto.definition.request.processors.MsJSR223Processor;
import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor;
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
import io.metersphere.api.dto.definition.request.sampler.MsDubboSampler;
@ -37,6 +38,7 @@ import java.util.List;
@JsonSubTypes({
@JsonSubTypes.Type(value = MsHTTPSamplerProxy.class, name = "HTTPSamplerProxy"),
@JsonSubTypes.Type(value = MsHeaderManager.class, name = "HeaderManager"),
@JsonSubTypes.Type(value = MsJSR223Processor.class, name = "JSR223Processor"),
@JsonSubTypes.Type(value = MsJSR223PostProcessor.class, name = "JSR223PostProcessor"),
@JsonSubTypes.Type(value = MsJSR223PreProcessor.class, name = "JSR223PreProcessor"),
@JsonSubTypes.Type(value = MsTestPlan.class, name = "TestPlan"),
@ -52,7 +54,7 @@ import java.util.List;
@JsonSubTypes.Type(value = MsScenario.class, name = "scenario"),
})
@JSONType(seeAlso = {MsHTTPSamplerProxy.class, MsHeaderManager.class, MsJSR223PostProcessor.class,
@JSONType(seeAlso = {MsHTTPSamplerProxy.class, MsHeaderManager.class, MsJSR223Processor.class, MsJSR223PostProcessor.class,
MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, AuthManager.class, MsAssertions.class,
MsExtract.class, MsTCPSampler.class, MsDubboSampler.class, MsJDBCSampler.class, MsConstantTimer.class, MsIfController.class, MsScenario.class}, typeKey = "type")
@Data
@ -118,7 +120,8 @@ public abstract class MsTestElement {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {});
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
});
hashTree.add(element);
} catch (Exception ex) {
ex.printStackTrace();

View File

@ -12,7 +12,7 @@ public interface ExtTestCaseReviewMapper {
List<TestCaseReviewDTO> list(@Param("request") QueryCaseReviewRequest params);
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId);
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId, @Param("projectId") String projectId);
List<TestReviewDTOWithMetric> listRelate(@Param("request") QueryTestReviewRequest request);

View File

@ -15,6 +15,9 @@
and test_case_review.name like CONCAT('%', #{request.name},'%')
</if>
and project.workspace_id = #{request.workspaceId}
<if test="request.projectId != null">
and test_case_review_project.project_id = #{request.projectId}
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
@ -32,6 +35,9 @@
test_case_review.id = test_case_review_project.review_id
and test_case_review_project.project_id = project.id
and project.workspace_id = #{workspaceId}
<if test="projectId != null">
and test_case_review_project.project_id = #{projectId}
</if>
and (
(test_case_review_users.review_id = test_case_review.id
and test_case_review_users.user_id = #{userId} )
@ -51,6 +57,9 @@
<if test="request.reviewerId != null">
and test_case_review_users.user_id = #{request.reviewerId}
</if>
<if test="request.projectId != null">
and test_case_review_project.project_id = #{request.projectId}
</if>
<if test="request.creator != null">
and (test_case_review.creator = #{request.creator}
<if test="request.reviewIds != null and request.reviewIds.size() > 0">

View File

@ -114,6 +114,9 @@
<if test="request.workspaceId != null">
AND test_plan.workspace_id = #{request.workspaceId}
</if>
<if test="request.projectId != null">
AND test_plan_project.project_id = #{request.projectId}
</if>
<if test="request.id != null">
AND test_plan.id = #{request.id}
</if>
@ -160,8 +163,13 @@
</select>
<select id="listRelate" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric">
select test_plan.* from test_plan
where test_plan.workspace_id = #{request.workspaceId}
select distinct test_plan.* from test_plan
inner join test_plan_project on test_plan.id = test_plan_project.test_plan_id
<where>
test_plan.workspace_id = #{request.workspaceId}
<if test="request.projectId != null">
and test_plan_project.project_id = #{request.projectId}
</if>
and (test_plan.principal = #{request.principal}
<if test="request.planIds != null and request.planIds.size() > 0">
or test_plan.id in
@ -170,6 +178,7 @@
</foreach>
</if>
)
</where>
order by test_plan.update_time desc
</select>

View File

@ -19,7 +19,7 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> listByNodes(@Param("request") QueryTestPlanCaseRequest request);
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);

View File

@ -270,8 +270,15 @@
select distinct plan_id from test_plan_test_case
inner join test_plan
on test_plan_test_case.plan_id = test_plan.id
where test_plan_test_case.executor = #{userId}
inner join test_plan_project
on test_plan.id = test_plan_project.test_plan_id
<where>
test_plan_test_case.executor = #{userId}
and test_plan.workspace_id = #{workspaceId}
<if test="projectId != null">
and test_plan_project.project_id = #{projectId}
</if>
</where>
</select>
<select id="getRecentTestedTestCase" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.*, test_case.*

View File

@ -11,7 +11,7 @@ public interface ExtTestReviewCaseMapper {
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
List<String> getStatusByReviewId(String reviewId);
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
/**
* 根据项目 ids 查询 TestReviewCaseDTO 列表

View File

@ -206,6 +206,7 @@
inner join project on project.id = test_case_review_project.project_id
where test_case_review_test_case.review_id = #{userId}
and project.workspace_id = #{workspaceId}
and test_case_review_project.project_id = #{projectId}
</select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select distinct * from test_case_review_test_case, test_case

View File

@ -68,4 +68,8 @@ public class SessionUtils {
public static String getCurrentOrganizationId() {
return Optional.ofNullable(getUser()).orElse(new SessionUser()).getLastOrganizationId();
}
public static String getCurrentProjectId() {
return Optional.ofNullable(getUser()).orElse(new SessionUser()).getLastProjectId();
}
}

View File

@ -81,8 +81,7 @@ public class TestCaseReviewController {
@PostMapping("/list/all")
public List<TestCaseReview> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
return testCaseReviewService.listCaseReviewAll(currentWorkspaceId);
return testCaseReviewService.listCaseReviewAll();
}
@PostMapping("/relevance")

View File

@ -35,4 +35,6 @@ public class QueryCaseReviewRequest extends TestCaseReviewTestCase {
private String method;
private Map<String, Object> combine;
private String projectId;
}

View File

@ -156,6 +156,7 @@ public class TestCaseReviewService {
public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
request.setProjectId(SessionUtils.getCurrentProjectId());
return extTestCaseReviewMapper.list(request);
}
@ -198,7 +199,7 @@ public class TestCaseReviewService {
}
public List<TestCaseReviewDTO> recent(String currentWorkspaceId) {
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId());
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId());
}
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
@ -346,21 +347,16 @@ public class TestCaseReviewService {
testCaseReviewTestCaseMapper.deleteByExample(testCaseReviewTestCaseExample);
}
public List<TestCaseReview> listCaseReviewAll(String currentWorkspaceId) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
List<Project> projects = projectMapper.selectByExample(projectExample);
List<String> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(projectIds)) {
TestCaseReviewProjectExample testCaseReviewProjectExample = new TestCaseReviewProjectExample();
testCaseReviewProjectExample.createCriteria().andProjectIdIn(projectIds);
List<TestCaseReviewProject> testCaseReviewProjects = testCaseReviewProjectMapper.selectByExample(testCaseReviewProjectExample);
List<String> reviewIds = testCaseReviewProjects.stream().map(TestCaseReviewProject::getReviewId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(reviewIds)) {
public List<TestCaseReview> listCaseReviewAll() {
TestCaseReviewProjectExample reviewProjectExample = new TestCaseReviewProjectExample();
TestCaseReviewProjectExample.Criteria criteria = reviewProjectExample.createCriteria();
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
List<TestCaseReviewProject> testCaseReviewProjects = testCaseReviewProjectMapper.selectByExample(reviewProjectExample);
if (!CollectionUtils.isEmpty(testCaseReviewProjects)) {
List<String> caseReviewIds = testCaseReviewProjects.stream().map(TestCaseReviewProject::getReviewId).collect(Collectors.toList());
TestCaseReviewExample testCaseReviewExample = new TestCaseReviewExample();
testCaseReviewExample.createCriteria().andIdIn(reviewIds);
testCaseReviewExample.createCriteria().andIdIn(caseReviewIds);
return testCaseReviewMapper.selectByExample(testCaseReviewExample);
}
}
@ -481,7 +477,8 @@ public class TestCaseReviewService {
request.setReviewerId(user.getId());
}
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
request.setProjectId(SessionUtils.getCurrentProjectId());
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId(), user.getLastProjectId()));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId());
@ -545,9 +542,11 @@ public class TestCaseReviewService {
if (userIds.size() > 0) {
for (String id : userIds) {
if (StringUtils.isNotBlank(userMap.get(id))) {
stringBuilder.append(userMap.get(id)).append("");
}
name = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
}
name = stringBuilder.substring(0, stringBuilder.length() - 1);
}
return name;
}

View File

@ -220,28 +220,18 @@ public class TestCaseService {
public List<TestCase> recentTestPlans(QueryTestCaseRequest request, int count) {
if (StringUtils.isBlank(request.getWorkspaceId())) {
return null;
}
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId());
List<String> projectIds = projectMapper.selectByExample(projectExample).stream()
.map(Project::getId).collect(Collectors.toList());
if (projectIds.isEmpty()) {
return null;
}
PageHelper.startPage(1, count, true);
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdIn(projectIds).andMaintainerEqualTo(request.getUserId());
TestCaseExample.Criteria criteria = testCaseExample.createCriteria();
criteria.andMaintainerEqualTo(request.getUserId());
String projectId = SessionUtils.getCurrentProjectId();
if (StringUtils.isNotBlank(projectId)) {
criteria.andProjectIdEqualTo(projectId);
testCaseExample.setOrderByClause("update_time desc, sort desc");
return testCaseMapper.selectByExample(testCaseExample);
}
return new ArrayList<>();
}
public Project getProjectByTestCaseId(String testCaseId) {
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(testCaseId);

View File

@ -327,6 +327,10 @@ public class TestPlanService {
public List<TestPlanDTOWithMetric> listTestPlan(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
String projectId = SessionUtils.getCurrentProjectId();
if (StringUtils.isNotBlank(projectId)) {
request.setProjectId(projectId);
}
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
calcTestPlanRate(testPlans);
return testPlans;
@ -392,25 +396,50 @@ public class TestPlanService {
if (StringUtils.isBlank(currentWorkspaceId)) {
return null;
}
TestPlanProjectExample testPlanProjectExample = new TestPlanProjectExample();
TestPlanProjectExample.Criteria criteria = testPlanProjectExample.createCriteria();
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
List<TestPlanProject> testPlanProjects = testPlanProjectMapper.selectByExample(testPlanProjectExample);
if (!CollectionUtils.isEmpty(testPlanProjects)) {
List<String> testPlanIds = testPlanProjects.stream().map(TestPlanProject::getTestPlanId).collect(Collectors.toList());
TestPlanExample testPlanTestCaseExample = new TestPlanExample();
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId)
.andIdIn(testPlanIds)
.andPrincipalEqualTo(SessionUtils.getUserId());
testPlanTestCaseExample.setOrderByClause("update_time desc");
return testPlanMapper.selectByExample(testPlanTestCaseExample);
}
}
return new ArrayList<>();
}
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {
TestPlanProjectExample testPlanProjectExample = new TestPlanProjectExample();
TestPlanProjectExample.Criteria criteria = testPlanProjectExample.createCriteria();
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
List<TestPlanProject> testPlanProjects = testPlanProjectMapper.selectByExample(testPlanProjectExample);
if (!CollectionUtils.isEmpty(testPlanProjects)) {
List<String> testPlanIds = testPlanProjects.stream().map(TestPlanProject::getTestPlanId).collect(Collectors.toList());
TestPlanExample testPlanExample = new TestPlanExample();
testPlanExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
TestPlanExample.Criteria testPlanCriteria = testPlanExample.createCriteria();
testPlanCriteria.andWorkspaceIdEqualTo(currentWorkspaceId);
testPlanCriteria.andIdIn(testPlanIds);
return testPlanMapper.selectByExample(testPlanExample);
}
}
return new ArrayList<>();
}
public List<TestPlanDTOWithMetric> listRelateAllPlan() {
SessionUser user = SessionUtils.getUser();
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setPrincipal(user.getId());
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
request.setProjectId(SessionUtils.getCurrentProjectId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId()));
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.listRelate(request);
calcTestPlanRate(testPlans);
return testPlans;

View File

@ -123,7 +123,7 @@ public class TestPlanTestCaseService {
public void buildQueryRequest(QueryTestPlanCaseRequest request, int count) {
SessionUser user = SessionUtils.getUser();
List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId());
List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId());
PageHelper.startPage(1, count, true);
request.setPlanIds(relateTestPlanIds);
request.setExecutor(user.getId());

View File

@ -14,6 +14,7 @@ import io.metersphere.xmind.parser.XmindParser;
import io.metersphere.xmind.parser.pojo.Attached;
import io.metersphere.xmind.parser.pojo.JsonRootBean;
import io.metersphere.xmind.utils.DetailUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
@ -185,7 +186,7 @@ public class XmindCaseParser {
String nodePath = parent.getPath() + "/" + item.getTitle();
item.setPath(nodePath);
item.setParent(parent);
if (item.getChildren() != null && !item.getChildren().getAttached().isEmpty()) {
if (item.getChildren() != null && CollectionUtils.isNotEmpty(item.getChildren().getAttached())) {
recursion(item, level + 1, item.getChildren().getAttached());
} else {
if (!nodePath.startsWith("/")) {

View File

@ -2,21 +2,32 @@
<div v-loading="loading">
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" v-if="request.referenced">
<div class="el-step__icon is-text ms-api-col" v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF'">
<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-inner">{{request.index}}</div>
</div>
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
@click="active(request)" v-if="request.referenced!=undefined && request.referenced!='Deleted' && request.referenced!='REF'"/>
<span>{{request.type!= 'create' ? request.name:''}} </span>
<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF'" class="ms-left-buttion" size="small">
{{$t('api_test.automation.api_list_import')}}
</el-button>
<el-button v-if="request.referenced==undefined || request.referenced==='Created' || request.referenced==='Copy'" class="ms-create-buttion" size="small">
{{$t('api_test.automation.customize_req')}}
</el-button>
<span v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF'">{{request.name}} </span>
<el-input size="small" v-model="request.name" style="width: 40%;" :placeholder="$t('commons.input_name')" v-else/>
<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
<el-tag size="mini" style="margin-left: 20px" v-if="request.referenced ==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
<div style="margin-right: 20px; float: right">
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
@click="active(request)" v-if="request.referenced!=undefined && request.referenced!='Deleted' && request.referenced!='REF'"/>
<el-switch v-model="request.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px"/>
</div>
</el-row>
<!-- 请求参数-->
<el-collapse-transition>
@ -112,6 +123,12 @@
color: #F56C6C;
}
.ms-left-buttion {
color: #F56C6C;
background-color: #FCF1F1;
margin-right: 20px;
}
.ms-api-col-create {
background-color: #EBF2F2;
border-color: #008080;
@ -127,6 +144,12 @@
transform: rotate(90deg);
}
.ms-create-buttion {
color: #008080;
background-color: #EBF2F2;
margin-right: 20px;
}
.tip {
padding: 3px 5px;
font-size: 16px;

View File

@ -61,7 +61,9 @@
this.request.method = row.method;
}
this.request.resourceId = getUUID();
this.$emit('addCustomizeApi', this.request);
let obj = {};
Object.assign(obj, this.request);
this.$emit('addCustomizeApi', obj);
},
reload() {
this.loading = true

View File

@ -2,13 +2,17 @@
<div v-loading="loading">
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{scenario.index}}</div>
</div>
<div style="margin-left: 20px;float: left"> {{scenario.name}}</div>
<el-button class="ms-title-buttion" size="small">{{$t('api_test.automation.scenario_import')}}</el-button>
{{scenario.name}}
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='Deleted'" type="danger">{{$t('api_test.automation.reference_deleted')}}</el-tag>
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
<div style="margin-right: 20px; float: right">
<el-switch v-model="scenario.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px"/>
</div>
</el-row>
</el-card>
</div>
@ -73,6 +77,12 @@
padding: 15px;
}
.ms-title-buttion {
background-color: #F4F4F5;
margin-right: 20px;
color: #606266;
}
.icon.is-active {
transform: rotate(90deg);
}

View File

@ -2,23 +2,15 @@
<div>
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{timer.index}}</div>
</div>
<div>
<el-row :gutter="10" type="flex" align="middle">
<el-col :span="2">{{ $t('api_test.request.wait') }}</el-col>
<el-col :span="10">
<el-button class="ms-title-buttion" size="small">{{$t('api_test.automation.wait_controller')}}</el-button>
<el-input-number class="width-100" size="small" v-model="timer.delay" :min="0" :step="1000"/>
</el-col>
<el-col :span="2">ms</el-col>
<el-col :span="8">
<el-switch v-model="timer.enable" :inactive-text="$t('api_test.scenario.enable_disable')"/>
</el-col>
<el-col :span="2">
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove"/>
</el-col>
</el-row>
ms
<div style="margin-right: 20px; float: right">
<el-switch v-model="timer.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
</div>
</el-row>
</el-card>
@ -37,7 +29,7 @@
},
methods: {
remove() {
this.$emit('remove', this.timer,this.node);
this.$emit('remove', this.timer, this.node);
}
}
}
@ -45,7 +37,7 @@
<style scoped>
.width-100 {
width: 100%
width: 40%
}
.ms-api-col {
@ -55,6 +47,12 @@
color: #67C23A;
}
.ms-title-buttion {
background-color: #F2F9EE;
color: #67C23A;
margin-right: 20px;
}
/deep/ .el-card__body {
padding: 15px;
}

View File

@ -1,10 +1,10 @@
<template>
<el-card class="card-content">
<div style="background-color: white;">
<div class="ms-main-div">
<el-row>
<el-col>
<!--操作按钮-->
<div style="float: right;margin-right: 20px">
<div class="ms-opt-btn">
<el-button type="primary" size="small" @click="editScenario">{{$t('commons.save')}}</el-button>
</div>
</el-col>
@ -119,7 +119,7 @@
<el-row>
<el-col :span="21">
<!-- 调试部分 -->
<div style="margin-left: 20px;border:1px #DCDFE6 solid;border-radius: 4px;margin-right: 10px">
<div class="ms-debug-div">
<el-row style="margin: 5px">
<el-col :span="6" class="ms-col-one">
{{currentScenario.name ===undefined || ''? $t('api_test.scenario.name') : currentScenario.name}}
@ -199,37 +199,37 @@
<el-button type="primary" icon="el-icon-refresh" size="small" @click="showAll">{{$t('commons.show_all')}}</el-button>
<br/>
<div v-if="operatingElements.indexOf('HTTPSamplerProxy')>0 || operatingElements.indexOf('DubboSampler')>0 || operatingElements.indexOf('JDBCSampler')>0 || operatingElements.indexOf('TCPSampler')>0 ">
<el-button class="ms-right-buttion" size="small" style="color: #F56C6C;background-color: #FCF1F1" @click="apiListImport">+{{$t('api_test.automation.api_list_import')}}</el-button>
<el-button class="ms-right-buttion ms-btn-1" size="small" @click="apiListImport">+{{$t('api_test.automation.api_list_import')}}</el-button>
</div>
<!--<div v-if="operatingElements.indexOf('OT_IMPORT')>0">
<el-button class="ms-right-buttion" size="small" style="color: #409EFF;background-color: #EEF5FE" @click="addComponent('OT_IMPORT')">+{{$t('api_test.automation.external_import')}}</el-button>
</div>-->
<div v-if="operatingElements.indexOf('ConstantTimer')>0">
<el-button class="ms-right-buttion" size="small" style="color: #67C23A;background-color: #F2F9EE" @click="addComponent('ConstantTimer')">+{{$t('api_test.automation.wait_controller')}}</el-button>
<el-button class="ms-right-buttion ms-btn-3" size="small" @click="addComponent('ConstantTimer')">+{{$t('api_test.automation.wait_controller')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('IfController')>0">
<el-button class="ms-right-buttion" size="small" style="color: #E6A23C;background-color: #FCF6EE" @click="addComponent('IfController')">+{{$t('api_test.automation.if_controller')}}</el-button>
<el-button class="ms-right-buttion ms-btn-4" size="small" @click="addComponent('IfController')">+{{$t('api_test.automation.if_controller')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('scenario')===0">
<el-button class="ms-right-buttion" size="small" style="color: #606266;background-color: #F4F4F5" @click="addComponent('scenario')">+{{$t('api_test.automation.scenario_import')}}</el-button>
<el-button class="ms-right-buttion ms-btn-5" size="small" @click="addComponent('scenario')">+{{$t('api_test.automation.scenario_import')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223Processor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #7B4D12;background-color: #F1EEE9" @click="addComponent('JSR223Processor')">+{{$t('api_test.automation.customize_script')}}</el-button>
<el-button class="ms-right-buttion ms-btn-6" size="small" @click="addComponent('JSR223Processor')">+{{$t('api_test.automation.customize_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('CustomizeReq')>0">
<el-button class="ms-right-buttion" size="small" style="color: #008080;background-color: #EBF2F2" @click="addComponent('CustomizeReq')">+{{$t('api_test.automation.customize_req')}}</el-button>
<el-button class="ms-right-buttion ms-btn-7" size="small" @click="addComponent('CustomizeReq')">+{{$t('api_test.automation.customize_req')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223PreProcessor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addComponent('JSR223PreProcessor')">+{{$t('api_test.definition.request.pre_script')}}</el-button>
<el-button class="ms-right-buttion ms-btn-8" size="small" @click="addComponent('JSR223PreProcessor')">+{{$t('api_test.definition.request.pre_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('JSR223PostProcessor')>0">
<el-button class="ms-right-buttion" size="small" style="color: #783887;background-color: #F2ECF3" @click="addComponent('JSR223PostProcessor')">+{{$t('api_test.definition.request.post_script')}}</el-button>
<el-button class="ms-right-buttion ms-btn-9" size="small" @click="addComponent('JSR223PostProcessor')">+{{$t('api_test.definition.request.post_script')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('Assertions')>0">
<el-button class="ms-right-buttion" size="small" style="color: #A30014;background-color: #F7E6E9" @click="addComponent('Assertions')">+{{$t('api_test.definition.request.assertions_rule')}}</el-button>
<el-button class="ms-right-buttion ms-btn-10" size="small" @click="addComponent('Assertions')">+{{$t('api_test.definition.request.assertions_rule')}}</el-button>
</div>
<div v-if="operatingElements.indexOf('Extract')>0">
<el-button class="ms-right-buttion" size="small" style="color: #015478;background-color: #E6EEF2" @click="addComponent('Extract')">+{{$t('api_test.definition.request.extract_param')}}</el-button>
<el-button class="ms-right-buttion ms-btn-11" size="small" @click="addComponent('Extract')">+{{$t('api_test.definition.request.extract_param')}}</el-button>
</div>
</el-col>
</div>
@ -245,7 +245,7 @@
<!--自定义接口-->
<el-drawer :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.customize_req')" style="overflow: auto" :modal="false" size="90%">
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi" />
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi"/>
<!--<el-button style="float: right;margin: 20px" @click="addCustomizeApi">{{$t('commons.save')}}</el-button>-->
</el-drawer>
<!--场景导入 -->
@ -361,38 +361,6 @@
},
watch: {},
methods: {
nodeClick(e) {
if (e.referenced != 'REF' && e.referenced != 'Deleted') {
this.operatingElements = ELEMENTS.get(e.type);
} else {
this.operatingElements = [];
}
this.selectedTreeNode = e;
},
showAll() {
this.operatingElements = ELEMENTS.get("ALL");
this.selectedTreeNode = undefined;
this.reload();
},
apiListImport() {
this.apiListVisible = true;
},
recursiveSorting(arr) {
for (let i in arr) {
arr[i].index = Number(i) + 1;
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
}
}
},
sort() {
for (let i in this.scenarioDefinition) {
this.scenarioDefinition[i].index = Number(i) + 1;
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
}
}
},
addComponent(type) {
switch (type) {
case ELEMENT_TYPE.IfController:
@ -436,8 +404,41 @@
this.sort();
this.reload();
},
nodeClick(e) {
if (e.referenced != 'REF' && e.referenced != 'Deleted') {
this.operatingElements = ELEMENTS.get(e.type);
} else {
this.operatingElements = [];
}
this.selectedTreeNode = e;
},
showAll() {
this.operatingElements = ELEMENTS.get("ALL");
this.selectedTreeNode = undefined;
this.reload();
},
apiListImport() {
this.apiListVisible = true;
},
recursiveSorting(arr) {
for (let i in arr) {
arr[i].index = Number(i) + 1;
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
}
}
},
sort() {
for (let i in this.scenarioDefinition) {
this.scenarioDefinition[i].index = Number(i) + 1;
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
}
}
},
addCustomizeApi(request) {
this.customizeVisible = false;
request.enable === undefined ? request.enable = true : request.enable;
if (this.selectedTreeNode != undefined) {
this.selectedTreeNode.hashTree.push(request);
} else {
@ -450,6 +451,7 @@
addScenario(arr) {
if (arr.length > 0) {
arr.forEach(item => {
item.enable === undefined ? item.enable = true : item.enable;
this.scenarioDefinition.push(item);
})
}
@ -470,6 +472,7 @@
request = item.request;
}
request.referenced = referenced;
request.enable === undefined ? request.enable = true : request.enable;
request.active = false;
request.resourceId = getUUID();
if (referenced === 'REF') {
@ -489,6 +492,7 @@
request = item.request;
}
request.referenced = referenced;
request.enable === undefined ? request.enable = true : request.enable;
request.active = false;
request.resourceId = getUUID();
if (referenced === 'REF') {
@ -734,6 +738,22 @@
width: 100%;
}
.ms-main-div {
background-color: white;
}
.ms-opt-btn {
float: right;
margin-right: 20px;
}
.ms-debug-div {
margin-left: 20px;
border: 1px #DCDFE6 solid;
border-radius: 4px;
margin-right: 10px;
}
.ms-scenario-button {
margin-left: 30%;
padding: 7px;
@ -761,6 +781,61 @@
margin-top: 10px;
}
.ms-btn-1 {
color: #F56C6C;
background-color: #FCF1F1
}
.ms-btn-2 {
color: #F56C6C;
background-color: #FCF1F1
}
.ms-btn-3 {
color: #67C23A;
background-color: #F2F9EE
}
.ms-btn-4 {
color: #E6A23C;
background-color: #FCF6EE
}
.ms-btn-5 {
color: #606266;
background-color: #F4F4F5
}
.ms-btn-6 {
color: #7B4D12;
background-color: #F1EEE9
}
.ms-btn-7 {
color: #008080;
background-color: #EBF2F2
}
.ms-btn-8 {
color: #B8741A;
background-color: #F9F1EA
}
.ms-btn-9 {
color: #783887;
background-color: #F2ECF3
}
.ms-btn-10 {
color: #A30014;
background-color: #F7E6E9
}
.ms-btn-11 {
color: #015478;
background-color: #E6EEF2
}
/deep/ .el-tree-node__content {
height: 100%;
margin-top: 8px;
@ -775,4 +850,7 @@
overflow: auto;
}
/deep/ .el-step__icon.is-text {
border: 1px solid;
}
</style>

View File

@ -1,31 +1,22 @@
<template>
<el-card>
<el-row>
<div class="el-step__icon is-text ms-api-col" style="float: left">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{controller.index}}</div>
</div>
<div>
<el-row :gutter="10" type="flex" align="middle">
<el-col :span="1">If</el-col>
<el-col :span="6">
<el-input size="small" v-model="controller.variable" :placeholder="$t('api_test.request.condition_variable')"/>
</el-col>
<el-col :span="5">
<el-button class="ms-title-buttion" size="small">{{$t('api_test.automation.if_controller')}}</el-button>
<el-input size="small" v-model="controller.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/>
<el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small"
@change="change">
@change="change" style="width: 10%;margin-left: 10px">
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
</el-select>
</el-col>
<el-col :span="6">
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator"/>
</el-col>
<el-col :span="4">
<el-switch v-model="controller.enable" :inactive-text="$t('api_test.scenario.enable_disable')"/>
</el-col>
<el-col :span="2">
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click="remove"/>
</el-col>
</el-row>
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator" style="width: 20%;margin-left: 20px"/>
<div style="margin-right: 20px; float: right">
<el-switch v-model="controller.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
</div>
</el-row>
</el-card>
@ -102,4 +93,10 @@
margin-right: 10px;
color: #E6A23C;
}
.ms-title-buttion {
background-color: #FCF6EE;
margin-right: 20px;
color: #E6A23C;
}
</style>

View File

@ -6,9 +6,12 @@
<div class="el-step__icon-inner">{{jsr223ProcessorData.index}}</div>
</div>
<el-button class="ms-left-buttion" size="small" :style="styleType" style="color: #B8741A;background-color: #F9F1EA">{{title}}</el-button>
<el-input size="small" v-model="jsr223ProcessorData.name" :placeholder="$t('commons.input_name')" class="ms-api-header-select" style="width: 40%"/>
<div style="margin-right: 20px; float: right">
<i class="icon el-icon-arrow-right" :class="{'is-active': this.jsr223ProcessorData.active}" @click="changeActive" style="margin-left: 20px"/>
<el-input size="small" v-model="jsr223ProcessorData.name" class="ms-api-header-select" style="width: 380px"/>
<el-button size="small" style="float: right" @click="remove">{{$t('commons.remove')}}</el-button>
<el-switch v-model="jsr223ProcessorData.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
</div>
</div>
</el-row>
<el-collapse-transition>

View File

@ -6,8 +6,17 @@
<div class="el-step__icon-inner">{{assertions.index}}</div>
</div>
<el-button class="ms-left-buttion" size="small" style="color: #A30014;background-color: #F7E6E9">{{$t('api_test.definition.request.assertions_rule')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">{{$t('commons.remove')}}</el-button>
<el-input size="small" v-model="assertions.name" style="width: 40%;margin-left: 20px" :placeholder="$t('commons.input_name')"/>
<div style="margin-right: 20px; float: right">
<i class="icon el-icon-arrow-right" :class="{'is-active': assertions.active}" @click="active(assertions)" style="margin-left: 20px"/>
<el-switch v-model="assertions.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
</div>
</div>
<!-- 请求参数-->
<el-collapse-transition>
<div v-if="assertions.active">
<div class="assertion-add">
<el-row :gutter="10">
<el-col :span="4">
@ -38,8 +47,10 @@
</el-col>
</el-row>
</div>
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" :reloadData="reloadData" style="margin-bottom: 20px"/>
</div>
</el-collapse-transition>
</el-card>
</div>
</template>
@ -72,7 +83,7 @@
node: {},
request: {},
customizeStyle: {
type:String,
type: String,
default: "margin-top: 10px"
},
scenario: Scenario,
@ -111,8 +122,12 @@
this.loading = false
})
},
active(item) {
item.active = !item.active;
this.reload();
},
remove() {
this.$emit('remove', this.assertions,this.node);
this.$emit('remove', this.assertions, this.node);
},
addJsonpathSuggest(jsonPathList) {
jsonPathList.forEach(jsonPath => {
@ -142,31 +157,11 @@
border-radius: 5px;
}
.bg-purple-dark {
background: #99a9bf;
.icon.is-active {
transform: rotate(90deg);
}
.bg-purple {
background: #d3dce6;
/deep/ .el-card__body {
padding: 15px;
}
.bg-purple-light {
background: #e5e9f2;
}
.grid-content {
border-radius: 4px;
min-height: 36px;
}
.row-bg {
padding: 10px 0;
background-color: #f9fafc;
}
.json-path-suggest-button {
margin-top: 20px;
margin-left: 20px;
}
</style>

View File

@ -1,12 +1,19 @@
<template>
<div :style="customizeStyle">
<div :style="customizeStyle" v-loading="loading">
<el-card>
<div class="el-step__icon is-text" style="color: #015478;background-color: #E6EEF2;margin-right: 10px" v-if="extract.index">
<div class="el-step__icon-inner">{{extract.index}}</div>
</div>
<el-button class="ms-left-buttion" size="small" style="color: #015478;background-color: #E6EEF2">{{$t('api_test.definition.request.extract_param')}}</el-button>
<el-button size="small" style="float: right;margin-top: 0px" @click="remove">移除</el-button>
<el-input size="small" v-model="extract.name" style="width: 40%;margin-left: 20px" :placeholder="$t('commons.input_name')"/>
<div style="margin-right: 20px; float: right">
<i class="icon el-icon-arrow-right" :class="{'is-active': extract.active}" @click="active(extract)" style="margin-left: 20px"/>
<el-switch v-model="extract.enable" style="margin-left: 10px"/>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
</div>
<!-- 请求参数-->
<el-collapse-transition>
<div v-if="extract.active">
<div style="margin: 20px">
<div class="extract-description">
{{$t('api_test.request.extract.description')}}
@ -30,6 +37,8 @@
</div>
<ms-api-extract-edit :is-read-only="isReadOnly" :reloadData="reloadData" :extract="extract"/>
</div>
</div>
</el-collapse-transition>
</el-card>
</div>
</template>
@ -66,6 +75,7 @@
options: EXTRACT_TYPE,
type: "",
reloadData: "",
loading: false,
}
},
@ -77,9 +87,17 @@
remove() {
this.$emit('remove', this.extract, this.node);
},
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
active(item) {
item.active = !item.active;
this.reload();
},
},
computed: {
list() {
switch (this.type) {
@ -113,4 +131,12 @@
margin: 5px 0;
border-radius: 5px;
}
.icon.is-active {
transform: rotate(90deg);
}
/deep/ .el-card__body {
padding: 15px;
}
</style>

View File

@ -1,11 +1,12 @@
<template>
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin-top: 20px">
<div style="margin-top: 10px">
<el-card>
<el-row>
<div>
<el-button class="ms-left-buttion" size="small" :style="styleType" style="color: #B8741A;background-color: #F9F1EA">{{title}}</el-button>
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" @click="changeActive" style="margin-left: 20px"/>
<el-input size="small" v-model="jsr223ProcessorData.name" class="ms-api-header-select" style="width: 380px"/>
<el-button size="small" style="float: right" @click="remove">移除</el-button>
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-right: 20px; float: right"/>
</div>
</el-row>
<el-collapse-transition>
@ -37,6 +38,7 @@
</el-row>
</div>
</el-collapse-transition>
</el-card>
</div>
</template>
@ -138,7 +140,7 @@
}
this.reload();
},
remove(){
remove() {
this.$emit('remove', this.jsr223ProcessorData);
},
reload() {
@ -195,4 +197,7 @@
.icon.is-active {
transform: rotate(90deg);
}
/deep/ .el-card__body {
padding: 15px;
}
</style>

View File

@ -776,7 +776,7 @@ export class Assertions extends BaseConfig {
this.jsr223 = [];
this.xpath2 = [];
this.duration = undefined;
this.enable = true;
this.set(options);
this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xpath2: XPath2}, options);
}
@ -843,6 +843,7 @@ export class JSR223Processor extends BaseConfig {
this.type = "JSR223Processor";
this.script = undefined;
this.language = "beanshell";
this.enable = true;
this.set(options);
}
}
@ -917,7 +918,7 @@ export class Extract extends BaseConfig {
this.regex = [];
this.json = [];
this.xpath = [];
this.enable = true;
this.set(options);
let types = {
json: ExtractJSONPath,

View File

@ -2,11 +2,6 @@
<ms-container>
<ms-aside-container>
<select-menu
:data="projects"
:current-data="currentProject"
:title="$t('test_track.project')"
@dataChange="changeProject"/>
<node-tree
class="node-tree"
v-loading="result.loading"
@ -17,13 +12,13 @@
:draggable="nodeTreeDraggable"
:select-node.sync="selectNode"
@refreshTable="refreshTable"
:current-project="currentProject"
:current-project="{id:currentProject}"
ref="nodeTree"/>
</ms-aside-container>
<ms-main-container>
<test-case-list
:current-project="currentProject"
:current-project="{id:currentProject}"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
@testCaseEdit="editTestCase"
@ -41,7 +36,7 @@
:read-only="testCaseReadOnly"
:tree-nodes="treeNodes"
:select-node="selectNode"
:current-project="currentProject"
:current-project="{id:currentProject}"
ref="testCaseEditDialog">
</test-case-edit>
@ -57,7 +52,7 @@
import NodeTree from '../common/NodeTree';
import TestCaseEdit from './components/TestCaseEdit';
import {CURRENT_PROJECT, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
import TestCaseList from "./components/TestCaseList";
import SelectMenu from "../common/SelectMenu";
import TestCaseMove from "./components/TestCaseMove";
@ -90,11 +85,15 @@ export default {
nodeTreeDraggable: true,
}
},
activated() {
this.currentProject = localStorage.getItem(PROJECT_ID);
},
mounted() {
this.init(this.$route);
},
watch: {
'$route'(to, from) {
// console.log(this.$route.params.projectId)
this.init(to);
},
currentProject() {
@ -105,7 +104,7 @@ export default {
init(route) {
let path = route.path;
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
this.getProjects();
// this.getProjects();
this.testCaseReadOnly = false;
if (!checkoutTestManagerOrTestUser()) {
this.testCaseReadOnly = true;
@ -113,48 +112,49 @@ export default {
let caseId = this.$route.params.caseId;
this.openRecentTestCaseEditDialog(caseId);
this.$router.push('/track/case/all');
} else if (route.params.projectId) {
this.getProjects();
this.getProjectById(route.params.projectId);
}
// else if (route.params.projectId) {
// this.getProjects();
// this.getProjectById(route.params.projectId);
// }
},
getProjects() {
this.$get("/project/listAll", (response) => {
this.projects = response.data;
let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
if (lastProject) {
let hasCurrentProject = false;
for (let i = 0; i < this.projects.length; i++) {
if (this.projects[i].id == lastProject.id) {
this.currentProject = lastProject;
hasCurrentProject = true;
break;
}
}
if (!hasCurrentProject) {
this.setCurrentProject(this.projects[0]);
}
} else {
if (this.projects.length > 0) {
this.setCurrentProject(this.projects[0]);
}
}
// this.checkProject();
});
},
checkProject() {
if (this.currentProject === null) {
this.$alert(this.$t('test_track.case.no_project'), {
confirmButtonText: this.$t('project.create'),
callback: action => {
this.$router.push("/track/project/create");
}
});
}
},
changeProject(project) {
this.setCurrentProject(project);
},
// getProjects() {
// this.$get("/project/listAll", (response) => {
// this.projects = response.data;
// let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
// if (lastProject) {
// let hasCurrentProject = false;
// for (let i = 0; i < this.projects.length; i++) {
// if (this.projects[i].id == lastProject.id) {
// this.currentProject = lastProject;
// hasCurrentProject = true;
// break;
// }
// }
// if (!hasCurrentProject) {
// this.setCurrentProject(this.projects[0]);
// }
// } else {
// if (this.projects.length > 0) {
// this.setCurrentProject(this.projects[0]);
// }
// }
// // this.checkProject();
// });
// },
// checkProject() {
// if (this.currentProject === null) {
// this.$alert(this.$t('test_track.case.no_project'), {
// confirmButtonText: this.$t('project.create'),
// callback: action => {
// this.$router.push("/track/project/create");
// }
// });
// }
// },
// changeProject(project) {
// this.setCurrentProject(project);
// },
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
@ -182,21 +182,21 @@ export default {
this.testCaseReadOnly = true;
this.$refs.testCaseEditDialog.open(testCase);
},
getProjectByCaseId(caseId) {
return this.$get('/test/case/project/' + caseId, async response => {
this.setCurrentProject(response.data);
});
},
// getProjectByCaseId(caseId) {
// return this.$get('/test/case/project/' + caseId, async response => {
// this.setCurrentProject(response.data);
// });
// },
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.selectNode = {};
this.$refs.testCaseList.initTableData();
this.refreshTable();
this.getNodeTree();
},
openRecentTestCaseEditDialog(caseId) {
if (caseId) {
this.getProjectByCaseId(caseId);
// this.getProjectByCaseId(caseId);
this.$get('/test/case/get/' + caseId, response => {
if (response.data) {
this.$refs.testCaseEditDialog.open(response.data);
@ -206,31 +206,31 @@ export default {
this.$refs.testCaseEditDialog.open();
}
},
getProjectById(id) {
if (id && id != 'all') {
this.$get('/project/get/' + id, response => {
let project = response.data;
this.setCurrentProject(project);
// this.$router.push('/track/case/all');
});
}
if (id === 'all') {
this.refresh();
}
},
setCurrentProject(project) {
if (project) {
this.currentProject = project;
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
}
this.refresh();
},
// getProjectById(id) {
// if (id && id != 'all') {
// this.$get('/project/get/' + id, response => {
// let project = response.data;
// this.setCurrentProject(project);
// // this.$router.push('/track/case/all');
// });
// }
// if (id === 'all') {
// this.refresh();
// }
// },
// setCurrentProject(project) {
// if (project) {
// this.currentProject = project;
// localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
// }
// this.refresh();
// },
getNodeTree() {
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.nodeTreeDraggable = false;
}
if (this.currentProject) {
this.result = this.$get("/case/node/list/" + this.currentProject.id, response => {
this.result = this.$get("/case/node/list/" + this.currentProject, response => {
this.treeNodes = response.data;
});
}

View File

@ -489,7 +489,7 @@ export default {
param.nodePath = item.path;
}
});
if (this.currentProject) {
if (this.currentProject.id) {
param.projectId = this.currentProject.id;
}
param.name = param.name.trim();
@ -563,7 +563,7 @@ export default {
},
getTestOptions() {
this.testOptions = [];
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
if (this.currentProject.id && this.form.type != '' && this.form.type != 'functional') {
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
this.testOptions = response.data;
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})

View File

@ -302,7 +302,9 @@ export default {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
if (this.currentProject.id) {
this.getData();
}
},
getData() {
if (this.currentProject) {

View File

@ -135,14 +135,14 @@ export default {
},
init() {
let path = this.$route.path;
if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
this.testCaseProjectPath = path;
//
this.isProjectActivation = false;
this.reload();
} else {
this.isProjectActivation = true;
}
// if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
// this.testCaseProjectPath = path;
// //
// this.isProjectActivation = false;
// this.reload();
// } else {
// this.isProjectActivation = true;
// }
if (path.indexOf("/track/plan/view") >= 0) {
this.testPlanViewPath = path;
this.reload();
@ -151,6 +151,10 @@ export default {
this.testCaseEditPath = path;
this.reload();
}
if (path.indexOf("/track/review/view") >= 0) {
this.testCaseReviewEditPath = path;
this.reload();
}
},
registerEvents() {
TrackEvent.$on(LIST_CHANGE, () => {

View File

@ -1,4 +1,3 @@
import MsProject from "@/business/components/settings/project/MsProject";
const TestTrack = () => import('@/business/components/track/TestTrack')
const TrackHome = () => import('@/business/components/track/home/TrackHome')

@ -1 +1 @@
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a