fix: [GH-3585]: operator suggestion should work on the substring typed in by the user (#4246)

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

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

* fix: [GH-3585]: address review comments
This commit is contained in:
Vikrant Gupta 2023-12-18 13:51:39 +05:30 committed by GitHub
parent 2baa6028b5
commit ce8fdd509b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 [