From 33096bbfd677e68221de405127a41540a18ae75c Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 9 Jan 2025 13:56:14 +0530 Subject: [PATCH 1/4] Update Util.ts --- client/src/consts/Util.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/consts/Util.ts b/client/src/consts/Util.ts index befdcc8e..48fb7944 100644 --- a/client/src/consts/Util.ts +++ b/client/src/consts/Util.ts @@ -62,6 +62,14 @@ export const LOGICAL_OPERATORS = [ value: 'ARRAY_CONTAINS_ANY', label: 'ARRAY_CONTAINS_ANY', }, + { + value: 'JSON_CONTAINS_ALL', + label: 'JSON_CONTAINS_ALL', + }, + { + value: 'JSON_CONTAINS_ANY', + label: 'JSON_CONTAINS_ANY', + }, ]; export enum FILE_MIME_TYPE { From 7c66209920847b1de97feba11b2ba2a2d713d201 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 9 Jan 2025 14:05:19 +0530 Subject: [PATCH 2/4] Update utils.ts --- client/src/components/advancedSearch/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/components/advancedSearch/utils.ts b/client/src/components/advancedSearch/utils.ts index 3eb55164..cca917e4 100644 --- a/client/src/components/advancedSearch/utils.ts +++ b/client/src/components/advancedSearch/utils.ts @@ -33,6 +33,8 @@ export const formatValue = (value: string, type: string, operator: string) => { break; case 'ARRAY_CONTAINS_ALL': case 'ARRAY_CONTAINS_ANY': + case 'JSON_CONTAINS_ALL': + case 'JSON_CONTAINS_ANY': conditionValue = `[${value}]`; break; default: From 3f6ff8e0bec9998c37c86fcb3dd425d3d9bf96ea Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 9 Jan 2025 14:41:32 +0530 Subject: [PATCH 3/4] Update utils.ts . --- client/src/components/advancedSearch/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/components/advancedSearch/utils.ts b/client/src/components/advancedSearch/utils.ts index cca917e4..291b2f2c 100644 --- a/client/src/components/advancedSearch/utils.ts +++ b/client/src/components/advancedSearch/utils.ts @@ -33,6 +33,8 @@ export const formatValue = (value: string, type: string, operator: string) => { break; case 'ARRAY_CONTAINS_ALL': case 'ARRAY_CONTAINS_ANY': + conditionValue = `[${value}]`; + break; case 'JSON_CONTAINS_ALL': case 'JSON_CONTAINS_ANY': conditionValue = `[${value}]`; From 026631f063bd26bae368ce4b162a467ee80869b9 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 9 Jan 2025 14:42:13 +0530 Subject: [PATCH 4/4] Update Filter.tsx . --- client/src/components/advancedSearch/Filter.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/advancedSearch/Filter.tsx b/client/src/components/advancedSearch/Filter.tsx index 71d4dba2..60a55c1d 100644 --- a/client/src/components/advancedSearch/Filter.tsx +++ b/client/src/components/advancedSearch/Filter.tsx @@ -103,7 +103,10 @@ const Filter = forwardRef((props: FilterProps, ref) => { if (op === 'ARRAY_CONTAINS_ALL' || op === 'ARRAY_CONTAINS_ANY') { newExpr = `${op}(${n}, ${value})`; } - + // rewrite expression if the op is JSON_CONTAINS_ANY/JSON_CONTAINS_ANY + if (op === 'JSON_CONTAINS_ALL' || op === 'JSON_CONTAINS_ANY') { + newExpr = `${op}(${n}, ${value})`; + } return `${prev}${prev && !prev.endsWith('|| ') ? ' && ' : ''}${newExpr}`; }, ''); func(expression);