Commit 04fbae40 authored by Jerem-info's avatar Jerem-info Committed by Jérémy Destin
Browse files

fix: Fix the bug when select sources from the germplasm result page to have...

fix: Fix the bug when select sources from the germplasm result page to have more accurate suggestions. GNP-4309
parent c4f7be3b
......@@ -45,7 +45,8 @@ export class SwitchButtonComponent implements OnInit {
switchGermplasmResult() {
if (!this.germplasmDisplayCurrentState) {
this.displayGermplasmResult$.next(!this.germplasmDisplayCurrentState);
if (this.germplasmDisplayCurrentState) {
this.localCriteria = {
...this.localCriteria,
facetFields: ['types'],
......@@ -60,6 +61,5 @@ export class SwitchButtonComponent implements OnInit {
this.germplasmSearchCriteria$.next(DataDiscoveryCriteriaUtils.emptyGermplasmSearchCriteria());
}
this.criteria$.next(this.localCriteria);
this.displayGermplasmResult$.next(!this.germplasmDisplayCurrentState);
}
}
......@@ -23,6 +23,7 @@
<faidare-facets
*ngIf="displayGermplasmResult && germplasmfacets.length"
[facets]="germplasmfacets"
[criteria$]="criteria$"
[displayGermplasmResult$]="displayGermplasmResult$"
[germplasmSearchCriteria$]="germplasmSearchCriteria$">
</faidare-facets>
......
......@@ -98,11 +98,13 @@ export class ResultPageComponent implements OnInit {
this.fetchDocumentsAndFacets();
this.criteriaIsEmpty = DataDiscoveryCriteriaUtils.checkCriteriaIsEmpty(newCriteria);
// Update URL query params
this.router.navigate(['.'], {
relativeTo: this.route,
queryParams: DataDiscoveryCriteriaUtils.toQueryParams(newCriteria)
});
if (!this.displayGermplasmResult) {
// Update URL query params
this.router.navigate(['.'], {
relativeTo: this.route,
queryParams: DataDiscoveryCriteriaUtils.toQueryParams(newCriteria)
});
}
});
this.germplasmfacets$.subscribe(facets => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment