From f0270bc98a8a87ff85f251379c802378b459fab2 Mon Sep 17 00:00:00 2001
From: jidanjuan <112756875+jidanjuan@users.noreply.github.com>
Date: Thu, 28 Nov 2024 16:07:28 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=20=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=981?=
=?UTF-8?q?=E3=80=8136=E3=80=8138=E3=80=8139=E3=80=8140=E3=80=8148?=
=?UTF-8?q?=E3=80=8150=E4=BF=AE=E5=A4=8D=20(#4092)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../graph-analysis/common/FieldSettings.vue | 71 +++++++++----------
.../graph-analysis/index.tsx | 6 --
.../graph-analysis/sql-editor/index.tsx | 1 -
.../graph-analysis/sql-editor/use-editor.ts | 1 +
4 files changed, 36 insertions(+), 43 deletions(-)
diff --git a/bklog/web/src/views/retrieve-v2/search-result-panel/graph-analysis/common/FieldSettings.vue b/bklog/web/src/views/retrieve-v2/search-result-panel/graph-analysis/common/FieldSettings.vue
index 288c4849cf..033c179518 100644
--- a/bklog/web/src/views/retrieve-v2/search-result-panel/graph-analysis/common/FieldSettings.vue
+++ b/bklog/web/src/views/retrieve-v2/search-result-panel/graph-analysis/common/FieldSettings.vue
@@ -44,15 +44,31 @@
const emit = defineEmits(['update']);
const selectedXAxis = ref(props.xAxis);
const selectedYAxis = ref(props.yAxis);
- const timeAxis = ref([]);
+ const timeAxis = ref('');
const hiddenField = ref([]);
const list = computed(() => props.result_schema.map(item => item.field_alias));
- const stringFilterList = computed(() =>
- props.result_schema.filter(item => item.field_type !== 'string').map(item => item.field_alias),
- );
- const timeFilterList = computed(() =>
- props.result_schema.filter(item => /^date/.test(item.field_type)).map(item => item.field_alias),
- );
+ const filterFields = ( typeCheck, excludeList) => {
+ return props.result_schema.filter(item => typeCheck(item))
+ .filter(item => !excludeList.includes(item.field_alias));
+ };
+
+ const xAxisFilterList = computed(() => {
+ return filterFields(item => true, [...selectedYAxis.value, timeAxis.value]);
+ });
+
+ const yAxisFilterList = computed(() => {
+ return filterFields(
+ item => item.field_type !== 'string',
+ [...selectedXAxis.value, timeAxis.value]
+ );
+ });
+
+ const timeFilterList = computed(() => {
+ return filterFields(
+ item => item.field_type == 'long',
+ [...selectedYAxis.value, ...selectedXAxis.value]
+ );
+ });
// 监听 props.xAxis 的变化并更新 selectedXAxis
watch(
() => props.xAxis,
@@ -84,10 +100,10 @@
multiple
>