Skip to content

Commit

Permalink
[feature] querier datasource, filter tags options by field `not_suppo…
Browse files Browse the repository at this point in the history
…rted_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)
  • Loading branch information
twou12031 authored and travilyu committed May 10, 2024
1 parent 802b651 commit 4b0c18c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions deepflow-querier-datasource/src/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type MetricOptsItem = LabelItem & {
is_agg?: boolean
whereOnly?: boolean
fromSelect?: BasicDataWithId
not_supported_operators?: string
}

export type MetricOpts = MetricOptsItem[]
Expand Down Expand Up @@ -249,7 +250,8 @@ export class QueryEditor extends PureComponent<Props> {
!tag.whereOnly &&
!SELECT_GROUP_BY_DISABLE_TAGS.find((val: string) => {
return (tag.value as string).includes(val)
})
}) &&
!tag.not_supported_operators?.includes('select')
)
})
}
Expand Down Expand Up @@ -1090,15 +1092,16 @@ export class QueryEditor extends PureComponent<Props> {
})
.concat(deprecatedTags)
.map((item: any) => {
const { name, client_name, server_name, display_name, type, deprecated } = item
const { name, client_name, server_name, display_name, type, deprecated, not_supported_operators } = item
const operatorOpts = formatTagOperators(item)
const displaySuffix = deprecated ? ' ⚠️' : ''
if (name === client_name && name === server_name) {
return {
label: (display_name === name ? `${name}` : `${name} (${display_name})`) + displaySuffix,
value: name,
type,
operatorOpts
operatorOpts,
not_supported_operators
}
}
return [
Expand All @@ -1109,7 +1112,8 @@ export class QueryEditor extends PureComponent<Props> {
value: name,
type,
whereOnly: true,
operatorOpts
operatorOpts,
not_supported_operators
}
]
: []),
Expand All @@ -1120,7 +1124,8 @@ export class QueryEditor extends PureComponent<Props> {
value: client_name,
type,
sideType: 'from',
operatorOpts
operatorOpts,
not_supported_operators
}
]
: []),
Expand All @@ -1131,7 +1136,8 @@ export class QueryEditor extends PureComponent<Props> {
value: server_name,
type,
sideType: 'to',
operatorOpts
operatorOpts,
not_supported_operators
}
]
: [])
Expand Down Expand Up @@ -1333,7 +1339,9 @@ export class QueryEditor extends PureComponent<Props> {
? tagOpts
.filter(tag => {
return (
!GROUP_BY_DISABLE_TAG_TYPES.includes(tag.type as string) && !tag.whereOnly
!GROUP_BY_DISABLE_TAG_TYPES.includes(tag.type as string) &&
!tag.whereOnly &&
!tag.not_supported_operators?.includes('group')
)
})
.filter((tag: MetricOptsItem) => {
Expand Down

0 comments on commit 4b0c18c

Please sign in to comment.