refactor(测试评审): 测试评审关联用例时数量显示在上面

This commit is contained in:
CaptainB 2022-04-11 17:52:31 +08:00 committed by 刘瑞斌
parent 3d0de7626e
commit b1184d237f
13 changed files with 621 additions and 368 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.LoadTest;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.performance.request.QueryProjectFileRequest;
import io.metersphere.performance.request.QueryTestPlanRequest;
@ -39,4 +40,6 @@ public interface ExtLoadTestMapper {
List<String> selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId);
List<FileMetadata> getFileMetadataByIds(@Param("testId") String testId);
List<String> selectIds(@Param("request") BaseQueryRequest request);
}

View File

@ -225,6 +225,53 @@
</where>
</select>
<sql id="filter">
<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">
<choose>
<when test="key=='status'">
and load_test.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and load_test.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_id'">
and load_test.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_name'">
and load_test.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='case_status'">
and load_test.case_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{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>
</if>
</sql>
<sql id="queryWhereCondition">
<where>
<if test="request.combine != null">
@ -234,6 +281,37 @@
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and (load_test.name like CONCAT('%', #{request.name},'%')
or load_test.num like CONCAT('%', #{request.name},'%')
</if>
<if test="request.notEqStatus != null">
and (load_test.status is null or load_test.status != #{request.notEqStatus})
</if>
<if test="request.id != null">
AND load_test.id = #{request.id}
</if>
<if test="request.userId != null">
AND load_test.user_id = #{request.userId}
</if>
<if test="request.createTime >0">
AND load_test.create_time >= #{request.createTime}
</if>
<if test="request.notInIds != null and request.notInIds.size() > 0">
and load_test.id not in
<foreach collection="request.notInIds" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<if test="request.projectId != null">
AND load_test.project_id = #{request.projectId}
</if>
<include refid="filter"/>
<include refid="queryVersionCondition">
<property name="versionTable" value="load_test"/>
</include>
</where>
</sql>
@ -349,4 +427,11 @@
WHERE test_id = #{testId}
ORDER BY sort
</select>
<select id="selectIds" resultType="java.lang.String">
select load_test.id
from load_test
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
</mapper>

View File

@ -22,6 +22,7 @@ import io.metersphere.dto.ScheduleDao;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.performance.dto.LoadModuleDTO;
import io.metersphere.performance.dto.LoadTestBatchRequest;
import io.metersphere.performance.dto.LoadTestExportJmx;
import io.metersphere.performance.request.*;
import io.metersphere.performance.service.PerformanceTestService;
@ -69,6 +70,11 @@ public class PerformanceTestController {
return performanceTestService.getLoadTestByProjectId(projectId);
}
@PostMapping("/list/batch")
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
public List<LoadTestDTO> listBatch(@RequestBody LoadTestBatchRequest request) {
return performanceTestService.listBatch(request);
}
@GetMapping("/state/get/{testId}")
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")

View File

@ -0,0 +1,19 @@
package io.metersphere.performance.dto;
import io.metersphere.base.domain.LoadTestWithBLOBs;
import io.metersphere.controller.request.OrderRequest;
import lombok.Data;
import java.util.List;
@Data
public class LoadTestBatchRequest extends LoadTestWithBLOBs {
private List<String> ids;
private String name;
private List<OrderRequest> orders;
private String projectId;
private String moduleId;
private String protocol;
private LoadTestRequest condition;
}

View File

@ -0,0 +1,42 @@
package io.metersphere.performance.dto;
import io.metersphere.controller.request.BaseQueryRequest;
import lombok.Data;
@Data
public class LoadTestRequest extends BaseQueryRequest {
private String id;
private String projectId;
private String name;
private String description;
private Long createTime;
private Long updateTime;
private String status;
private String testResourcePoolId;
private String userId;
private Integer num;
private String createUser;
private Integer scenarioVersion;
private String scenarioId;
private Long order;
private String refId;
private String versionId;
private Boolean latest;
}

View File

@ -35,6 +35,7 @@ import io.metersphere.log.vo.performance.PerformanceReference;
import io.metersphere.performance.base.GranularityData;
import io.metersphere.performance.base.VumProcessedStatus;
import io.metersphere.performance.dto.LoadModuleDTO;
import io.metersphere.performance.dto.LoadTestBatchRequest;
import io.metersphere.performance.dto.LoadTestExportJmx;
import io.metersphere.performance.engine.Engine;
import io.metersphere.performance.engine.EngineFactory;
@ -1124,4 +1125,17 @@ public class PerformanceTestService {
}
public List<LoadTestDTO> listBatch(LoadTestBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extLoadTestMapper.selectIds(query));
if (org.apache.commons.collections.CollectionUtils.isEmpty(request.getIds())) {
return new ArrayList<>();
}
QueryTestPlanRequest request2 = new QueryTestPlanRequest();
Map<String, List<String>> param = new HashMap<>();
param.put("id", request.getIds());
request2.setFilters(param);
return this.list(request2);
}
}

View File

@ -13,17 +13,28 @@
ref="envPopover" class="env-popover"/>
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="search"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"
class="search-input"/>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect" @filter-change="filter">
<el-table-column type="selection"/>
<ms-table ref="scenarioTable"
v-loading="result.loading"
:data="tableData"
:condition="condition"
:page-size="pageSize"
:total="total"
:remember-order="true"
row-key="id"
:row-order-group-id="projectId"
@refresh="search"
:disable-header-config="true"
:show-select-all="false"
@selectCountChange="selectCountChange">
<el-table-column v-if="!customNum" prop="num" label="ID"
show-overflow-tooltip>
</el-table-column>
@ -52,7 +63,8 @@
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" min-width="120">
<template v-slot:default="scope">
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName"
style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>
@ -64,13 +76,17 @@
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">{{ $t('api_test.automation.success') }}</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">{{ $t('api_test.automation.fail') }}</el-link>
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
{{ $t('api_test.automation.success') }}
</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }}
</el-link>
</template>
</el-table-column>
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip/>
</el-table>
</ms-table>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
@ -79,221 +95,222 @@
</template>
<script>
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {ENV_TYPE} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {
TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS
} from "@/business/components/common/components/search/search-components";
import {ENV_TYPE} from "@/common/js/constants";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
export default {
name: "RelevanceScenarioList",
components: {
PriorityTableItem,
EnvPopover,
TestPlanScenarioListHeader,
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,
MsTableHeader,
MsTag,
MsApiReportDetail,
MsTestPlanList,
MsTableAdvSearchBar,
'VersionSelect': VersionSelect.default,
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "RelevanceScenarioList",
components: {
MsTable,
PriorityTableItem,
EnvPopover,
TestPlanScenarioListHeader,
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,
MsTableHeader,
MsTag,
MsApiReportDetail,
MsTestPlanList,
MsTableAdvSearchBar,
'VersionSelect': VersionSelect.default,
},
props: {
referenced: {
type: Boolean,
default: false,
},
props: {
referenced: {
type: Boolean,
default: false,
selectNodeIds: Array,
projectId: String,
planId: String,
versionEnable: Boolean,
},
data() {
return {
result: {},
showConfigButtonWithOutPermission: false,
condition: {
components: TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS
},
selectNodeIds: Array,
projectId: String,
planId: String,
versionEnable: Boolean,
currentScenario: {},
schedule: {},
selectAll: false,
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
reportId: "",
infoDb: false,
selectRows: new Set(),
projectEnvMap: new Map(),
projectList: [],
projectIds: new Set(),
map: new Map(),
customNum: false,
environmentType: ENV_TYPE.JSON,
envGroupId: "",
versionFilters: [],
};
},
computed: {
ENV_TYPE() {
return ENV_TYPE;
}
},
watch: {
selectNodeIds() {
this.search();
},
data() {
return {
result: {},
showConfigButtonWithOutPermission:false,
condition: {
components: TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS
},
currentScenario: {},
schedule: {},
selectAll: false,
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
reportId: "",
infoDb: false,
selectRows: new Set(),
projectEnvMap: new Map(),
projectList: [],
projectIds: new Set(),
map: new Map(),
customNum: false,
environmentType: ENV_TYPE.JSON,
envGroupId: "",
versionFilters: [],
projectId() {
this.search();
},
},
created() {
this.getWsProjects();
this.getVersionOptions();
},
methods: {
search() {
this.projectEnvMap.clear();
this.projectIds.clear();
if (!this.projectId) {
return;
}
},
computed: {
ENV_TYPE() {
return ENV_TYPE;
this.getProject(this.projectId);
this.selectRows = new Set();
this.loading = true;
if (this.condition.filters) {
this.condition.filters.status = ["Prepare", "Underway", "Completed"];
} else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
},
watch: {
selectNodeIds() {
this.search();
},
projectId() {
this.search();
},
},
created() {
this.getWsProjects();
this.getVersionOptions();
},
methods: {
search() {
this.projectEnvMap.clear();
this.projectIds.clear();
if (!this.projectId) {
return;
}
this.getProject(this.projectId);
this.selectRows = new Set();
this.loading = true;
if (this.condition.filters) {
this.condition.filters.status = ["Prepare", "Underway", "Completed"];
} else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
this.condition.moduleIds = this.selectNodeIds;
this.condition.moduleIds = this.selectNodeIds;
if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.planId != null) {
this.condition.planId = this.planId;
}
if (this.planId != null) {
this.condition.planId = this.planId;
}
let url = "/test/plan/scenario/case/relevance/list/" + this.currentPage + "/" + this.pageSize;
this.result = this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.clear();
let url = "/test/plan/scenario/case/relevance/list/" + this.currentPage + "/" + this.pageSize;
this.result = this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.clear();
});
},
clear() {
this.selectRows.clear();
},
setProjectEnvMap(projectEnvMap) {
this.projectEnvMap = projectEnvMap;
},
setEnvGroup(id) {
this.envGroupId = id;
},
getWsProjects() {
this.$get("/project/getOwnerProjects", res => {
this.projectList = res.data;
});
},
getProject(projectId) {
if (projectId) {
this.$get('/project_application/get/config/' + projectId + "/SCENARIO_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
},
clear() {
this.selectRows.clear();
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
this.initProjectIds();
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
this.initProjectIds();
},
setProjectEnvMap(projectEnvMap) {
this.projectEnvMap = projectEnvMap;
},
setEnvGroup(id) {
this.envGroupId = id;
},
getWsProjects() {
this.$get("/project/getOwnerProjects", res => {
this.projectList = res.data;
})
},
getProject(projectId) {
if (projectId) {
this.$get('/project_application/get/config/' + projectId + "/SCENARIO_CUSTOM_NUM", result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
}
},
initProjectIds() {
this.projectIds.clear();
this.map.clear();
this.selectRows.forEach(row => {
this.result = this.$get('/api/automation/getApiScenarioProjectId/' + row.id, res => {
let data = res.data;
data.projectIds.forEach(d => this.projectIds.add(d));
this.map.set(row.id, data.projectIds);
})
})
},
checkEnv() {
return this.$refs.envPopover.checkEnv();
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;
this.search();
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
filter(field) {
this.condition.filters = field || null;
this.search();
}
},
initProjectIds() {
this.projectIds.clear();
this.map.clear();
this.selectRows.forEach(row => {
this.$get('/api/automation/getApiScenarioProjectId/' + row.id, res => {
let data = res.data;
data.projectIds.forEach(d => this.projectIds.add(d));
this.map.set(row.id, data.projectIds);
});
});
},
checkEnv() {
return this.$refs.envPopover.checkEnv();
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;
this.search();
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
filter(field) {
this.condition.filters = field || null;
this.search();
},
selectCountChange(data) {
this.selectRows = this.$refs.scenarioTable.selectRows;
this.initProjectIds();
this.$emit("selectCountChange", data);
}
}
};
</script>
<style scoped>
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
.env-popover {
float: right;
margin-top: 10px;
}
.env-popover {
float: right;
margin-top: 10px;
}
.search-input {
float: right;
width: 250px;
margin-top: 10px;
margin-bottom: 20px;
margin-right: 20px;
}
.search-input {
float: right;
width: 250px;
margin-top: 10px;
margin-bottom: 20px;
margin-right: 20px;
}
.adv-search-bar {
float: right;
margin-top: 15px;
margin-right: 10px;
}
.adv-search-bar {
float: right;
margin-top: 15px;
margin-right: 10px;
}
</style>

View File

@ -28,6 +28,7 @@
:versionFilters="versionFilters"
:version-enable="versionEnable"
@isApiListEnableChange="isApiListEnableChange"
@selectCountChange="setSelectCounts"
ref="apiList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event,'api')" margin-left="10"/>
@ -45,6 +46,7 @@
:version-enable="versionEnable"
:plan-id="planId"
@isApiListEnableChange="isApiListEnableChange"
@selectCountChange="setSelectCounts"
ref="apiCaseList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event, 'case')"
@ -229,7 +231,10 @@
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
this.$refs.apiCaseList.initTable();
}
}
},
setSelectCounts(data) {
this.$refs.baseRelevance.selectCounts = data;
},
}
}
</script>

View File

@ -22,6 +22,7 @@
:version-enable="versionEnable"
:plan-id="planId"
:project-id="projectId"
@selectCountChange="setSelectCounts"
ref="apiScenarioList"/>
</test-case-relevance-base>
@ -30,138 +31,167 @@
<script>
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
import {getCurrentProjectID, strMapToObj} from "../../../../../../../common/js/utils";
import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList";
import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList";
import MsApiScenarioModule from "../../../../../api/automation/scenario/ApiScenarioModule";
import RelevanceScenarioList from "./RelevanceScenarioList";
import {ENV_TYPE} from "@/common/js/constants";
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
import {strMapToObj} from "../../../../../../../common/js/utils";
import ApiCaseSimpleList from "../../../../../api/definition/components/list/ApiCaseSimpleList";
import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList";
import MsApiScenarioModule from "../../../../../api/automation/scenario/ApiScenarioModule";
import RelevanceScenarioList from "./RelevanceScenarioList";
import {ENV_TYPE} from "@/common/js/constants";
export default {
name: "TestCaseScenarioRelevance",
components: {
RelevanceScenarioList,
MsApiScenarioModule,
MsApiScenarioList,
ApiCaseSimpleList,
MsApiModule,
TestCaseRelevanceBase,
export default {
name: "TestCaseScenarioRelevance",
components: {
RelevanceScenarioList,
MsApiScenarioModule,
MsApiScenarioList,
ApiCaseSimpleList,
MsApiModule,
TestCaseRelevanceBase,
},
data() {
return {
showCasePage: true,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
trashEnable: false,
condition: {},
currentRow: {},
projectId: ""
};
},
props: {
planId: {
type: String
},
data() {
return {
showCasePage: true,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
trashEnable: false,
condition: {},
currentRow: {},
projectId: ""
};
versionEnable: {
type: Boolean,
default: false
}
},
watch: {
planId() {
this.condition.planId = this.planId;
},
props: {
planId: {
type: String
},
versionEnable: {
type: Boolean,
default: false
},
methods: {
open() {
this.$refs.baseRelevance.open();
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.clear();
this.$refs.apiScenarioList.search();
}
},
watch: {
planId() {
this.condition.planId = this.planId;
},
setProject(projectId) {
this.projectId = projectId;
},
methods: {
open() {
this.$refs.baseRelevance.open();
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.clear();
this.$refs.apiScenarioList.search();
}
},
setProject(projectId) {
this.projectId = projectId;
},
refresh(data) {
this.$refs.apiScenarioList.search(data);
},
refresh(data) {
this.$refs.apiScenarioList.search(data);
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
async saveCaseRelevance() {
const sign = await this.$refs.apiScenarioList.checkEnv();
if (!sign) {
return false;
}
let param = {};
let url = '/api/automation/relevance';
const envMap = this.$refs.apiScenarioList.projectEnvMap;
let map = this.$refs.apiScenarioList.map;
let envType = this.$refs.apiScenarioList.environmentType;
let envGroupId = this.$refs.apiScenarioList.envGroupId;
if (!map || map.size < 1) {
this.$warning(this.$t("api_test.please_select_case"));
return false;
}
if (envType === ENV_TYPE.JSON && (!envMap || envMap.size < 1)) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
} else if (envType === ENV_TYPE.GROUP && !envGroupId) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
}
param.planId = this.planId;
param.mapping = strMapToObj(map);
param.envMap = strMapToObj(envMap);
param.environmentType = envType;
param.envGroupId = envGroupId;
postRelevance() {
let url = '/api/automation/relevance';
const envMap = this.$refs.apiScenarioList.projectEnvMap;
let envType = this.$refs.apiScenarioList.environmentType;
let map = this.$refs.apiScenarioList.map;
let envGroupId = this.$refs.apiScenarioList.envGroupId;
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
this.refresh();
this.autoCheckStatus();
this.$refs.baseRelevance.close();
});
},
autoCheckStatus() { //
if (!this.planId) {
return;
}
this.$post('/test/plan/autoCheck/' + this.planId, (response) => {
});
},
if (envType === ENV_TYPE.JSON && (!envMap || envMap.size < 1)) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
} else if (envType === ENV_TYPE.GROUP && !envGroupId) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
}
let param = {};
param.planId = this.planId;
param.mapping = strMapToObj(map);
param.envMap = strMapToObj(envMap);
param.environmentType = envType;
param.envGroupId = envGroupId;
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
this.refresh();
this.autoCheckStatus();
this.$refs.baseRelevance.close();
});
},
async saveCaseRelevance() {
const sign = await this.$refs.apiScenarioList.checkEnv();
if (!sign) {
return false;
}
let url = '/api/automation/relevance';
const envMap = this.$refs.apiScenarioList.projectEnvMap;
let envType = this.$refs.apiScenarioList.environmentType;
let map = this.$refs.apiScenarioList.map;
let envGroupId = this.$refs.apiScenarioList.envGroupId;
if (envType === ENV_TYPE.JSON && (!envMap || envMap.size < 1)) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
} else if (envType === ENV_TYPE.GROUP && !envGroupId) {
this.$warning(this.$t("api_test.environment.select_environment"));
return false;
}
let param = {};
param.planId = this.planId;
param.mapping = strMapToObj(map);
param.envMap = strMapToObj(envMap);
param.environmentType = envType;
param.envGroupId = envGroupId;
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
this.refresh();
this.autoCheckStatus();
this.$refs.baseRelevance.close();
});
},
autoCheckStatus() { //
if (!this.planId) {
return;
}
this.$post('/test/plan/autoCheck/' + this.planId, (response) => {
});
},
setSelectCounts(data) {
this.$refs.baseRelevance.selectCounts = data;
}
}
};
</script>
<style scoped>
/deep/ .select-menu {
margin-bottom: 15px;
}
/deep/ .select-menu {
margin-bottom: 15px;
}
/deep/ .environment-select {
float: right;
margin-right: 10px;
}
/deep/ .environment-select {
float: right;
margin-right: 10px;
}
/deep/ .module-input {
width: 243px;
}
/deep/ .module-input {
width: 243px;
}
</style>

View File

@ -7,11 +7,11 @@
</div>
</template>
<template slot="title" slot-scope="{title}" v-if="!$slots.headerBtn">
<ms-dialog-header :title="title" :enable-cancel="false" @confirm="save">
<ms-dialog-header :title="title" :enable-cancel="false" @confirm="save" btn-size="mini">
<template #other>
<table-select-count-bar :count="selectCounts" style="float: left; margin: 5px;"/>
<div v-if="flag" style="margin-top: 5px;">
<div v-if="flag" style="margin: 5px; float: left;">
<el-checkbox v-model="checked" class="el-checkbox__label">{{ $t('test_track.sync_add_api_load') }}</el-checkbox>
</div>
</template>

View File

@ -31,6 +31,7 @@
:page-size.sync="page.pageSize"
:screen-height="null"
@handlePageChange="getTestCases"
@selectCountChange="setSelectCounts"
@refresh="getTestCases"
ref="table">
@ -99,7 +100,8 @@
</ms-table>
<ms-table-pagination :change="getTestCases" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize" :total="page.total"/>
<ms-table-pagination :change="getTestCases" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize"
:total="page.total"/>
</test-case-relevance-base>
</template>
@ -117,7 +119,8 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
@ -137,14 +140,14 @@ export default {
MsTableHeader,
'VersionSelect': VersionSelect.default,
},
mounted(){
mounted() {
this.getVersionOptions();
},
data() {
return {
openType: 'relevance',
result: {},
isSaving:false,
isSaving: false,
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
@ -217,7 +220,7 @@ export default {
if (data) {
this.customNum = data.customNum;
}
})
});
},
getTestCases() {
let condition = this.page.condition;
@ -261,7 +264,7 @@ export default {
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions= response.data;
this.versionOptions = response.data;
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
@ -271,9 +274,12 @@ export default {
changeVersion(currentVersion) {
this.page.condition.versionId = currentVersion || null;
this.getTestCases();
},
setSelectCounts(data) {
this.$refs.baseRelevance.selectCounts = data;
}
}
}
};
</script>
<style scoped>

View File

@ -19,19 +19,23 @@
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="getTestCases"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20" class="search-input"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"
class="search-input"/>
<el-table
<ms-table
v-loading="result.loading"
:data="testCases"
:condition="condition"
:page-size="pageSize"
:total="total"
:remember-order="true"
row-key="id"
@select-all="handleSelectAll"
@select="handleSelectionChange"
@filter-change="filter"
height="50vh"
:row-order-group-id="projectId"
@refresh="search"
:disable-header-config="true"
@selectCountChange="setSelectCounts"
ref="table">
<el-table-column
type="selection"/>
<el-table-column
prop="num"
label="ID"
@ -81,11 +85,10 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</el-table>
</ms-table>
<ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</test-case-relevance-base>
</template>
@ -100,15 +103,18 @@ import MsTableAdvSearchBar from "@/business/components/common/components/search/
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import {_filter} from "@/common/js/tableUtils";
import {_filter, buildBatchParam} 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";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "TestCaseLoadRelevance",
components: {
MsTable,
TestCaseRelevanceBase,
NodeTree,
PriorityTableItem,
@ -167,7 +173,7 @@ export default {
this.condition.reviewId = this.reviewId;
},
},
mounted(){
mounted() {
this.getVersionOptions();
},
methods: {
@ -185,31 +191,37 @@ export default {
this.search();
},
saveCaseRelevance() {
let param = {};
param.caseIds = [...this.selectIds];
let selectRows = this.$refs.table.selectRows;
let param = buildBatchParam(this, undefined, this.projectId);
param.ids = Array.from(selectRows).map(row => row.id);
if (this.planId) {
param.testPlanId = this.planId;
this.result = this.$post('/test/plan/load/case/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
this.result = this.$post("/performance/list/batch", param, (response) => {
let tests = response.data;
let condition = {
caseIds: Array.from(tests).map(row => row.id),
testPlanId: this.planId,
};
this.result = this.$post('/test/plan/load/case/relevance', condition, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
});
});
}
if (this.reviewId) {
param.testCaseReviewId = this.reviewId;
this.result = this.$post('/test/review/load/case/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
this.result = this.$post("/performance/list/batch", param, (response) => {
let tests = response.data;
let condition = {
caseIds: Array.from(tests).map(row => row.id),
testCaseReviewId: this.reviewId,
};
this.result = this.$post('/test/review/load/case/relevance', condition, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
});
});
}
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
@ -311,12 +323,15 @@ export default {
});
}
},
changeVersion(currentVersion){
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;
this.search();
},
setSelectCounts(data) {
this.$refs.baseRelevance.selectCounts = data;
}
}
}
};
</script>
<style scoped>

View File

@ -8,7 +8,11 @@
<template slot="title" :slot-scope="$t('test_track.review_view.relevance_case')" v-if="!$slots.headerBtn">
<ms-dialog-header :title="$t('test_track.review_view.relevance_case')" @cancel="dialogFormVisible = false"
@confirm="saveReviewRelevance"/>
@confirm="saveReviewRelevance">
<template #other>
<table-select-count-bar :count="selectCounts" style="float: left; margin: 5px;"/>
</template>
</ms-dialog-header>
</template>
<el-container class="main-content">
@ -42,6 +46,7 @@
:page-size.sync="pageSize"
@handlePageChange="getReviews"
@refresh="getReviews"
@selectCountChange="setSelectCounts"
:condition="condition"
ref="table">
@ -133,6 +138,7 @@ import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsDialogHeader from "@/business/components/common/components/MsDialogHeader";
import MsTable from "@/business/components/common/components/table/MsTable";
import TableSelectCountBar from "@/business/components/api/automation/scenario/api/TableSelectCountBar";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
@ -141,6 +147,7 @@ const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./v
export default {
name: "TestReviewRelevance",
components: {
TableSelectCountBar,
SelectMenu,
NodeTree,
MsDialogFooter,
@ -199,6 +206,7 @@ export default {
{text: this.$t('test_track.review.pass'), value: 'Pass'},
{text: this.$t('test_track.review.un_pass'), value: 'UnPass'},
],
selectCounts: null,
};
},
props: {
@ -252,6 +260,7 @@ export default {
}
this.result = this.$post('/test/case/review/relevance', param, () => {
this.selectIds.clear();
this.selectCounts = 0;
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
@ -280,7 +289,9 @@ export default {
}
},
setSelectCounts(data) {
this.selectCounts = data;
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;