Skip to content

Commit

Permalink
fix: [SigNozGH-3585]: operator suggestion should work on the substrin…
Browse files Browse the repository at this point in the history
…g typed in by the user (SigNoz#4246)

* fix: [SigNozGH-3585]: operator suggestion logic

* fix: [SigNozGH-3585]: address review comments

* fix: [SigNozGH-3585]: address review comments
  • Loading branch information
vikrantgupta25 authored Dec 18, 2023
1 parent 2baa602 commit ce8fdd5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontend/src/hooks/queryBuilder/useOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ export const useOptions = (

const getKeyOperatorOptions = useCallback(
(key: string) => {
const operatorsOptions = operators?.map((operator) => ({
value: `${key} ${operator} `,
label: `${key} ${operator} `,
const keyOperator = key.split(' ');
const partialOperator = keyOperator?.[1];
const partialKey = keyOperator?.[0];
const filteredOperators = operators?.filter((operator) =>
operator.startsWith(partialOperator?.toUpperCase()),
);
const operatorsOptions = filteredOperators?.map((operator) => ({
value: `${partialKey} ${operator} `,
label: `${partialKey} ${operator} `,
}));
if (whereClauseConfig) {
return [
Expand Down

0 comments on commit ce8fdd5

Please sign in to comment.