fix: trace associate with log

This commit is contained in:
Fine 2023-02-07 18:06:07 +08:00
parent 1768a1641c
commit dfb1874454
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import { dashboardStore } from "./../store/modules/dashboard";
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -15,9 +16,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { useDashboardStore } from "@/store/modules/dashboard";
import dateFormatStep from "@/utils/dateFormat"; import dateFormatStep from "@/utils/dateFormat";
import getLocalTime from "@/utils/localtime"; import getLocalTime from "@/utils/localtime";
import type { EventParams } from "@/types/app"; import type { EventParams } from "@/types/app";
import type { LayoutConfig } from "@/types/dashboard";
export default function associateProcessor(props: any) { export default function associateProcessor(props: any) {
function eventAssociate() { function eventAssociate() {
@ -115,5 +118,13 @@ export default function associateProcessor(props: any) {
item.metricValue = value; item.metricValue = value;
return item; return item;
} }
return { eventAssociate, traceFilters }; function removeAssociationFilters(config: LayoutConfig) {
const dashboardStore = useDashboardStore();
if (!config.filters) {
return;
}
delete config.filters;
dashboardStore.setWidget(config);
}
return { eventAssociate, traceFilters, removeAssociationFilters };
} }

View File

@ -129,6 +129,7 @@ limitations under the License. -->
import { ErrorCategory } from "./data"; import { ErrorCategory } from "./data";
import type { LayoutConfig } from "@/types/dashboard"; import type { LayoutConfig } from "@/types/dashboard";
import type { DurationTime } from "@/types/app"; import type { DurationTime } from "@/types/app";
import removeAssociationFilters from "@/hooks/useAssociateProcessor";
/*global defineProps, Recordable */ /*global defineProps, Recordable */
const props = defineProps({ const props = defineProps({
@ -319,6 +320,7 @@ limitations under the License. -->
} }
onUnmounted(() => { onUnmounted(() => {
logStore.resetState(); logStore.resetState();
removeAssociationFilters(props.data);
}); });
watch( watch(
() => selectorStore.currentService, () => selectorStore.currentService,

View File

@ -89,6 +89,7 @@ limitations under the License. -->
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType, QueryOrders, Status } from "../../data"; import { EntityType, QueryOrders, Status } from "../../data";
import type { LayoutConfig } from "@/types/dashboard"; import type { LayoutConfig } from "@/types/dashboard";
import removeAssociationFilters from "@/hooks/useAssociateProcessor";
/*global defineProps, Recordable */ /*global defineProps, Recordable */
const props = defineProps({ const props = defineProps({
@ -245,6 +246,7 @@ limitations under the License. -->
} }
onUnmounted(() => { onUnmounted(() => {
traceStore.resetState(); traceStore.resetState();
removeAssociationFilters(props.data);
}); });
watch( watch(
() => [selectorStore.currentPod], () => [selectorStore.currentPod],

View File

@ -86,6 +86,7 @@ limitations under the License. -->
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType, QueryOrders, Status } from "../../data"; import { EntityType, QueryOrders, Status } from "../../data";
import type { LayoutConfig } from "@/types/dashboard"; import type { LayoutConfig } from "@/types/dashboard";
import removeAssociationFilters from "@/hooks/useAssociateProcessor";
const FiltersKeys: { [key: string]: string } = { const FiltersKeys: { [key: string]: string } = {
status: "traceState", status: "traceState",
@ -229,6 +230,7 @@ limitations under the License. -->
} }
onUnmounted(() => { onUnmounted(() => {
traceStore.resetState(); traceStore.resetState();
removeAssociationFilters(props.data);
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>