-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from geonetwork/multiple_search
Allow multiple searches in the state
- Loading branch information
Showing
40 changed files
with
877 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
<div> | ||
<div class="p-4"> | ||
<catalog-site-title></catalog-site-title> | ||
</div> | ||
<search-records-metrics field="tag" count="20"></search-records-metrics> | ||
<div class="mb-3 mx-4 rounded flex flex-row"> | ||
<div class="w-2/4 mr-3"> | ||
<search-fuzzy-search></search-fuzzy-search> | ||
</div> | ||
<div class="w-1/4 mr-3"> | ||
<search-sort-by></search-sort-by> | ||
</div> | ||
<div class="flex-grow"> | ||
<search-results-layout></search-results-layout> | ||
</div> | ||
</div> | ||
<div class="flex flex-row"> | ||
<search-facets-container class="w-1/4"></search-facets-container> | ||
<div class="w-3/4"> | ||
<search-results-hits></search-results-hits> | ||
<search-results-list-container></search-results-list-container> | ||
</div> | ||
</div> | ||
<div class="p-4"> | ||
<catalog-site-title></catalog-site-title> | ||
</div> | ||
<search-records-metrics field="tag" count="20"></search-records-metrics> | ||
|
||
<div searchSearchStateContainer="mainSearch"> | ||
<app-main-search></app-main-search> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/search/src/app/main-search/main-search.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="mb-3 mx-4 rounded flex flex-row"> | ||
<div class="w-2/4 mr-3"> | ||
<search-fuzzy-search></search-fuzzy-search> | ||
</div> | ||
<div class="w-1/4 mr-3"> | ||
<search-sort-by></search-sort-by> | ||
</div> | ||
<div class="flex-grow"> | ||
<search-results-layout></search-results-layout> | ||
</div> | ||
</div> | ||
<div class="flex flex-row"> | ||
<search-facets-container class="w-1/4"></search-facets-container> | ||
<div class="w-3/4"> | ||
<search-results-hits></search-results-hits> | ||
<search-results-list-container></search-results-list-container> | ||
</div> | ||
</div> |
Empty file.
58 changes: 58 additions & 0 deletions
58
apps/search/src/app/main-search/main-search.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core' | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { RouterTestingModule } from '@angular/router/testing' | ||
import { BootstrapService } from '@lib/common' | ||
import { SearchFacade } from '@lib/search' | ||
import { EffectsModule } from '@ngrx/effects' | ||
import { StoreModule } from '@ngrx/store' | ||
import { of } from 'rxjs' | ||
import { AppComponent } from '../app.component' | ||
|
||
import { MainSearchComponent } from './main-search.component' | ||
|
||
const configFacetMock = { | ||
mods: { | ||
search: { | ||
facetConfig: { | ||
tag: {}, | ||
}, | ||
}, | ||
}, | ||
} | ||
const boostrapServiceMock = { | ||
uiConfReady: jest.fn(() => of(configFacetMock)), | ||
} | ||
const searchFacadeMock = { | ||
setConfigAggregations: jest.fn(), | ||
requestMoreResults: jest.fn(), | ||
} | ||
|
||
describe('MainSearchComponent', () => { | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
RouterTestingModule, | ||
EffectsModule.forRoot(), | ||
StoreModule.forRoot({}), | ||
], | ||
declarations: [AppComponent], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
providers: [ | ||
{ | ||
provide: BootstrapService, | ||
useValue: boostrapServiceMock, | ||
}, | ||
{ | ||
provide: SearchFacade, | ||
useValue: searchFacadeMock, | ||
}, | ||
], | ||
}).compileComponents() | ||
})) | ||
|
||
it('should create the app', () => { | ||
const fixture = TestBed.createComponent(AppComponent) | ||
const app = fixture.componentInstance | ||
expect(app).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, OnInit } from '@angular/core' | ||
import { BootstrapService } from '@lib/common' | ||
import { SearchFacade } from '@lib/search' | ||
import { map, take, tap } from 'rxjs/operators' | ||
|
||
@Component({ | ||
selector: 'app-main-search', | ||
templateUrl: './main-search.component.html', | ||
styleUrls: ['./main-search.component.scss'], | ||
}) | ||
export class MainSearchComponent implements OnInit { | ||
constructor( | ||
private bootstrap: BootstrapService, | ||
private searchFacade: SearchFacade | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.bootstrap | ||
.uiConfReady('srv') | ||
.pipe( | ||
take(1), | ||
map((config) => config.mods.search.facetConfig), | ||
tap((aggregationsConfig) => { | ||
this.searchFacade.setConfigAggregations(aggregationsConfig) | ||
this.searchFacade.requestMoreResults() | ||
}) | ||
) | ||
.subscribe() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.