diff --git a/package-lock.json b/package-lock.json index 40152bd4..a388a03a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "echarts": "^5.2.2", "element-plus": "^2.2.5", "lodash": "^4.17.21", + "mitt": "^3.0.1", "monaco-editor": "^0.34.1", "pinia": "^2.0.28", "vis-timeline": "^7.5.1", @@ -9750,9 +9751,9 @@ } }, "node_modules/mitt": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-2.1.0.tgz", - "integrity": "sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==" + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, "node_modules/mixin-deep": { "version": "1.3.2", @@ -14819,6 +14820,11 @@ "mitt": "^2.1.0" } }, + "node_modules/vue-grid-layout/node_modules/mitt": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/mitt/-/mitt-2.1.0.tgz", + "integrity": "sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==" + }, "node_modules/vue-i18n": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.2.2.tgz", @@ -22286,9 +22292,9 @@ } }, "mitt": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-2.1.0.tgz", - "integrity": "sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==" + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, "mixin-deep": { "version": "1.3.2", @@ -25853,6 +25859,13 @@ "@interactjs/modifiers": "^1.10.2", "element-resize-detector": "^1.2.1", "mitt": "^2.1.0" + }, + "dependencies": { + "mitt": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/mitt/-/mitt-2.1.0.tgz", + "integrity": "sha512-ILj2TpLiysu2wkBbWjAmww7TkZb65aiQO+DkVdUTBpBXq+MHYiETENkKFMtsJZX1Lf4pe4QOrTSjIfUwN5lRdg==" + } } }, "vue-i18n": { diff --git a/package.json b/package.json index beca5ae2..c6b35cbb 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "echarts": "^5.2.2", "element-plus": "^2.2.5", "lodash": "^4.17.21", + "mitt": "^3.0.1", "monaco-editor": "^0.34.1", "pinia": "^2.0.28", "vis-timeline": "^7.5.1", diff --git a/src/main.ts b/src/main.ts index d051bb83..d4dbbf7a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,6 +22,7 @@ import i18n from "./locales"; import { useAppStoreWithOut } from "@/store/modules/app"; import "./styles/index.ts"; import "virtual:svg-icons-register"; +import mitt from "mitt"; const app = createApp(App); const appStore = useAppStoreWithOut(); @@ -29,6 +30,7 @@ const appStore = useAppStoreWithOut(); app.use(components); app.use(i18n); app.use(store); +app.config.globalProperties.$mybus = mitt(); mountApp(); async function mountApp() { diff --git a/src/utils/mitt.ts b/src/utils/mitt.ts new file mode 100644 index 00000000..433de4a3 --- /dev/null +++ b/src/utils/mitt.ts @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mitt from "mitt"; + +const emitter = mitt(); + +export default emitter; diff --git a/src/views/dashboard/controls/Trace.vue b/src/views/dashboard/controls/Trace.vue index d3fddd2a..b988df3a 100644 --- a/src/views/dashboard/controls/Trace.vue +++ b/src/views/dashboard/controls/Trace.vue @@ -25,11 +25,17 @@ limitations under the License. -->