Skip to content

Commit 4b0c18c

Browse files
twou12031travilyu
authored andcommitted
[feature] querier datasource, filter tags options by field not_supported_operators
**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)
1 parent 802b651 commit 4b0c18c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

deepflow-querier-datasource/src/QueryEditor.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type MetricOptsItem = LabelItem & {
8383
is_agg?: boolean
8484
whereOnly?: boolean
8585
fromSelect?: BasicDataWithId
86+
not_supported_operators?: string
8687
}
8788

8889
export type MetricOpts = MetricOptsItem[]
@@ -249,7 +250,8 @@ export class QueryEditor extends PureComponent<Props> {
249250
!tag.whereOnly &&
250251
!SELECT_GROUP_BY_DISABLE_TAGS.find((val: string) => {
251252
return (tag.value as string).includes(val)
252-
})
253+
}) &&
254+
!tag.not_supported_operators?.includes('select')
253255
)
254256
})
255257
}
@@ -1090,15 +1092,16 @@ export class QueryEditor extends PureComponent<Props> {
10901092
})
10911093
.concat(deprecatedTags)
10921094
.map((item: any) => {
1093-
const { name, client_name, server_name, display_name, type, deprecated } = item
1095+
const { name, client_name, server_name, display_name, type, deprecated, not_supported_operators } = item
10941096
const operatorOpts = formatTagOperators(item)
10951097
const displaySuffix = deprecated ? ' ⚠️' : ''
10961098
if (name === client_name && name === server_name) {
10971099
return {
10981100
label: (display_name === name ? `${name}` : `${name} (${display_name})`) + displaySuffix,
10991101
value: name,
11001102
type,
1101-
operatorOpts
1103+
operatorOpts,
1104+
not_supported_operators
11021105
}
11031106
}
11041107
return [
@@ -1109,7 +1112,8 @@ export class QueryEditor extends PureComponent<Props> {
11091112
value: name,
11101113
type,
11111114
whereOnly: true,
1112-
operatorOpts
1115+
operatorOpts,
1116+
not_supported_operators
11131117
}
11141118
]
11151119
: []),
@@ -1120,7 +1124,8 @@ export class QueryEditor extends PureComponent<Props> {
11201124
value: client_name,
11211125
type,
11221126
sideType: 'from',
1123-
operatorOpts
1127+
operatorOpts,
1128+
not_supported_operators
11241129
}
11251130
]
11261131
: []),
@@ -1131,7 +1136,8 @@ export class QueryEditor extends PureComponent<Props> {
11311136
value: server_name,
11321137
type,
11331138
sideType: 'to',
1134-
operatorOpts
1139+
operatorOpts,
1140+
not_supported_operators
11351141
}
11361142
]
11371143
: [])
@@ -1333,7 +1339,9 @@ export class QueryEditor extends PureComponent<Props> {
13331339
? tagOpts
13341340
.filter(tag => {
13351341
return (
1336-
!GROUP_BY_DISABLE_TAG_TYPES.includes(tag.type as string) && !tag.whereOnly
1342+
!GROUP_BY_DISABLE_TAG_TYPES.includes(tag.type as string) &&
1343+
!tag.whereOnly &&
1344+
!tag.not_supported_operators?.includes('group')
13371345
)
13381346
})
13391347
.filter((tag: MetricOptsItem) => {

0 commit comments

Comments
 (0)