Merge branch 'master' of github.com:metersphere/metersphere

This commit is contained in:
chenjianxing 2021-03-15 21:25:58 +08:00
commit 8b71a911b8
8 changed files with 105 additions and 19 deletions

View File

@ -306,6 +306,9 @@
or test_case.num like CONCAT('%', #{request.name},'%')
or test_case.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.createTime >0">
AND test_case.create_time >= #{request.createTime}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
@ -316,6 +319,12 @@
and test_case.project_id = #{request.projectId}
</if>
<include refid="filters"/>
<if test="request.caseCoverage == 'uncoverage' ">
and test_case.test_id is null and test_case.type != 'functional'
</if>
<if test="request.caseCoverage == 'coverage' ">
and test_case.test_id is not null and test_case.type != 'functional'
</if>
</where>
</sql>

View File

@ -22,4 +22,10 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
private String userId;
private String reviewId;
private boolean isSelectThisWeedData = false;
private String caseCoverage;
private long createTime = 0;
}

View File

@ -5,7 +5,6 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiBatchRequest;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
@ -14,10 +13,7 @@ import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.excel.domain.ExcelErrData;
import io.metersphere.excel.domain.ExcelResponse;
@ -189,6 +185,7 @@ public class TestCaseService {
}
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
this.initRequest(request, true);
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序
@ -199,6 +196,25 @@ public class TestCaseService {
return extTestCaseMapper.list(request);
}
/**
* 初始化部分参数
*
* @param request
* @param checkThisWeekData
* @return
*/
private void initRequest(QueryTestCaseRequest request, boolean checkThisWeekData) {
if (checkThisWeekData) {
if (request.isSelectThisWeedData()) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (weekFirstTime != null) {
request.setCreateTime(weekFirstTime.getTime());
}
}
}
}
public List<TestCaseDTO> listTestCaseMthod(QueryTestCaseRequest request) {
return extTestCaseMapper.listByMethod(request);
}

View File

@ -136,5 +136,8 @@ update schedule sch inner join load_test ldt on
update schedule sch inner join api_test apiTest on
apiTest.id = sch.resource_id
set sch.name = apiTest.name;
update schedule sch inner join swagger_url_project sup on
sup.id = sch.resource_id
set sch.name = LEFT(SUBSTRING_INDEX(sup.swagger_url, '/', 3), 100);
-- delete an unused colum
alter table schedule drop column custom_data;

View File

@ -312,6 +312,7 @@ export default {
currentCaseId: null,
projectId: "",
selectDataCounts: 0,
selectDataRange: "all"
}
},
props: {
@ -326,10 +327,27 @@ export default {
},
moduleOptions: {
type: Array
},
trashEnable: {
type: Boolean,
default: false,
}
},
created: function () {
this.$emit('setCondition', this.condition);
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
} else {
this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]};
}
this.initTableData();
},
activated() {
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
} else {
this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]};
}
this.initTableData();
},
watch: {
@ -345,6 +363,11 @@ export default {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
getSelectDataRange() {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
this.selectDataRange = dataType === 'case' ? dataRange : 'all';
},
initTableData() {
this.projectId = getCurrentProjectID();
this.condition.planId = "";
@ -363,6 +386,29 @@ export default {
this.getData();
},
getData() {
this.getSelectDataRange();
this.condition.selectThisWeedData = false;
this.condition.caseCoverage = null;
switch (this.selectDataRange) {
case 'thisWeekCount':
this.condition.selectThisWeedData = true;
break;
case 'uncoverage':
this.condition.caseCoverage = 'uncoverage';
break;
case 'coverage':
this.condition.caseCoverage = 'coverage';
break;
case 'Prepare':
this.condition.filters.status = [this.selectDataRange];
break;
case 'Pass':
this.condition.filters.status = [this.selectDataRange];
break;
case 'UnPass':
this.condition.filters.status = [this.selectDataRange];
break;
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {

View File

@ -29,12 +29,12 @@
<el-row :gutter="10">
<el-col :span="6">
<div class="square">
<case-count-card :track-count-data="trackCountData" class="track-card"/>
<case-count-card :track-count-data="trackCountData" class="track-card" @redirectPage="redirectPage"/>
</div>
</el-col>
<el-col :span="6">
<div class="square">
<relevance-case-card :relevance-count-data="relevanceCountData" class="track-card"/>
<relevance-case-card :relevance-count-data="relevanceCountData" class="track-card" @redirectPage="redirectPage"/>
</div>
</el-col>
<el-col :span="12">
@ -73,7 +73,7 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import MsContainer from "@/business/components/common/components/MsContainer";
import CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance";
import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
import BugCountCard from "@/business/components/track/home/components/BugCountCard";
@ -185,8 +185,14 @@ export default {
}]
};
this.caseOption = option;
},
redirectPage(page,dataType,selectType){
switch (page){
case "case":
this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}});
break;
}
}
}
}
</script>

View File

@ -83,27 +83,27 @@
<el-row>
<el-col>
<span class="default-property">
{{$t('api_test.home_page.detail_card.running')}}
未评审
{{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000">
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
{{trackCountData.prepareCount}}
</el-link>
</span>
</el-col>
<el-col style="margin-top: 5px;">
<span class="default-property">
{{$t('api_test.home_page.detail_card.not_started')}}
未通过
{{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
<el-link type="info" @click="redirectPage('Pass')" target="_blank" style="color: #000000">
{{trackCountData.passCount}}
</el-link>
</span>
</el-col>
<el-col style="margin-top: 5px;">
<span class="main-property">
{{$t('api_test.home_page.detail_card.finished')}}
已通过
{{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Completed')" target="_blank" style="color: #000000">
<el-link type="info" @click="redirectPage('UnPass')" target="_blank" style="color: #000000">
{{trackCountData.unPassCount}}
</el-link>
</span>
@ -133,7 +133,7 @@ export default {
},
methods: {
redirectPage(clickType){
this.$emit("redirectPage","api","api",clickType);
this.$emit("redirectPage","case", "case",clickType);
}
}
}

View File

@ -68,7 +68,7 @@
<span class="default-property">
未覆盖
{{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000">
<el-link type="info" @click="redirectPage('uncoverage')" target="_blank" style="color: #000000">
{{relevanceCountData.uncoverageCount}}
</el-link>
</span>
@ -77,7 +77,7 @@
<span class="main-property">
已覆盖
{{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
<el-link type="info" @click="redirectPage('coverage')" target="_blank" style="color: #000000">
{{relevanceCountData.coverageCount}}
</el-link>
</span>
@ -107,7 +107,7 @@ export default {
},
methods: {
redirectPage(clickType){
this.$emit("redirectPage","api","api",clickType);
this.$emit("redirectPage","case","case",clickType);
}
}
}