fix(接口测试): 分享报告登录问题

--user=郭雨琦
--bug=1013301
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001013301
This commit is contained in:
guoyuqi 2022-05-30 17:44:27 +08:00 committed by xiaomeinvG
parent af6d57061c
commit 3756231d5b
5 changed files with 44 additions and 14 deletions

View File

@ -17,6 +17,7 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest; import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.LogDetailDTO; import io.metersphere.dto.LogDetailDTO;
import io.metersphere.dto.ReportDTO; import io.metersphere.dto.ReportDTO;
import io.metersphere.dto.RequestResult;
import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.performance.base.*; import io.metersphere.performance.base.*;
import io.metersphere.performance.dto.LoadTestExportJmx; import io.metersphere.performance.dto.LoadTestExportJmx;
@ -70,6 +71,8 @@ public class ShareController {
MetricQueryService metricService; MetricQueryService metricService;
@Resource @Resource
private TestResourcePoolService testResourcePoolService; private TestResourcePoolService testResourcePoolService;
@Resource
private ApiScenarioReportService apiReportService;
@GetMapping("/issues/plan/get/{shareId}/{planId}") @GetMapping("/issues/plan/get/{shareId}/{planId}")
public List<IssuesDao> getIssuesByPlanoId(@PathVariable String shareId, @PathVariable String planId) { public List<IssuesDao> getIssuesByPlanoId(@PathVariable String shareId, @PathVariable String planId) {
@ -308,4 +311,10 @@ public class ShareController {
resourcePoolRequest.setStatus(ResourceStatusEnum.VALID.name()); resourcePoolRequest.setStatus(ResourceStatusEnum.VALID.name());
return testResourcePoolService.listResourcePools(resourcePoolRequest); return testResourcePoolService.listResourcePools(resourcePoolRequest);
} }
@GetMapping("/{shareId}/scenario/report/selectReportContent/{stepId}")
public RequestResult selectReportContent(@PathVariable String stepId,@PathVariable String shareId) {
shareInfoService.validateExpired(shareId);
return apiReportService.selectReportContent(stepId);
}
} }

View File

@ -26,6 +26,8 @@
:treeData="fullTreeNodes" :treeData="fullTreeNodes"
:console="content.console" :console="content.console"
:report="report" :report="report"
:is-share="isShare"
:share-id="shareId"
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
ref="resultsTree"/> ref="resultsTree"/>
</el-tab-pane> </el-tab-pane>
@ -38,6 +40,8 @@
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
:console="content.console" :console="content.console"
:report="report" :report="report"
:is-share="isShare"
:share-id="shareId"
:treeData="fullTreeNodes" ref="failsTree" :treeData="fullTreeNodes" ref="failsTree"
:errorReport="content.error"/> :errorReport="content.error"/>
</el-tab-pane> </el-tab-pane>
@ -51,6 +55,8 @@
<ms-scenario-results <ms-scenario-results
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
:report="report" :report="report"
:is-share="isShare"
:share-id="shareId"
:console="content.console" :console="content.console"
:treeData="fullTreeNodes" ref="errorReportTree"/> :treeData="fullTreeNodes" ref="errorReportTree"/>
</el-tab-pane> </el-tab-pane>
@ -65,6 +71,8 @@
<ms-scenario-results <ms-scenario-results
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
:report="report" :report="report"
:is-share="isShare"
:share-id="shareId"
:console="content.console" :console="content.console"
:treeData="fullTreeNodes" ref="unExecuteTree"/> :treeData="fullTreeNodes" ref="unExecuteTree"/>
</el-tab-pane> </el-tab-pane>
@ -171,11 +179,6 @@
if (this.isTemplate) { if (this.isTemplate) {
this.getReport(); this.getReport();
} }
},
isShare() {
if(this.isShare()){
this.handleExport()
}
} }
}, },
methods: { methods: {

View File

@ -185,7 +185,9 @@ export default {
isActive: { isActive: {
type: Boolean, type: Boolean,
default: false default: false
} },
isShare: Boolean,
shareId: String,
}, },
created() { created() {
this.showActive = this.isActive; this.showActive = this.isActive;
@ -261,12 +263,22 @@ export default {
}, },
loadRequestInfoExpand() { loadRequestInfoExpand() {
if (!this.request.responseResult || this.request.responseResult.body === null || this.request.responseResult.body === undefined) { if (!this.request.responseResult || this.request.responseResult.body === null || this.request.responseResult.body === undefined) {
this.$get("/api/scenario/report/selectReportContent/" + this.stepId, response => { if (this.isShare) {
this.requestInfo = response.data; this.$get("/share/" + this.shareId + "/scenario/report/selectReportContent/" + this.stepId, response => {
this.$nextTick(() => { this.requestInfo = response.data;
this.requestInfo.loading = false; this.$nextTick(() => {
this.requestInfo.loading = false;
});
}); });
}); } else {
this.$get("/api/scenario/report/selectReportContent/" + this.stepId, response => {
this.requestInfo = response.data;
this.$nextTick(() => {
this.requestInfo.loading = false;
});
});
}
} else { } else {
this.requestInfo = this.request; this.requestInfo = this.request;
} }

View File

@ -36,6 +36,8 @@
:total-status="node.totalStatus" :total-status="node.totalStatus"
:console="console" :console="console"
:isActive="isActive" :isActive="isActive"
:is-share="isShare"
:share-id="shareId"
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
/> />
</div> </div>
@ -59,6 +61,8 @@ export default {
node: Object, node: Object,
console: String, console: String,
isActive: Boolean, isActive: Boolean,
isShare:Boolean,
shareId: String,
}, },
data() { data() {
return { return {

View File

@ -15,8 +15,8 @@
highlight-current highlight-current
class="ms-tree ms-report-tree" ref="resultsTree"> class="ms-tree ms-report-tree" ref="resultsTree">
<span slot-scope="{ node, data}" style="width: 99%" @click="nodeClick(node)"> <span slot-scope="{ node, data}" style="width: 99%" @click="nodeClick(node)">
<ms-scenario-result :node="data" :console="console" v-on:requestResult="requestResult" <ms-scenario-result :node="data" :console="console" v-on:requestResult="requestResult"
:isActive="isActive"/> :isActive="isActive" :is-share="isShare" :share-id="shareId"/>
</span> </span>
</el-tree> </el-tree>
</el-card> </el-card>
@ -37,7 +37,9 @@ export default {
defaultExpand: { defaultExpand: {
default: false, default: false,
type: Boolean, type: Boolean,
} },
isShare:Boolean,
shareId: String,
}, },
data() { data() {
return { return {