From e087c394f6520130a8389ff11a53b85b66f5cf65 Mon Sep 17 00:00:00 2001 From: Yefu Zhang Date: Thu, 10 Nov 2022 12:14:25 +0800 Subject: [PATCH] [bugfix] deepflow querier datasource, throw error when reusing tag from SELECT **Phenomenon and reproduction steps** none **Root cause and solution** none **Impactions** none **Test method** none **Affected branch(es)** - main **Checklist** - [ ] Dependencies update required - [ ] Common bug (similar problem in other repo) --- deepflow-querier-datasource/src/QueryEditor.tsx | 12 +++++------- deepflow-querier-datasource/src/consts.ts | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/deepflow-querier-datasource/src/QueryEditor.tsx b/deepflow-querier-datasource/src/QueryEditor.tsx index acde124..282470c 100644 --- a/deepflow-querier-datasource/src/QueryEditor.tsx +++ b/deepflow-querier-datasource/src/QueryEditor.tsx @@ -24,7 +24,6 @@ import { SERVICE_MAP_SUPPORT_DB, SERVICE_MAP_SUPPORT_TABLE, TAG_METRIC_TYPE_NUM, - TAG_TAG_TYPE, TIME_TAG_TYPE } from 'consts' import { DATA_SOURCE_SETTINGS, getTagMapCache, SQL_CACHE } from 'utils/cache' @@ -224,7 +223,7 @@ export class QueryEditor extends PureComponent { } const result = select .filter(e => { - return ![TAG_TAG_TYPE, TIME_TAG_TYPE].includes(e.type) && !!e.key && e.as !== '' + return e.type === 'tag' && !!e.key && e.as !== '' }) .map((e, i) => { const orgOpt = tagOpts.find(opt => { @@ -240,6 +239,7 @@ export class QueryEditor extends PureComponent { fromSelect: e } }) + .filter(e => !!e) return result } @@ -1110,11 +1110,9 @@ export class QueryEditor extends PureComponent { ) && extra ) }) - : this.tagsFromSelect.concat( - tagOpts.filter(tag => { - return ![MAP_TAG_TYPE, TIME_TAG_TYPE].includes(tag.type as string) - }) - ) + : this.tagsFromSelect.concat(tagOpts).filter(tag => { + return ![MAP_TAG_TYPE, TIME_TAG_TYPE].includes(tag.type as string) + }) } metricOpts={ conf.targetDataKey === 'orderBy' diff --git a/deepflow-querier-datasource/src/consts.ts b/deepflow-querier-datasource/src/consts.ts index 1895d98..3f614c2 100644 --- a/deepflow-querier-datasource/src/consts.ts +++ b/deepflow-querier-datasource/src/consts.ts @@ -14,7 +14,6 @@ export const TAG_METRIC_TYPE_NUM = 6 export const MAP_METRIC_TYPE_NUM = 7 export const TIME_TAG_TYPE = 'time' -export const TAG_TAG_TYPE = 'tag' export const MAP_TAG_TYPE = 'map' export const IP_ARRAY_TAG_TYPE = 'ip_array' export const RESOURCE_ARRAY_TAG_TYPE = 'resource_array'