From 582e43bbeeba6c8e8a96e391c3dfb14369319ae6 Mon Sep 17 00:00:00 2001 From: Fine Date: Thu, 20 Oct 2022 15:50:49 +0800 Subject: [PATCH] update --- src/components/Graph.vue | 1 + src/hooks/useAssociateProcessor.ts | 23 ++++++--------- src/locales/lang/en.ts | 1 + src/locales/lang/es.ts | 1 + src/locales/lang/zh.ts | 1 + src/views/dashboard/configuration/Widget.vue | 6 +++- .../widget/RelatedTraceOptions.vue | 29 +++++-------------- src/views/dashboard/related/trace/Header.vue | 16 ++++++---- 8 files changed, 35 insertions(+), 43 deletions(-) diff --git a/src/components/Graph.vue b/src/components/Graph.vue index c5c87e19..d60a8e70 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -167,6 +167,7 @@ function viewTrace() { filters: item, }; showTrace.value = true; + visMenus.value = true; } watch( diff --git a/src/hooks/useAssociateProcessor.ts b/src/hooks/useAssociateProcessor.ts index 1c98cc74..81d0966e 100644 --- a/src/hooks/useAssociateProcessor.ts +++ b/src/hooks/useAssociateProcessor.ts @@ -18,8 +18,8 @@ import { Option } from "@/types/app"; 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"; +import { QueryOrders, Status } from "@/views/dashboard/data"; export default function associateProcessor(props: any) { function eventAssociate() { @@ -92,18 +92,13 @@ export default function associateProcessor(props: any) { step, }; } - let queryOrder = QueryOrders[1].value; - let status = undefined; - let latency = undefined; - if (currentParams.seriesName.includes("_sla")) { - queryOrder = QueryOrders[0].value; - status = "ERROR"; - } - if (currentParams.seriesName.includes("_apdex")) { - status = "ERROR"; - } - if (props.option.series) { - latency = props.option.series.map( + const relatedTrace = props.relatedTrace || {}; + const status = relatedTrace.status; + const queryOrder = relatedTrace.queryOrder; + const { latency } = relatedTrace; + let latencyList = undefined; + if (latency && props.option.series) { + latencyList = props.option.series.map( (d: { name: string; data: number[][] }) => { return { [d.name]: d.data[currentParams.dataIndex] }; } @@ -113,7 +108,7 @@ export default function associateProcessor(props: any) { duration, queryOrder, status, - latency, + latency: latencyList, }; return item; } diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 9bc9d127..a700b93d 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -160,6 +160,7 @@ const msg = { viewTrace: "View related trace", relatedTraceOptions: "Related Trace Options", setLatencyDuration: "Set Latency Range", + queryOrder: "Query Order", seconds: "Seconds", hourTip: "Select Hour", minuteTip: "Select Minute", diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index e5dd271d..7c830e47 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -157,6 +157,7 @@ const msg = { postgreSQL: "PostgreSQL", endpointTips: "Aquí, la tabla muestra hasta 20 punto final.", apisix: "APISIX", + queryOrder: "Orden de consulta", seconds: "Segundos", hourTip: "Seleccione Hora", minuteTip: "Seleccione Minuto", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index b246a663..9b54385a 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -157,6 +157,7 @@ const msg = { viewTrace: "查看相关Trace", relatedTraceOptions: "相关的Trace选项", setLatencyDuration: "设置延时范围", + queryOrder: "查询顺序", seconds: "秒", hourTip: "选择小时", minuteTip: "选择分钟", diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 054790f9..e6967bf8 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -65,7 +65,11 @@ limitations under the License. --> > - + diff --git a/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue b/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue index c08fdbde..75fb0fe1 100644 --- a/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue +++ b/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue @@ -20,7 +20,7 @@ limitations under the License. --> :value="status" :options="Status" placeholder="Select a status" - @change="updateConfig({ status })" + @change="updateConfig({ status: $event[0].value })" />
@@ -30,25 +30,16 @@ limitations under the License. --> :value="queryOrder" :options="QueryOrders" placeholder="Select a option" - @change="updateConfig({ queryOrder })" + @change="updateConfig({ queryOrder: $event[0].value })" />
-
{{ t("setLatencyDuration") }}
@@ -56,16 +47,14 @@ limitations under the License. --> import { ref } from "vue"; import { useI18n } from "vue-i18n"; import { useDashboardStore } from "@/store/modules/dashboard"; -import { Status } from "../../data"; -import { QueryOrders } from "../../data"; +import { Status, QueryOrders } from "../../data"; const { t } = useI18n(); const dashboardStore = useDashboardStore(); -const traceOpt = dashboardStore.selectedGrid.relatedTrace; +const traceOpt = dashboardStore.selectedGrid.relatedTrace || {}; const status = ref(traceOpt.status || Status[0].value); const queryOrder = ref(traceOpt.queryOrder || QueryOrders[0].value); -// const setDuration = ref(traceOpt.setDuration || false); -const setLatencyDuration = ref(traceOpt.setLatencyDuration || false); +const latency = ref(traceOpt.setLatencyDuration || false); function updateConfig(param: { [key: string]: unknown }) { const relatedTrace = { @@ -83,10 +72,6 @@ function updateConfig(param: { [key: string]: unknown }) { margin-bottom: 5px; } -.input { - width: 500px; -} - .item { margin-bottom: 10px; } diff --git a/src/views/dashboard/related/trace/Header.vue b/src/views/dashboard/related/trace/Header.vue index 9d38c746..0792f303 100644 --- a/src/views/dashboard/related/trace/Header.vue +++ b/src/views/dashboard/related/trace/Header.vue @@ -81,15 +81,19 @@ const state = reactive({ endpoint: "", service: "", }); -const items = Object.keys(filters).map((d: string) => { - return { key: d, value: filtersKeys[d] }; -}); -const conditions = ref(items[0].key); +const conditions = ref(""); +const items = ref<{ key: string; value: string }[]>([]); init(); async function init() { if (!filters.id) { + for (const d of Object.keys(filters)) { + if (filters[d]) { + items.value.push({ key: d, value: filtersKeys[d] }); + } + } + conditions.value = (items.value[0] && items.value[0].key) || ""; state.service = selectorStore.currentService.id; if (dashboardStore.entity === EntityType[2].value) { state.instance = selectorStore.currentPod.id; @@ -154,8 +158,8 @@ function setCondition() { }; // echarts if (!filters.id) { - for (const k of items) { - if (k.key === conditions.value) { + for (const k of items.value) { + if (k.key === conditions.value && filters[k.key]) { params[k.value] = filters[k.key]; } }