Skip to content

Commit

Permalink
Merge pull request #198 from folio-org/MODFQMMGR-548
Browse files Browse the repository at this point in the history
MODFQMMGR-548: Refactor array handling to treat arrays as JSONB
  • Loading branch information
kjain110 authored Dec 16, 2024
2 parents e46fed8 + f7cff81 commit a1661ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/QueryBuilder/QueryBuilder/helpers/selectOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ export const getOperatorOptions = ({
case DATA_TYPES.NumberType:
return getOperatorsWithPlaceholder(extendedLogicalOperators(), intl);

case DATA_TYPES.ArrayType:
return getOperatorsWithPlaceholder(ArrayOperators(), intl);
case DATA_TYPES.ArrayType:

Check failure on line 89 in src/QueryBuilder/QueryBuilder/helpers/selectOptions.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

Trailing spaces not allowed
case DATA_TYPES.JsonbArrayType:
return getOperatorsWithPlaceholder(ArrayOperators(), intl);

Check failure on line 91 in src/QueryBuilder/QueryBuilder/helpers/selectOptions.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

Expected indentation of 6 spaces but found 8

case DATA_TYPES.DateType:
return getOperatorsWithPlaceholder(extendedLogicalOperators(), intl);
Expand Down
19 changes: 19 additions & 0 deletions src/QueryBuilder/QueryBuilder/helpers/selectOptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,25 @@ describe('select options', () => {
});
});

it('should return operators with placeholder for jsonb array type', () => {
const options = getOperatorOptions({
dataType: DATA_TYPES.JsonbArrayType,
hasSourceOrValues: false,
intl: intlMock,
});

expectFn({
options,
operators: [
{ label: OPERATORS_LABELS.CONTAINS_ALL, value: OPERATORS.CONTAINS_ALL },
{ label: OPERATORS_LABELS.NOT_CONTAINS_ALL, value: OPERATORS.NOT_CONTAINS_ALL },
{ label: OPERATORS_LABELS.CONTAINS_ANY, value: OPERATORS.CONTAINS_ANY },
{ label: OPERATORS_LABELS.NOT_CONTAINS_ANY, value: OPERATORS.NOT_CONTAINS_ANY },
{ label: OPERATORS_LABELS.EMPTY, value: OPERATORS.EMPTY },
],
});
});

it('should return operators with placeholder for enum type', () => {
const options = getOperatorOptions({
dataType: DATA_TYPES.EnumType,
Expand Down
1 change: 1 addition & 0 deletions src/constants/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const DATA_TYPES = {
EnumType: 'enumType',
ObjectType: 'objectType',
ArrayType: 'arrayType',
JsonbArrayType: 'jsonbArrayType',
};

0 comments on commit a1661ef

Please sign in to comment.