mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 19:43:04 +00:00
search page fix
This commit is contained in:
@@ -79,13 +79,13 @@ export class SearchFilterService {
|
|||||||
this.getCurrentQuery(),
|
this.getCurrentQuery(),
|
||||||
this.getCurrentFilters(),
|
this.getCurrentFilters(),
|
||||||
(pagination, sort, view, scope, query, filters) => {
|
(pagination, sort, view, scope, query, filters) => {
|
||||||
return Object.assign(new SearchOptions(),
|
return Object.assign(new PaginatedSearchOptions(),
|
||||||
defaults,
|
defaults,
|
||||||
{
|
{
|
||||||
pagination: pagination,
|
pagination: pagination,
|
||||||
sort: sort,
|
sort: sort,
|
||||||
view: view,
|
view: view,
|
||||||
scope: scope,
|
scope: scope || defaults.scope,
|
||||||
query: query,
|
query: query,
|
||||||
filters: filters
|
filters: filters
|
||||||
})
|
})
|
||||||
|
@@ -43,7 +43,8 @@ export class SearchPageComponent implements OnInit {
|
|||||||
id: 'search-results-pagination',
|
id: 'search-results-pagination',
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
},
|
},
|
||||||
query: ''
|
query: '',
|
||||||
|
scope: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private service: SearchService,
|
constructor(private service: SearchService,
|
||||||
|
@@ -99,7 +99,7 @@ export class SearchService implements OnDestroy {
|
|||||||
const requestObs = this.halService.getEndpoint(this.searchLinkPath).pipe(
|
const requestObs = this.halService.getEndpoint(this.searchLinkPath).pipe(
|
||||||
map((url: string) => {
|
map((url: string) => {
|
||||||
if (hasValue(searchOptions)) {
|
if (hasValue(searchOptions)) {
|
||||||
url = searchOptions.toRestUrl(url);
|
url = (searchOptions as PaginatedSearchOptions).toRestUrl(url);
|
||||||
}
|
}
|
||||||
const request = new GetRequest(this.requestService.generateRequestId(), url);
|
const request = new GetRequest(this.requestService.generateRequestId(), url);
|
||||||
return Object.assign(request, {
|
return Object.assign(request, {
|
||||||
|
@@ -336,7 +336,8 @@ export class PaginationComponent implements OnDestroy, OnInit {
|
|||||||
*/
|
*/
|
||||||
private updateRoute(params: {}) {
|
private updateRoute(params: {}) {
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: Object.assign({}, this.currentQueryParams, params)
|
queryParams: Object.assign({}, this.currentQueryParams, params),
|
||||||
|
queryParamsHandling: 'merge'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/search">
|
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/search">
|
||||||
<div *ngIf="isNotEmpty(scopes)" class="col-12 col-sm-3">
|
<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 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>
|
<option *ngFor="let scopeOption of scopes" [value]="scopeOption.id">{{scopeOption?.name ? scopeOption.name : 'search.form.search_dspace' | translate}}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@@ -50,11 +50,4 @@ export class SearchFormComponent {
|
|||||||
return isNotEmpty(object);
|
return isNotEmpty(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
byId(id1: string, id2: string) {
|
|
||||||
if (isEmpty(id1) && isEmpty(id2)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return id1 === id2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user