Skip to content

Commit

Permalink
fix(search-header): update filters on autocomplete selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Sep 23, 2024
1 parent 9fdfb66 commit b625cdf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 1 addition & 2 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="py-3 px-12 flex justify-between w-full">
<div class="w-2/3">
<gn-ui-fuzzy-search
(itemSelected)="handleItemSelection($event)"
style="--gn-ui-text-input-border-size: 0px"
></gn-ui-fuzzy-search>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 })
}
}

0 comments on commit b625cdf

Please sign in to comment.