add latency in filters

This commit is contained in:
Fine 2022-10-13 15:57:06 +08:00
parent 44316a4f16
commit 7a48d96e7f
3 changed files with 19 additions and 14 deletions

View File

@ -49,17 +49,13 @@ import type { PropType } from "vue";
import { useI18n } from "vue-i18n";
import { EventParams } from "@/types/app";
import { useECharts } from "@/hooks/useEcharts";
import { useAppStoreWithOut } from "@/store/modules/app";
import { addResizeListener, removeResizeListener } from "@/utils/event";
import Trace from "@/views/dashboard/controls/Trace.vue";
import dateFormatStep from "@/utils/dateFormat";
import getLocalTime from "@/utils/localtime";
import associateProcessor from "@/hooks/useAssociateProcessor";
/*global Nullable, defineProps, defineEmits*/
const emits = defineEmits(["select"]);
const { t } = useI18n();
const appStore = useAppStoreWithOut();
const chartRef = ref<Nullable<HTMLDivElement>>(null);
const menus = ref<Nullable<HTMLDivElement>>(null);
const visMenus = ref<boolean>(false);
@ -153,8 +149,8 @@ function updateOptions() {
return;
}
if (props.filters.isRange) {
const { eventAssociate } = associateProcessor();
const options = eventAssociate(props);
const { eventAssociate } = associateProcessor(props);
const options = eventAssociate();
setOptions(options || props.option);
} else {
instance.dispatchAction({
@ -166,8 +162,7 @@ function updateOptions() {
}
function viewTrace() {
const item = associateProcessor().traceFilters(currentParams.value);
console.log(item);
const item = associateProcessor(props).traceFilters(currentParams.value);
traceOptions.value = {
...traceOptions.value,
filters: item,
@ -186,8 +181,8 @@ watch(
}
let options;
if (props.filters && props.filters.isRange) {
const { eventAssociate } = associateProcessor();
options = eventAssociate(props);
const { eventAssociate } = associateProcessor(props);
options = eventAssociate();
}
setOptions(options || props.option);
}

View File

@ -1,3 +1,4 @@
import { Option } from "@/types/app";
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -18,9 +19,10 @@ import { useAppStoreWithOut } from "@/store/modules/app";
import dateFormatStep from "@/utils/dateFormat";
import getLocalTime from "@/utils/localtime";
import { QueryOrders } from "@/views/dashboard/data";
import { EventParams } from "@/types/app";
export default function associateProcessor() {
function eventAssociate(props: any) {
export default function associateProcessor(props: any) {
function eventAssociate() {
if (!props.filters) {
return;
}
@ -64,7 +66,7 @@ export default function associateProcessor() {
};
return options;
}
function traceFilters(currentParams: any) {
function traceFilters(currentParams: Nullable<EventParams>) {
const appStore = useAppStoreWithOut();
if (!currentParams) {
@ -92,6 +94,7 @@ export default function associateProcessor() {
}
let queryOrder = QueryOrders[1].value;
let status = undefined;
let latency = undefined;
if (currentParams.seriesName.includes("_sla")) {
queryOrder = QueryOrders[0].value;
status = "ERROR";
@ -99,10 +102,18 @@ export default function associateProcessor() {
if (currentParams.seriesName.includes("_apdex")) {
status = "ERROR";
}
if (props.option.series) {
latency = props.option.series.map(
(d: { name: string; data: number[][] }) => {
return { [d.name]: d.data[currentParams.dataIndex] };
}
);
}
const item = {
duration,
queryOrder,
status,
latency,
};
return item;
}

View File

@ -57,7 +57,6 @@ export const traceStore = defineStore({
actions: {
setTraceCondition(data: any) {
this.conditions = { ...this.conditions, ...data };
console.log(this.conditions.queryOrder);
},
setCurrentTrace(trace: Trace) {
this.currentTrace = trace;