refactor(测试计划): 重写测试计划加载场景报告的方式
This commit is contained in:
parent
e69c669ae1
commit
f180fbf884
|
@ -37,7 +37,17 @@ export default {
|
|||
methods: {
|
||||
getRouteParam(name) {
|
||||
if (this.$route) {
|
||||
if (name === 'reportId') {
|
||||
// 测试计划模块使用qiankun加载该页面时,会在reportId前面加上UUID和'[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;
|
||||
}
|
||||
|
|
|
@ -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'))
|
||||
|
|
|
@ -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 { getUUID, strMapToObj } from "metersphere-frontend/src/utils";
|
||||
import {
|
||||
hasLicense,
|
||||
hasPermission,
|
||||
} from "metersphere-frontend/src/utils/permission";
|
||||
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 MsTableMoreBtn from "metersphere-frontend/src/components/table/TableMoreBtn";
|
||||
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
||||
import {
|
||||
|
@ -299,18 +293,18 @@ import {
|
|||
getCustomTableWidth,
|
||||
initCondition,
|
||||
} from "metersphere-frontend/src/utils/tableUtils";
|
||||
import { TEST_PLAN_SCENARIO_CASE } from "metersphere-frontend/src/utils/constants";
|
||||
import {TEST_PLAN_SCENARIO_CASE} from "metersphere-frontend/src/utils/constants";
|
||||
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
|
||||
import BatchEdit from "@/business/case/components/BatchEdit";
|
||||
import MsPlanRunMode from "@/business/plan/common/PlanRunModeWithEnv";
|
||||
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
||||
import { API_SCENARIO_FILTERS } from "metersphere-frontend/src/utils/table-constants";
|
||||
import {API_SCENARIO_FILTERS} from "metersphere-frontend/src/utils/table-constants";
|
||||
import MsTaskCenter from "metersphere-frontend/src/components/task/TaskCenter";
|
||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
|
||||
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
|
||||
import { editTestPlanScenarioCaseOrder } from "@/api/remote/plan/test-plan";
|
||||
import {editTestPlanScenarioCaseOrder} from "@/api/remote/plan/test-plan";
|
||||
import {
|
||||
testPlanScenarioCaseBatchDelete,
|
||||
testPlanScenarioCaseBatchUpdateEnv,
|
||||
|
@ -319,11 +313,11 @@ import {
|
|||
testPlanScenarioCaseSelectAllTableRows,
|
||||
testPlanScenarioList,
|
||||
} from "@/api/remote/plan/test-plan-scenario";
|
||||
import { apiAutomationReduction } from "@/api/remote/api/api-automation";
|
||||
import {apiAutomationReduction} from "@/api/remote/api/api-automation";
|
||||
import MicroApp from "metersphere-frontend/src/components/MicroApp";
|
||||
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
|
||||
import { getVersionFilters } from "@/business/utils/sdk-utils";
|
||||
import { TEST_PLAN_API_SCENARIO_CONFIGS } from "metersphere-frontend/src/components/search/search-components";
|
||||
import {getVersionFilters} from "@/business/utils/sdk-utils";
|
||||
import {TEST_PLAN_API_SCENARIO_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
|
||||
import MsTestPlanRunModeWithEnv from "@/business/plan/common/TestPlanRunModeWithEnv";
|
||||
|
||||
export default {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -130,19 +130,10 @@ import MsScenarioResults from "./ScenarioResults";
|
|||
import MsContainer from "metersphere-frontend/src/components/MsContainer";
|
||||
import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer";
|
||||
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
||||
import { STEP } from "./Setting";
|
||||
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,10 +614,10 @@ 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: [] };
|
||||
this.content = {scenarios: []};
|
||||
}
|
||||
this.formatResult(this.content);
|
||||
this.getFails();
|
||||
|
|
|
@ -275,12 +275,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 { hasLicense } from "metersphere-frontend/src/utils/permission";
|
||||
import { getUUID, strMapToObj } from "metersphere-frontend/src/utils";
|
||||
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";
|
||||
import MsPlanRunMode from "@/business/plan/common/PlanRunModeWithEnv";
|
||||
import {
|
||||
|
@ -289,7 +286,7 @@ import {
|
|||
getCustomTableWidth,
|
||||
initCondition,
|
||||
} from "metersphere-frontend/src/utils/tableUtils";
|
||||
import { TEST_PLAN_UI_SCENARIO_CASE } from "metersphere-frontend/src/utils/constants";
|
||||
import {TEST_PLAN_UI_SCENARIO_CASE} from "metersphere-frontend/src/utils/constants";
|
||||
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
|
||||
import BatchEdit from "@/business/case/components/BatchEdit";
|
||||
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
||||
|
@ -298,7 +295,7 @@ import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
|||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
|
||||
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
|
||||
import { editTestPlanUiScenarioCaseOrder } from "@/api/remote/plan/test-plan";
|
||||
import {editTestPlanUiScenarioCaseOrder} from "@/api/remote/plan/test-plan";
|
||||
import {
|
||||
testPlanUiScenarioCaseBatchDelete,
|
||||
testPlanUiScenarioCaseBatchUpdateEnv,
|
||||
|
@ -307,16 +304,13 @@ import {
|
|||
testPlanUiScenarioCaseSelectAllTableRows,
|
||||
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 {getVersionFilters} from "@/business/utils/sdk-utils";
|
||||
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";
|
||||
import UiRunMode from "@/business/plan/view/comonents/ui/UiRunMode";
|
||||
import { baseSocket } from "@/api/base-network";
|
||||
import {baseSocket} from "@/api/base-network";
|
||||
|
||||
export default {
|
||||
name: "MsTestPlanUiScenarioList",
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue