feat: 测试计划-接口,性能与版本关联
This commit is contained in:
parent
0e8123cbb2
commit
c55350f2ec
|
@ -33,8 +33,6 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
|
|||
private String reviewId;
|
||||
private String deleteUserId;
|
||||
private long deleteTime;
|
||||
private String refId;
|
||||
private String versionId;
|
||||
/**
|
||||
* 检查待更新的(近三天有更新的或者状态为error的)
|
||||
*/
|
||||
|
|
|
@ -369,8 +369,35 @@
|
|||
</select>
|
||||
<select id="listRelevance" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
|
||||
select
|
||||
<include refid="io.metersphere.base.mapper.ApiDefinitionMapper.Base_Column_List"/>
|
||||
api_definition.version_id versionId,
|
||||
project_version.name versionName,
|
||||
api_definition.id,
|
||||
api_definition.project_id,
|
||||
api_definition.`name`,
|
||||
api_definition.`method`,
|
||||
api_definition.protocol,
|
||||
api_definition.`path`,
|
||||
api_definition.module_path,
|
||||
api_definition.environment_id,
|
||||
api_definition.schedule,
|
||||
api_definition.`status`,
|
||||
api_definition.module_id,
|
||||
api_definition.user_id,
|
||||
api_definition.create_time,
|
||||
api_definition.update_time,
|
||||
api_definition.num,
|
||||
api_definition.tags,
|
||||
api_definition.original_state,
|
||||
api_definition.create_user,
|
||||
api_definition.case_total,
|
||||
api_definition.case_status,
|
||||
api_definition.case_passing_rate,
|
||||
api_definition.delete_time,
|
||||
api_definition.delete_user_id,
|
||||
api_definition.`order`,
|
||||
api_definition.ref_id
|
||||
from api_definition
|
||||
left join project_version on api_definition.project_id = project_version.project_id and api_definition.version_id = project_version.id
|
||||
<where>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
|
@ -425,6 +452,12 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='version_id'">
|
||||
and api_definition.version_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
@ -442,6 +475,32 @@
|
|||
)
|
||||
)
|
||||
</if>
|
||||
<if test="request.versionId != null">
|
||||
and api_definition.version_id = #{request.versionId}
|
||||
</if>
|
||||
<if test="request.refId != null">
|
||||
and api_definition.ref_id = #{request.refId}
|
||||
</if>
|
||||
<if test="request.versionId == null and request.refId == null and request.id == null">
|
||||
AND (
|
||||
version_id = (SELECT project_version.id
|
||||
FROM api_definition tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
|
||||
WHERE ref_id = api_definition.ref_id
|
||||
LIMIT 1)
|
||||
OR
|
||||
version_id = (SELECT project_version.id
|
||||
FROM api_definition tmp
|
||||
JOIN project_version ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id
|
||||
WHERE ref_id = api_definition.ref_id
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(project_version.create_time) DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
|
|
|
@ -132,6 +132,12 @@
|
|||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
<choose>
|
||||
<when test="key == 'id'">
|
||||
AND load_test.id IN
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key == 'status'">
|
||||
AND load_test.status IN
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
project_version.id as versionId
|
||||
from test_case
|
||||
left join test_case_review_test_case as T2 on test_case.id=T2.case_id and T2.review_id =#{request.reviewId}
|
||||
left join project_version on test_case.version_id = project_version.id
|
||||
left join project_version on test_case.version_id = project_version.id and test_casel.project_id = project_version.project_id
|
||||
<include refid="notInQueryWhereCondition"/>
|
||||
and T2.case_id is null
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
|
|
|
@ -28,10 +28,36 @@
|
|||
</select>
|
||||
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
|
||||
select
|
||||
t.id, t.environment_id,(select name from api_test_environment where id = t.environment_id) as environment_name, t.create_time, t.update_time,
|
||||
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id,
|
||||
c.update_user_id, c.num, c.tags, t.create_user,
|
||||
a.module_id, a.path, a.protocol, t.status execResult, a.user_id
|
||||
t.id,
|
||||
t.environment_id,
|
||||
(
|
||||
SELECT
|
||||
NAME
|
||||
FROM
|
||||
api_test_environment
|
||||
WHERE
|
||||
id = t.environment_id
|
||||
) AS environment_name,
|
||||
t.create_time,
|
||||
t.update_time,
|
||||
c.id AS case_id,
|
||||
c.project_id,
|
||||
c.name,
|
||||
c.api_definition_id,
|
||||
c.priority,
|
||||
c.description,
|
||||
c.create_user_id,
|
||||
c.update_user_id,
|
||||
c.num,
|
||||
c.tags,
|
||||
t.create_user,
|
||||
a.module_id,
|
||||
a.path,
|
||||
a.protocol,
|
||||
t.status execResult,
|
||||
a.user_id,
|
||||
a.version_id versionId,
|
||||
project_version.name versionName
|
||||
from
|
||||
test_plan_api_case t
|
||||
inner join
|
||||
|
@ -44,6 +70,7 @@
|
|||
api_definition a
|
||||
on
|
||||
c.api_definition_id = a.id
|
||||
left join project_version on a.version_id = project_version.id and a.project_id = project_version.project_id
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and a.protocol = #{request.protocol}
|
||||
</if>
|
||||
|
@ -112,6 +139,32 @@
|
|||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.versionId != null">
|
||||
and a.version_id = #{request.versionId}
|
||||
</if>
|
||||
<if test="request.refId != null">
|
||||
and a.ref_id = #{request.refId}
|
||||
</if>
|
||||
<if test="request.versionId == null and request.refId == null and request.id == null">
|
||||
AND (
|
||||
a.version_id = (SELECT project_version.id
|
||||
FROM api_definition tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
|
||||
WHERE ref_id = a.ref_id
|
||||
LIMIT 1)
|
||||
OR
|
||||
a.version_id = (SELECT project_version.id
|
||||
FROM api_definition tmp
|
||||
JOIN project_version ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id
|
||||
WHERE ref_id = a.ref_id
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(project_version.create_time) DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
|
@ -128,6 +181,7 @@
|
|||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="selectIds" resultType="java.lang.String">
|
||||
select
|
||||
|
|
|
@ -25,6 +25,32 @@
|
|||
<if test="request.name != null and request.name != ''">
|
||||
and (load_test.name like CONCAT('%', #{request.name},'%') OR load_test.num like CONCAT('%', #{request.name},'%'))
|
||||
</if>
|
||||
<if test="request.versionId != null">
|
||||
and load_test.version_id = #{request.versionId}
|
||||
</if>
|
||||
<if test="request.refId != null">
|
||||
and load_test.ref_id = #{request.refId}
|
||||
</if>
|
||||
<if test="request.versionId == null and request.refId == null and request.id == null">
|
||||
AND (
|
||||
load_test.version_id = (SELECT project_version.id
|
||||
FROM load_test tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
|
||||
WHERE ref_id = load_test.ref_id
|
||||
LIMIT 1)
|
||||
OR
|
||||
load_test.version_id = (SELECT project_version.id
|
||||
FROM load_test tmp
|
||||
JOIN project_version ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id
|
||||
WHERE ref_id = load_test.ref_id
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(project_version.create_time) DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
|
@ -35,6 +61,12 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='version_id'">
|
||||
and load_test.version_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
@ -135,11 +167,14 @@
|
|||
tplc.status as caseStatus,
|
||||
lt.name as caseName,
|
||||
tplc.load_report_id,
|
||||
p.name as projectName
|
||||
p.name as projectName,
|
||||
pv.name versionName,
|
||||
lt.version_id versionId
|
||||
from test_plan_load_case tplc
|
||||
inner join load_test lt on tplc.load_case_id = lt.id
|
||||
left join user u on lt.user_id = u.id
|
||||
left join project p on lt.project_id = p.id
|
||||
left join project_version pv on lt.project_id = pv.project_id and lt.version_id = pv.id
|
||||
<where>
|
||||
tplc.test_plan_id = #{request.testPlanId}
|
||||
<if test="request.caseIds != null and request.caseIds.size > 0">
|
||||
|
@ -172,6 +207,32 @@
|
|||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.versionId != null">
|
||||
and lt.version_id = #{request.versionId}
|
||||
</if>
|
||||
<if test="request.refId != null">
|
||||
and lt.ref_id = #{request.refId}
|
||||
</if>
|
||||
<if test="request.versionId == null and request.refId == null and request.id == null">
|
||||
AND (
|
||||
lt.version_id = (SELECT project_version.id
|
||||
FROM load_test tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
|
||||
WHERE ref_id = lt.ref_id
|
||||
LIMIT 1)
|
||||
OR
|
||||
lt.version_id = (SELECT project_version.id
|
||||
FROM load_test tmp
|
||||
JOIN project_version ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id
|
||||
WHERE ref_id = lt.ref_id
|
||||
GROUP BY ref_id
|
||||
HAVING MAX(latest) = 0
|
||||
ORDER BY MAX(project_version.create_time) DESC
|
||||
LIMIT 1)
|
||||
)
|
||||
</if>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
|
|
|
@ -662,14 +662,16 @@ public class PerformanceTestService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<LoadTest> getLoadTestListByIds(List<String> ids) {
|
||||
public List<LoadTestDTO> getLoadTestListByIds(List<String> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
LoadTestExample loadTestExample = new LoadTestExample();
|
||||
loadTestExample.createCriteria().andIdIn(ids);
|
||||
List<LoadTest> loadTests = loadTestMapper.selectByExample(loadTestExample);
|
||||
return Optional.ofNullable(loadTests).orElse(new ArrayList<>());
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
Map filters = new HashMap();
|
||||
filters.put("id", ids);
|
||||
request.setFilters(filters);
|
||||
List<LoadTestDTO> loadTestDTOS = extLoadTestMapper.list(request);
|
||||
return loadTestDTOS;
|
||||
}
|
||||
|
||||
private int getNextNum(String projectId) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.commons.constants.TriggerMode;
|
|||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.ResetOrderRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.performance.request.RunTestPlanRequest;
|
||||
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
|
||||
|
@ -31,7 +32,7 @@ public class TestPlanLoadCaseController {
|
|||
private TestPlanLoadCaseService testPlanLoadCaseService;
|
||||
|
||||
@PostMapping("/relevance/list/{goPage}/{pageSize}")
|
||||
public Pager<List<LoadTest>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody LoadCaseRequest request) {
|
||||
public Pager<List<LoadTestDTO>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody LoadCaseRequest request) {
|
||||
return testPlanLoadCaseService.relevanceList(request, goPage, pageSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package io.metersphere.track.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.LoadTest;
|
||||
import io.metersphere.base.domain.TestCaseReviewLoad;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.dto.TestReviewLoadCaseDTO;
|
||||
import io.metersphere.performance.request.RunTestPlanRequest;
|
||||
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
|
||||
import io.metersphere.track.request.testplan.LoadCaseRequest;
|
||||
import io.metersphere.track.request.testreview.TestReviewRequest;
|
||||
import io.metersphere.track.service.TestCaseReviewLoadService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,7 +23,7 @@ public class TestReviewLoadCaseController {
|
|||
private TestCaseReviewLoadService testCaseReviewLoadService;
|
||||
|
||||
@PostMapping("/relevance/list/{goPage}/{pageSize}")
|
||||
public Pager<List<LoadTest>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody TestReviewRequest request) {
|
||||
public Pager<List<LoadTestDTO>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody TestReviewRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testCaseReviewLoadService.relevanceList(request));
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs {
|
|||
private String name;
|
||||
private ResponseDTO response;
|
||||
private String reportId;
|
||||
private String versionId;
|
||||
private String versionName;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
|
@ -19,7 +19,8 @@ public class LoadCaseRequest extends TestPlanLoadCase {
|
|||
private Map<String, List<String>> filters;
|
||||
private List<OrderRequest> orders;
|
||||
private Map<String, Object> combine;
|
||||
|
||||
private String versionId;
|
||||
private String refId;
|
||||
// 测试计划是否允许重复
|
||||
private boolean repeatCase;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.mapper.ext.ExtTestCaseReviewLoadMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
|
||||
import io.metersphere.commons.constants.TestPlanStatus;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.dto.TestReviewLoadCaseDTO;
|
||||
import io.metersphere.performance.request.RunTestPlanRequest;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
|
@ -46,7 +47,7 @@ public class TestCaseReviewLoadService {
|
|||
@Resource
|
||||
private LoadTestMapper loadTestMapper;
|
||||
|
||||
public List<LoadTest> relevanceList(TestReviewRequest request) {
|
||||
public List<LoadTestDTO> relevanceList(TestReviewRequest request) {
|
||||
List<String> ids = extTestCaseReviewLoadMapper.selectIdsNotInPlan(request.getProjectId(), request.getTestCaseReviewId());
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
|
|
|
@ -19,6 +19,7 @@ import io.metersphere.commons.utils.*;
|
|||
import io.metersphere.constants.RunModeConstants;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import io.metersphere.controller.request.ResetOrderRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.log.vo.OperatingLogDetails;
|
||||
import io.metersphere.performance.request.RunTestPlanRequest;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
|
@ -69,7 +70,7 @@ public class TestPlanLoadCaseService {
|
|||
@Lazy
|
||||
private TestPlanService testPlanService;
|
||||
|
||||
public Pager<List<LoadTest>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) {
|
||||
public Pager<List<LoadTestDTO>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) {
|
||||
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
|
||||
orders.forEach(i -> i.setPrefix("load_test"));
|
||||
request.setOrders(orders);
|
||||
|
@ -78,7 +79,7 @@ public class TestPlanLoadCaseService {
|
|||
}
|
||||
List<String> ids = extTestPlanLoadCaseMapper.selectIdsNotInPlan(request);
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return PageUtils.setPageInfo(PageHelper.startPage(goPage, pageSize, true), new ArrayList<>());
|
||||
return PageUtils.setPageInfo(PageHelper.startPage(goPage, pageSize, true), new ArrayList <>());
|
||||
}
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, performanceTestService.getLoadTestListByIds(ids));
|
||||
|
|
|
@ -120,7 +120,6 @@ export default {
|
|||
this.$emit('isApiListEnableChange', data);
|
||||
},
|
||||
initTable(projectId) {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (this.trashEnable) {
|
||||
this.condition.filters = {status: ["Trash"]};
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
:project-id="projectId"
|
||||
:is-test-plan="true"
|
||||
:plan-id="planId"
|
||||
:versionFilters="versionFilters"
|
||||
@isApiListEnableChange="isApiListEnableChange"
|
||||
ref="apiList"/>
|
||||
|
||||
|
@ -49,6 +50,7 @@
|
|||
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
|
||||
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
||||
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
||||
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestCaseApiRelevance",
|
||||
|
@ -69,7 +71,8 @@
|
|||
isApiListEnable: true,
|
||||
condition: {},
|
||||
currentRow: {},
|
||||
projectId: ""
|
||||
projectId: "",
|
||||
versionFilters: [],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -82,6 +85,9 @@
|
|||
this.condition.planId = this.planId;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getVersionOptions();
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.init();
|
||||
|
@ -182,6 +188,16 @@
|
|||
this.$refs.baseRelevance.close();
|
||||
});
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionOptions = response.data;
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
:project-id="getProjectId()"
|
||||
:condition="condition"
|
||||
:plan-id="planId"
|
||||
@changeVersion="changeVersion"
|
||||
@refresh="initTable"
|
||||
@relevanceCase="$emit('relevanceCase')"
|
||||
@setEnvironment="setEnvironment"
|
||||
|
@ -39,6 +40,18 @@
|
|||
<ms-table-column :field="item" :fields-width="fieldsWidth" prop="name" sortable min-width="120"
|
||||
:label="$t('test_track.case.name')"/>
|
||||
|
||||
<ms-table-column
|
||||
prop="versionId"
|
||||
:field="item"
|
||||
:filters="versionFilters"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="$t('commons.version')"
|
||||
min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.versionName }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
|
@ -166,7 +179,7 @@ import MsContainer from "../../../../../common/components/MsContainer";
|
|||
import MsBottomContainer from "../../../../../api/definition/components/BottomContainer";
|
||||
import BatchEdit from "@/business/components/track/case/components/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
|
||||
import {getCurrentProjectID, strMapToObj} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, hasLicense, strMapToObj} from "@/common/js/utils";
|
||||
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
|
||||
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
|
||||
import {getUUID} from "../../../../../../../common/js/utils";
|
||||
|
@ -212,6 +225,9 @@ export default {
|
|||
MsBottomContainer,
|
||||
MsTaskCenter
|
||||
},
|
||||
mounted(){
|
||||
this.getVersionOptions();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: TEST_PLAN_API_CASE,
|
||||
|
@ -275,7 +291,8 @@ export default {
|
|||
rowLoading: "",
|
||||
userFilters: [],
|
||||
projectIds: [],
|
||||
projectList: []
|
||||
projectList: [],
|
||||
versionFilters: [],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -627,6 +644,24 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
changeVersion(currentVersion) {
|
||||
if (currentVersion == "") {
|
||||
this.condition.versionId = null;
|
||||
} else {
|
||||
this.condition.versionId = currentVersion;
|
||||
}
|
||||
this.initTable();
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionOptions= response.data;
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
|
||||
:content="$t('test_track.plan_view.relevance_test_case')"
|
||||
@click="$emit('relevanceCase')"/>
|
||||
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
|
||||
</template>
|
||||
|
||||
</ms-table-header>
|
||||
|
@ -20,10 +21,12 @@
|
|||
import MsTableHeader from "../../../../../common/components/MsTableHeader";
|
||||
import MsTableButton from "../../../../../common/components/MsTableButton";
|
||||
import MsEnvironmentSelect from "../../../../../api/definition/components/case/MsEnvironmentSelect";
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||
|
||||
export default {
|
||||
name: "TestPlanCaseListHeader",
|
||||
components: {MsEnvironmentSelect, MsTableButton, MsTableHeader},
|
||||
components: {MsEnvironmentSelect, MsTableButton, MsTableHeader, 'VersionSelect': VersionSelect.default},
|
||||
props: ['condition', 'projectId', 'isReadOnly', 'planId'],
|
||||
methods: {
|
||||
setEnvironment(data) {
|
||||
|
@ -35,6 +38,9 @@ export default {
|
|||
this.$emit('setEnvironment', data);
|
||||
});
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion) {
|
||||
this.$emit('changeVersion', currentVersion);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -46,4 +52,7 @@ export default {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.version-select {
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="versionId"
|
||||
:column-key="'versionId'"
|
||||
:filters="versionFilters"
|
||||
:label="$t('commons.version')"
|
||||
min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.versionName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
|
@ -88,6 +100,7 @@ import MsPerformanceTestStatus from "@/business/components/performance/test/Perf
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import {_filter} from "@/common/js/tableUtils";
|
||||
import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components";
|
||||
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestCaseLoadRelevance",
|
||||
|
@ -126,7 +139,8 @@ export default {
|
|||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
]
|
||||
],
|
||||
versionFilters: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -145,6 +159,9 @@ export default {
|
|||
this.condition.reviewId = this.reviewId;
|
||||
},
|
||||
},
|
||||
mounted(){
|
||||
this.getVersionOptions();
|
||||
},
|
||||
methods: {
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
|
@ -275,7 +292,17 @@ export default {
|
|||
}
|
||||
this.treeNodes = [];
|
||||
this.selectNodeIds = [];
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionOptions = response.data;
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<test-plan-load-case-list-header
|
||||
:condition="condition"
|
||||
:plan-id="planId"
|
||||
:isShowVersion="true"
|
||||
@changeVersion="changeVersion"
|
||||
@refresh="initTable"
|
||||
@relevanceCase="$emit('relevanceCase')"/>
|
||||
</template>
|
||||
|
@ -43,6 +45,16 @@
|
|||
min-width="120"
|
||||
sortable>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
prop="versionId"
|
||||
:filters="versionFilters"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="$t('commons.version')"
|
||||
min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.versionName }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
|
@ -129,7 +141,7 @@ import {
|
|||
buildBatchParam, getCustomTableHeader, getCustomTableWidth
|
||||
} from "@/common/js/tableUtils";
|
||||
import {TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
|
||||
import {getCurrentProjectID, getCurrentUser, getCurrentUserId} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentUser, getCurrentUserId, hasLicense} from "@/common/js/utils";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import MsPlanRunMode from "../../../common/PlanRunMode";
|
||||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
|
@ -211,7 +223,8 @@ export default {
|
|||
],
|
||||
reportId: '',
|
||||
loading: false,
|
||||
statusScheduler: null
|
||||
statusScheduler: null,
|
||||
versionFilters: []
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -242,6 +255,9 @@ export default {
|
|||
this.initTable();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getVersionOptions();
|
||||
},
|
||||
methods: {
|
||||
orderBySelectRows(rows){
|
||||
let selectIds = Array.from(rows).map(row => row.id);
|
||||
|
@ -450,6 +466,24 @@ export default {
|
|||
clearInterval(this.refreshScheduler);
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion) {
|
||||
if (currentVersion == "") {
|
||||
this.condition.versionId = null;
|
||||
} else {
|
||||
this.condition.versionId = currentVersion;
|
||||
}
|
||||
this.initTable();
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionOptions= response.data;
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.cancelRefresh();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<template>
|
||||
<ms-table-header
|
||||
:isShowVersion="isShowVersion"
|
||||
@changeVersion="changeVersion"
|
||||
:condition="condition"
|
||||
@search="$emit('refresh')"
|
||||
:show-create="false"
|
||||
|
@ -19,11 +21,20 @@
|
|||
<script>
|
||||
import MsTableButton from "@/business/components/common/components/MsTableButton";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||
|
||||
export default {
|
||||
name: "TestPlanLoadCaseListHeader",
|
||||
components: {MsTableButton, MsTableHeader},
|
||||
props: ['condition'],
|
||||
components: {
|
||||
MsTableButton, MsTableHeader, 'VersionSelect': VersionSelect.default,
|
||||
},
|
||||
props: ['condition', 'isShowVersion'],
|
||||
methods: {
|
||||
changeVersion(currentVersion) {
|
||||
this.$emit("changeVersion", currentVersion)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ export let CUSTOM_TABLE_HEADER = {
|
|||
TEST_PLAN_LOAD_CASE: [
|
||||
{id: 'num', key: '1', label: 'commons.id'},
|
||||
{id: 'caseName', key: '2', label: 'commons.name'},
|
||||
{id: 'versionId', key: '9', label: 'project.version.name', xpack: true},
|
||||
{id: 'projectName', key: '3', label: 'load_test.project_name'},
|
||||
{id: 'userName', key: '4', label: 'load_test.user_name'},
|
||||
{id: 'createTime', key: '5', label: 'commons.create_time'},
|
||||
|
|
Loading…
Reference in New Issue