-
-
-
diff --git a/src/app/+search-page/search-page.component.ts b/src/app/+search-page/search-page.component.ts
index c646318de3..7b2ad5294a 100644
--- a/src/app/+search-page/search-page.component.ts
+++ b/src/app/+search-page/search-page.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { flatMap, switchMap, } from 'rxjs/operators';
import { PaginatedList } from '../core/data/paginated-list';
@@ -12,7 +12,7 @@ import { SearchResult } from './search-result.model';
import { SearchService } from './search-service/search.service';
import { SearchSidebarService } from './search-sidebar/search-sidebar.service';
import { Subscription } from 'rxjs/Subscription';
-import { hasValue } from '../shared/empty.util';
+import { hasValue, isNotEmpty } from '../shared/empty.util';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { SearchConfigurationService } from './search-service/search-configuration.service';
import { getSucceededRemoteData } from '../core/shared/operators';
@@ -62,7 +62,23 @@ export class SearchPageComponent implements OnInit {
*/
sub: Subscription;
- fixedFilter;
+ /**
+ * Whether or not the search bar should be visible
+ */
+ @Input()
+ searchEnabled = true;
+
+ /**
+ * The width of the sidebar (bootstrap columns)
+ */
+ @Input()
+ sideBarWidth = 3;
+
+ /**
+ * The currently applied filter (determines title of search)
+ */
+ @Input()
+ fixedFilter$: Observable
;
constructor(protected service: SearchService,
protected sidebarService: SearchSidebarService,
@@ -81,7 +97,7 @@ export class SearchPageComponent implements OnInit {
* If something changes, update the list of scopes for the dropdown
*/
ngOnInit(): void {
- this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
+ this.searchOptions$ = this.getSearchOptions();
this.sub = this.searchOptions$
.switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData()))
.subscribe((results) => {
@@ -90,7 +106,13 @@ export class SearchPageComponent implements OnInit {
this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(
switchMap((scopeId) => this.service.getScopes(scopeId))
);
- this.fixedFilter = this.routeService.getRouteParameterValue('filter');
+ if (!isNotEmpty(this.fixedFilter$)) {
+ this.fixedFilter$ = this.routeService.getRouteParameterValue('filter');
+ }
+ }
+
+ protected getSearchOptions(): Observable {
+ return this.searchConfigService.paginatedSearchOptions;
}
/**
diff --git a/src/app/+search-page/search-page.module.ts b/src/app/+search-page/search-page.module.ts
index fd9c2e5adc..658c32d27e 100644
--- a/src/app/+search-page/search-page.module.ts
+++ b/src/app/+search-page/search-page.module.ts
@@ -89,6 +89,9 @@ const effects = [
SearchTextFilterComponent,
SearchHierarchyFilterComponent,
SearchBooleanFilterComponent,
+ ],
+ exports: [
+ FilteredSearchPageComponent
]
})
diff --git a/src/app/+search-page/search-results/search-results.component.html b/src/app/+search-page/search-results/search-results.component.html
index a9b54a4601..b685d0b28d 100644
--- a/src/app/+search-page/search-results/search-results.component.html
+++ b/src/app/+search-page/search-results/search-results.component.html
@@ -1,4 +1,4 @@
-{{ getTitleKey() | translate }}
+{{ getTitleKey() | translate }}
0" @fadeIn>
} Emits the current fixed filter as a partial SearchOptions object
*/
private getFixedFilterPart(): Observable {
- return this.getCurrentFixedFilter().map((fixedFilter) => {
- return { fixedFilter }
- });
+ return this.getCurrentFixedFilter().pipe(
+ isNotEmptyOperator(),
+ map((fixedFilter) => {
+ return { fixedFilter }
+ })
+ );
+ }
+
+ public updateFixedFilter(fixedFilter: string) {
+ const currentPaginatedValue: PaginatedSearchOptions = this.paginatedSearchOptions.getValue();
+ const updatedPaginatedValue: PaginatedSearchOptions = Object.assign(currentPaginatedValue, { fixedFilter: fixedFilter });
+ this.paginatedSearchOptions.next(updatedPaginatedValue);
+
+ const currentValue: SearchOptions = this.searchOptions.getValue();
+ const updatedValue: SearchOptions = Object.assign(currentValue, { fixedFilter: fixedFilter });
+ this.searchOptions.next(updatedValue);
}
}