search page fix

This commit is contained in:
Lotte Hofstede
2018-04-05 15:54:51 +02:00
parent 6133bc5068
commit d5114a87da
6 changed files with 8 additions and 13 deletions

View File

@@ -79,13 +79,13 @@ export class SearchFilterService {
this.getCurrentQuery(),
this.getCurrentFilters(),
(pagination, sort, view, scope, query, filters) => {
return Object.assign(new SearchOptions(),
return Object.assign(new PaginatedSearchOptions(),
defaults,
{
pagination: pagination,
sort: sort,
view: view,
scope: scope,
scope: scope || defaults.scope,
query: query,
filters: filters
})

View File

@@ -43,7 +43,8 @@ export class SearchPageComponent implements OnInit {
id: 'search-results-pagination',
pageSize: 10
},
query: ''
query: '',
scope: ''
};
constructor(private service: SearchService,

View File

@@ -99,7 +99,7 @@ export class SearchService implements OnDestroy {
const requestObs = this.halService.getEndpoint(this.searchLinkPath).pipe(
map((url: string) => {
if (hasValue(searchOptions)) {
url = searchOptions.toRestUrl(url);
url = (searchOptions as PaginatedSearchOptions).toRestUrl(url);
}
const request = new GetRequest(this.requestService.generateRequestId(), url);
return Object.assign(request, {

View File

@@ -336,7 +336,8 @@ export class PaginationComponent implements OnDestroy, OnInit {
*/
private updateRoute(params: {}) {
this.router.navigate([], {
queryParams: Object.assign({}, this.currentQueryParams, params)
queryParams: Object.assign({}, this.currentQueryParams, params),
queryParamsHandling: 'merge'
});
}

View File

@@ -1,6 +1,6 @@
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/search">
<div *ngIf="isNotEmpty(scopes)" class="col-12 col-sm-3">
<select [(ngModel)]="selectedId" name="scope" class="form-control" aria-label="Search scope" [compareWith]="byId">
<select [(ngModel)]="selectedId" name="scope" class="form-control" aria-label="Search scope">
<option value>{{'search.form.search_dspace' | translate}}</option>
<option *ngFor="let scopeOption of scopes" [value]="scopeOption.id">{{scopeOption?.name ? scopeOption.name : 'search.form.search_dspace' | translate}}</option>
</select>

View File

@@ -50,11 +50,4 @@ export class SearchFormComponent {
return isNotEmpty(object);
}
byId(id1: string, id2: string) {
if (isEmpty(id1) && isEmpty(id2)) {
return true;
}
return id1 === id2;
}
}