Skip to content

Commit fe98821

Browse files
authored
Move boolean filters into group (#2399)
1 parent 46ea031 commit fe98821

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

app/institutions/dashboard/-components/object-list/template.hbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ as |list|>
240240
@toggleFilter={{queue this.toggleFilter (perform list.searchObjectsTask)}}
241241
/>
242242
{{/each}}
243+
{{#if list.booleanFilters.length}}
244+
<SearchPage::BooleanFilters
245+
@cardSearchText={{this.cardSearchText}}
246+
@cardSearchFilter={{this.valueSearchQueryOptions}}
247+
@properties={{list.booleanFilters}}
248+
@toggleFilter={{queue this.toggleFilter (perform list.searchObjectsTask)}}
249+
/>
250+
{{/if}}
243251
</wrapper.right>
244252
{{/if}}
245253
</Institutions::Dashboard::-Components::InstitutionalDashboardWrapper>

lib/osf-components/addon/components/index-card-searcher/component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Toast from 'ember-toastr/services/toast';
88

99
import SearchResultModel from 'ember-osf-web/models/search-result';
1010
import { taskFor } from 'ember-concurrency-ts';
11-
import RelatedPropertyPathModel from 'ember-osf-web/models/related-property-path';
11+
import RelatedPropertyPathModel, { SuggestedFilterOperators } from 'ember-osf-web/models/related-property-path';
1212

1313
interface IndexCardSearcherArgs {
1414
queryOptions: Record<string, any>;
@@ -25,6 +25,7 @@ export default class IndexCardSearcher extends Component<IndexCardSearcherArgs>
2525
@tracked totalResultCount = 0;
2626

2727
@tracked relatedProperties?: RelatedPropertyPathModel[] = [];
28+
@tracked booleanFilters?: RelatedPropertyPathModel[] = [];
2829

2930
@tracked firstPageCursor?: string;
3031
@tracked nextPageCursor?: string;
@@ -57,7 +58,12 @@ export default class IndexCardSearcher extends Component<IndexCardSearcherArgs>
5758
try {
5859
const searchResult = await this.store.queryRecord('index-card-search', this.args.queryOptions);
5960

60-
this.relatedProperties = await searchResult.relatedProperties;
61+
this.booleanFilters = searchResult.relatedProperties
62+
.filterBy('suggestedFilterOperator', SuggestedFilterOperators.IsPresent);
63+
this.relatedProperties = searchResult.relatedProperties.filter(
64+
(property: RelatedPropertyPathModel) =>
65+
property.suggestedFilterOperator !== SuggestedFilterOperators.IsPresent, // AnyOf or AtDate
66+
);
6167
this.firstPageCursor = searchResult.firstPageCursor;
6268
this.nextPageCursor = searchResult.nextPageCursor;
6369
this.prevPageCursor = searchResult.prevPageCursor;

lib/osf-components/addon/components/index-card-searcher/template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{yield (hash
22
searchResults=this.searchResults
33
relatedProperties=this.relatedProperties
4+
booleanFilters=this.booleanFilters
45
totalResultCount=this.totalResultCount
56

67
debouceSearchObjectsTask=this.debouceSearchObjectsTask

0 commit comments

Comments
 (0)