Commit 9e30c1db authored by Jérémy Destin's avatar Jérémy Destin
Browse files

fix: Fix the error message which appear in the browser console when display...

fix: Fix the error message which appear in the browser console when display the germplasm-result-page for the second time. GNP-4309
parent ad57a69e
......@@ -41,6 +41,7 @@
*ngIf="!criteriaIsEmpty"
style="margin-top: -10px; margin-left: 25px"
[criteria$]=criteria$
[germplasmSearchCriteria$]="germplasmSearchCriteria$"
[displayGermplasmResult$]="displayGermplasmResult$"
[facetFiled]="facet.field"
[switchTitle]="'Germplasm details'">
......
......@@ -131,7 +131,6 @@ export class LargeFacetsComponent implements OnInit {
if (event.item.term !== 'Germplasm' && this.facet.field === 'types') {
if (this.localCriteria[this.facet.field]) {
console.log('here');
this.localCriteria[this.facet.field].push(event.item.term);
} else {
this.localCriteria[this.facet.field] = [event.item.term];
......
......@@ -27,6 +27,7 @@
style="margin-top: 5px"
*ngIf="term.term == 'Germplasm' && !criteriaIsEmpty"
[criteria$]=criteria$
[germplasmSearchCriteria$]="germplasmSearchCriteria$"
[displayGermplasmResult$]="displayGermplasmResult$"
[facetFiled]="facet.field"
[switchTitle]="'Details'">
......
......@@ -32,7 +32,6 @@ export class SmallFacetsComponent implements OnInit {
criteriaIsEmpty = true;
queryParams: Params;
checkBoxes: FormGroup = new FormGroup({});
displayAdvanceGermplasmSearchButton: boolean;
germplasmDisplayCurrentState = false;
constructor() {
......@@ -59,9 +58,6 @@ export class SmallFacetsComponent implements OnInit {
this.getSelectedTerms(criteria);
this.criteriaIsEmpty = DataDiscoveryCriteriaUtils.checkCriteriaIsEmpty(criteria);
if (criteria.types) {
this.showAndHideAdvanceGermplasmSearch(criteria.types);
}
});
}
......@@ -90,7 +86,6 @@ export class SmallFacetsComponent implements OnInit {
this.displayGermplasmResult$.next(false);
}
this.showAndHideAdvanceGermplasmSearch(selectedTerms);
if (this.criteria$) {
this.localCriteria = {
...this.localCriteria,
......@@ -118,10 +113,4 @@ export class SmallFacetsComponent implements OnInit {
this.criteriaIsEmpty = DataDiscoveryCriteriaUtils.checkCriteriaIsEmpty(criteria);
}
showAndHideAdvanceGermplasmSearch(typeList: String[]) {
const facetIsTypes = this.facet.field === 'types';
const GermplasmSelected = typeList.includes('Germplasm');
this.displayAdvanceGermplasmSearchButton = facetIsTypes && GermplasmSelected;
}
}
......@@ -5,6 +5,7 @@ import {
DataDiscoverySource
} from '../../models/data-discovery.model';
import { BehaviorSubject } from 'rxjs';
import { GermplasmSearchCriteria } from '../../models/gnpis.model';
@Component({
selector: 'faidare-switch-button',
......@@ -15,6 +16,7 @@ export class SwitchButtonComponent implements OnInit {
@Input() criteria$: BehaviorSubject<DataDiscoveryCriteria>;
@Input() germplasmSearchCriteria$: BehaviorSubject<GermplasmSearchCriteria>;
@Input() displayGermplasmResult$: BehaviorSubject<boolean>;
@Input() facetFiled: string;
@Input() switchTitle: string;
......@@ -52,6 +54,7 @@ export class SwitchButtonComponent implements OnInit {
...this.localCriteria,
facetFields: ['types', 'sources']
};
this.germplasmSearchCriteria$.next(DataDiscoveryCriteriaUtils.emptyGermplasmSearchCriteria());
}
this.criteria$.next(this.localCriteria);
this.displayGermplasmResult$.next(!this.germplasmDisplayCurrentState);
......
......@@ -72,7 +72,7 @@ export class GermplasmResultPageComponent implements OnInit {
ngOnInit() {
const queryParams = this.route.snapshot.queryParams;
// this.reassignCriteriaFieldFromDataDiscoveryFields(queryParams);
this.reassignCriteriaFieldFromDataDiscoveryFields(queryParams);
this.criteriaFromForm$.subscribe(criteria => {
this.reassignCriteriaFieldFromDataDiscoveryFields(criteria);
......@@ -82,7 +82,7 @@ export class GermplasmResultPageComponent implements OnInit {
this.germplasmSearchCriteria$
.subscribe(criteria => {
this.localCriteria = criteria;
this.searchGermplasm(criteria);
this.searchGermplasm(this.localCriteria);
});
}
......@@ -180,11 +180,6 @@ export class GermplasmResultPageComponent implements OnInit {
changePage(page: number) {
this.localCriteria.page = page - 1;
this.germplasmSearchCriteria$.next(this.localCriteria);
/*this.router.navigate(['.'], {
relativeTo: this.route,
queryParams: { page },
queryParamsHandling: 'merge'
});*/
}
changeNbElementPerPage(pageSize: number) {
......
......@@ -107,7 +107,6 @@
</ng-container>
<ng-container *ngIf="displayGermplasmResult">
<faidare-germplasm-result-page
[criteriaFromForm$]=criteria$
[germplasmSearchCriteria$]="germplasmSearchCriteria$"
......
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