diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java index 7794a24acf..e6414067b0 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java @@ -123,4 +123,9 @@ public class TestPlanScenarioCaseController { public void orderCase(@RequestBody ResetOrderRequest request) { testPlanScenarioCaseService.updateOrder(request); } + + @GetMapping("/get-scenario-id/{id}") + public String getScenarioId(@PathVariable("id") String planScenarioId) { + return testPlanScenarioCaseService.getScenarioId(planScenarioId); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java index be4f081ddb..2711496718 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java @@ -654,4 +654,12 @@ public class TestPlanScenarioCaseService { extTestPlanScenarioCaseMapper.getFailureList(planId, "unExecute"); return buildCases(apiTestCases); } + + public String getScenarioId(String planScenarioId) { + TestPlanApiScenario planApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(planScenarioId); + if (planApiScenario != null) { + return planApiScenario.getApiScenarioId(); + } + return planScenarioId; + } } diff --git a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue index e6e0b36000..2d685c055b 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportViewHeader.vue @@ -82,6 +82,7 @@ import {generateShareInfoWithExpired} from "@/network/share"; import {getCurrentProjectID, getCurrentWorkspaceId, getUUID} from "@/common/js/utils"; import MsTag from "@/business/components/common/components/MsTag"; + const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const UiDownloadScreenshot = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/report/UiDownloadScreenshot.vue") : {}; @@ -155,6 +156,18 @@ export default { $event.target.blur(); }, redirect() { + let resourceId = this.scenarioId; + if (this.isPlan) { + this.$get('/test/plan/scenario/case/get-scenario-id/' + resourceId , res => { + resourceId = res.data; + this.showDetail(resourceId); + }); + } else { + resourceId = this.scenarioId; + this.showDetail(resourceId); + } + }, + showDetail(resourceId) { let data = this.$router.resolve({ name: this.isUi ? 'uiAutomation' : 'ApiAutomation', query: { @@ -162,7 +175,7 @@ export default { dataType: "scenario", projectId: getCurrentProjectID(), workspaceId: getCurrentWorkspaceId(), - resourceId: this.scenarioId + resourceId: resourceId } }); window.open(data.href, '_blank'); @@ -193,7 +206,7 @@ export default { pram.shareType = 'API_REPORT'; let thisHost = window.location.host; let shareUrl = thisHost + "/shareApiReport"; - if(this.isUi){ + if (this.isUi) { pram.shareType = 'UI_REPORT'; shareUrl = thisHost + "/shareUiReport"; } @@ -202,8 +215,8 @@ export default { }); }, getProjectApplication() { - let path = "/API_SHARE_REPORT_TIME"; - if(this.isUi){ + let path = "/API_SHARE_REPORT_TIME"; + if (this.isUi) { path = "/UI_SHARE_REPORT_TIME"; } this.$get('/project_application/get/' + getCurrentProjectID() + path, res => { diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index 079b7b5030..1c996a0999 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -186,7 +186,7 @@ - +