update relateTrace

This commit is contained in:
Fine 2022-10-20 16:18:57 +08:00
parent 582e43bbee
commit 3604c5bc10
6 changed files with 33 additions and 23 deletions

View File

@ -47,6 +47,7 @@ import {
import type { PropType } from "vue"; import type { PropType } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { EventParams } from "@/types/app"; import { EventParams } from "@/types/app";
import { Filters, RelatedTrace } from "@/types/dashboard";
import { useECharts } from "@/hooks/useEcharts"; import { useECharts } from "@/hooks/useEcharts";
import { addResizeListener, removeResizeListener } from "@/utils/event"; import { addResizeListener, removeResizeListener } from "@/utils/event";
import Trace from "@/views/dashboard/related/trace/Index.vue"; import Trace from "@/views/dashboard/related/trace/Index.vue";
@ -74,15 +75,10 @@ const props = defineProps({
default: () => ({}), default: () => ({}),
}, },
filters: { filters: {
type: Object as PropType<{ type: Object as PropType<Filters>,
duration: { },
startTime: string; relatedTrace: {
endTime: string; type: Object as PropType<RelatedTrace>,
};
isRange: boolean;
dataIndex?: number;
sourceId: string;
}>,
}, },
}); });
const available = computed( const available = computed(

View File

@ -1,3 +1,4 @@
import { DurationTime } from "@/types/app";
/** /**
* 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
@ -40,7 +41,15 @@ export interface LayoutConfig {
associate?: { widgetId: string }[]; associate?: { widgetId: string }[];
eventAssociate?: boolean; eventAssociate?: boolean;
filters?: Filters; filters?: Filters;
relatedTrace?: RelatedTrace;
} }
export type RelatedTrace = {
duration: DurationTime;
status: string;
queryOrder: string;
latency: any;
};
export type Filters = { export type Filters = {
dataIndex: number; dataIndex: number;
sourceId: string; sourceId: string;

View File

@ -36,6 +36,7 @@ limitations under the License. -->
metrics: dashboardStore.selectedGrid.metrics, metrics: dashboardStore.selectedGrid.metrics,
metricTypes: dashboardStore.selectedGrid.metricTypes, metricTypes: dashboardStore.selectedGrid.metricTypes,
metricConfig: dashboardStore.selectedGrid.metricConfig, metricConfig: dashboardStore.selectedGrid.metricConfig,
relatedTrace: dashboardStore.selectedGrid.relatedTrace,
}" }"
:needQuery="true" :needQuery="true"
/> />

View File

@ -64,6 +64,7 @@ limitations under the License. -->
id: data.id, id: data.id,
metricConfig: data.metricConfig, metricConfig: data.metricConfig,
filters: data.filters || {}, filters: data.filters || {},
relatedTrace: data.relatedTrace || {},
}" }"
:needQuery="needQuery" :needQuery="needQuery"
@click="clickHandle" @click="clickHandle"

View File

@ -13,12 +13,22 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<template> <template>
<Graph :option="option" @select="clickEvent" :filters="config.filters" /> <Graph
:option="option"
@select="clickEvent"
:filters="config.filters"
:relatedTrace="config.relatedTrace"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from "vue"; import { computed } from "vue";
import type { PropType } from "vue"; import type { PropType } from "vue";
import { LineConfig, EventParams } from "@/types/dashboard"; import {
LineConfig,
EventParams,
RelatedTrace,
Filters,
} from "@/types/dashboard";
/*global defineProps, defineEmits */ /*global defineProps, defineEmits */
const emits = defineEmits(["click"]); const emits = defineEmits(["click"]);
@ -32,15 +42,8 @@ const props = defineProps({
config: { config: {
type: Object as PropType< type: Object as PropType<
LineConfig & { LineConfig & {
filters: { filters: Filters;
sourceId: string; relatedTrace: RelatedTrace;
duration: {
startTime: string;
endTime: string;
};
isRange: boolean;
dataIndex?: number;
};
} & { id: string } } & { id: string }
>, >,
default: () => ({ default: () => ({

View File

@ -53,7 +53,7 @@ import { ElMessage } from "element-plus";
import { EntityType, QueryOrders, Status } from "../../data"; import { EntityType, QueryOrders, Status } from "../../data";
import { LayoutConfig } from "@/types/dashboard"; import { LayoutConfig } from "@/types/dashboard";
const filtersKeys: { [key: string]: string } = { const FiltersKeys: { [key: string]: string } = {
status: "traceState", status: "traceState",
queryOrder: "queryOrder", queryOrder: "queryOrder",
duration: "queryDuration", duration: "queryDuration",
@ -89,8 +89,8 @@ init();
async function init() { async function init() {
if (!filters.id) { if (!filters.id) {
for (const d of Object.keys(filters)) { for (const d of Object.keys(filters)) {
if (filters[d]) { if (filters[d] && d !== "duration") {
items.value.push({ key: d, value: filtersKeys[d] }); items.value.push({ key: d, value: FiltersKeys[d] });
} }
} }
conditions.value = (items.value[0] && items.value[0].key) || ""; conditions.value = (items.value[0] && items.value[0].key) || "";