small fixes for search

This commit is contained in:
lotte
2019-05-16 13:43:07 +02:00
parent 5254308b8b
commit 487ee9f756
5 changed files with 4 additions and 12 deletions

View File

@@ -90,14 +90,14 @@ export class CollectionPageComponent implements OnInit {
dsoType: DSpaceObjectType.ITEM dsoType: DSpaceObjectType.ITEM
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>> })).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>
}), }),
startWith(undefined) // Make sure switching page shows loading component startWith(undefined) // Make sure switching pages shows loading component
) )
) )
); );
this.route.queryParams.pipe(take(1)).subscribe((params) => { this.route.queryParams.pipe(take(1)).subscribe((params) => {
this.metadata.processRemoteData(this.collectionRD$); this.metadata.processRemoteData(this.collectionRD$);
this.onPaginationChange(params) this.onPaginationChange(params);
}) })
} }

View File

@@ -354,10 +354,7 @@ export class SearchService implements OnDestroy {
* @returns {string} The base path to the search page * @returns {string} The base path to the search page
*/ */
getSearchLink(): string { getSearchLink(): string {
const urlTree = this.router.parseUrl(this.router.url); return '/search';
const g: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
const searchLink: any = '/' + g.toString();
return (searchLink !== '/search' && searchLink !== '/mydspace') ? '/search' : searchLink;
} }
/** /**

View File

@@ -79,7 +79,6 @@ export class SearchSettingsComponent implements OnInit {
this.router.navigate(this.getSearchLinkParts(), navigationExtras); this.router.navigate(this.getSearchLinkParts(), navigationExtras);
} }
/** /**
* @returns {string} The base path to the search page, or the current page when inPlaceSearch is true * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true
*/ */
@@ -99,5 +98,4 @@ export class SearchSettingsComponent implements OnInit {
} }
return this.getSearchLink().split('/'); return this.getSearchLink().split('/');
} }
} }

View File

@@ -218,8 +218,7 @@ export class RemoteDataBuildService {
.map((d: RemoteData<T>) => d.isResponsePending) .map((d: RemoteData<T>) => d.isResponsePending)
.find((b: boolean) => b === true); .find((b: boolean) => b === true);
let isSuccessful: boolean;
let isSuccessful: boolean = undefined;
// isSuccessful should be undefined until all responses have come in. // isSuccessful should be undefined until all responses have come in.
// We can't know its state beforehand. We also can't say it's false // We can't know its state beforehand. We also can't say it's false
// because that would imply a request failed. // because that would imply a request failed.

View File

@@ -69,7 +69,6 @@ export class SearchFormComponent {
* @param data Updated parameters * @param data Updated parameters
*/ */
updateSearch(data: any) { updateSearch(data: any) {
this.router.navigate(this.getSearchLinkParts(), { this.router.navigate(this.getSearchLinkParts(), {
queryParams: Object.assign({}, { page: 1 }, data), queryParams: Object.assign({}, { page: 1 }, data),
queryParamsHandling: 'merge' queryParamsHandling: 'merge'
@@ -83,7 +82,6 @@ export class SearchFormComponent {
return isNotEmpty(object); return isNotEmpty(object);
} }
/** /**
* @returns {string} The base path to the search page, or the current page when inPlaceSearch is true * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true
*/ */