forked from hazza/dspace-angular
browse-by-metadata-page works correctly on numeric 'value' param
This commit is contained in:
@@ -109,7 +109,7 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* The authority key (may be undefined) associated with {@link #value}.
|
* The authority key (may be undefined) associated with {@link #value}.
|
||||||
*/
|
*/
|
||||||
authority: string;
|
authority: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current startsWith option (fetched and updated from query-params)
|
* The current startsWith option (fetched and updated from query-params)
|
||||||
@@ -122,19 +122,19 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
fetchThumbnails: boolean;
|
fetchThumbnails: boolean;
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
public constructor(protected route: ActivatedRoute,
|
||||||
protected browseService: BrowseService,
|
protected browseService: BrowseService,
|
||||||
protected dsoService: DSpaceObjectDataService,
|
protected dsoService: DSpaceObjectDataService,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@Inject(APP_CONFIG) public appConfig: AppConfig) {
|
@Inject(APP_CONFIG) public appConfig: AppConfig) {
|
||||||
|
|
||||||
this.fetchThumbnails = this.appConfig.browseBy.showThumbnails;
|
this.fetchThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: BBM_PAGINATION_ID,
|
id: BBM_PAGINATION_ID,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: this.appConfig.browseBy.pageSize,
|
pageSize: this.appConfig.browseBy.pageSize,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -149,19 +149,28 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
return [Object.assign({}, routeParams, queryParams),currentPage,currentSort];
|
return [Object.assign({}, routeParams, queryParams),currentPage,currentSort];
|
||||||
})
|
})
|
||||||
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.authority = params.authority;
|
this.authority = params.authority;
|
||||||
this.value = +params.value || params.value || '';
|
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
if(typeof params.value === "string"){
|
||||||
if (isNotEmpty(this.value)) {
|
this.value = params.value.trim();
|
||||||
this.updatePageWithItems(
|
}
|
||||||
browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), this.value, this.authority);
|
|
||||||
} else {
|
this.value = +params.value || params.value || '';
|
||||||
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
|
|
||||||
}
|
if(typeof params.startsWith === "string"){
|
||||||
this.updateParent(params.scope);
|
this.startsWith = params.startsWith.trim();
|
||||||
this.updateLogo();
|
}
|
||||||
}));
|
|
||||||
|
if (isNotEmpty(this.value)) {
|
||||||
|
this.updatePageWithItems(
|
||||||
|
browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), this.value, this.authority);
|
||||||
|
} else {
|
||||||
|
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
|
||||||
|
}
|
||||||
|
this.updateParent(params.scope);
|
||||||
|
this.updateLogo();
|
||||||
|
}));
|
||||||
this.updateStartsWithTextOptions();
|
this.updateStartsWithTextOptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -213,8 +222,8 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
...linksToFollow() as FollowLinkConfig<DSpaceObject>[]).pipe(
|
...linksToFollow() as FollowLinkConfig<DSpaceObject>[]).pipe(
|
||||||
getFirstSucceededRemoteData()
|
getFirstSucceededRemoteData()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,9 +287,9 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
* @returns BrowseEntrySearchOptions instance
|
* @returns BrowseEntrySearchOptions instance
|
||||||
*/
|
*/
|
||||||
export function getBrowseSearchOptions(defaultBrowseId: string,
|
export function getBrowseSearchOptions(defaultBrowseId: string,
|
||||||
paginationConfig: PaginationComponentOptions,
|
paginationConfig: PaginationComponentOptions,
|
||||||
sortConfig: SortOptions,
|
sortConfig: SortOptions,
|
||||||
fetchThumbnails?: boolean) {
|
fetchThumbnails?: boolean) {
|
||||||
if (!hasValue(fetchThumbnails)) {
|
if (!hasValue(fetchThumbnails)) {
|
||||||
fetchThumbnails = false;
|
fetchThumbnails = false;
|
||||||
}
|
}
|
||||||
@@ -297,15 +306,15 @@ export function getBrowseSearchOptions(defaultBrowseId: string,
|
|||||||
* @param fetchThumbnail Optional parameter for requesting thumbnail images
|
* @param fetchThumbnail Optional parameter for requesting thumbnail images
|
||||||
*/
|
*/
|
||||||
export function browseParamsToOptions(params: any,
|
export function browseParamsToOptions(params: any,
|
||||||
paginationConfig: PaginationComponentOptions,
|
paginationConfig: PaginationComponentOptions,
|
||||||
sortConfig: SortOptions,
|
sortConfig: SortOptions,
|
||||||
metadata?: string,
|
metadata?: string,
|
||||||
fetchThumbnail?: boolean): BrowseEntrySearchOptions {
|
fetchThumbnail?: boolean): BrowseEntrySearchOptions {
|
||||||
return new BrowseEntrySearchOptions(
|
return new BrowseEntrySearchOptions(
|
||||||
metadata,
|
metadata,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
sortConfig,
|
sortConfig,
|
||||||
+params.startsWith || params.startsWith,
|
params.startsWith,
|
||||||
params.scope,
|
params.scope,
|
||||||
fetchThumbnail
|
fetchThumbnail
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user