Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support logic for ARRAY_CONTAINS_ALL in attu query search #559

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/src/components/advancedSearch/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ const Filter = forwardRef((props: FilterProps, ref) => {
if (op === 'JSON_CONTAINS' || op === 'ARRAY_CONTAINS') {
newExpr = `${op}(${n}, ${value})`;
}
// rewrite expression if the op is ARRAY_CONTAINS_ALL/ARRAY_CONTAINS_ANY
if (op === 'ARRAY_CONTAINS_ALL' || op === 'ARRAY_CONTAINS_ANY') {
newExpr = `${op}(${n}, ${value})`;
}

return `${prev}${prev && !prev.endsWith('|| ') ? ' && ' : ''}${newExpr}`;
}, '');
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/advancedSearch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const formatValue = (value: string, type: string, operator: string) => {
case 'ARRAY_CONTAINS':
conditionValue = `${value}`;
break;
case 'ARRAY_CONTAINS_ALL':
case 'ARRAY_CONTAINS_ANY':
conditionValue = `[${value}]`;
break;
default:
conditionValue = `"${value}"`;
break;
Expand Down
8 changes: 8 additions & 0 deletions client/src/consts/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export const LOGICAL_OPERATORS = [
value: 'ARRAY_CONTAINS',
label: 'ARRAY_CONTAINS',
},
{
value: 'ARRAY_CONTAINS_ALL',
label: 'ARRAY_CONTAINS_ALL',
},
{
value: 'ARRAY_CONTAINS_ANY',
label: 'ARRAY_CONTAINS_ANY',
},
];

export enum FILE_MIME_TYPE {
Expand Down
Loading