mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
62530: fixed loading issue
This commit is contained in:
@@ -9,9 +9,7 @@ import { SearchConfigurationService } from './search-service/search-configuratio
|
||||
import { Observable } from 'rxjs';
|
||||
import { PaginatedSearchOptions } from './paginated-search-options.model';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||
import { isNotEmpty } from '../shared/empty.util';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
/**
|
||||
* This component renders a simple item page.
|
||||
@@ -33,7 +31,6 @@ import { isNotEmpty } from '../shared/empty.util';
|
||||
})
|
||||
|
||||
export class FilteredSearchPageComponent extends SearchPageComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* The actual query for the fixed filter.
|
||||
* If empty, the query will be determined by the route parameter called 'filter'
|
||||
@@ -59,7 +56,6 @@ export class FilteredSearchPageComponent extends SearchPageComponent implements
|
||||
super.ngOnInit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current paginated search options after updating the fixed filter using the fixedFilterQuery input
|
||||
* This is to make sure the fixed filter is included in the paginated search options, as it is not part of any
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="search-page row">
|
||||
<ds-search-sidebar *ngIf="!(isXsOrSm$ | async)" class="col-{{sideBarWidth}} sidebar-md-sticky"
|
||||
id="search-sidebar"
|
||||
[resultCount]="(resultsRD$ | async)?.payload.totalElements" [inPlaceSearch]="inPlaceSearch"></ds-search-sidebar>
|
||||
[resultCount]="(resultsRD$ | async)?.payload?.totalElements" [inPlaceSearch]="inPlaceSearch"></ds-search-sidebar>
|
||||
<div class="col-12 col-md-{{12 - sideBarWidth}}">
|
||||
<ds-search-form *ngIf="searchEnabled" id="search-form"
|
||||
[query]="(searchOptions$ | async)?.query"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ChangeDetectionStrategy, Component, Inject, Input, OnInit } from '@angular/core';
|
||||
import { Observable , Subscription , BehaviorSubject } from 'rxjs';
|
||||
import { switchMap, } from 'rxjs/operators';
|
||||
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { startWith, switchMap, } from 'rxjs/operators';
|
||||
import { PaginatedList } from '../core/data/paginated-list';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { DSpaceObject } from '../core/shared/dspace-object.model';
|
||||
@@ -43,7 +43,6 @@ export const SEARCH_ROUTE = '/search';
|
||||
* It renders search results depending on the current search options
|
||||
*/
|
||||
export class SearchPageComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* The current search results
|
||||
*/
|
||||
@@ -110,7 +109,7 @@ export class SearchPageComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
this.searchOptions$ = this.getSearchOptions();
|
||||
this.sub = this.searchOptions$.pipe(
|
||||
switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData())))
|
||||
switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData(), startWith(observableOf(undefined)))))
|
||||
.subscribe((results) => {
|
||||
this.resultsRD$.next(results);
|
||||
});
|
||||
|
@@ -6,7 +6,7 @@
|
||||
[objects]="searchResults"
|
||||
[hideGear]="true">
|
||||
</ds-viewable-collection></div>
|
||||
<ds-loading *ngIf="!searchResults || searchResults?.isLoading" message="{{'loading.search-results' | translate}}"></ds-loading>
|
||||
<ds-loading *ngIf="hasNoValue(searchResults) || hasNoValue(searchResults.payload) || searchResults.isLoading" message="{{'loading.search-results' | translate}}"></ds-loading>
|
||||
<ds-error *ngIf="searchResults?.hasFailed && (!searchResults?.error || searchResults?.error?.statusCode != 400)" message="{{'error.search-results' | translate}}"></ds-error>
|
||||
<div *ngIf="searchResults?.payload?.page.length == 0 || searchResults?.error?.statusCode == 400">
|
||||
{{ 'search.results.no-results' | translate }}
|
||||
|
@@ -6,7 +6,7 @@ import { SetViewMode } from '../../shared/view-mode';
|
||||
import { SearchOptions } from '../search-options.model';
|
||||
import { SearchResult } from '../search-result.model';
|
||||
import { PaginatedList } from '../../core/data/paginated-list';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { hasNoValue, isNotEmpty } from '../../shared/empty.util';
|
||||
import { SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
|
||||
@Component({
|
||||
@@ -22,6 +22,8 @@ import { SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
* Component that represents all results from a search
|
||||
*/
|
||||
export class SearchResultsComponent {
|
||||
hasNoValue = hasNoValue;
|
||||
|
||||
/**
|
||||
* The actual search result objects
|
||||
*/
|
||||
|
@@ -229,7 +229,6 @@ export class SearchConfigurationService implements OnDestroy {
|
||||
this.getFiltersPart(),
|
||||
this.getFixedFilterPart()
|
||||
).subscribe((update) => {
|
||||
console.log(update);
|
||||
const currentValue: SearchOptions = this.searchOptions.getValue();
|
||||
const updatedValue: SearchOptions = Object.assign(currentValue, update);
|
||||
this.searchOptions.next(updatedValue);
|
||||
|
@@ -21,11 +21,11 @@ import { coreSelector } from '../../core/core.selectors';
|
||||
|
||||
export const routeParametersSelector = createSelector(
|
||||
coreSelector,
|
||||
(state: CoreState) => state['route'].params
|
||||
(state: CoreState) => state.route.params
|
||||
);
|
||||
export const queryParametersSelector = createSelector(
|
||||
coreSelector,
|
||||
(state: CoreState) => state['route'].queryParams
|
||||
(state: CoreState) => state.route.queryParams
|
||||
);
|
||||
|
||||
export const routeParameterSelector = (key: string) => parameterSelector(key, routeParametersSelector);
|
||||
@@ -96,9 +96,7 @@ export class RouteService {
|
||||
}
|
||||
|
||||
getRouteParameterValue(paramName: string): Observable<string> {
|
||||
const test = this.store.pipe(select(routeParameterSelector(paramName)));
|
||||
test.subscribe((t) => {console.log('test', t)});
|
||||
return test;
|
||||
return this.store.pipe(select(routeParameterSelector(paramName)));
|
||||
}
|
||||
|
||||
getRouteDataValue(datafield: string): Observable<any> {
|
||||
|
Reference in New Issue
Block a user