refactor(测试计划): 重写测试计划加载场景报告的方式

This commit is contained in:
song-tianyang 2023-06-27 19:30:16 +08:00 committed by 刘瑞斌
parent e69c669ae1
commit f180fbf884
6 changed files with 57 additions and 59 deletions

View File

@ -37,7 +37,17 @@ export default {
methods: {
getRouteParam(name) {
if (this.$route) {
if (name === 'reportId') {
// 使qiankunreportIdUUID'[TEST-PLAN-REDIRECT]'
let reportId = this.$route.params[name];
if (reportId && reportId.indexOf('[TEST-PLAN-REDIRECT]') > -1) {
return reportId.split('[TEST-PLAN-REDIRECT]')[1];
} else {
return reportId;
}
} else {
return this.$route.params[name];
}
} else {
return null;
}

View File

@ -111,12 +111,13 @@
<script>
import MsDrawer from "../MsDrawer";
import {getCurrentProjectID, getCurrentUser} from "../../utils/token";
import {hasPermissions, hasLicense} from "../../utils/permission";
import {hasLicense, hasPermissions} from "../../utils/permission";
import {getProjectUsers} from "../../api/user";
import {getCaseData, getScenarioData, getTaskList, getTaskSocket, stopBatchTask, stopTask} from "../../api/task";
import MicroApp from "../../components/MicroApp";
import {prefetchApps} from "qiankun";
import TaskCenterItem from "./TaskCenterItem";
import {getUUID} from "../../utils";
export default {
name: "MsTaskCenter",
@ -350,9 +351,13 @@ export default {
this.executionModule = null;
this.$nextTick(() => {
this.size = window.innerWidth;
this.reportId = row.id;
this.executionModule = row.executionModule;
this.reportType = row.reportType;
if (row.executionModule === 'SCENARIO' || row.reportType === 'API_INTEGRATED') {
this.reportId = getUUID() + "[TEST-PLAN-REDIRECT]" + row.id;
} else {
this.reportId = row.id;
}
})
} else {
this.$warning(this.$t('commons.run_warning'))

View File

@ -282,15 +282,9 @@
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {
getCurrentProjectID,
getCurrentWorkspaceId,
} from "metersphere-frontend/src/utils/token";
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
import {
hasLicense,
hasPermission,
} from "metersphere-frontend/src/utils/permission";
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
import MsTableMoreBtn from "metersphere-frontend/src/components/table/TableMoreBtn";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {
@ -600,7 +594,7 @@ export default {
showReport(row) {
this.runVisible = true;
this.infoDb = true;
this.reportId = row.reportId;
this.reportId = getUUID() + "[TEST-PLAN-REDIRECT]" + row.reportId;
},
remove(row) {
if (this.planId) {

View File

@ -56,9 +56,10 @@
<div v-if="showResponse">
<micro-app
v-show="!isTemplate"
v-if="reportId!==null"
service="ui"
route-name="ApiReportView"
:route-params="routeParams"
:route-params="getRouteParams()"
/>
<UiShareReportDetail
v-show="isTemplate"
@ -133,16 +134,7 @@ export default {
Running: "Running",
UnExecute: "Prepare",
},
routeParams: {
reportId: this.reportId,
isShare: this.isShare,
shareId: this.shareId,
isPlanReport: true,
isTemplate: this.isTemplate,
response: this.response,
showCancelButton: false,
showReportNameButton: false,
},
};
},
mounted() {
@ -159,6 +151,18 @@ export default {
},
},
methods: {
getRouteParams() {
return {
reportId: this.reportId,
isShare: this.isShare,
shareId: this.shareId,
isPlanReport: true,
isTemplate: this.isTemplate,
response: this.response,
showCancelButton: false,
showReportNameButton: false,
};
},
getScenarioApiCase() {
this.scenarioCases = [];
if (this.filterStatus && this.filterStatus.length > 0) {

View File

@ -132,17 +132,8 @@ import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer
import MsApiReportViewHeader from "./ApiReportViewHeader";
import {STEP} from "./Setting";
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
import {
getCurrentProjectID,
getUUID,
hasLicense,
windowPrint,
} from "@/business/utils/sdk-utils";
import {
getScenarioReport,
getScenarioReportAll,
getShareScenarioReport,
} from "@/api/ui-report";
import {getCurrentProjectID, getUUID, hasLicense, windowPrint,} from "@/business/utils/sdk-utils";
import {getScenarioReport, getScenarioReportAll, getShareScenarioReport,} from "@/api/ui-report";
export default {
name: "UiShareReportDetail",
@ -623,7 +614,7 @@ export default {
},
buildReport() {
if (this.report) {
if (this.isNotRunning) {
if (this.isNotRunning && this.report.content) {
this.content = JSON.parse(this.report.content);
if (!this.content) {
this.content = {scenarios: []};

View File

@ -275,10 +275,7 @@
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {
getCurrentProjectID,
getCurrentWorkspaceId,
} from "metersphere-frontend/src/utils/token";
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
import {hasLicense} from "metersphere-frontend/src/utils/permission";
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
import TestPlanScenarioListHeader from "../ui/TestPlanUiScenarioListHeader";
@ -308,10 +305,7 @@ import {
testPlanUiScenarioList,
} from "@/api/remote/ui/test-plan-ui-scenario-case";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {
uiAutomationReduction,
uiAutomationVerifySeleniumServer,
} from "@/api/remote/ui/api-scenario";
import {uiAutomationReduction, uiAutomationVerifySeleniumServer,} from "@/api/remote/ui/api-scenario";
import i18n from "@/i18n";
import MicroApp from "metersphere-frontend/src/components/MicroApp";
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
@ -722,7 +716,7 @@ export default {
showReport(row) {
this.runVisible = true;
this.infoDb = true;
this.reportId = row.reportId;
this.reportId = getUUID() + "[TEST-PLAN-REDIRECT]" + row.reportId;
},
remove(row) {
if (this.planId) {