mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 12:39:12 +08:00
fix(接口测试): 修复接口测试首页本周新建跳转错误的问题
--bug=1023817 --user=宋天阳 【接口测试】github#21926,本周新增接口统计数据,链接错误 https://www.tapd.cn/55049933/s/1348336
This commit is contained in:
parent
18fc1d3cc9
commit
1f5f32b71a
@ -15,7 +15,7 @@
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<api-dashboard :version-id="versionId" @redirectPage="redirectPage" ref="apiDashboard" />
|
||||
<api-dashboard @redirectPage="redirectPage" ref="apiDashboard" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<api-case-dashboard @redirectPage="redirectPage" ref="apiCaseDashboard" />
|
||||
|
@ -20,6 +20,7 @@ export default {
|
||||
props: {
|
||||
apiData: Object,
|
||||
totalTime: Number,
|
||||
versionId: String,
|
||||
isExport: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@ -175,7 +176,7 @@ export default {
|
||||
},
|
||||
},
|
||||
sublink: hasPermission('PROJECT_API_DEFINITION:READ')
|
||||
? '/#/api/definition/' + getUUID() + '/api/thisWeekCount'
|
||||
? '/#/api/definition/' + this.versionId + '/api/api/thisWeekCount'
|
||||
: '',
|
||||
subtextStyle: {
|
||||
color: '#1F2329',
|
||||
|
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div v-show="!loadError">
|
||||
<div class="main-info">
|
||||
<count-chart :api-data="apiData" ref="countChart" />
|
||||
<count-chart :version-id="versionId" :api-data="apiData" ref="countChart" />
|
||||
</div>
|
||||
<div class="addition-info">
|
||||
<el-row :gutter="16" style="margin: 0">
|
||||
@ -141,6 +141,7 @@ export default {
|
||||
loadError: false,
|
||||
apiCoveredRageToolTip: this.$t('api_test.home_page.formula.api_coverage'),
|
||||
completedRageToolTip: this.$t('api_test.home_page.formula.completion'),
|
||||
versionId: 'default',
|
||||
apiData: {
|
||||
httpCount: 0,
|
||||
tcpCount: 0,
|
||||
@ -161,6 +162,7 @@ export default {
|
||||
search(versionId) {
|
||||
this.loading = true;
|
||||
this.loadError = false;
|
||||
this.versionId = versionId;
|
||||
let selectProjectId = getCurrentProjectID();
|
||||
apiCountByProjectId(selectProjectId, versionId)
|
||||
.then((response) => {
|
||||
|
@ -2,7 +2,6 @@ package io.metersphere.controller;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.TestCase;
|
||||
import io.metersphere.commons.constants.MicroServiceName;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
@ -62,32 +61,42 @@ public class TrackController {
|
||||
return statistics;
|
||||
}
|
||||
|
||||
@GetMapping("/failure/case/about/plan/{projectId}/{versionId}/{limitNumber}/{goPage}/{pageSize}")
|
||||
@GetMapping("/failure/case/about/plan/{projectId}/{versionId}/{pageSize}/{goPage}")
|
||||
public Pager<List<ExecutedCaseInfoDTO>> failureCaseAboutTestPlan(@PathVariable String projectId, @PathVariable String versionId,
|
||||
@PathVariable int limitNumber, @PathVariable int goPage, @PathVariable int pageSize) {
|
||||
@PathVariable int pageSize, @PathVariable int goPage) {
|
||||
if (StringUtils.equalsIgnoreCase(versionId, "default")) {
|
||||
versionId = null;
|
||||
}
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<ExecutedCaseInfoResult> selectDataList = trackService.findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(projectId, versionId, limitNumber);
|
||||
List<ExecutedCaseInfoDTO> returnList = new ArrayList<>(selectDataList.size());
|
||||
for (int dataIndex = 0; dataIndex < selectDataList.size(); dataIndex++) {
|
||||
ExecutedCaseInfoDTO dataDTO = new ExecutedCaseInfoDTO();
|
||||
dataDTO.setSortIndex(dataIndex + 1);
|
||||
ExecutedCaseInfoResult selectData = selectDataList.get(dataIndex);
|
||||
dataDTO.setCaseID(selectData.getTestCaseID());
|
||||
dataDTO.setCaseName(selectData.getCaseName());
|
||||
dataDTO.setTestPlan(selectData.getTestPlan());
|
||||
dataDTO.setFailureTimes(selectData.getFailureTimes());
|
||||
dataDTO.setTestPlanId(selectData.getTestPlanId());
|
||||
dataDTO.setCaseType(selectData.getCaseType());
|
||||
dataDTO.setId(selectData.getId());
|
||||
dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList());
|
||||
returnList.add(dataDTO);
|
||||
}
|
||||
|
||||
List<ExecutedCaseInfoResult> selectDataList = trackService.findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(projectId, versionId);
|
||||
List<ExecutedCaseInfoDTO> returnList = this.getResultList(goPage, pageSize, selectDataList);
|
||||
Page<Object> page = new Page<>(goPage, pageSize);
|
||||
page.setTotal(selectDataList.size());
|
||||
return PageUtils.setPageInfo(page, returnList);
|
||||
}
|
||||
|
||||
private List<ExecutedCaseInfoDTO> getResultList(int goPage, int pageSize, List<ExecutedCaseInfoResult> selectDataList) {
|
||||
List<ExecutedCaseInfoDTO> returnList = new ArrayList<>(selectDataList.size());
|
||||
for (int dataIndex = goPage * pageSize; dataIndex < selectDataList.size(); dataIndex++) {
|
||||
if (returnList.size() < pageSize) {
|
||||
ExecutedCaseInfoDTO dataDTO = new ExecutedCaseInfoDTO();
|
||||
dataDTO.setSortIndex(dataIndex + 1);
|
||||
ExecutedCaseInfoResult selectData = selectDataList.get(dataIndex);
|
||||
dataDTO.setCaseID(selectData.getTestCaseID());
|
||||
dataDTO.setCaseName(selectData.getCaseName());
|
||||
dataDTO.setTestPlan(selectData.getTestPlan());
|
||||
dataDTO.setFailureTimes(selectData.getFailureTimes());
|
||||
dataDTO.setTestPlanId(selectData.getTestPlanId());
|
||||
dataDTO.setCaseType(selectData.getCaseType());
|
||||
dataDTO.setId(selectData.getId());
|
||||
dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList());
|
||||
returnList.add(dataDTO);
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/relevance/count/{projectId}")
|
||||
public TrackStatisticsDTO getRelevanceCount(@PathVariable String projectId) {
|
||||
TrackStatisticsDTO statistics = new TrackStatisticsDTO();
|
||||
|
@ -308,7 +308,7 @@ public class TrackService {
|
||||
return testPlan.getPassRate();
|
||||
}
|
||||
|
||||
public List<ExecutedCaseInfoResult> findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, String versionId, int limitNumber) {
|
||||
public List<ExecutedCaseInfoResult> findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, String versionId) {
|
||||
|
||||
//获取7天之前的日期
|
||||
Date startDay = DateUtils.dateSum(new Date(), -6);
|
||||
@ -323,6 +323,7 @@ public class TrackService {
|
||||
if (startTime == null) {
|
||||
return new ArrayList<>(0);
|
||||
} else {
|
||||
int limitNumber = 10;
|
||||
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
|
||||
ArrayList<ExecutedCaseInfoResult> allCaseExecList = new ArrayList<>();
|
||||
allCaseExecList.addAll(extTestPlanTestCaseMapper.findFailureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber(projectId, versionId, startTime.getTime(), limitNumber));
|
||||
|
@ -4,14 +4,9 @@ export function getTrackCount(selectProjectId) {
|
||||
return get("/track/count/" + selectProjectId);
|
||||
}
|
||||
|
||||
export function homeTestPlanFailureCaseGet(
|
||||
projectId,
|
||||
limitNumber,
|
||||
currentPage,
|
||||
pageSize
|
||||
) {
|
||||
export function homeTestPlanFailureCaseGet(projectId, pageSize, currentPage) {
|
||||
return get(
|
||||
`/track/failure/case/about/plan/${projectId}/default/${limitNumber}/${currentPage}/${pageSize}`
|
||||
`/track/failure/case/about/plan/${projectId}/default/${pageSize}/${currentPage}`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
style="min-height: 228px"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
prop="sortIndex"
|
||||
:label="$t('home.case.index')"
|
||||
show-overflow-tooltip
|
||||
width="100px"
|
||||
@ -131,6 +131,7 @@
|
||||
:page-size.sync="pageSize"
|
||||
layout="prev, pager, next, sizes"
|
||||
:total="total"
|
||||
:pageSizes="[5, 10]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -176,14 +177,13 @@ export default {
|
||||
this.loadError = false;
|
||||
homeTestPlanFailureCaseGet(
|
||||
this.projectId,
|
||||
10,
|
||||
this.currentPage,
|
||||
this.pageSize
|
||||
this.pageSize,
|
||||
this.currentPage - 1
|
||||
)
|
||||
.then((r) => {
|
||||
this.loading = false;
|
||||
this.loadError = false;
|
||||
this.total = r.data.itemCount;
|
||||
this.total = 10;
|
||||
this.tableData = r.data.listObject;
|
||||
})
|
||||
.catch(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user