Skip to content

Commit a5c7462

Browse files
matt-bernsteinjomboothricardoantoniocm
authored
fix: ROOT-57: Annotation results filter does not return result, although matching criteria is met (#8086)
Co-authored-by: matt-bernstein <[email protected]> Co-authored-by: Jo Booth <[email protected]> Co-authored-by: Ricardo Cabral <[email protected]>
1 parent a5e375b commit a5c7462

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

web/libs/datamanager/src/components/Filters/FilterLine/FilterOperation.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ export const FilterOperation = observer(({ filter, field, operator, value, disab
6666
}
6767
const operators = operatorList.map(({ key, label }) => {
6868
if (filter.filter.field.isAnnotationResultsFilterColumn) {
69-
if (key === "contains") label = "includes all";
70-
if (key === "not_contains") label = "does not include all";
69+
if (filter.schema?.multiple ?? false) {
70+
if (key === "contains") label = "includes all";
71+
if (key === "not_contains") label = "does not include all";
72+
} else {
73+
if (key === "contains") label = "is";
74+
if (key === "not_contains") label = "is not";
75+
}
7176
}
7277
return { value: key, label };
7378
});
@@ -89,6 +94,7 @@ export const FilterOperation = observer(({ filter, field, operator, value, disab
8994
key={`${filter.filter.id}-${filter.filter.currentType}`}
9095
schema={filter.schema}
9196
filter={filter}
97+
multiple={filter.schema?.multiple ?? false}
9298
value={value}
9399
onChange={onChange}
94100
size="small"

web/libs/datamanager/src/components/Filters/types/List.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ export const ListFilter = [
4545
key: "contains",
4646
label: "contains",
4747
valueType: "single",
48-
input: (props) => <VariantSelect {...props} multiple />,
48+
input: (props) => <VariantSelect {...props} multiple={props.schema?.multiple} />,
4949
},
5050
{
5151
key: "not_contains",
5252
label: "not contains",
5353
valueType: "single",
54-
input: (props) => <VariantSelect {...props} multiple />,
54+
input: (props) => <VariantSelect {...props} multiple={props.schema?.multiple} />,
5555
},
5656
// ... Common,
5757
];

web/libs/datamanager/src/stores/Tabs/filter_utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ const filterFormatters: Formatter = {
2525

2626
return String(value);
2727
},
28+
List: (_op, value) => {
29+
// Ensure that List filter values are always serialized as arrays.
30+
if (Array.isArray(value) || value === null || value === undefined) return value;
31+
return [value];
32+
},
2833
};
2934

3035
export const normalizeFilterValue = (type: string, op: string, value: any) => {

web/libs/datamanager/src/stores/Tabs/tab_filter_type.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const FilterItemType = types.union({
2424
export const FilterValueList = types
2525
.model("FilterValueList", {
2626
items: types.array(FilterItemType),
27+
multiple: types.maybeNull(types.boolean),
2728
})
2829
.views((self) => ({
2930
get value() {

0 commit comments

Comments
 (0)