From b97d53567ad8a2e4bacb1e8bbf084475a7989d2f Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 19 Nov 2024 11:32:59 -0500 Subject: [PATCH] Implement boolean filters correctly --- .../dashboard/-components/object-list/component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/institutions/dashboard/-components/object-list/component.ts b/app/institutions/dashboard/-components/object-list/component.ts index 35c308a169..0333bfb59a 100644 --- a/app/institutions/dashboard/-components/object-list/component.ts +++ b/app/institutions/dashboard/-components/object-list/component.ts @@ -3,6 +3,7 @@ import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import InstitutionModel from 'ember-osf-web/models/institution'; +import { SuggestedFilterOperators } from 'ember-osf-web/models/related-property-path'; import SearchResultModel from 'ember-osf-web/models/search-result'; import { Filter } from 'osf-components/components/search-page/component'; @@ -29,7 +30,7 @@ export type ObjectListColumn = ValueColumn | LinkColumn | ComponentColumn; interface InstitutionalObjectListArgs { institution: InstitutionModel; - defaultQueryOptions: Record<'cardSearchFilter', Record>; + defaultQueryOptions: Record<'cardSearchFilter', Record>; columns: ObjectListColumn[]; objectType: string; } @@ -53,6 +54,11 @@ export default class InstitutionalObjectList extends Component { + if (filter.suggestedFilterOperator === SuggestedFilterOperators.IsPresent) { + acc.cardSearchFilter[filter.propertyPathKey] = {}; + acc.cardSearchFilter[filter.propertyPathKey][filter.value] = true; + return acc; + } const currentValue = acc.cardSearchFilter[filter.propertyPathKey]; acc.cardSearchFilter[filter.propertyPathKey] = currentValue ? currentValue.concat(filter.value) : [filter.value];