diff --git a/src/app/search-page/configuration-search-page.component.ts b/src/app/search-page/configuration-search-page.component.ts index 1eefeeb569..5ba318b850 100644 --- a/src/app/search-page/configuration-search-page.component.ts +++ b/src/app/search-page/configuration-search-page.component.ts @@ -47,6 +47,12 @@ export class ConfigurationSearchPageComponent extends SearchComponent implements */ @Input() fixedFilterQuery: string; + + /** + * Whether to show the scope selection dropdown + */ + @Input() scopeSelectable = true; + constructor(protected service: SearchService, protected sidebarService: SidebarService, protected windowService: HostWindowService, diff --git a/src/app/search-page/search.component.html b/src/app/search-page/search.component.html index d8aa25e4a3..499f652200 100644 --- a/src/app/search-page/search.component.html +++ b/src/app/search-page/search.component.html @@ -45,6 +45,7 @@ -
+
-
+
diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts index 1469eac566..bbaee5709d 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -72,6 +72,16 @@ describe('SearchFormComponent', () => { expect(select).toBeNull(); }); + it('should not display scopes when scopeSelectable is false', () => { + comp.scopeSelectable = false; + comp.scopes = objects; + comp.scope = objects[1].id; + + fixture.detectChanges(); + const select = de.query(By.css('select')); + expect(select).toBeNull(); + }); + it('should display set query value in input field', fakeAsync(() => { const testString = 'This is a test query'; comp.query = testString; diff --git a/src/app/shared/search-form/search-form.component.ts b/src/app/shared/search-form/search-form.component.ts index 2791aee378..1cf3c11913 100644 --- a/src/app/shared/search-form/search-form.component.ts +++ b/src/app/shared/search-form/search-form.component.ts @@ -66,6 +66,11 @@ export class SearchFormComponent { */ @Output() submitSearch = new EventEmitter(); + /** + * Whether to show the scope selection dropdown + */ + @Input() scopeSelectable = true; + constructor(private router: Router, private searchService: SearchService, private paginationService: PaginationService, private searchConfig: SearchConfigurationService