Commits
Davide Negretti authored 64231683b3d
1 1 | import { ChangeDetectionStrategy, Component, Inject, Input, OnInit } from '@angular/core'; |
2 2 | import { BehaviorSubject, Observable, Subscription } from 'rxjs'; |
3 3 | import { startWith, switchMap } from 'rxjs/operators'; |
4 4 | import { PaginatedList } from '../core/data/paginated-list.model'; |
5 5 | import { RemoteData } from '../core/data/remote-data'; |
6 6 | import { DSpaceObject } from '../core/shared/dspace-object.model'; |
7 7 | import { pushInOut } from '../shared/animations/push'; |
8 8 | import { HostWindowService } from '../shared/host-window.service'; |
9 9 | import { SidebarService } from '../shared/sidebar/sidebar.service'; |
10 10 | import { hasValue, isEmpty } from '../shared/empty.util'; |
11 - | import { getFirstSucceededRemoteData } from '../core/shared/operators'; |
11 + | import { getFirstCompletedRemoteData } from '../core/shared/operators'; |
12 12 | import { RouteService } from '../core/services/route.service'; |
13 13 | import { SEARCH_CONFIG_SERVICE } from '../my-dspace-page/my-dspace-page.component'; |
14 14 | import { PaginatedSearchOptions } from '../shared/search/paginated-search-options.model'; |
15 15 | import { SearchResult } from '../shared/search/search-result.model'; |
16 16 | import { SearchConfigurationService } from '../core/shared/search/search-configuration.service'; |
17 17 | import { SearchService } from '../core/shared/search/search.service'; |
18 18 | import { currentPath } from '../shared/utils/route.utils'; |
19 19 | import { Router } from '@angular/router'; |
20 20 | import { Context } from '../core/shared/context.model'; |
21 21 | import { SortOptions } from '../core/cache/models/sort-options.model'; |
119 119 | * |
120 120 | * Listen to changes in the scope |
121 121 | * If something changes, update the list of scopes for the dropdown |
122 122 | */ |
123 123 | ngOnInit(): void { |
124 124 | this.isSidebarCollapsed$ = this.isSidebarCollapsed(); |
125 125 | this.searchLink = this.getSearchLink(); |
126 126 | this.searchOptions$ = this.getSearchOptions(); |
127 127 | this.sub = this.searchOptions$.pipe( |
128 128 | switchMap((options) => this.service.search( |
129 - | options, undefined, true, true, followLink<Item>('thumbnail', { isOptional: true }) |
130 - | ).pipe(getFirstSucceededRemoteData(), startWith(undefined)) |
129 + | options, undefined, false, true, followLink<Item>('thumbnail', { isOptional: true }) |
130 + | ).pipe(getFirstCompletedRemoteData(), startWith(undefined)) |
131 131 | ) |
132 132 | ).subscribe((results) => { |
133 - | this.resultsRD$.next(results); |
134 - | }); |
133 + | this.resultsRD$.next(results); |
134 + | }); |
135 135 | |
136 136 | if (isEmpty(this.configuration$)) { |
137 137 | this.configuration$ = this.searchConfigService.getCurrentConfiguration('default'); |
138 138 | } |
139 139 | |
140 140 | const searchConfig$ = this.searchConfigService.getConfigurationSearchConfigObservable(this.configuration$, this.service); |
141 141 | |
142 142 | this.sortOptions$ = this.searchConfigService.getConfigurationSortOptionsObservable(searchConfig$); |
143 143 | this.searchConfigService.initializeSortOptionsFromConfiguration(searchConfig$); |
144 144 | |