mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 20:19:16 +08:00
refactor(测试计划): 重写测试计划加载场景报告的方式
This commit is contained in:
parent
e69c669ae1
commit
f180fbf884
@ -37,7 +37,17 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getRouteParam(name) {
|
getRouteParam(name) {
|
||||||
if (this.$route) {
|
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];
|
return this.$route.params[name];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import MsDrawer from "../MsDrawer";
|
import MsDrawer from "../MsDrawer";
|
||||||
import {getCurrentProjectID, getCurrentUser} from "../../utils/token";
|
import {getCurrentProjectID, getCurrentUser} from "../../utils/token";
|
||||||
import {hasPermissions, hasLicense} from "../../utils/permission";
|
import {hasLicense, hasPermissions} from "../../utils/permission";
|
||||||
import {getProjectUsers} from "../../api/user";
|
import {getProjectUsers} from "../../api/user";
|
||||||
import {getCaseData, getScenarioData, getTaskList, getTaskSocket, stopBatchTask, stopTask} from "../../api/task";
|
import {getCaseData, getScenarioData, getTaskList, getTaskSocket, stopBatchTask, stopTask} from "../../api/task";
|
||||||
import MicroApp from "../../components/MicroApp";
|
import MicroApp from "../../components/MicroApp";
|
||||||
import {prefetchApps} from "qiankun";
|
import {prefetchApps} from "qiankun";
|
||||||
import TaskCenterItem from "./TaskCenterItem";
|
import TaskCenterItem from "./TaskCenterItem";
|
||||||
|
import {getUUID} from "../../utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsTaskCenter",
|
name: "MsTaskCenter",
|
||||||
@ -350,9 +351,13 @@ export default {
|
|||||||
this.executionModule = null;
|
this.executionModule = null;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.size = window.innerWidth;
|
this.size = window.innerWidth;
|
||||||
this.reportId = row.id;
|
|
||||||
this.executionModule = row.executionModule;
|
this.executionModule = row.executionModule;
|
||||||
this.reportType = row.reportType;
|
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 {
|
} else {
|
||||||
this.$warning(this.$t('commons.run_warning'))
|
this.$warning(this.$t('commons.run_warning'))
|
||||||
|
@ -282,15 +282,9 @@
|
|||||||
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
||||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||||
import {
|
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
|
||||||
getCurrentProjectID,
|
|
||||||
getCurrentWorkspaceId,
|
|
||||||
} from "metersphere-frontend/src/utils/token";
|
|
||||||
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
|
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
|
||||||
import {
|
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
|
||||||
hasLicense,
|
|
||||||
hasPermission,
|
|
||||||
} from "metersphere-frontend/src/utils/permission";
|
|
||||||
import MsTableMoreBtn from "metersphere-frontend/src/components/table/TableMoreBtn";
|
import MsTableMoreBtn from "metersphere-frontend/src/components/table/TableMoreBtn";
|
||||||
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
||||||
import {
|
import {
|
||||||
@ -600,7 +594,7 @@ export default {
|
|||||||
showReport(row) {
|
showReport(row) {
|
||||||
this.runVisible = true;
|
this.runVisible = true;
|
||||||
this.infoDb = true;
|
this.infoDb = true;
|
||||||
this.reportId = row.reportId;
|
this.reportId = getUUID() + "[TEST-PLAN-REDIRECT]" + row.reportId;
|
||||||
},
|
},
|
||||||
remove(row) {
|
remove(row) {
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
|
@ -56,9 +56,10 @@
|
|||||||
<div v-if="showResponse">
|
<div v-if="showResponse">
|
||||||
<micro-app
|
<micro-app
|
||||||
v-show="!isTemplate"
|
v-show="!isTemplate"
|
||||||
|
v-if="reportId!==null"
|
||||||
service="ui"
|
service="ui"
|
||||||
route-name="ApiReportView"
|
route-name="ApiReportView"
|
||||||
:route-params="routeParams"
|
:route-params="getRouteParams()"
|
||||||
/>
|
/>
|
||||||
<UiShareReportDetail
|
<UiShareReportDetail
|
||||||
v-show="isTemplate"
|
v-show="isTemplate"
|
||||||
@ -133,16 +134,7 @@ export default {
|
|||||||
Running: "Running",
|
Running: "Running",
|
||||||
UnExecute: "Prepare",
|
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() {
|
mounted() {
|
||||||
@ -159,6 +151,18 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
getScenarioApiCase() {
|
||||||
this.scenarioCases = [];
|
this.scenarioCases = [];
|
||||||
if (this.filterStatus && this.filterStatus.length > 0) {
|
if (this.filterStatus && this.filterStatus.length > 0) {
|
||||||
|
@ -132,17 +132,8 @@ import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer
|
|||||||
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
||||||
import {STEP} from "./Setting";
|
import {STEP} from "./Setting";
|
||||||
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
|
||||||
import {
|
import {getCurrentProjectID, getUUID, hasLicense, windowPrint,} from "@/business/utils/sdk-utils";
|
||||||
getCurrentProjectID,
|
import {getScenarioReport, getScenarioReportAll, getShareScenarioReport,} from "@/api/ui-report";
|
||||||
getUUID,
|
|
||||||
hasLicense,
|
|
||||||
windowPrint,
|
|
||||||
} from "@/business/utils/sdk-utils";
|
|
||||||
import {
|
|
||||||
getScenarioReport,
|
|
||||||
getScenarioReportAll,
|
|
||||||
getShareScenarioReport,
|
|
||||||
} from "@/api/ui-report";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "UiShareReportDetail",
|
name: "UiShareReportDetail",
|
||||||
@ -623,7 +614,7 @@ export default {
|
|||||||
},
|
},
|
||||||
buildReport() {
|
buildReport() {
|
||||||
if (this.report) {
|
if (this.report) {
|
||||||
if (this.isNotRunning) {
|
if (this.isNotRunning && this.report.content) {
|
||||||
this.content = JSON.parse(this.report.content);
|
this.content = JSON.parse(this.report.content);
|
||||||
if (!this.content) {
|
if (!this.content) {
|
||||||
this.content = {scenarios: []};
|
this.content = {scenarios: []};
|
||||||
|
@ -275,10 +275,7 @@
|
|||||||
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
||||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||||
import {
|
import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
|
||||||
getCurrentProjectID,
|
|
||||||
getCurrentWorkspaceId,
|
|
||||||
} from "metersphere-frontend/src/utils/token";
|
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
|
import {getUUID, strMapToObj} from "metersphere-frontend/src/utils";
|
||||||
import TestPlanScenarioListHeader from "../ui/TestPlanUiScenarioListHeader";
|
import TestPlanScenarioListHeader from "../ui/TestPlanUiScenarioListHeader";
|
||||||
@ -308,10 +305,7 @@ import {
|
|||||||
testPlanUiScenarioList,
|
testPlanUiScenarioList,
|
||||||
} from "@/api/remote/ui/test-plan-ui-scenario-case";
|
} from "@/api/remote/ui/test-plan-ui-scenario-case";
|
||||||
import {getVersionFilters} from "@/business/utils/sdk-utils";
|
import {getVersionFilters} from "@/business/utils/sdk-utils";
|
||||||
import {
|
import {uiAutomationReduction, uiAutomationVerifySeleniumServer,} from "@/api/remote/ui/api-scenario";
|
||||||
uiAutomationReduction,
|
|
||||||
uiAutomationVerifySeleniumServer,
|
|
||||||
} from "@/api/remote/ui/api-scenario";
|
|
||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
import MicroApp from "metersphere-frontend/src/components/MicroApp";
|
import MicroApp from "metersphere-frontend/src/components/MicroApp";
|
||||||
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
|
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
|
||||||
@ -722,7 +716,7 @@ export default {
|
|||||||
showReport(row) {
|
showReport(row) {
|
||||||
this.runVisible = true;
|
this.runVisible = true;
|
||||||
this.infoDb = true;
|
this.infoDb = true;
|
||||||
this.reportId = row.reportId;
|
this.reportId = getUUID() + "[TEST-PLAN-REDIRECT]" + row.reportId;
|
||||||
},
|
},
|
||||||
remove(row) {
|
remove(row) {
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user