From 077cc22f3325e5b12e03ca537033be77ad72d293 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 21 Feb 2022 11:08:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E4=BA=8B=E4=BB=B6=E6=80=BB=E7=BA=BF=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/automation/report/SysnApiReportDetail.vue | 3 +-- .../components/api/automation/scenario/ApiScenarioList.vue | 5 ++--- frontend/src/business/components/track/plan/event-bus.js | 3 --- .../view/comonents/functional/FunctionalTestCaseList.vue | 5 ++--- .../TemplateComponent/FailureResultAdvanceComponent.vue | 3 +-- .../report/TemplateComponent/FailureResultComponent.vue | 3 +-- 6 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 frontend/src/business/components/track/plan/event-bus.js diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index 09fb6e3bcb..76e744693e 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -83,7 +83,6 @@ import MsApiReportViewHeader from "./ApiReportViewHeader"; import {RequestFactory} from "../../definition/model/ApiTestModel"; import {windowPrint, getCurrentProjectID, getUUID} from "@/common/js/utils"; import {STEP} from "../scenario/Setting"; -import {scenario} from "@/business/components/track/plan/event-bus"; export default { name: "SysnApiReportDetail", @@ -367,7 +366,7 @@ export default { if (e.data && e.data.indexOf("MS_TEST_END") !== -1) { this.getReport(); this.messageWebSocket.close(); - scenario.$emit('hide', this.scenarioId); + this.$EventBus.$emit('hide', this.scenarioId); this.$emit('refresh', this.debugResult); } }, diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index ea7e454e20..26cd5907bd 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -310,7 +310,6 @@ import { getLastTableSortField } from "@/common/js/tableUtils"; import {API_SCENARIO_FILTERS} from "@/common/js/table-constants"; -import {scenario} from "@/business/components/track/plan/event-bus"; import MsTable from "@/business/components/common/components/table/MsTable"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; @@ -568,7 +567,7 @@ export default { }, created() { this.apiscenariofilters = API_SCENARIO_FILTERS(); - scenario.$on('hide', id => { + this.$EventBus.$on('hide', id => { this.hideStopBtn(id); }); this.projectId = getCurrentProjectID(); @@ -617,7 +616,7 @@ export default { } }, beforeDestroy() { - scenario.$off("hide"); + this.$EventBus.$off("hide"); }, watch: { selectNodeIds() { diff --git a/frontend/src/business/components/track/plan/event-bus.js b/frontend/src/business/components/track/plan/event-bus.js deleted file mode 100644 index e697981c47..0000000000 --- a/frontend/src/business/components/track/plan/event-bus.js +++ /dev/null @@ -1,3 +0,0 @@ -import Vue from 'vue'; -export const hub = new Vue(); -export const scenario = new Vue(); diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue index e0488527e2..30fea9a1be 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -287,7 +287,6 @@ import MsTableOperatorButton from "../../../../../common/components/MsTableOpera import {TEST_PLAN_TEST_CASE_CONFIGS} from "../../../../../common/components/search/search-components"; import BatchEdit from "../../../../case/components/BatchEdit"; import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; -import {hub} from "@/business/components/track/plan/event-bus"; import MsTag from "@/business/components/common/components/MsTag"; import { buildBatchParam, @@ -451,7 +450,7 @@ export default { }, mounted() { this.$emit('setCondition', this.condition); - hub.$on("openFailureTestCase", row => { + this.$EventBus.$on("openFailureTestCase", row => { this.isReadOnly = true; this.condition.status = 'Failure'; this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row, this.tableData); @@ -463,7 +462,7 @@ export default { this.getVersionOptions(); }, beforeDestroy() { - hub.$off("openFailureTestCase"); + this.$EventBus.$off("openFailureTestCase"); }, methods: { nextPage() { diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue index 17db43e854..945d9626fa 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue @@ -15,7 +15,6 @@ import TypeTableItem from "../../../../../common/tableItems/planview/TypeTableItem"; import MethodTableItem from "../../../../../common/tableItems/planview/MethodTableItem"; import StatusTableItem from "../../../../../common/tableItems/planview/StatusTableItem"; - import {hub} from "@/business/components/track/plan/event-bus"; import FunctionalFailureCasesList from "./component/FunctionalFailureCasesList"; import ApiFailureCasesList from "./component/ApiFailureCasesList"; import ScenarioFailureCasesList from "./component/ScenarioFailureCasesList"; @@ -66,7 +65,7 @@ }, methods: { goFailureTestCase(row) { - hub.$emit("openFailureTestCase", row); + this.$EventBus.$emit("openFailureTestCase", row); } } } diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultComponent.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultComponent.vue index 633728fc30..65b36abe47 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultComponent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultComponent.vue @@ -92,7 +92,6 @@ import TypeTableItem from "../../../../../common/tableItems/planview/TypeTableItem"; import MethodTableItem from "../../../../../common/tableItems/planview/MethodTableItem"; import StatusTableItem from "../../../../../common/tableItems/planview/StatusTableItem"; - import {hub} from "@/business/components/track/plan/event-bus"; export default { name: "FailureResultComponent", components: {StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem, CommonComponent}, @@ -127,7 +126,7 @@ }, methods: { goFailureTestCase(row) { - hub.$emit("openFailureTestCase", row); + this.$EventBus.$emit("openFailureTestCase", row); } } }