diff --git a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts index 7105e28ae..f6f6c161c 100644 --- a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts +++ b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts @@ -229,8 +229,7 @@ describe('dashboard', () => { it('should filter the dashboard based on the search input', () => { checkDashboardFiltered() }) - // TODO remove skip when handleItemSelection of autocomplete is handled correctly - it.skip('should navigate to list of all records and filter the dashboard based on the search input when on different page', () => { + it('should navigate to list of all records and filter the dashboard based on the search input when on different page', () => { cy.visit('/my-space/my-records') checkDashboardFiltered() }) diff --git a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.html b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.html index fffb54206..ea1efc582 100644 --- a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.html +++ b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.html @@ -1,6 +1,7 @@
diff --git a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts index cd81a297b..1c3490f5c 100644 --- a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts +++ b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts @@ -2,11 +2,15 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component } from '@angular/core' import { MatIconModule } from '@angular/material/icon' import { LetDirective } from '@ngrx/component' -import { FeatureSearchModule } from '@geonetwork-ui/feature/search' +import { + FeatureSearchModule, + SearchService, +} from '@geonetwork-ui/feature/search' import { UiElementsModule } from '@geonetwork-ui/ui/elements' import { AvatarServiceInterface } from '@geonetwork-ui/api/repository' import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' import { TranslateModule } from '@ngx-translate/core' +import { CatalogRecord } from '@geonetwork-ui/common/domain/model/record' @Component({ selector: 'md-editor-search-header', @@ -29,6 +33,11 @@ export class SearchHeaderComponent { constructor( public platformService: PlatformServiceInterface, - private avatarService: AvatarServiceInterface + private avatarService: AvatarServiceInterface, + private searchService: SearchService ) {} + + handleItemSelection(item: CatalogRecord) { + this.searchService.updateFilters({ any: item.title }) + } }