diff --git a/src/__tests__/main.spec.ts b/src/__tests__/main.spec.ts index 59ad2afc..ce31bd64 100644 --- a/src/__tests__/main.spec.ts +++ b/src/__tests__/main.spec.ts @@ -166,8 +166,8 @@ describe("Main Application", () => { const mockStore = useAppStoreWithOut(); // Mock async operations to take time - mockStore.getActivateMenus.mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 100))); - mockStore.queryOAPTimeInfo.mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 100))); + vi.mocked(mockStore.getActivateMenus).mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 100))); + vi.mocked(mockStore.queryOAPTimeInfo).mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 100))); // Test async operations const promises = [mockStore.getActivateMenus(), mockStore.queryOAPTimeInfo()]; diff --git a/src/components/Graph/Graph.vue b/src/components/Graph/Graph.vue index 76e668df..23a5c74d 100644 --- a/src/components/Graph/Graph.vue +++ b/src/components/Graph/Graph.vue @@ -55,11 +55,11 @@ limitations under the License. --> import type { PropType, Ref } from "vue"; import { useI18n } from "vue-i18n"; import type { EventParams } from "@/types/app"; - import type { Filters, RelatedTrace } from "@/types/dashboard"; + import type { Filters, RelatedTrace, AssociateProcessorProps } from "@/types/dashboard"; import { useECharts } from "@/hooks/useEcharts"; import { addResizeListener, removeResizeListener } from "@/utils/event"; import Trace from "@/views/dashboard/related/trace/Index.vue"; - import associateProcessor from "@/hooks/useAssociateProcessor"; + import useAssociateProcessor from "@/hooks/useAssociateProcessor"; import { WidgetType } from "@/views/dashboard/data"; import SelectorLegend from "./Legend.vue"; @@ -71,7 +71,7 @@ limitations under the License. --> const { setOptions, resize, getInstance } = useECharts(chartRef as Ref); const currentParams = ref>(null); const showTrace = ref(false); - const traceOptions = ref<{ type: string; filters?: unknown }>({ + const traceOptions = ref<{ type: string; filters?: unknown } | any>({ type: WidgetType.Trace, }); const menuPos = reactive<{ x: number; y: number }>({ x: NaN, y: NaN }); @@ -187,7 +187,11 @@ limitations under the License. --> return; } if (props.filters.isRange) { - const { eventAssociate } = associateProcessor(props); + const { eventAssociate } = useAssociateProcessor({ + filters: props.filters, + option: props.option, + relatedTrace: props.relatedTrace, + } as AssociateProcessorProps); const options = eventAssociate(); setOptions(options || props.option); } else { @@ -200,7 +204,12 @@ limitations under the License. --> } function viewTrace() { - const item = associateProcessor(props).traceFilters(currentParams.value); + const item = useAssociateProcessor({ + filters: props.filters, + option: props.option, + relatedTrace: props.relatedTrace, + } as AssociateProcessorProps).traceFilters(currentParams.value); + traceOptions.value = { ...traceOptions.value, filters: item, @@ -243,8 +252,12 @@ limitations under the License. --> return; } let options; - if (props.filters && props.filters.isRange) { - const { eventAssociate } = associateProcessor(props); + if (props.filters?.isRange) { + const { eventAssociate } = useAssociateProcessor({ + filters: props.filters, + option: props.option, + relatedTrace: props.relatedTrace, + } as AssociateProcessorProps); options = eventAssociate(); } setOptions(options || props.option); diff --git a/src/components/Radio.vue b/src/components/Radio.vue index 17e21593..4fe4318e 100644 --- a/src/components/Radio.vue +++ b/src/components/Radio.vue @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. -->