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

[ENG-6585] Move boolean filters into group #2399

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
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ as |list|>
@toggleFilter={{queue this.toggleFilter (perform list.searchObjectsTask)}}
/>
{{/each}}
{{#if list.booleanFilters.length}}
<SearchPage::BooleanFilters
@cardSearchText={{this.cardSearchText}}
@cardSearchFilter={{this.valueSearchQueryOptions}}
@properties={{list.booleanFilters}}
@toggleFilter={{queue this.toggleFilter (perform list.searchObjectsTask)}}
/>
{{/if}}
</wrapper.right>
{{/if}}
</Institutions::Dashboard::-Components::InstitutionalDashboardWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Toast from 'ember-toastr/services/toast';

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

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

@tracked relatedProperties?: RelatedPropertyPathModel[] = [];
@tracked booleanFilters?: RelatedPropertyPathModel[] = [];

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

this.relatedProperties = await searchResult.relatedProperties;
this.booleanFilters = searchResult.relatedProperties
.filterBy('suggestedFilterOperator', SuggestedFilterOperators.IsPresent);
this.relatedProperties = searchResult.relatedProperties.filter(
(property: RelatedPropertyPathModel) =>
property.suggestedFilterOperator !== SuggestedFilterOperators.IsPresent, // AnyOf or AtDate
);
this.firstPageCursor = searchResult.firstPageCursor;
this.nextPageCursor = searchResult.nextPageCursor;
this.prevPageCursor = searchResult.prevPageCursor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{yield (hash
searchResults=this.searchResults
relatedProperties=this.relatedProperties
booleanFilters=this.booleanFilters
totalResultCount=this.totalResultCount

debouceSearchObjectsTask=this.debouceSearchObjectsTask
Expand Down
Loading