fix: 用例评审测试计划版本选择框

This commit is contained in:
zhangdahai112 2022-01-19 22:22:05 +08:00 committed by zhangdahai112
parent 23b4884e19
commit f3fa4412a5
6 changed files with 320 additions and 281 deletions

View File

@ -31,26 +31,6 @@
<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">

View File

@ -9,6 +9,7 @@ import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.base.mapper.TestPlanLoadCaseMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
@ -21,6 +22,7 @@ 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.QueryTestPlanRequest;
import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.*;
@ -69,6 +71,8 @@ public class TestPlanLoadCaseService {
@Resource
@Lazy
private TestPlanService testPlanService;
@Resource
private ExtLoadTestMapper extLoadTestMapper;
public Pager<List<LoadTestDTO>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
@ -82,7 +86,12 @@ public class TestPlanLoadCaseService {
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));
QueryTestPlanRequest newRequest = new QueryTestPlanRequest();
Map filters = new HashMap();
filters.put("id", ids);
newRequest.setFilters(filters);
List<LoadTestDTO> loadTestDTOS = extLoadTestMapper.list(newRequest);
return PageUtils.setPageInfo(page, loadTestDTOS);
}
public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) {

View File

@ -27,7 +27,11 @@
:plan-id="planId"
:versionFilters="versionFilters"
@isApiListEnableChange="isApiListEnableChange"
ref="apiList"/>
ref="apiList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event,'api')" margin-left="10"/>
</template>
</relevance-api-list>
<relevance-case-list
v-if="!isApiListEnable"
@ -36,9 +40,15 @@
:is-api-list-enable="isApiListEnable"
:project-id="projectId"
:is-test-plan="true"
:versionFilters="versionFilters"
:plan-id="planId"
@isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/>
ref="apiCaseList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event, 'case')"
margin-left="10"/>
</template>
</relevance-case-list>
</test-case-relevance-base>
@ -51,6 +61,8 @@
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
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") : {};
export default {
name: "TestCaseApiRelevance",
@ -59,6 +71,7 @@
RelevanceApiList,
MsApiModule,
TestCaseRelevanceBase,
'VersionSelect': VersionSelect.default,
},
data() {
return {
@ -198,6 +211,15 @@
});
}
},
changeVersion(currentVersion, type) {
if (type == 'api') {
this.$refs.apiList.condition.versionId = currentVersion || null;
this.$refs.apiList.initTable();
} else {
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
this.$refs.apiCaseList.initTable();
}
}
}
}
</script>

View File

@ -17,8 +17,11 @@
ref="nodeTree"/>
</template>
<ms-table-header :condition.sync="page.condition" @search="getTestCases" title="" :show-create="false"/>
<ms-table-header :condition.sync="page.condition" @search="getTestCases" title="" :show-create="false">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template>
</ms-table-header>
<ms-table
v-loading="page.result.loading"
:data="page.data"
@ -112,6 +115,8 @@ 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";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "FunctionalRelevance",
@ -127,6 +132,7 @@ export default {
MsTableSearchBar,
MsTableAdvSearchBar,
MsTableHeader,
'VersionSelect': VersionSelect.default,
},
mounted(){
this.getVersionOptions();
@ -255,6 +261,10 @@ export default {
});
}
},
changeVersion(currentVersion) {
this.page.condition.versionId = currentVersion || null;
this.getTestCases();
}
}
}
</script>

View File

@ -19,6 +19,7 @@
<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"/>
<el-table
v-loading="result.loading"
@ -101,6 +102,8 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
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";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "TestCaseLoadRelevance",
@ -113,7 +116,8 @@ export default {
MsTableAdvSearchBar,
MsTableHeader,
MsPerformanceTestStatus,
MsTablePagination
MsTablePagination,
'VersionSelect': VersionSelect.default,
},
data() {
return {
@ -140,7 +144,7 @@ export default {
{text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'}
],
versionFilters: []
versionFilters: [],
};
},
props: {
@ -303,6 +307,10 @@ export default {
});
}
},
changeVersion(currentVersion){
this.condition.versionId = currentVersion || null;
this.search();
}
}
}
</script>

View File

@ -24,7 +24,11 @@
<el-container>
<el-main class="case-content">
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template>
</ms-table-header>
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading"
@filter-change="filter" row-key="id"
@select-all="handleSelectAll"
@ -122,6 +126,8 @@ import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectMenu from "../../../common/SelectMenu";
import {_filter} from "@/common/js/tableUtils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
@ -136,8 +142,8 @@ export default {
MsTableAdvSearchBar,
MsTableHeader,
SwitchProject,
ReviewStatus
ReviewStatus,
'VersionSelect': VersionSelect.default,
},
directives: {
'el-table-infinite-scroll': elTableInfiniteScroll
@ -212,7 +218,7 @@ export default {
this.toggleSelection(this.testReviews);
},
methods: {
hasLicense(){
hasLicense() {
return hasLicense();
},
openTestReviewRelevanceDialog() {
@ -224,9 +230,9 @@ export default {
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
param.request = this.condition;
/*
/*
param.checked = this.checked;
*/
*/
//
if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
@ -396,8 +402,12 @@ export default {
});
}
},
changeVersion(version) {
this.condition.versionId = version || null;
this.search();
}
}
}
</script>
<style scoped>