Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
APP_CONFIG,
AppConfig,
} from '@dspace/config/app-config.interface';
import { currentPath } from '@dspace/core/router/utils/route.utils';
import { FilterType } from '@dspace/core/shared/search/models/filter-type.model';
import { SearchFilterConfig } from '@dspace/core/shared/search/models/search-filter-config.model';
import { FilterConfig } from '@dspace/core/shared/search/search-filters/search-config.model';
Expand Down Expand Up @@ -64,6 +65,11 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy {
*/
@Input() filtersConfig: SearchFilterConfig[];

/**
* True when the search component should show results on the current page
*/
@Input() inPlaceSearch: boolean;

/**
* The current search scope
*/
Expand Down Expand Up @@ -129,11 +135,21 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy {
}
}

/**
* @returns {string} The base path to the search page, or the current page when inPlaceSearch is true
*/
getSearchLink(): string {
if (this.inPlaceSearch) {
return currentPath(this.router);
}
return this.searchService.getSearchLink();
}

applyFilter(): void {
if (isNotEmpty(this.currentValue)) {
this.searchFilterService.minimizeAll();
this.subs.push(this.searchConfigurationService.selectNewAppliedFilterParams(this.currentFilter, this.currentValue.trim(), this.currentOperator).pipe(take(1)).subscribe((params: Params) => {
void this.router.navigate([this.searchService.getSearchLink()], {
void this.router.navigate([this.getSearchLink()], {
queryParams: params,
});
this.currentValue = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class SearchHierarchyFilterComponent extends SearchFacetFilterComponent i
take(1),
).subscribe((params: Params) => {
void this.router.navigate(
[this.searchService.getSearchLink()],
[this.getSearchLink()],
{
queryParams: params,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<ds-advanced-search
[configuration]="configuration"
[filtersConfig]="(filters | async)?.payload"
[inPlaceSearch]="inPlaceSearch"
[scope]="currentScope">
</ds-advanced-search>
}
Expand Down
Loading