fix(测试跟踪): 测试计划报告分享,无法展示运行模式和资源池

--bug=1021013 --user=陈建星 [测试跟踪]测试跟踪-报告-历史报告分享后打开链接提示Network Error https://www.tapd.cn/55049933/s/1319228
--bug=1021103 --user=陈建星 【测试跟踪】测试报告-导出/分享的报告-不显示运行模式和资源池 https://www.tapd.cn/55049933/s/1319227
This commit is contained in:
chenjianxing 2022-12-26 10:30:24 +08:00 committed by f2c-ci-robot[bot]
parent 61ff11d8d4
commit 254e0d4959
4 changed files with 52 additions and 14 deletions

View File

@ -1,7 +1,9 @@
package io.metersphere.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.metersphere.commons.utils.HttpHeaderUtils;
import io.metersphere.dto.TestPlanCaseDTO;
import io.metersphere.plan.dto.TestPlanExtReportDTO;
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
import io.metersphere.plan.service.TestPlanReportService;
import io.metersphere.plan.service.TestPlanService;
@ -62,4 +64,22 @@ public class ShareController {
shareInfoService.validate(shareId, reportId);
return testPlanReportService.getShareDbReport(shareInfoService.get(shareId), reportId);
}
@GetMapping("test/plan/ext/report/{shareId}/{reportId}")
public TestPlanExtReportDTO getExtReport(@PathVariable String shareId, @PathVariable String reportId) throws JsonProcessingException {
shareInfoService.validate(shareId, reportId);
HttpHeaderUtils.runAsUser("admin");
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByReportId(reportId);
HttpHeaderUtils.clearUser();
return reportExtInfo;
}
@GetMapping("test/plan/ext/plan/{shareId}/{planId}")
public TestPlanExtReportDTO getExtPlan(@PathVariable String shareId, @PathVariable String planId) throws JsonProcessingException {
shareInfoService.validate(shareId, planId);
HttpHeaderUtils.runAsUser("admin");
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByPlanId(planId);
HttpHeaderUtils.clearUser();
return reportExtInfo;
}
}

View File

@ -19,6 +19,10 @@ public class UserService {
UserMapper userMapper;
public UserDTO.PlatformInfo getCurrentPlatformInfo(String workspaceId) {
return JSON.parseObject(getCurrentPlatformInfoStr(workspaceId), UserDTO.PlatformInfo.class);
}
public String getCurrentPlatformInfoStr(String workspaceId) {
User user = userMapper.selectByPrimaryKey(SessionUtils.getUserId());
if (user == null) {
return null;
@ -32,11 +36,6 @@ public class UserService {
if (platformInfo == null) {
return null;
}
return JSON.parseObject(JSON.toJSONString(platformInfo), UserDTO.PlatformInfo.class);
}
public String getCurrentPlatformInfoStr(String workspaceId) {
UserDTO.PlatformInfo currentPlatformInfo = getCurrentPlatformInfo(workspaceId);
return currentPlatformInfo == null ? null : JSON.toJSONString(currentPlatformInfo);
return JSON.toJSONString(platformInfo);
}
}

View File

@ -315,11 +315,21 @@ export function testPlanLoadCaseEditStatus(planId) {
export function getTestPlanExtReport(planId, reportId) {
if (reportId) {
return get('/test/plan/ext/report/' + reportId);
return get(BASE_URL + 'ext/report/' + reportId);
} else if (planId) {
return get('/test/plan/ext/plan/' + planId);
return get(BASE_URL + 'ext/plan/' + planId);
} else {
return {};
return new Promise(() => {});
}
}
export function getShareTestPlanExtReport(shareId, planId, reportId) {
if (reportId) {
return get('/share' + BASE_URL + `ext/report/${shareId}/${reportId}`);
} else if (planId) {
return get('/share' + BASE_URL + `ext/plan/${shareId}/${planId}`);
} else {
return new Promise(() => {});
}
}

View File

@ -36,7 +36,7 @@ import {
getShareTestPlanReportContent,
getTestPlanReport,
getTestPlanReportContent,
getTestPlanExtReport
getTestPlanExtReport, getShareTestPlanExtReport
} from "@/api/remote/plan/test-plan";
import TestPlanApiReport from "@/business/plan/view/comonents/report/detail/TestPlanApiReport";
import TestPlanUiReport from "@/business/plan/view/comonents/report/detail/TestPlanUiReport";
@ -187,10 +187,19 @@ export default {
});
}
}
getTestPlanExtReport(this.planId, this.reportId).then((response) => {
this.runMode = response.data.runMode;
this.resourcePool = response.data.resourcePool;
})
if (!this.isTemplate) {
if (this.isShare) {
getShareTestPlanExtReport(this.shareId, this.planId, this.reportId).then((response) => {
this.runMode = response.data.runMode;
this.resourcePool = response.data.resourcePool;
});
} else {
getTestPlanExtReport(this.planId, this.reportId).then((response) => {
this.runMode = response.data.runMode;
this.resourcePool = response.data.resourcePool;
});
}
}
},
getDefaultConfig(report) {
let dbConfig = null;