From 7b036589de4bbd8b5ff7ba1d8d936954e946ddf0 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Tue, 8 Jan 2019 10:23:26 +0100 Subject: [PATCH 01/29] missing css for tables display. GNP-5424 --- frontend/src/assets/gpds/theme.scss | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 168116f3..62ac8f15 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -17,6 +17,20 @@ $enable-shadows: true; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; @import "~bootstrap/scss/tables"; +@import "~bootstrap/scss/tables"; +@import "~bootstrap/scss/card"; +@import "~bootstrap/scss/transitions"; + + + +//custom tables +.table { + border-bottom: 2px solid #79c93f; + border-top: 2px solid #79c93f; +} + + + // public custom variables used in this theme, and in component styles -- GitLab From d020efaeefe6d6f77346567755d4fdfc5413eaf9 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Tue, 8 Jan 2019 18:13:49 +0100 Subject: [PATCH 02/29] Corrections and theme. GNP-5424 --- .../germplasm-card.component.html | 186 +++++++++--------- .../germplasm-card.component.ts | 2 +- frontend/src/assets/gpds/theme.scss | 1 - 3 files changed, 97 insertions(+), 92 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index e6305478..a46140ce 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,6 +1,7 @@ -<!-- + + <h3> - Germplasm: {{ germplasm.result.defaultDisplayName }} + Germplasm: {{ germplasm.result?.germplasmName }} </h3> <h4>Identification</h4> @@ -11,168 +12,173 @@ <table class="table float-right w-75 p-2 table-sm"> <tr> <td><b>Accession number</b></td> - <td>{{ germplasm.result.accessionNumber }}</td> + <td>{{ germplasm.result?.accessionNumber }}</td> </tr> - <tr *ngIf="germplasm.result.acquisitionDate!=null"> + <tr *ngIf="germplasm.result?.acquisitionDate"> <td><b>Acquisition date</b></td> - <td>{{ germplasm.result.acquisitionDate }}</td> + <td>{{ germplasm.result?.acquisitionDate }}</td> </tr> <tr> - <td><b>Accession name</b></td> - <td>{{ germplasm.result.defaultDisplayName }}</td> + <td><b>Germplasm name</b></td> + <td>{{ germplasm.result?.germplasmName }}</td> </tr> <tr> <td><b>Permanent Unique Identifier</b></td> - <td> https://{{ germplasm.result.germplasmPUI }}</td> + <td> {{ germplasm.result?.germplasmPUI }}</td> </tr> - <tr *ngIf="germplasm.result.seedSource != null"> + <tr> <td><b>Seed source</b></td> - <td><a *ngFor="let syn of germplasm.result.seedSource"> {{ syn }}</a></td> + <td>{{ germplasm.result?.seedSource }}</td> </tr> <tr> - <tr *ngIf="germplasm.result.geneticNature != null"> <td><b>Genetic nature</b></td> - <td><a *ngFor="let syn of germplasm.result.geneticNature"> {{ syn }}</a></td> + <td>{{ germplasm.result?.geneticNature }}</td> </tr> - <tr *ngIf="germplasm.result.synonyms != null"> + + <tr *ngIf="germplasm.result?.synonyms"> <td><b>Accession synonyms</b></td> - <td><a *ngFor="let syn of germplasm.result.synonyms"> {{ syn }}</a></td> + <td><a *ngFor="let synonym of germplasm.result?.synonyms"> {{ synonym }}</a></td> </tr> - <tr> + + <tr *ngIf="germplasm.result?.genus==null"> <td><b>Taxon name</b></td> - <td>{{ germplasm.result.genus }} {{ germplasm.result.species}} {{ germplasm.result.speciesAuthority}} {{ germplasm.result.subtaxa}}</td> + <td>{{ germplasm.result?.species}} {{ germplasm.result?.speciesAuthority}} {{ germplasm.result?.subtaxa}}</td> </tr> <tr> <td><b>Taxon common names</b></td> - <td>{{ germplasm.result.commonCropName }}</td> + <td>{{ germplasm.result?.commonCropName }}</td> </tr> - <tr> + + <tr *ngIf="germplasm.result?.species!=null"> <td><b>Taxon synonyms</b></td> - <td>{{ germplasm.result.species }}</td> + <td><a *ngFor="let taxonSynonym of germplasm.result?.species"> {{ taxonSynonym }}</a></td> </tr> - <tr *ngIf="germplasm.result.pedigree!=null"> + + <tr *ngIf="germplasm.result?.pedigree!=null"> <td><b>Pedigree</b></td> - <td>{{ germplasm.result.pedigree }}</td> + <td>{{ germplasm.result?.pedigree }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.biologicalStatusOfAccessionCode!=null"> <td><b>Biological status</b></td> - <td>{{ germplasm.result.biologicalStatusOfAccessionCode }}</td> + <td>{{ germplasm.result?.biologicalStatusOfAccessionCode }}</td> </tr> <tr> <td><b>Source</b></td> - <td>{{ germplasm.result.source }}</td> + <td>{{ germplasm.result?.source }}</td> </tr> - <tr *ngIf="!germplasm.result.source.equals('URGI')"> - <td><b>External link</b></td> - <td><a>{{ germplasm.result.url }}</a></td> + <tr *ngIf="germplasm.result?.source!='URGI'"> + <td><b>Source link</b></td> + <td><a>{{ germplasm.result?.url }}</a></td> </tr> <tr> <td><b>Comments</b></td> - <td>{{ germplasm.result.comment }}</td> + <td>{{ germplasm.result?.comment }}</td> </tr> </table> </div> - <div class="row"> + <div class="row" *ngIf="germplasm.result?.holdingInstitute!=null"> <h4>Holding</h4> <table class="table table-sm"> <tr> <td><b>Institution name</b></td> - <td>{{ germplasm.result.holdingInstitute.instituteName }} {{ germplasm.result.holdingInstitute.organisation }}</td> + <td>{{ germplasm.result?.holdingInstitute?.instituteName }} {{ germplasm.result?.holdingInstitute?.instituteCode }}</td> </tr> <tr> <td><b>Link</b></td> - <td>{{ germplasm.result.holdingInstitute.webSite }}</td> + <td>{{ germplasm.result?.holdingInstitute?.webSite }}</td> </tr> <tr> <td><b>Adresse</b></td> - <td>{{ germplasm.result.holdingInstitute.address }}</td> + <td>{{ germplasm.result?.holdingInstitute?.address }}</td> </tr> <tr> <td><b>Logo</b></td> - <td>{{ germplasm.result.holdingInstitute.logo }}</td> + <td>{{ germplasm.result?.holdingInstitute?.logo }}</td> </tr> </table> + </div> + <div class="row" *ngIf="germplasm.result?.holdingGenbank"> <h4>Holding gene bank</h4> <table class="table table-sm"> <tr> <td><b>Institution name</b></td> - <td>{{ germplasm.result.holdingGenbank }} {{ germplasm.result.organisation }}</td> + <td>{{ germplasm.result?.holdingGenbank }} {{ germplasm.result?.organisation }}</td> </tr> <tr> <td><b>Link</b></td> - <td>{{ germplasm.result.webSite }}</td> + <td>{{ germplasm.result?.webSite }}</td> </tr> <tr> <td><b>Adresse</b></td> - <td>{{ germplasm.result.address }}</td> + <td>{{ germplasm.result?.address }}</td> </tr> <tr> <td><b>Logo</b></td> - <td>{{ germplasm.result.logo }}</td> + <td>{{ germplasm.result?.logo }}</td> </tr> </table> </div> - <ng-container *ngIf="germplasm.result.breeder != null"> + <ng-container *ngIf="germplasm.result?.breeder != null"> <h4>Breeder</h4> <div class="row"> <table class="table table-sm"> <tr> <td><b>accessionCreationDate</b></td> - <td>{{ germplasm.result.breeder.accessionCreationDate }}</td> + <td>{{ germplasm.result?.breeder.accessionCreationDate }}</td> </tr> <tr> <td><b>accessionNumber</b></td> - <td>{{ germplasm.result.breeder.accessionNumber }}</td> + <td>{{ germplasm.result?.breeder.accessionNumber }}</td> </tr> <tr> <td><b>collectors</b></td> - <td>{{ germplasm.result.breeder.collectors }}</td> + <td>{{ germplasm.result?.breeder.collectors }}</td> </tr> <tr> <td><b>deregistrationYear</b></td> - <td>{{ germplasm.result.breeder.deregistrationYear }}</td> + <td>{{ germplasm.result?.breeder.deregistrationYear }}</td> </tr> <tr> <td><b>distributionStatus</b></td> - <td>{{ germplasm.result.breeder.distributionStatus }}</td> + <td>{{ germplasm.result?.breeder.distributionStatus }}</td> </tr> <tr> <td><b>germplasmPUI</b></td> - <td>{{ germplasm.result.breeder.germplasmPUI }}</td> + <td>{{ germplasm.result?.breeder.germplasmPUI }}</td> </tr> <ng-container> <tr> <table> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> <tr> <td><b>institute name</b></td> - <td>{{ germplasm.result.breeder.instituteName }}</td> + <td>{{ germplasm.result?.breeder.instituteName }}</td> </tr> </table> </tr> @@ -181,13 +187,13 @@ </div> </ng-container> - <ng-container *ngIf="germplasm.result.taxonIds != null"> + <ng-container *ngIf="germplasm.result?.taxonIds != null"> <div class="row"> <h4>Collecting site</h4> <table class="table table-sm"> <tr> <td><b>Ids</b></td> - <td>{{ germplasm.result.taxonIds.sourcename }}</td> + <td>{{ germplasm.result?.taxonIds.sourcename }}</td> </tr> <tr> <td><b></b></td> @@ -197,10 +203,10 @@ </div> </ng-container> - <ng-container *ngIf="germplasm.result.donors != null"> + <ng-container *ngIf="germplasm.result?.donors != null"> <div class="row"> <h4>Donors</h4> - <ng-container *ngFor="let donor of germplasm.result.donors"> + <ng-container *ngFor="let donor of germplasm.result?.donors"> <table class="table table-sm"> <tr> <td><b>Donation accession number</b></td> @@ -224,23 +230,23 @@ <table class="table table-sm"> <tr> <td><b>Geographical origin</b></td> - <td>{{ germplasm.result.countryOfOriginCode }}</td> + <td>{{ germplasm.result?.countryOfOriginCode }}</td> </tr> <tr> <td><b>Collecting</b></td> - <td>{{ germplasm.result.siteName }}</td> + <td>{{ germplasm.result?.siteName }}</td> </tr> <tr> <td><b>Donation</b></td> - <td>{{ germplasm.result.instituteName }}</td> + <td>{{ germplasm.result?.instituteName }}</td> </tr> <tr> <td><b>Date</b> - <td>{{ germplasm.result.instituteName }}</td> + <td>{{ germplasm.result?.instituteName }}</td> </tr> <tr> <td><b>Institution name</b></td> - <td>{{ germplasm.result.instituteName }}</td> + <td>{{ germplasm.result?.instituteName }}</td> </tr> </table> </div> @@ -252,37 +258,37 @@ <table class="table table-sm"> <tr> <td><b>Crossing plan</b></td> - <td>{{ germplasmPedigree.result.crossingPlan }}</td> + <td>{{ germplasmPedigree.result?.crossingPlan }}</td> </tr> <tr> <td><b>Crossing year</b></td> - <td>{{ germplasmPedigree.result.crossingYear }}</td> + <td>{{ germplasmPedigree.result?.crossingYear }}</td> </tr> <tr> <td><b>Affiliation</b></td> - <td>{{ germplasm.result.instituteName }}</td> + <td>{{ germplasm.result?.instituteName }}</td> </tr> <tr> - <td><b>Parent accessions</b></td> + <td *ngIf="germplasmPedigree.result"><b>Parent accessions</b></td> <td><table class="table"> - <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> + <ng-container [ngSwitch]="germplasmPedigree.result?.parent1Type"> <tr *ngSwitchCase="'FEMALE'"> <td>Mother</td> - <td>{{ germplasmPedigree.result.parent1Name }}</td> + <td>{{ germplasmPedigree.result?.parent1Name }}</td> </tr> <tr *ngSwitchCase="'MALE'"> <td>Father</td> - <td>{{ germplasmPedigree.result.parent1Name }}</td> + <td>{{ germplasmPedigree.result?.parent1Name }}</td> </tr> </ng-container> - <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> + <ng-container [ngSwitch]="germplasmPedigree.result?.parent2Type"> <tr *ngSwitchCase="'FEMALE'"> <td>Mother</td> - <td>{{ germplasmPedigree.result.parent2Name }}</td> + <td>{{ germplasmPedigree.result?.parent2Name }}</td> </tr> <tr *ngSwitchCase="'MALE'"> <td>Father</td> - <td>{{ germplasmPedigree.result.parent2Name }}</td> + <td>{{ germplasmPedigree.result?.parent2Name }}</td> </tr> </ng-container> </table></td> @@ -295,21 +301,21 @@ <table class="table table-sm"> <tr> <td><b>Siblings accessions</b></td> - <td><a *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> + <td><a *ngFor="let sibling of germplasmPedigree.result?.siblings"> {{ sibling.defaultDisplayName }}</a></td> </tr> <tr> <td><b>Geographical origin</b></td> - <td>{{ germplasm.result.countryOfOriginCode }}</td> + <td>{{ germplasm.result?.countryOfOriginCode }}</td> </tr> </table> </div> </ng-container> - <ng-container *ngIf="germplasm.result.distributors != null"> + <ng-container *ngIf="germplasm.result?.distributors != null"> <div class="row"> <h4>Distribution</h4> <table class="table table-sm"> - <ng-container *ngFor="let distributor of germplasm.result.distributors"> + <ng-container *ngFor="let distributor of germplasm.result?.distributors"> <tr><b>Institution name</b> {{ distributor.institute.instituteName }}</tr> <tr><b>Distribution status</b> {{ distributor.institute.instituteName }}</tr> </ng-container> @@ -319,51 +325,51 @@ - <ng-container *ngIf="germplasm.result.collector != null"> + <ng-container *ngIf="germplasm.result?.collector != null"> <div class="row"> <h4>Collector</h4> <table class="table table-sm"> <tr> <td><b>accessionNumber</b></td> - <td>{{ germplasm.result.collector.accessionNumber }}</td> + <td>{{ germplasm.result?.collector.accessionNumber }}</td> </tr> <tr> <td><b>collectors</b></td> - <td>{{ germplasm.result.collector.collectors }}</td> + <td>{{ germplasm.result?.collector.collectors }}</td> </tr> <tr> <td><b>deregistrationYear</b></td> - <td>{{ germplasm.result.collector.deregistrationYear }}</td> + <td>{{ germplasm.result?.collector.deregistrationYear }}</td> </tr> <tr> <td><b>distributionStatus</b></td> - <td>{{ germplasm.result.collector.distributionStatus }}</td> + <td>{{ germplasm.result?.collector.distributionStatus }}</td> </tr> <tr> <td><b>germplasmPUI</b></td> - <td>{{ germplasm.result.collector.germplasmPUI }}</td> + <td>{{ germplasm.result?.collector.germplasmPUI }}</td> </tr> <tr> <td><b>institute</b></td> - <td>{{ germplasm.result.collector.instituteName }}</td> + <td>{{ germplasm.result?.collector.instituteName }}</td> </tr> <tr> <td><b>institute</b></td> - <td>{{ germplasm.result.collector.materialType }}</td> + <td>{{ germplasm.result?.collector.materialType }}</td> </tr> <tr> <td><b>institute</b></td> - <td>{{ germplasm.result.collector.registrationYear }}</td> + <td>{{ germplasm.result?.collector.registrationYear }}</td> </tr> </table> </div> </ng-container> - <ng-container *ngIf="germplasm.result.collection != null"> + <ng-container *ngIf="germplasm.result?.collection != null"> <div class="row"> <h4>Collection</h4> <table class="table table-sm"> - <ng-container *ngFor="let co of germplasm.result.collection"> + <ng-container *ngFor="let co of germplasm.result?.collection"> <tr><b>Institution name</b> {{ co.germplasmCount }}</tr> <tr><b>Distribution status</b> {{ co.germplasmRef }}</tr> <tr><b>Institution name</b> {{ co.id }}</tr> @@ -374,11 +380,11 @@ </div> </ng-container> - <ng-container *ngIf="germplasm.result.panel != null"> + <ng-container *ngIf="germplasm.result?.panel != null"> <div class="row"> <h4>Panel</h4> <table class="table table-sm"> - <ng-container *ngFor="let co of germplasm.result.panel"> + <ng-container *ngFor="let co of germplasm.result?.panel"> <tr><b>Institution name</b> {{ co.germplasmCount }}</tr> <tr><b>Distribution status</b> {{ co.germplasmRef }}</tr> <tr><b>Institution name</b> {{ co.id }}</tr> @@ -389,11 +395,11 @@ </div> </ng-container> - <ng-container *ngIf="germplasmAttributes.result.data != null"> + <ng-container *ngIf="germplasmAttributes.result?.data!=null"> <h4>Evaluation Data</h4> <div class="row"> <table class="table table-sm"> - <ng-container *ngFor="let descriptor of germplasmAttributes.result.data"> + <ng-container *ngFor="let descriptor of germplasmAttributes.result?.data"> <tr><td><b>{{ descriptor.attributeName }}</b></td> <td>{{ descriptor.value }}</td></tr> </ng-container> </table> @@ -406,4 +412,4 @@ </table> </div> </div> ---> + diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 1183fd8a..f9fe7661 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -44,7 +44,7 @@ export class GermplasmCardComponent implements OnInit { this.germplasmAttributes = germplasmAttributes; }); - this.brapiService.germplasm(germplasmId) + this.gnpisService.germplasm(germplasmId) .subscribe(germplasmGnpis => this.germplasmGnpis = germplasmGnpis); } diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 62ac8f15..3b6b4cfa 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -17,7 +17,6 @@ $enable-shadows: true; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; @import "~bootstrap/scss/tables"; -@import "~bootstrap/scss/tables"; @import "~bootstrap/scss/card"; @import "~bootstrap/scss/transitions"; -- GitLab From 97e1afb2c39fc6827ae8579a920ebaeb0c6e5b2e Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Wed, 9 Jan 2019 16:20:28 +0100 Subject: [PATCH 03/29] Corrections based on merge request comments. GNP-5424 --- .../germplasm-card.component.html | 222 +++++++++--------- frontend/src/assets/gpds/theme.scss | 7 + 2 files changed, 113 insertions(+), 116 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index a46140ce..1205ed2d 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -7,9 +7,9 @@ <h4>Identification</h4> <div class="container-fluid"> <div class="row"> - <img src="" class="img-fluid float-left w-25 p-2 table-sm" alt="" > + <!-- <img src="" class="img-fluid float-left w-25 p-2 table-sm" alt="" >--> - <table class="table float-right w-75 p-2 table-sm"> + <table class="table table-sm"> <tr> <td><b>Accession number</b></td> <td>{{ germplasm.result?.accessionNumber }}</td> @@ -26,30 +26,43 @@ <td><b>Permanent Unique Identifier</b></td> <td> {{ germplasm.result?.germplasmPUI }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.seedSource"> <td><b>Seed source</b></td> - <td>{{ germplasm.result?.seedSource }}</td> + <td>{{ germplasm.result.seedSource }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.geneticNature"> <td><b>Genetic nature</b></td> <td>{{ germplasm.result?.geneticNature }}</td> </tr> - <tr *ngIf="germplasm.result?.synonyms"> + <tr *ngIf="germplasm.result?.synonyms.length > 0"> <td><b>Accession synonyms</b></td> <td><a *ngFor="let synonym of germplasm.result?.synonyms"> {{ synonym }}</a></td> </tr> - <tr *ngIf="germplasm.result?.genus==null"> - <td><b>Taxon name</b></td> - <td>{{ germplasm.result?.species}} {{ germplasm.result?.speciesAuthority}} {{ germplasm.result?.subtaxa}}</td> - </tr> + <ng-template *ngIf="germplasm.result?.genus!=null; then withGenus; else withoutGenus"></ng-template> + + <ng-template #withGenus> + <tr> + <td><b>Taxon name</b></td> + <td *ngIf="germplasm.result?.speciesAuthority">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} ({{ germplasm.result?.speciesAuthority}}) </td> + <td *ngIf="germplasm.result?.speciesAuthority==null">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} </td> + </tr> + </ng-template> + + <ng-template #withoutGenus> + <tr> + <td><b>Taxon name</b></td> + <td>{{ germplasm.result?.species}}</td> + </tr> + </ng-template> + <tr> <td><b>Taxon common names</b></td> <td>{{ germplasm.result?.commonCropName }}</td> </tr> - <tr *ngIf="germplasm.result?.species!=null"> + <tr *ngIf="germplasm.result?.species"> <td><b>Taxon synonyms</b></td> <td><a *ngFor="let taxonSynonym of germplasm.result?.species"> {{ taxonSynonym }}</a></td> </tr> @@ -84,17 +97,17 @@ <td><b>Institution name</b></td> <td>{{ germplasm.result?.holdingInstitute?.instituteName }} {{ germplasm.result?.holdingInstitute?.instituteCode }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.holdingInstitute?.webSite"> <td><b>Link</b></td> - <td>{{ germplasm.result?.holdingInstitute?.webSite }}</td> + <td>{{ germplasm.result.holdingInstitute.webSite }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.holdingInstitute?.address"> <td><b>Adresse</b></td> - <td>{{ germplasm.result?.holdingInstitute?.address }}</td> + <td>{{ germplasm.result.holdingInstitute.address }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.holdingInstitute?.logo"> <td><b>Logo</b></td> - <td>{{ germplasm.result?.holdingInstitute?.logo }}</td> + <td>{{ germplasm.result.holdingInstitute.logo }}</td> </tr> </table> </div> @@ -121,68 +134,34 @@ </table> </div> - <ng-container *ngIf="germplasm.result?.breeder != null"> + <ng-container *ngIf="germplasm.result?.breeder"> <h4>Breeder</h4> <div class="row"> <table class="table table-sm"> - <tr> + <tr *ngIf="germplasm.result?.breeder.accessionCreationDate"> <td><b>accessionCreationDate</b></td> <td>{{ germplasm.result?.breeder.accessionCreationDate }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.breeder.accessionNumber"> <td><b>accessionNumber</b></td> <td>{{ germplasm.result?.breeder.accessionNumber }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.breeder.collectors"> <td><b>collectors</b></td> <td>{{ germplasm.result?.breeder.collectors }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.breeder.deregistrationYear"> <td><b>deregistrationYear</b></td> <td>{{ germplasm.result?.breeder.deregistrationYear }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.breeder.distributionStatus"> <td><b>distributionStatus</b></td> <td>{{ germplasm.result?.breeder.distributionStatus }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.breeder.germplasmPUI"> <td><b>germplasmPUI</b></td> <td>{{ germplasm.result?.breeder.germplasmPUI }}</td> </tr> - <ng-container> - <tr> - <table> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - <tr> - <td><b>institute name</b></td> - <td>{{ germplasm.result?.breeder.instituteName }}</td> - </tr> - </table> - </tr> - </ng-container> </table> </div> </ng-container> @@ -193,7 +172,7 @@ <table class="table table-sm"> <tr> <td><b>Ids</b></td> - <td>{{ germplasm.result?.taxonIds.sourcename }}</td> + <td>{{ germplasm.result?.taxonIds.sourceName }}</td> </tr> <tr> <td><b></b></td> @@ -203,10 +182,10 @@ </div> </ng-container> - <ng-container *ngIf="germplasm.result?.donors != null"> + <ng-container *ngIf="germplasm.result?.donors.length > 0"> <div class="row"> <h4>Donors</h4> - <ng-container *ngFor="let donor of germplasm.result?.donors"> + <ng-container *ngFor="let donor of germplasm.result.donors"> <table class="table table-sm"> <tr> <td><b>Donation accession number</b></td> @@ -228,30 +207,31 @@ <div class="row"> <h4>Origin</h4> <table class="table table-sm"> - <tr> + <tr *ngIf="germplasm.result?.countryOfOriginCode"> <td><b>Geographical origin</b></td> - <td>{{ germplasm.result?.countryOfOriginCode }}</td> + <td>{{ germplasm.result.countryOfOriginCode }}</td> </tr> - <tr> - <td><b>Collecting</b></td> - <td>{{ germplasm.result?.siteName }}</td> + <tr *ngIf="germplasm.result?.originSite?.siteName"> + <td><b>Origin site</b></td> + <td>{{ germplasm.result.originSite.siteName }}</td> </tr> - <tr> - <td><b>Donation</b></td> - <td>{{ germplasm.result?.instituteName }}</td> - </tr> - <tr> - <td><b>Date</b> - <td>{{ germplasm.result?.instituteName }}</td> + <tr *ngIf="germplasm.result?.collectingSite?.siteName"> + <td><b>Collecting site</b></td> + <td>{{ germplasm.result.collectingSite.siteName }}</td> </tr> <tr> <td><b>Institution name</b></td> <td>{{ germplasm.result?.instituteName }}</td> </tr> + <tr *ngIf="germplasm.result?.evaluationSites?.siteName"> + <td><b>Evaluation sites</b></td> + <td>{{ germplasm.result.evaluationSites.siteName }}</td> + </tr> + </table> </div> - <ng-container *ngIf="germplasmPedigree != null"> + <ng-container *ngIf="germplasmPedigree"> <div class="row"> <h4>Genealogy</h4> <h5>Ascendants</h5> @@ -260,13 +240,13 @@ <td><b>Crossing plan</b></td> <td>{{ germplasmPedigree.result?.crossingPlan }}</td> </tr> - <tr> + <tr *ngIf="germplasmPedigree.result?.crossingYear"> <td><b>Crossing year</b></td> - <td>{{ germplasmPedigree.result?.crossingYear }}</td> + <td>{{ germplasmPedigree.result.crossingYear }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.genealogy?.familyCode"> <td><b>Affiliation</b></td> - <td>{{ germplasm.result?.instituteName }}</td> + <td>{{ germplasm.result.genealogy.familyCode }}</td> </tr> <tr> <td *ngIf="germplasmPedigree.result"><b>Parent accessions</b></td> @@ -280,6 +260,12 @@ <td>Father</td> <td>{{ germplasmPedigree.result?.parent1Name }}</td> </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result?.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result?.parent1Name }}</td> + </tr> </ng-container> <ng-container [ngSwitch]="germplasmPedigree.result?.parent2Type"> <tr *ngSwitchCase="'FEMALE'"> @@ -290,6 +276,12 @@ <td>Father</td> <td>{{ germplasmPedigree.result?.parent2Name }}</td> </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result?.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result?.parent2Name }}</td> + </tr> </ng-container> </table></td> </tr> @@ -303,62 +295,60 @@ <td><b>Siblings accessions</b></td> <td><a *ngFor="let sibling of germplasmPedigree.result?.siblings"> {{ sibling.defaultDisplayName }}</a></td> </tr> - <tr> - <td><b>Geographical origin</b></td> - <td>{{ germplasm.result?.countryOfOriginCode }}</td> - </tr> </table> </div> </ng-container> - <ng-container *ngIf="germplasm.result?.distributors != null"> - <div class="row"> + <div class="row"> + <ng-container *ngIf="germplasm.result?.distributors != null"> <h4>Distribution</h4> <table class="table table-sm"> <ng-container *ngFor="let distributor of germplasm.result?.distributors"> <tr><b>Institution name</b> {{ distributor.institute.instituteName }}</tr> - <tr><b>Distribution status</b> {{ distributor.institute.instituteName }}</tr> + <tr><b>Distribution status</b> {{ distributor.distributionStatus }}</tr> </ng-container> </table> - </div> - </ng-container> - + </ng-container> + </div> <ng-container *ngIf="germplasm.result?.collector != null"> <div class="row"> <h4>Collector</h4> <table class="table table-sm"> - <tr> + <tr *ngIf="germplasm.result?.collector.accessionNumber"> <td><b>accessionNumber</b></td> <td>{{ germplasm.result?.collector.accessionNumber }}</td> </tr> - <tr> + + <tr *ngIf="germplasm.result?.collector.collectors.length > 0"> <td><b>collectors</b></td> - <td>{{ germplasm.result?.collector.collectors }}</td> + <ng-container *ngFor="let collector of germplasm.result?.collector.collectors"> + <td>{{ collector }}</td> + </ng-container> </tr> - <tr> + + <tr *ngIf="germplasm.result?.collector.deregistrationYear"> <td><b>deregistrationYear</b></td> <td>{{ germplasm.result?.collector.deregistrationYear }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.collector.distributionStatus"> <td><b>distributionStatus</b></td> <td>{{ germplasm.result?.collector.distributionStatus }}</td> </tr> - <tr> - <td><b>germplasmPUI</b></td> - <td>{{ germplasm.result?.collector.germplasmPUI }}</td> - </tr> - <tr> - <td><b>institute</b></td> + + <tr *ngIf="germplasm.result?.collector.instituteName"> + <td><b>Institute name</b></td> <td>{{ germplasm.result?.collector.instituteName }}</td> </tr> - <tr> - <td><b>institute</b></td> + + <tr *ngIf="germplasm.result?.collector.materialType"> + <td><b>Material type</b></td> <td>{{ germplasm.result?.collector.materialType }}</td> </tr> - <tr> - <td><b>institute</b></td> + + <tr *ngIf="germplasm.result?.collector.registrationYear"> + <td><b>Registration Year</b></td> <td>{{ germplasm.result?.collector.registrationYear }}</td> </tr> </table> @@ -369,12 +359,12 @@ <div class="row"> <h4>Collection</h4> <table class="table table-sm"> - <ng-container *ngFor="let co of germplasm.result?.collection"> - <tr><b>Institution name</b> {{ co.germplasmCount }}</tr> - <tr><b>Distribution status</b> {{ co.germplasmRef }}</tr> - <tr><b>Institution name</b> {{ co.id }}</tr> - <tr><b>Institution name</b> {{ co.name }}</tr> - <tr><b>Institution name</b> {{ co.type }}</tr> + <ng-container *ngFor="let collection of germplasm.result?.collection"> + <tr><b>Count</b> {{ collection.germplasmCount }}</tr> + <tr><b>Ref</b> {{ collection.germplasmRef }}</tr> + <tr><b>Institution name</b> {{ collection.id }}</tr> + <tr><b>Institution name</b> {{ collection.name }}</tr> + <tr><b>Institution type</b> {{ collection.type }}</tr> </ng-container> </table> </div> @@ -384,18 +374,18 @@ <div class="row"> <h4>Panel</h4> <table class="table table-sm"> - <ng-container *ngFor="let co of germplasm.result?.panel"> - <tr><b>Institution name</b> {{ co.germplasmCount }}</tr> - <tr><b>Distribution status</b> {{ co.germplasmRef }}</tr> - <tr><b>Institution name</b> {{ co.id }}</tr> - <tr><b>Institution name</b> {{ co.name }}</tr> - <tr><b>Institution name</b> {{ co.type }}</tr> + <ng-container *ngFor="let panel of germplasm.result?.panel"> + <tr><b>Institution name</b> {{ panel.germplasmCount }}</tr> + <tr><b>Distribution status</b> {{ panel.germplasmRef }}</tr> + <tr><b>Institution name</b> {{ panel.id }}</tr> + <tr><b>Institution name</b> {{ panel.name }}</tr> + <tr><b>Institution name</b> {{ panel.type }}</tr> </ng-container> </table> </div> </ng-container> - <ng-container *ngIf="germplasmAttributes.result?.data!=null"> + <ng-container *ngIf="germplasmAttributes.result?.data.length > 0"> <h4>Evaluation Data</h4> <div class="row"> <table class="table table-sm"> diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 3b6b4cfa..0c0ae299 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -33,6 +33,13 @@ $enable-shadows: true; // public custom variables used in this theme, and in component styles + +//custom tables +.table { + border-bottom: 2px solid #79c93f; + border-top: 2px solid #79c93f; +} + // custom button $theme-btn-color: $white; $theme-btn-bg-color: $_theme-black; -- GitLab From 3987a82c833a3a6e6646823c473dafdae20e04af Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Wed, 9 Jan 2019 16:52:39 +0100 Subject: [PATCH 04/29] Fix syntax error. GNP-5424 --- frontend/src/app/germplasm-card/germplasm-card.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index f9fe7661..17b14d5a 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -25,9 +25,9 @@ export class GermplasmCardComponent implements OnInit { const germplasmId = this.route.snapshot.paramMap.get('id'); this.brapiService.germplasm(germplasmId) - .subscribe(germplasm => { - this.germplasm = germplasm; - }); + .subscribe(germplasm => { + this.germplasm = germplasm; + }); this.brapiService.germplasmProgeny(germplasmId) .subscribe(germplasmProgeny => { -- GitLab From c33720925e296ffd689a7c36b55872535a00f544 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Wed, 9 Jan 2019 17:14:55 +0100 Subject: [PATCH 05/29] Useless ? GNP-5424 --- frontend/src/app/germplasm-card/germplasm-card.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 1205ed2d..46f4162b 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -73,7 +73,7 @@ </tr> <tr *ngIf="germplasm.result?.biologicalStatusOfAccessionCode!=null"> <td><b>Biological status</b></td> - <td>{{ germplasm.result?.biologicalStatusOfAccessionCode }}</td> + <td>{{ germplasm.result.biologicalStatusOfAccessionCode }}</td> </tr> <tr> <td><b>Source</b></td> -- GitLab From a8b0f2a2f66699043fc8ded76ba8c3ba37b28787 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Fri, 11 Jan 2019 17:02:06 +0100 Subject: [PATCH 06/29] Adding GnpIS index informations, popovers for institutions. GNP-5424 --- frontend/src/app/app.module.ts | 9 +- .../germplasm-card.component.html | 342 ++++++++++-------- .../germplasm-card.component.ts | 5 +- frontend/src/app/gnpis.service.ts | 4 +- frontend/src/assets/gpds/theme.scss | 13 +- 5 files changed, 210 insertions(+), 163 deletions(-) diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index f3486f6f..e13a8109 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { HomeComponent } from './home/home.component'; import { FormComponent } from './form/form.component'; import { ResultPageComponent } from './result-page/result-page.component'; import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component'; @@ -23,10 +24,12 @@ import { CardRowComponent } from './card-row/card-row.component'; import { CardSectionComponent } from './card-section/card-section.component'; import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; import { CardTableComponent } from './card-table/card-table.component'; +import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [ AppComponent, + HomeComponent, FormComponent, ResultPageComponent, GermplasmCardComponent, @@ -47,13 +50,15 @@ import { CardTableComponent } from './card-table/card-table.component'; imports: [ BrowserModule, AppRoutingModule, + HttpClientModule, NgbTypeaheadModule, NgbPaginationModule, NgbAlertModule, NgbDropdownModule, + NgbPopoverModule, + NgbDropdownModule, FormsModule, - ReactiveFormsModule, - HttpClientModule, + ReactiveFormsModule ], providers: [ diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 46f4162b..35ea79b3 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,79 +1,75 @@ +<body> +<h3 *ngIf="germplasm.result"> + Germplasm: {{ germplasm.result.germplasmName }} +</h3> + -<h3> - Germplasm: {{ germplasm.result?.germplasmName }} -</h3> <h4>Identification</h4> <div class="container-fluid"> - <div class="row"> - <!-- <img src="" class="img-fluid float-left w-25 p-2 table-sm" alt="" >--> - + <div class="row" *ngIf="germplasm.result && germplasmGnpis"> + <!-- <img src="" class="img-fluid float-left w-25 p-2 table-sm" alt="" >--> <table class="table table-sm"> - <tr> + <tr *ngIf="germplasm.result?.accessionNumber"> <td><b>Accession number</b></td> - <td>{{ germplasm.result?.accessionNumber }}</td> + <td>{{ germplasm.result.accessionNumber }}</td> </tr> - <tr *ngIf="germplasm.result?.acquisitionDate"> + <tr *ngIf="germplasmGnpis?.acquisitionDate"> <td><b>Acquisition date</b></td> - <td>{{ germplasm.result?.acquisitionDate }}</td> + <td>{{ germplasmGnpis.acquisitionDate }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.germplasmName"> <td><b>Germplasm name</b></td> - <td>{{ germplasm.result?.germplasmName }}</td> + <td>{{ germplasm.result.germplasmName }}</td> </tr> - <tr> + <tr *ngIf="germplasm.result?.germplasmPUI"> <td><b>Permanent Unique Identifier</b></td> - <td> {{ germplasm.result?.germplasmPUI }}</td> + <td> {{ germplasm.result.germplasmPUI }}</td> </tr> <tr *ngIf="germplasm.result?.seedSource"> <td><b>Seed source</b></td> <td>{{ germplasm.result.seedSource }}</td> </tr> - <tr *ngIf="germplasm.result?.geneticNature"> + <tr *ngIf="germplasmGnpis?.geneticNature"> <td><b>Genetic nature</b></td> - <td>{{ germplasm.result?.geneticNature }}</td> + <td>{{ germplasmGnpis?.geneticNature }}</td> </tr> - <tr *ngIf="germplasm.result?.synonyms.length > 0"> <td><b>Accession synonyms</b></td> <td><a *ngFor="let synonym of germplasm.result?.synonyms"> {{ synonym }}</a></td> </tr> <ng-template *ngIf="germplasm.result?.genus!=null; then withGenus; else withoutGenus"></ng-template> - <ng-template #withGenus> <tr> - <td><b>Taxon name</b></td> + <td><b>Taxon</b></td> <td *ngIf="germplasm.result?.speciesAuthority">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} ({{ germplasm.result?.speciesAuthority}}) </td> <td *ngIf="germplasm.result?.speciesAuthority==null">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} </td> </tr> </ng-template> - <ng-template #withoutGenus> <tr> - <td><b>Taxon name</b></td> + <td><b>Taxon</b></td> <td>{{ germplasm.result?.species}}</td> </tr> </ng-template> - <tr> + <tr *ngIf="germplasmGnpis?.taxonCommonNames.length > 0"> <td><b>Taxon common names</b></td> - <td>{{ germplasm.result?.commonCropName }}</td> + <td><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> </tr> - - <tr *ngIf="germplasm.result?.species"> + <tr *ngIf="germplasmGnpis?.taxonSynonyms"> <td><b>Taxon synonyms</b></td> - <td><a *ngFor="let taxonSynonym of germplasm.result?.species"> {{ taxonSynonym }}</a></td> + <td><a *ngFor="let taxonSynonym of germplasmGnpis?.taxonSynonyms"> {{ taxonSynonym }}</a></td> </tr> - <tr *ngIf="germplasm.result?.pedigree!=null"> <td><b>Pedigree</b></td> <td>{{ germplasm.result?.pedigree }}</td> </tr> - <tr *ngIf="germplasm.result?.biologicalStatusOfAccessionCode!=null"> + <tr *ngIf="germplasmGnpis?.biologicalStatusOfAccessionCode"> <td><b>Biological status</b></td> - <td>{{ germplasm.result.biologicalStatusOfAccessionCode }}</td> + <td>{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> </tr> <tr> <td><b>Source</b></td> @@ -83,96 +79,142 @@ <td><b>Source link</b></td> <td><a>{{ germplasm.result?.url }}</a></td> </tr> - <tr> + <tr *ngIf="germplasmGnpis.comment"> <td><b>Comments</b></td> - <td>{{ germplasm.result?.comment }}</td> + <td>{{ germplasmGnpis.comment }}</td> </tr> </table> </div> - <div class="row" *ngIf="germplasm.result?.holdingInstitute!=null"> + <div class="row" *ngIf="germplasmGnpis?.holdingInstitute"> <h4>Holding</h4> <table class="table table-sm"> <tr> - <td><b>Institution name</b></td> - <td>{{ germplasm.result?.holdingInstitute?.instituteName }} {{ germplasm.result?.holdingInstitute?.instituteCode }}</td> + <td><b>Institution</b></td> + <td><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute?.instituteName"> + {{ germplasmGnpis.holdingInstitute?.instituteName }} {{ germplasm.holdingInstitute?.instituteCode }}</a></td> </tr> - <tr *ngIf="germplasm.result?.holdingInstitute?.webSite"> - <td><b>Link</b></td> - <td>{{ germplasm.result.holdingInstitute.webSite }}</td> + <tr *ngIf="germplasmGnpis.holdingInstitute?.instituteName"> + <td><b>Stock center name</b></td> + <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> </tr> - <tr *ngIf="germplasm.result?.holdingInstitute?.address"> - <td><b>Adresse</b></td> - <td>{{ germplasm.result.holdingInstitute.address }}</td> - </tr> - <tr *ngIf="germplasm.result?.holdingInstitute?.logo"> - <td><b>Logo</b></td> - <td>{{ germplasm.result.holdingInstitute.logo }}</td> + <tr *ngIf="germplasmGnpis.presenceStatus"> + <td><b>Presence status</b></td> + <td>{{ germplasmGnpis.presenceStatus }}</td> </tr> </table> + + <ng-template #holdingInstituteTemplate> + + <table> + <tr *ngIf="germplasmGnpis?.holdingInstitute?.webSite"> + <td><b>Link</b></td> + <td><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis?.holdingInstitute?.address"> + <td><b>Adresse</b></td> + <td>{{ germplasmGnpis.holdingInstitute.address }}</td> + </tr> + <!--<tr *ngIf="germplasmGnpis?.holdingInstitute?.logo"> + <td><b>Logo</b></td> + <td>{{ germplasmGnpis.holdingInstitute.logo }}</td> + </tr>--> + </table> + + </ng-template> </div> - <div class="row" *ngIf="germplasm.result?.holdingGenbank"> + <!--<div class="row" *ngIf="germplasmGnpis?.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName"> <h4>Holding gene bank</h4> <table class="table table-sm"> <tr> - <td><b>Institution name</b></td> - <td>{{ germplasm.result?.holdingGenbank }} {{ germplasm.result?.organisation }}</td> + <td><b>Institution</b></td> + <td><a class="btn popovers" placement="top" [ngbPopover]="holdingGenbankTemplate" [popoverTitle]="germplasmGnpis.holdingGenbank.instituteName"> + {{ germplasmGnpis.holdingGenbank.instituteName }} {{ germplasm.holdingGenbank.instituteCode }}</a></td> </tr> - <tr> + </table> + + <ng-template #holdingGenbankTemplate> + <table> + <tr *ngIf="germplasmGnpis.holdingGenbank.webSite"> <td><b>Link</b></td> - <td>{{ germplasm.result?.webSite }}</td> + <td><a href="{{ germplasmGnpis.holdingGenbank.webSite }}">{{ germplasmGnpis.holdingGenbank.webSite }}</a></td> </tr> - <tr> + <tr *ngIf="germplasmGnpis.holdingGenbank.address"> <td><b>Adresse</b></td> - <td>{{ germplasm.result?.address }}</td> + <td>{{ germplasmGnpis.holdingGenbank.address }}</td> </tr> - <tr> + <!–<tr *ngIf="germplasmGnpis.holdingGenbank.logo"> <td><b>Logo</b></td> - <td>{{ germplasm.result?.logo }}</td> - </tr> + <td>{{ germplasmGnpis.holdingGenbank.logo }}</td> + </tr>–> </table> - </div> + </ng-template> + </div>--> - <ng-container *ngIf="germplasm.result?.breeder"> - <h4>Breeder</h4> + <ng-container *ngIf="germplasmGnpis?.breeder.institute.instituteName"> <div class="row"> + <h4>Breeder</h4> + <table class="table table-sm"> - <tr *ngIf="germplasm.result?.breeder.accessionCreationDate"> - <td><b>accessionCreationDate</b></td> - <td>{{ germplasm.result?.breeder.accessionCreationDate }}</td> + <tr> + <td><b>Institution</b></td> + <td><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> + {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a></td> </tr> - <tr *ngIf="germplasm.result?.breeder.accessionNumber"> - <td><b>accessionNumber</b></td> - <td>{{ germplasm.result?.breeder.accessionNumber }}</td> + <tr *ngIf="germplasmGnpis.breeder.institute.accessionCreationDate"> + <td><b>Accession Creation date</b></td> + <td>{{ germplasmGnpis.breeder.institute.accessionCreationDate }}</td> </tr> - <tr *ngIf="germplasm.result?.breeder.collectors"> + <tr *ngIf="germplasmGnpis.breeder.institute.accessionNumber"> + <td><b>Accession number</b></td> + <td>{{ germplasmGnpis.breeder.institute.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.institute.collectors"> <td><b>collectors</b></td> - <td>{{ germplasm.result?.breeder.collectors }}</td> + <td>{{ germplasmGnpis.breeder.institute.collectors }}</td> </tr> - <tr *ngIf="germplasm.result?.breeder.deregistrationYear"> - <td><b>deregistrationYear</b></td> - <td>{{ germplasm.result?.breeder.deregistrationYear }}</td> + <tr *ngIf="germplasmGnpis.breeder.institute.deregistrationYear"> + <td><b>Deregistration year</b></td> + <td>{{ germplasmGnpis.breeder.institute.deregistrationYear }}</td> </tr> - <tr *ngIf="germplasm.result?.breeder.distributionStatus"> + <tr *ngIf="germplasmGnpis.breeder.institute.distributionStatus"> <td><b>distributionStatus</b></td> - <td>{{ germplasm.result?.breeder.distributionStatus }}</td> + <td>{{ germplasmGnpis.breeder.institute.distributionStatus }}</td> </tr> - <tr *ngIf="germplasm.result?.breeder.germplasmPUI"> + <tr *ngIf="germplasmGnpis.breeder.institute.germplasmPUI"> <td><b>germplasmPUI</b></td> - <td>{{ germplasm.result?.breeder.germplasmPUI }}</td> + <td>{{ germplasmGnpis.breeder.institute.germplasmPUI }}</td> </tr> </table> + + <ng-template #BreederInstituteTemplate> + <table> + <tr *ngIf="germplasmGnpis.breeder.institute.webSite"> + <td><b>Link</b></td> + <td><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.institute.address"> + <td><b>Adresse</b></td> + <td>{{ germplasmGnpis.breeder.institute.address }}</td> + </tr> + <!--<tr *ngIf="germplasmGnpis.breeder.institute.logo"> + <td><b>Logo</b></td> + <td>{{ germplasmGnpis.breeder.institute.logo }}</td> + </tr>--> + </table> + </ng-template> + </div> </ng-container> - <ng-container *ngIf="germplasm.result?.taxonIds != null"> + <ng-container *ngIf="germplasmGnpis?.collectingSite.siteName"> <div class="row"> <h4>Collecting site</h4> <table class="table table-sm"> - <tr> - <td><b>Ids</b></td> - <td>{{ germplasm.result?.taxonIds.sourceName }}</td> + <tr *ngIf="germplasmGnpis.collectingSite.siteName"> + <td><b>Name</b></td> + <td>{{ germplasmGnpis.collectingSite.siteName }}</td> </tr> <tr> <td><b></b></td> @@ -182,10 +224,10 @@ </div> </ng-container> - <ng-container *ngIf="germplasm.result?.donors.length > 0"> + <ng-container *ngIf="germplasmGnpis.donors?.length > 0"> <div class="row"> <h4>Donors</h4> - <ng-container *ngFor="let donor of germplasm.result.donors"> + <ng-container *ngFor="let donor of germplasmGnpis.donors"> <table class="table table-sm"> <tr> <td><b>Donation accession number</b></td> @@ -220,7 +262,7 @@ <td>{{ germplasm.result.collectingSite.siteName }}</td> </tr> <tr> - <td><b>Institution name</b></td> + <td><b>Institution</b></td> <td>{{ germplasm.result?.instituteName }}</td> </tr> <tr *ngIf="germplasm.result?.evaluationSites?.siteName"> @@ -231,56 +273,55 @@ </table> </div> - <ng-container *ngIf="germplasmPedigree"> + <ng-container *ngIf="germplasmPedigree.result"> <div class="row"> - <h4>Genealogy</h4> - <h5>Ascendants</h5> + <h4>Ascendants</h4> <table class="table table-sm"> - <tr> + <tr *ngIf="germplasmPedigree.result.crossingPlan"> <td><b>Crossing plan</b></td> - <td>{{ germplasmPedigree.result?.crossingPlan }}</td> + <td>{{ germplasmPedigree.result.crossingPlan }}</td> </tr> - <tr *ngIf="germplasmPedigree.result?.crossingYear"> + <tr *ngIf="germplasmPedigree.result.crossingYear"> <td><b>Crossing year</b></td> <td>{{ germplasmPedigree.result.crossingYear }}</td> </tr> - <tr *ngIf="germplasm.result?.genealogy?.familyCode"> + <tr *ngIf="germplasmGnpis.genealogy.familyCode"> <td><b>Affiliation</b></td> - <td>{{ germplasm.result.genealogy.familyCode }}</td> + <td>{{ germplasmGnpis.genealogy.familyCode }}</td> </tr> <tr> - <td *ngIf="germplasmPedigree.result"><b>Parent accessions</b></td> - <td><table class="table"> - <ng-container [ngSwitch]="germplasmPedigree.result?.parent1Type"> + <td><b>Parent accessions</b></td> + <td><table> + <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> <tr *ngSwitchCase="'FEMALE'"> <td>Mother</td> - <td>{{ germplasmPedigree.result?.parent1Name }}</td> + <td>{{ germplasmPedigree.result.parent1Name }}</td> </tr> <tr *ngSwitchCase="'MALE'"> <td>Father</td> - <td>{{ germplasmPedigree.result?.parent1Name }}</td> + <td>{{ germplasmPedigree.result.parent1Name }}</td> </tr> <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result?.parent1Name }}</td> + <td>{{ germplasmPedigree.result.parent1Name }}</td> </tr> <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result?.parent1Name }}</td> + <td>{{ germplasmPedigree.result.parent1Name }}</td> </tr> </ng-container> - <ng-container [ngSwitch]="germplasmPedigree.result?.parent2Type"> + <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> <tr *ngSwitchCase="'FEMALE'"> <td>Mother</td> - <td>{{ germplasmPedigree.result?.parent2Name }}</td> + <td>{{ germplasmPedigree.result.parent2Name }}</td> </tr> <tr *ngSwitchCase="'MALE'"> <td>Father</td> - <td>{{ germplasmPedigree.result?.parent2Name }}</td> + <td>{{ germplasmPedigree.result.parent2Name }}</td> </tr> <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result?.parent2Name }}</td> + <td>{{ germplasmPedigree.result.parent2Name }}</td> </tr> <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result?.parent2Name }}</td> + <td>{{ germplasmPedigree.result.parent2Name }}</td> </tr> </ng-container> </table></td> @@ -288,118 +329,125 @@ </table> </div> + <ng-container *ngIf="germplasmPedigree.result.siblings"> <div class="row"> <h5>Siblings</h5> <table class="table table-sm"> <tr> <td><b>Siblings accessions</b></td> - <td><a *ngFor="let sibling of germplasmPedigree.result?.siblings"> {{ sibling.defaultDisplayName }}</a></td> + <td><a *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> </tr> </table> </div> + </ng-container> </ng-container> <div class="row"> - <ng-container *ngIf="germplasm.result?.distributors != null"> + <ng-container *ngIf="germplasmGnpis?.distributors.length > 0"> <h4>Distribution</h4> <table class="table table-sm"> - <ng-container *ngFor="let distributor of germplasm.result?.distributors"> - <tr><b>Institution name</b> {{ distributor.institute.instituteName }}</tr> - <tr><b>Distribution status</b> {{ distributor.distributionStatus }}</tr> + <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <tr> + <td><b>{{ distributor.institute.instituteName }}</b></td> + <td>{{ distributor.distributionStatus }}</td> + </tr> </ng-container> </table> </ng-container> </div> - - <ng-container *ngIf="germplasm.result?.collector != null"> + <ng-container *ngIf="germplasmGnpis?.collector.length > 0"> <div class="row"> <h4>Collector</h4> <table class="table table-sm"> - <tr *ngIf="germplasm.result?.collector.accessionNumber"> + <tr *ngIf="germplasmGnpis.collector.accessionNumber"> <td><b>accessionNumber</b></td> - <td>{{ germplasm.result?.collector.accessionNumber }}</td> + <td>{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - <tr *ngIf="germplasm.result?.collector.collectors.length > 0"> + <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> <td><b>collectors</b></td> - <ng-container *ngFor="let collector of germplasm.result?.collector.collectors"> + <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> <td>{{ collector }}</td> </ng-container> </tr> - <tr *ngIf="germplasm.result?.collector.deregistrationYear"> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> <td><b>deregistrationYear</b></td> - <td>{{ germplasm.result?.collector.deregistrationYear }}</td> + <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> </tr> - <tr *ngIf="germplasm.result?.collector.distributionStatus"> + <tr *ngIf="germplasmGnpis.collector.distributionStatus"> <td><b>distributionStatus</b></td> - <td>{{ germplasm.result?.collector.distributionStatus }}</td> + <td>{{ germplasmGnpis.collector.distributionStatus }}</td> </tr> - <tr *ngIf="germplasm.result?.collector.instituteName"> - <td><b>Institute name</b></td> - <td>{{ germplasm.result?.collector.instituteName }}</td> + <tr *ngIf="germplasmGnpis.collector.instituteName"> + <td><b>Institute</b></td> + <td>{{ germplasmGnpis.collector.instituteName }}</td> </tr> - <tr *ngIf="germplasm.result?.collector.materialType"> + <tr *ngIf="germplasmGnpis.collector.materialType"> <td><b>Material type</b></td> - <td>{{ germplasm.result?.collector.materialType }}</td> + <td>{{ germplasmGnpis.collector.materialType }}</td> </tr> - <tr *ngIf="germplasm.result?.collector.registrationYear"> + <tr *ngIf="germplasmGnpis.collector.registrationYear"> <td><b>Registration Year</b></td> - <td>{{ germplasm.result?.collector.registrationYear }}</td> + <td>{{ germplasmGnpis.collector.registrationYear }}</td> </tr> </table> </div> </ng-container> - <ng-container *ngIf="germplasm.result?.collection != null"> + <ng-container *ngIf="germplasmAttributes.result?.data.length > 0"> + <h4>Evaluation Data</h4> <div class="row"> - <h4>Collection</h4> <table class="table table-sm"> - <ng-container *ngFor="let collection of germplasm.result?.collection"> - <tr><b>Count</b> {{ collection.germplasmCount }}</tr> - <tr><b>Ref</b> {{ collection.germplasmRef }}</tr> - <tr><b>Institution name</b> {{ collection.id }}</tr> - <tr><b>Institution name</b> {{ collection.name }}</tr> - <tr><b>Institution type</b> {{ collection.type }}</tr> + <ng-container *ngFor="let descriptor of germplasmAttributes.result?.data"> + <tr><td><b>{{ descriptor.attributeName }}</b></td> <td>{{ descriptor.value }}</td></tr> </ng-container> </table> </div> </ng-container> - <ng-container *ngIf="germplasm.result?.panel != null"> + <ng-container *ngIf="germplasmGnpis.collection.length > 0"> <div class="row"> - <h4>Panel</h4> + <h4>Collection</h4> <table class="table table-sm"> - <ng-container *ngFor="let panel of germplasm.result?.panel"> - <tr><b>Institution name</b> {{ panel.germplasmCount }}</tr> - <tr><b>Distribution status</b> {{ panel.germplasmRef }}</tr> - <tr><b>Institution name</b> {{ panel.id }}</tr> - <tr><b>Institution name</b> {{ panel.name }}</tr> - <tr><b>Institution name</b> {{ panel.type }}</tr> + <ng-container *ngFor="let collection of germplasmGnpis.collection"> + <tr> + <td><b>{{ collection.name }}</b></td><td><a href="">{{ collection.germplasmCount }} accessions</a></td></tr> + <!--<ng-container *ngIf="collection.germplasmRef"> + <tr><b>Name</b> {{ collection.germplasmRef.name }}</tr> + <tr><b>Pui</b> {{ collection.germplasmRef.pui }}</tr> + <tr><b>value</b> {{ collection.germplasmRef.value }}</tr> + </ng-container> + <tr><b>Name</b> {{ collection.name }}</tr> + <tr><b>Type</b> {{ collection.type }}</tr>--> </ng-container> </table> </div> </ng-container> - <ng-container *ngIf="germplasmAttributes.result?.data.length > 0"> - <h4>Evaluation Data</h4> + <ng-container *ngIf="germplasmGnpis.panel.length > 0"> <div class="row"> + <h4>Panel</h4> <table class="table table-sm"> - <ng-container *ngFor="let descriptor of germplasmAttributes.result?.data"> - <tr><td><b>{{ descriptor.attributeName }}</b></td> <td>{{ descriptor.value }}</td></tr> + <ng-container *ngFor="let panel of germplasmGnpis.panel"> + <tr><b>Number of germplasms</b> {{ panel.germplasmCount }}</tr> + <ng-container *ngIf="panel.germplasmRef"> + <tr><b>Name</b> {{ panel.germplasmRef.name }}</tr> + <tr><b>Pui</b> {{ panel.germplasmRef.pui }}</tr> + <tr><b>value</b> {{ panel.germplasmRef.value }}</tr> + </ng-container> + <tr><b>Name</b> {{ panel.name }}</tr> + <tr><b>Type</b> {{ panel.type }}</tr> </ng-container> </table> </div> </ng-container> - <div class="row"> - <h4>Cross-reference</h4> - <table class="container-fluid"> - </table> - </div> -</div> + +</div> +</body> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 17b14d5a..2ef7f9ae 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -45,8 +45,9 @@ export class GermplasmCardComponent implements OnInit { }); this.gnpisService.germplasm(germplasmId) - .subscribe(germplasmGnpis => - this.germplasmGnpis = germplasmGnpis); + .subscribe(germplasmGnpis => { + this.germplasmGnpis = germplasmGnpis; + }); } } diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 967550c8..340b7057 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -95,5 +95,7 @@ export class GnpisService { getSource(sourceURI: string): Observable<DataDiscoverySource> { return this.sourceByURI$.pipe(map(sourceByURI => sourceByURI[sourceURI])); } - + germplasm(germplasmDbId: string): Observable<object> { + return this.http.get<object>(`/gnpis/v1/germplasm/${germplasmDbId}`); + } } diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 0c0ae299..6fbfb3d3 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -19,17 +19,8 @@ $enable-shadows: true; @import "~bootstrap/scss/tables"; @import "~bootstrap/scss/card"; @import "~bootstrap/scss/transitions"; - - - -//custom tables -.table { - border-bottom: 2px solid #79c93f; - border-top: 2px solid #79c93f; -} - - - +@import "~bootstrap/scss/tooltip"; +@import "~bootstrap/scss/popover"; // public custom variables used in this theme, and in component styles -- GitLab From 75876fc840909af08d8633ec194f9d17805662af Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 17 Jan 2019 16:52:54 +0100 Subject: [PATCH 07/29] Modification of brapi and gnpis model, more responsive page. GNP-5424 --- frontend/src/app/brapi.service.ts | 18 +- .../germplasm-card.component.html | 831 +++++++++--------- .../germplasm-card.component.ts | 15 +- frontend/src/app/gnpis.service.ts | 6 +- frontend/src/app/model/brapi.model.ts | 86 ++ frontend/src/app/model/gnpis.model.ts | 63 ++ frontend/src/assets/gpds/theme.scss | 9 + 7 files changed, 600 insertions(+), 428 deletions(-) create mode 100644 frontend/src/app/model/brapi.model.ts create mode 100644 frontend/src/app/model/gnpis.model.ts diff --git a/frontend/src/app/brapi.service.ts b/frontend/src/app/brapi.service.ts index be27a43a..d9595061 100644 --- a/frontend/src/app/brapi.service.ts +++ b/frontend/src/app/brapi.service.ts @@ -10,6 +10,10 @@ import { BrapiStudy, BrapiTrial } from './models/brapi.model'; +import { + GermplasmResult +} from './model/gnpis.model'; +import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from './model/brapi.model'; export const BASE_URL = 'brapi/v1'; @@ -21,18 +25,20 @@ export class BrapiService { constructor(private http: HttpClient) { } - germplasm(germplasmDbId: string): Observable<object> { - return this.http.get<object>(`${BASE_URL}/germplasm/${germplasmDbId}`); + germplasm(germplasmDbId: string): Observable<GermplasmResult<null>> { + return this.http.get<GermplasmResult<null>>(`/brapi/v1/germplasm/${germplasmDbId}`); } - germplasmPedigree(germplasmDbId: string): Observable<object> { - return this.http.get<object>(`${BASE_URL}/germplasm/${germplasmDbId}/pedigree`); + germplasmPedigree(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmPedigree>> { + return this.http.get<GermplasmResult<BrapiGermplasmPedigree>>(`/brapi/v1/germplasm/${germplasmDbId}/pedigree`); } - germplasmProgeny(germplasmDbId: string): Observable<object> { - return this.http.get<object>(`${BASE_URL}/germplasm/${germplasmDbId}/progeny`); + germplasmProgeny(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmProgeny>> { + return this.http.get<GermplasmResult<BrapiGermplasmProgeny>>(`/brapi/v1/germplasm/${germplasmDbId}/progeny`); } + germplasmAttributes(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmAttributes[]>> { + return this.http.get<GermplasmResult<BrapiGermplasmAttributes[]>>(`/brapi/v1/germplasm/${germplasmDbId}/attributes`); germplasmAttributes(germplasmDbId: string): Observable<object> { return this.http.get<object>(`${BASE_URL}/germplasm/${germplasmDbId}/attributes`); } diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 35ea79b3..1557e37a 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,453 +1,456 @@ -<body> -<h3 *ngIf="germplasm.result"> - Germplasm: {{ germplasm.result.germplasmName }} -</h3> - - - - -<h4>Identification</h4> -<div class="container-fluid"> - <div class="row" *ngIf="germplasm.result && germplasmGnpis"> - <!-- <img src="" class="img-fluid float-left w-25 p-2 table-sm" alt="" >--> - <table class="table table-sm"> - <tr *ngIf="germplasm.result?.accessionNumber"> - <td><b>Accession number</b></td> - <td>{{ germplasm.result.accessionNumber }}</td> - </tr> - <tr *ngIf="germplasmGnpis?.acquisitionDate"> - <td><b>Acquisition date</b></td> - <td>{{ germplasmGnpis.acquisitionDate }}</td> - </tr> - <tr *ngIf="germplasm.result?.germplasmName"> - <td><b>Germplasm name</b></td> - <td>{{ germplasm.result.germplasmName }}</td> - </tr> - <tr *ngIf="germplasm.result?.germplasmPUI"> - <td><b>Permanent Unique Identifier</b></td> - <td> {{ germplasm.result.germplasmPUI }}</td> - </tr> - <tr *ngIf="germplasm.result?.seedSource"> - <td><b>Seed source</b></td> - <td>{{ germplasm.result.seedSource }}</td> - </tr> - <tr *ngIf="germplasmGnpis?.geneticNature"> - <td><b>Genetic nature</b></td> - <td>{{ germplasmGnpis?.geneticNature }}</td> - </tr> - <tr *ngIf="germplasm.result?.synonyms.length > 0"> - <td><b>Accession synonyms</b></td> - <td><a *ngFor="let synonym of germplasm.result?.synonyms"> {{ synonym }}</a></td> - </tr> - - <ng-template *ngIf="germplasm.result?.genus!=null; then withGenus; else withoutGenus"></ng-template> - <ng-template #withGenus> - <tr> - <td><b>Taxon</b></td> - <td *ngIf="germplasm.result?.speciesAuthority">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} ({{ germplasm.result?.speciesAuthority}}) </td> - <td *ngIf="germplasm.result?.speciesAuthority==null">{{ germplasm.result?.genus}} {{ germplasm.result?.species}} {{ germplasm.result?.subtaxa}} </td> - </tr> - </ng-template> - <ng-template #withoutGenus> - <tr> - <td><b>Taxon</b></td> - <td>{{ germplasm.result?.species}}</td> - </tr> - </ng-template> - - <tr *ngIf="germplasmGnpis?.taxonCommonNames.length > 0"> - <td><b>Taxon common names</b></td> - <td><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis?.taxonSynonyms"> - <td><b>Taxon synonyms</b></td> - <td><a *ngFor="let taxonSynonym of germplasmGnpis?.taxonSynonyms"> {{ taxonSynonym }}</a></td> - </tr> - <tr *ngIf="germplasm.result?.pedigree!=null"> - <td><b>Pedigree</b></td> - <td>{{ germplasm.result?.pedigree }}</td> - </tr> - <tr *ngIf="germplasmGnpis?.biologicalStatusOfAccessionCode"> - <td><b>Biological status</b></td> - <td>{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> - </tr> - <tr> - <td><b>Source</b></td> - <td>{{ germplasm.result?.source }}</td> - </tr> - <tr *ngIf="germplasm.result?.source!='URGI'"> - <td><b>Source link</b></td> - <td><a>{{ germplasm.result?.url }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.comment"> - <td><b>Comments</b></td> - <td>{{ germplasmGnpis.comment }}</td> - </tr> - </table> - </div> - - <div class="row" *ngIf="germplasmGnpis?.holdingInstitute"> - <h4>Holding</h4> - <table class="table table-sm"> - <tr> - <td><b>Institution</b></td> - <td><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute?.instituteName"> - {{ germplasmGnpis.holdingInstitute?.instituteName }} {{ germplasm.holdingInstitute?.instituteCode }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute?.instituteName"> - <td><b>Stock center name</b></td> - <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> - </tr> - <tr *ngIf="germplasmGnpis.presenceStatus"> - <td><b>Presence status</b></td> - <td>{{ germplasmGnpis.presenceStatus }}</td> - </tr> - </table> - - <ng-template #holdingInstituteTemplate> - - <table> - <tr *ngIf="germplasmGnpis?.holdingInstitute?.webSite"> - <td><b>Link</b></td> - <td><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis?.holdingInstitute?.address"> - <td><b>Adresse</b></td> - <td>{{ germplasmGnpis.holdingInstitute.address }}</td> - </tr> - <!--<tr *ngIf="germplasmGnpis?.holdingInstitute?.logo"> - <td><b>Logo</b></td> - <td>{{ germplasmGnpis.holdingInstitute.logo }}</td> - </tr>--> - </table> - - </ng-template> - </div> - - <!--<div class="row" *ngIf="germplasmGnpis?.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName"> - <h4>Holding gene bank</h4> - <table class="table table-sm"> - <tr> - <td><b>Institution</b></td> - <td><a class="btn popovers" placement="top" [ngbPopover]="holdingGenbankTemplate" [popoverTitle]="germplasmGnpis.holdingGenbank.instituteName"> - {{ germplasmGnpis.holdingGenbank.instituteName }} {{ germplasm.holdingGenbank.instituteCode }}</a></td> - </tr> - </table> +<div *ngIf="germplasmGnpis!=null"> + <h3> + Germplasm: {{ germplasmGnpis.germplasmName }} + </h3> + + <div class="container-fluid"> + <h4>Identification</h4> + <div class="container" > + + <div class="row"> + + <div class="col-md-auto"> + <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExMWFhUXGBkbGBcYGBobIBseIBodGB0fGRgdHSggGx8lIBgXITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGyslICMtLS0xLTAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS03Lf/AABEIARMAtwMBIgACEQEDEQH/xAAcAAACAgMBAQAAAAAAAAAAAAAFBgMEAAEHAgj/xAA6EAACAQIFAgUBBgYCAQUBAAABAhEAAwQFEiExQVEGEyJhcYEyQpGhscEUI1LR4fAVYjMHQ3KC8Rb/xAAaAQADAQEBAQAAAAAAAAAAAAACAwQBAAUG/8QALxEAAQQBAwQBAgUEAwAAAAAAAQACAxEhBBIxEyJBUTJhoQUUcZHwI4Gx8UJSwf/aAAwDAQACEQMRAD8AF+HPLFwBj94T3iuhJlga6ty0NDAgrHX5Fc/sXvKxFy3H80+nccCJJ+aNZRiMQt1fLuEt2JkfhXz7yGOGMlPBoUQn/wAT+LbeEVdtdw/d7d5pd8MYkY7EO9xVWQdNsDaf6iepof4ga3eu2xdtFXGzHksTG/sPan7wtk9qykosExM9KuZJ15KrAQlu0WlpsOVvj+JLwJ4J37EUzZZnFlbIltIRevb680QzHDBkYwCdJgkTG1It++mONq1btkLZA85uP/qO8xTIdOYboivusJ3Ink2agtdxTI5Nw6UAGwUH0/3+tWWsXcS2oDy1PM/vUV/zFKrZYC3sI22+tHLWAAurcVzsPUoOxPf2oGl0riLx/PK49hVbLsiW1sUV5nc9PpXvIsCia4si2wdpjg77Ee0dKLI4PBmtMxAJG532qxsbAMICbUd14YfG46UN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7Uq5hcIJAgDtArKyvN15U+o+SzJlDXIbeIielM+TYdXxUOA0ISJ7zFbrKCL5tS2fJWcfhkF7TpEduf1pcxmCtktKisrKdqR/lNk5QLJybN1TaJUlwp3JkEHaDT3dQCWAgmJNarKojy0JzPilzEOfPujp6TFUs6vsAACYPPvzWVlZJ8VzvikK7bH8QojbVR5lC6o25rKyku4CiKpXzGFkbEtuasZXzp6cx0msrK5/ARLcfz//AKmsrKytpcv/2Q==" + class="img-fluid" alt="" > + </div> + <div class="col"> + + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr *ngIf="germplasmGnpis.accessionNumber!=null"> + <th scope="row">Accession number</th> + <td>{{ germplasmGnpis.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.acquisitionDate!=null"> + <th scope="row">Acquisition date</th> + <td>{{ germplasmGnpis.acquisitionDate }}</td> + </tr> + <tr *ngIf="germplasmGnpis.germplasmName!=null"> + <th scope="row">Germplasm name</th> + <td>{{ germplasmGnpis.germplasmName }}</td> + </tr> + <tr *ngIf="germplasmGnpis.germplasmPUI!=null"> + <th scope="row">Permanent Unique Identifier</th> + <td> {{ germplasmGnpis.germplasmPUI }}</td> + </tr> + <tr *ngIf="germplasmGnpis.seedSource!=null"> + <th scope="row">Seed source</th> + <td>{{ germplasmGnpis.seedSource }}</td> + </tr> + <tr *ngIf="germplasmGnpis.geneticNature!=null"> + <th scope="row">Genetic nature</th> + <td>{{ germplasmGnpis.geneticNature }}</td> + </tr> + <tr *ngIf="germplasmGnpis.synonyms.length > 0"> + <th scope="row">Accession synonyms</th> + <td><a *ngFor="let synonym of germplasmGnpis.synonyms"> {{ synonym }}</a></td> + </tr> + + <ng-template *ngIf="germplasmGnpis.genus!=null; then withGenus; else withoutGenus"></ng-template> + <ng-template #withGenus> + <tr> + <th scope="row">Taxon</th> + <td *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus}} {{ germplasmGnpis.species}} {{ germplasmGnpis.subtaxa}} ({{ germplasmGnpis.speciesAuthority}}) </td> + <td *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus}} {{ germplasmGnpis.species}} {{ germplasmGnpis.subtaxa}} </td> + </tr> + </ng-template> + <ng-template #withoutGenus> + <tr> + <th scope="row">Taxon</th> + <td>{{ germplasmGnpis.species}}</td> + </tr> + </ng-template> + + <tr *ngIf="germplasmGnpis.taxonCommonNames.length > 0"> + <th scope="row">Taxon common names</th> + <td><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.taxonSynonyms.length > 0"> + <th scope="row">Taxon synonyms</th> + <td><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }},</a></td> + </tr> + <tr *ngIf="germplasmGnpis.pedigree!=null"> + <th scope="row">Pedigree</th> + <td>{{ germplasmGnpis.pedigree }}</td> + </tr> + <tr *ngIf="germplasmGnpis.biologicalStatusOfAccessionCode!=null"> + <th scope="row">Biological status</th> + <td>{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> + </tr> + <!--<tr> + <td>Source</td> + <td>{{ germplasmGnpis.source }}</td> + </tr> + <tr *ngIf="germplasmGnpis.source!='URGI'"> + <td>Source link</td> + <td><a>{{ germplasmGnpis.url }}</a></td> + </tr>--> + <tr *ngIf="germplasmGnpis.comment!=null"> + <th scope="row">Comments</th> + <td>{{ germplasmGnpis.comment }}</td> + </tr> + </table> + </div> + </div> + </div> - <ng-template #holdingGenbankTemplate> - <table> - <tr *ngIf="germplasmGnpis.holdingGenbank.webSite"> - <td><b>Link</b></td> - <td><a href="{{ germplasmGnpis.holdingGenbank.webSite }}">{{ germplasmGnpis.holdingGenbank.webSite }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.holdingGenbank.address"> - <td><b>Adresse</b></td> - <td>{{ germplasmGnpis.holdingGenbank.address }}</td> - </tr> - <!–<tr *ngIf="germplasmGnpis.holdingGenbank.logo"> - <td><b>Logo</b></td> - <td>{{ germplasmGnpis.holdingGenbank.logo }}</td> - </tr>–> - </table> - </ng-template> - </div>--> + <div class="container" > + <div class="row" *ngIf="germplasmGnpis.holdingInstitute!=null"> + <h4>Holding</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr> + <th scope="row">Institution</th> + <td><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> + {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.presenceStatus"> + <th scope="row">Presence status</th> + <td>{{ germplasmGnpis.presenceStatus }}</td> + </tr> + </table> - <ng-container *ngIf="germplasmGnpis?.breeder.institute.instituteName"> - <div class="row"> - <h4>Breeder</h4> + <ng-template #holdingInstituteTemplate> + <table> + <tr *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> + <th scope="row">Link</th> + <td><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> + <th scope="row">Adresse</th> + <td>{{ germplasmGnpis.holdingInstitute.address }}</td> + </tr> + </table> + </ng-template> + </div> + <div class="row" *ngIf="germplasmGnpis.collectingSite.siteName!=null"> + <div class="row"> + <h4>Collecting site</h4> + <table> + <tr *ngIf="germplasmGnpis.collectingSite.siteName"> + <th scope="row">Name</th> + <td>{{ germplasmGnpis.collectingSite.siteName }}</td> + </tr> + <tr> + <td></td> + <td></td> + </tr> + </table> + </div> + </div> + + <div class="row"> + <h4>Origin</h4> + </div> + <div class="row" *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <h5>Breeder</h5> + <table class="table table-sm"> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <th scope="row">Institution</th> + <td><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> + {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> + <th scope="row">Accession Creation date</th> + <td>{{ germplasmGnpis.breeder.accessionCreationDate }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.accessionNumber!=null"> + <th scope="row">Accession number</th> + <td>{{ germplasmGnpis.breeder.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.collectors!=null"> + <th scope="row">collectors</th> + <td>{{ germplasmGnpis.breeder.collectors }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.deregistrationYear!=null"> + <th scope="row">Deregistration year</th> + <td>{{ germplasmGnpis.breeder.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.distributionStatus!=null"> + <th scope="row">distributionStatus</th> + <td>{{ germplasmGnpis.breeder.distributionStatus }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.germplasmPUI!=null"> + <th scope="row">germplasmPUI</th> + <td>{{ germplasmGnpis.breeder.germplasmPUI }}</td> + </tr> + </table> + </div> + + <div class="row" *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <h5>Collecting</h5> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <th scope="row">Institution</th> + <td><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> + {{ germplasmGnpis.collector.institute.instituteName }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> + <th scope="row">Accession Creation date</th> + <td>{{ germplasmGnpis.collector.accessionCreationDate }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.accessionNumber!=null"> + <th scope="row">Accession number</th> + <td>{{ germplasmGnpis.collector.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.collectors!=null"> + <th scope="row">collectors</th> + <td>{{ germplasmGnpis.collector.collectors }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear!=null"> + <th scope="row">Deregistration year</th> + <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.distributionStatus!=null"> + <th scope="row">distributionStatus</th> + <td>{{ germplasmGnpis.collector.distributionStatus }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.germplasmPUI!=null"> + <th scope="row">germplasmPUI</th> + <td>{{ germplasmGnpis.collector.germplasmPUI }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.materialType!=null"> + <th scope="row">Material type</th> + <td>{{ germplasmGnpis.collector.materialType }}</td> + </tr> + </table> + </div> - <table class="table table-sm"> - <tr> - <td><b>Institution</b></td> - <td><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> - {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.accessionCreationDate"> - <td><b>Accession Creation date</b></td> - <td>{{ germplasmGnpis.breeder.institute.accessionCreationDate }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.accessionNumber"> - <td><b>Accession number</b></td> - <td>{{ germplasmGnpis.breeder.institute.accessionNumber }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.collectors"> - <td><b>collectors</b></td> - <td>{{ germplasmGnpis.breeder.institute.collectors }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.deregistrationYear"> - <td><b>Deregistration year</b></td> - <td>{{ germplasmGnpis.breeder.institute.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.distributionStatus"> - <td><b>distributionStatus</b></td> - <td>{{ germplasmGnpis.breeder.institute.distributionStatus }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.germplasmPUI"> - <td><b>germplasmPUI</b></td> - <td>{{ germplasmGnpis.breeder.institute.germplasmPUI }}</td> - </tr> - </table> + <div class="row" *ngIf="germplasmGnpis.donors.length > 0"> + <h4>Donation</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead> + <tr> + <th scope="col">Institute</th> + <th scope="col">Date</th> + </tr> + </thead> + <tr *ngFor="let donor of germplasmGnpis.donors"> + <td><a class="btn popovers" placement="top" [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> + {{ donor.donorInstitute.instituteName }} {{ donor.donorInstitute.instituteCode }}</a></td> + <td>{{ donor.donationDate | date:'yyyy/MM/dd' }}</td> + + <ng-template #DonorInstituteTemplate > + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr *ngIf="donor.donorInstitute.instituteType!=null"> + <th scope="row">Type</th> + <td>{{ donor.donorInstitute.instituteType }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.webSite!=null"> + <th scope="row">Link</th> + <td><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> + </tr> + <tr *ngIf="donor.donorInstitute.address!=null"> + <th scope="row">Adresse</th> + <td>{{ donor.donorInstitute.address }}</td> + </tr> + </table> + </ng-template> + </tr> + </table> + </div> + <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName!=null"> + <td>Evaluation sites</td> + <td>{{ germplasmGnpis.evaluationSites.siteName }}</td> + </tr>--> <ng-template #BreederInstituteTemplate> <table> - <tr *ngIf="germplasmGnpis.breeder.institute.webSite"> - <td><b>Link</b></td> + <tr *ngIf="germplasmGnpis.breeder.institute.webSite!=null"> + <th scope="row">Link</th> <td><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.address"> - <td><b>Adresse</b></td> + <tr *ngIf="germplasmGnpis.breeder.institute.address!=null"> + <th scope="row">Adresse</th> <td>{{ germplasmGnpis.breeder.institute.address }}</td> </tr> - <!--<tr *ngIf="germplasmGnpis.breeder.institute.logo"> - <td><b>Logo</b></td> - <td>{{ germplasmGnpis.breeder.institute.logo }}</td> - </tr>--> + </table> </ng-template> - </div> - </ng-container> + <ng-template #CollectorInstituteTemplate> + <table> + <tr *ngIf="germplasmGnpis.collector.institute.webSite!=null"> + <th scope="row">Link</th> + <td><a href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.collector.institute.address!=null"> + <th scope="row">Adresse</th> + <td>{{ germplasmGnpis.collector.institute.address }}</td> + </tr> - <ng-container *ngIf="germplasmGnpis?.collectingSite.siteName"> - <div class="row"> - <h4>Collecting site</h4> - <table class="table table-sm"> - <tr *ngIf="germplasmGnpis.collectingSite.siteName"> - <td><b>Name</b></td> - <td>{{ germplasmGnpis.collectingSite.siteName }}</td> - </tr> - <tr> - <td><b></b></td> - <td></td> - </tr> - </table> - </div> - </ng-container> + </table> + </ng-template> - <ng-container *ngIf="germplasmGnpis.donors?.length > 0"> - <div class="row"> - <h4>Donors</h4> - <ng-container *ngFor="let donor of germplasmGnpis.donors"> - <table class="table table-sm"> - <tr> - <td><b>Donation accession number</b></td> - <td>{{ donor.donorAccessionNumber }}</td> + +<ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> + <div class="row"> + <h4>Genealogy</h4> + </div> + <div class="row" *ngIf="germplasmPedigree.result!=null"> + <h5>Ascendants</h5> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr *ngIf="germplasmPedigree.result.crossingPlan"> + <th scope="row">Crossing plan</th> + <td>{{ germplasmPedigree.result.crossingPlan }}</td> </tr> - <tr> - <td><b>Donation germplasm PUI</b></td> - <td>{{ donor.donorGermplasmPUI }}</td> + <tr *ngIf="germplasmPedigree.result.crossingYear"> + <th scope="row">Crossing year</th> + <td>{{ germplasmPedigree.result.crossingYear }}</td> </tr> <tr> - <td><b>Institute code</b></td> - <td>{{ donor.donorInstituteCode }}</td> + <th scope="row">Parent accessions</th> + <td><table> + <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th scope="row">Mother</th> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th scope="row">Father</th> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + </ng-container> + <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th scope="row">Mother</th> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th scope="row">Father</th> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + </ng-container> + </table></td> </tr> </table> + </div> + + <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> + <div class="row"> + <h5>Siblings</h5> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr> + <th scope="row">Siblings accessions</th> + <td><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> + </tr> + </table> + </div> </ng-container> - </div> - </ng-container> - <div class="row"> - <h4>Origin</h4> - <table class="table table-sm"> - <tr *ngIf="germplasm.result?.countryOfOriginCode"> - <td><b>Geographical origin</b></td> - <td>{{ germplasm.result.countryOfOriginCode }}</td> - </tr> - <tr *ngIf="germplasm.result?.originSite?.siteName"> - <td><b>Origin site</b></td> - <td>{{ germplasm.result.originSite.siteName }}</td> - </tr> - <tr *ngIf="germplasm.result?.collectingSite?.siteName"> - <td><b>Collecting site</b></td> - <td>{{ germplasm.result.collectingSite.siteName }}</td> - </tr> - <tr> - <td><b>Institution</b></td> - <td>{{ germplasm.result?.instituteName }}</td> - </tr> - <tr *ngIf="germplasm.result?.evaluationSites?.siteName"> - <td><b>Evaluation sites</b></td> - <td>{{ germplasm.result.evaluationSites.siteName }}</td> - </tr> + </ng-container> - </table> - </div> - <ng-container *ngIf="germplasmPedigree.result"> <div class="row"> - <h4>Ascendants</h4> - <table class="table table-sm"> - <tr *ngIf="germplasmPedigree.result.crossingPlan"> - <td><b>Crossing plan</b></td> - <td>{{ germplasmPedigree.result.crossingPlan }}</td> - </tr> - <tr *ngIf="germplasmPedigree.result.crossingYear"> - <td><b>Crossing year</b></td> - <td>{{ germplasmPedigree.result.crossingYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.genealogy.familyCode"> - <td><b>Affiliation</b></td> - <td>{{ germplasmGnpis.genealogy.familyCode }}</td> - </tr> - <tr> - <td><b>Parent accessions</b></td> - <td><table> - <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> - <tr *ngSwitchCase="'FEMALE'"> - <td>Mother</td> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <td>Father</td> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - </ng-container> - <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> - <tr *ngSwitchCase="'FEMALE'"> - <td>Mother</td> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <td>Father</td> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - </ng-container> - </table></td> - </tr> - </table> - </div> - - <ng-container *ngIf="germplasmPedigree.result.siblings"> - <div class="row"> - <h5>Siblings</h5> - <table class="table table-sm"> - <tr> - <td><b>Siblings accessions</b></td> - <td><a *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> - </tr> - </table> + <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> + <h4>Distribution</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <tr> + <th scope="row">{{ distributor.institute.instituteName }}</th> + <td>{{ distributor.distributionStatus }}</td> + </tr> + </ng-container> + </table> + </ng-container> </div> - </ng-container> - </ng-container> - <div class="row"> - <ng-container *ngIf="germplasmGnpis?.distributors.length > 0"> - <h4>Distribution</h4> - <table class="table table-sm"> - <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> - <tr> - <td><b>{{ distributor.institute.instituteName }}</b></td> - <td>{{ distributor.distributionStatus }}</td> + <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> + <div class="row"> + <h4>Collector</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <tr *ngIf="germplasmGnpis.collector.accessionNumber"> + <th scope="row">accessionNumber</th> + <td>{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - </ng-container> - </table> - </ng-container> - </div> - - <ng-container *ngIf="germplasmGnpis?.collector.length > 0"> - <div class="row"> - <h4>Collector</h4> - <table class="table table-sm"> - <tr *ngIf="germplasmGnpis.collector.accessionNumber"> - <td><b>accessionNumber</b></td> - <td>{{ germplasmGnpis.collector.accessionNumber }}</td> - </tr> - - <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> - <td><b>collectors</b></td> - <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> - <td>{{ collector }}</td> - </ng-container> - </tr> - <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> - <td><b>deregistrationYear</b></td> - <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus"> - <td><b>distributionStatus</b></td> - <td>{{ germplasmGnpis.collector.distributionStatus }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> + <th scope="row">collectors</th> + <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> + <td>{{ collector }}</td> + </ng-container> + </tr> - <tr *ngIf="germplasmGnpis.collector.instituteName"> - <td><b>Institute</b></td> - <td>{{ germplasmGnpis.collector.instituteName }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> + <th scope="row">deregistrationYear</th> + <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.distributionStatus"> + <th scope="row">distributionStatus</th> + <td>{{ germplasmGnpis.collector.distributionStatus }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.materialType"> - <td><b>Material type</b></td> - <td>{{ germplasmGnpis.collector.materialType }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.instituteName"> + <th scope="row">Institute</th> + <td>{{ germplasmGnpis.collector.instituteName }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.registrationYear"> - <td><b>Registration Year</b></td> - <td>{{ germplasmGnpis.collector.registrationYear }}</td> - </tr> - </table> - </div> - </ng-container> + <tr *ngIf="germplasmGnpis.collector.materialType"> + <th scope="row">Material type</th> + <td>{{ germplasmGnpis.collector.materialType }}</td> + </tr> - <ng-container *ngIf="germplasmAttributes.result?.data.length > 0"> - <h4>Evaluation Data</h4> - <div class="row"> - <table class="table table-sm"> - <ng-container *ngFor="let descriptor of germplasmAttributes.result?.data"> - <tr><td><b>{{ descriptor.attributeName }}</b></td> <td>{{ descriptor.value }}</td></tr> - </ng-container> - </table> - </div> - </ng-container> + <tr *ngIf="germplasmGnpis.collector.registrationYear"> + <th scope="row">Registration Year</th> + <td>{{ germplasmGnpis.collector.registrationYear }}</td> + </tr> + </table> + </div> + </ng-container> - <ng-container *ngIf="germplasmGnpis.collection.length > 0"> - <div class="row"> - <h4>Collection</h4> - <table class="table table-sm"> - <ng-container *ngFor="let collection of germplasmGnpis.collection"> - <tr> - <td><b>{{ collection.name }}</b></td><td><a href="">{{ collection.germplasmCount }} accessions</a></td></tr> - <!--<ng-container *ngIf="collection.germplasmRef"> - <tr><b>Name</b> {{ collection.germplasmRef.name }}</tr> - <tr><b>Pui</b> {{ collection.germplasmRef.pui }}</tr> - <tr><b>value</b> {{ collection.germplasmRef.value }}</tr> + <ng-container *ngIf="germplasmAttributes.length > 0"> + <h4>Evaluation Data</h4> + <div class="row"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let descriptor of germplasmAttributes"> + <tr> + <th scope="row">{{ descriptor.attributeName }}</th> + <td>{{ descriptor.value }}</td> + </tr> </ng-container> - <tr><b>Name</b> {{ collection.name }}</tr> - <tr><b>Type</b> {{ collection.type }}</tr>--> - </ng-container> - </table> - </div> - </ng-container> + </table> + </div> + </ng-container> - <ng-container *ngIf="germplasmGnpis.panel.length > 0"> - <div class="row"> - <h4>Panel</h4> - <table class="table table-sm"> - <ng-container *ngFor="let panel of germplasmGnpis.panel"> - <tr><b>Number of germplasms</b> {{ panel.germplasmCount }}</tr> - <ng-container *ngIf="panel.germplasmRef"> - <tr><b>Name</b> {{ panel.germplasmRef.name }}</tr> - <tr><b>Pui</b> {{ panel.germplasmRef.pui }}</tr> - <tr><b>value</b> {{ panel.germplasmRef.value }}</tr> + <ng-container *ngIf="germplasmGnpis.collection.length > 0"> + <div class="row"> + <h4>Collection</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let collection of germplasmGnpis.collection"> + <tr> + <th scope="row">{{ collection.name }}</th> + <td><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> + {{ collection.germplasmCount }} accessions</a> + </td> + </tr> </ng-container> - <tr><b>Name</b> {{ panel.name }}</tr> - <tr><b>Type</b> {{ panel.type }}</tr> - </ng-container> - </table> - </div> - </ng-container> - - + </table> + </div> + </ng-container> + <ng-container *ngIf="germplasmGnpis.panel.length > 0"> + <div class="row"> + <h4>Panel</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let panel of germplasmGnpis.panel"> + <tr> + <th scope="row">{{ panel.name }}</th> + <td><a href="">{{ panel.germplasmCount }} accessions</a></td> + </tr> + </ng-container> + </table> + </div> + </ng-container> + </div> +</div> </div> -</body> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 2ef7f9ae..56da2363 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; import { GnpisService } from '../gnpis.service'; +import { GermplasmResult +} from '../model/gnpis.model'; +import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from '../model/brapi.model'; @Component({ selector: 'gpds-germplasm-card', @@ -15,11 +18,11 @@ export class GermplasmCardComponent implements OnInit { constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { } - germplasm: object = {}; - germplasmGnpis: object = {}; - germplasmPedigree: object = {}; - germplasmProgeny: object = {}; - germplasmAttributes: object = {}; + germplasm: GermplasmResult<null>; + germplasmGnpis: GermplasmResult<null>; + germplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; + germplasmProgeny: GermplasmResult<BrapiGermplasmProgeny>; + germplasmAttributes: BrapiGermplasmAttributes[]; ngOnInit() { const germplasmId = this.route.snapshot.paramMap.get('id'); @@ -41,7 +44,7 @@ export class GermplasmCardComponent implements OnInit { this.brapiService.germplasmAttributes(germplasmId) .subscribe(germplasmAttributes => { - this.germplasmAttributes = germplasmAttributes; + this.germplasmAttributes = germplasmAttributes.result.data; }); this.gnpisService.germplasm(germplasmId) diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 340b7057..9deb13a6 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -4,6 +4,8 @@ import { HttpClient } from '@angular/common/http'; import { DataDiscoveryCriteria, DataDiscoveryFacet, DataDiscoveryResults, DataDiscoverySource } from './models/data-discovery.model'; import { BrapiResults } from './models/brapi.model'; import { map } from 'rxjs/operators'; +import { GermplasmResult } from './model/gnpis.model'; + export const BASE_URL = 'gnpis/v1/datadiscovery'; @@ -95,7 +97,7 @@ export class GnpisService { getSource(sourceURI: string): Observable<DataDiscoverySource> { return this.sourceByURI$.pipe(map(sourceByURI => sourceByURI[sourceURI])); } - germplasm(germplasmDbId: string): Observable<object> { - return this.http.get<object>(`/gnpis/v1/germplasm/${germplasmDbId}`); + germplasm(germplasmDbId: string): Observable<GermplasmResult<null>> { + return this.http.get<GermplasmResult<null>>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); } } diff --git a/frontend/src/app/model/brapi.model.ts b/frontend/src/app/model/brapi.model.ts new file mode 100644 index 00000000..243d1bdc --- /dev/null +++ b/frontend/src/app/model/brapi.model.ts @@ -0,0 +1,86 @@ +import { GermplasmRef } from './gnpis.model'; + +export interface BrapiSite { + latitude: number; + longitude: number; + siteId: number; + siteName: string; + siteType: string; +} + +export interface BrapiSibling { + germplasmDbId: string; + defaultDisplayName: string; +} + +export interface BrapiDescriptor { + name: string; + pui: string; + value: string; +} + +export interface BrapiGermplasmPedigree { + germplasmDbId: string; + defaultDisplayName: string; + pedigree: string; + crossingPlan: string; + crossingYear: string; + familyCode: string; + parent1DbId: string; + parent1Name: string; + parent1Type: string; + parent2DbId: string; + parent2Name: string; + parent2Type: string; + siblings: BrapiSibling[]; +} + +export interface BrapiGermplasmProgeny { + germplasmDbId: string; + defaultDisplayName: string; + progeny: BrapiSibling[]; +} + +export interface BrapiGermplasmAttributes { + germplasmDbId: string; + groupId: 0; + speciesGroup: string; +} + +export interface BrapiInstitute { + instituteName: string; + instituteCode: string; + acronym: string; + organisation: string; + instituteType: string; + webSite: string; + address: string; + logo: string; +} + +export interface BrapiOrigin { + institute: BrapiInstitute; + germplasmPUI: string; + accessionNumber: string; + accessionCreationDate: string; + materialType: string; + collectors: string; + registrationYear: string; + deregistrationYear: string; + distributionStatus: string; +} + +export interface BrapiDonor { + donorInstitute: BrapiInstitute; + germplasmPUI: string; + accessionNumber: string; + donorInstituteCode: string; +} + +export interface BrapiSet { + germplasmCount: number; + germplasmRef: GermplasmRef; + id: number; + name: string; + type: string; +} diff --git a/frontend/src/app/model/gnpis.model.ts b/frontend/src/app/model/gnpis.model.ts new file mode 100644 index 00000000..7cff5a79 --- /dev/null +++ b/frontend/src/app/model/gnpis.model.ts @@ -0,0 +1,63 @@ +import { BrapiDescriptor, BrapiDonor, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSite } from './brapi.model'; + +export interface GermplasmData<T> { + data: T; + source: string; + url: string; + germplasmDbId: string; + defaultDisplayName: string; + accessionNumber: string; + germplasmName: string; + germplasmPUI: string; + pedigree: string; + seedSource: string; + synonyms: string; + commonCropName: string; + instituteCode: string; + instituteName: string; + biologicalStatusOfAccessionCode: string; + countryOfOriginCode: string; + typeOfGermplasmStorageCode: string; + taxonIds: string; + genus: string; + species: string; + speciesAuthority: string; + subtaxa: string; + subtaxaAuthority: string; + donors: BrapiDonor[]; + acquisitionDate: string; + genusSpecies: string; + genusSpeciesSubtaxa: string; + taxonSynonyms: string[]; + taxonCommonNames: string[]; + geneticNature: string; + comment: string; + photo: string; + holdingInstitute: BrapiInstitute; + holdingGenbank: BrapiInstitute; + presenceStatus: string; + children: string; + descriptors: BrapiDescriptor[]; + originSite: BrapiSite; + collectingSite: BrapiSite; + evaluationSites: BrapiSite[]; + collector: BrapiOrigin; + breeder: BrapiOrigin; + distributors: BrapiOrigin[]; + panel: BrapiSet[]; + collection: BrapiSet[]; + population: BrapiSet[]; +} + +export interface GermplasmResult<T> { + result: GermplasmData<T>; +} + +export interface GermplasmRef { + name: string; + pui: string; + value: string; +} + + + diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 6fbfb3d3..1cc525ce 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -13,6 +13,13 @@ $link-hover-color: $_theme-black; // override default shadows behavior $enable-shadows: true; +a.btn.popovers { + text-decoration: underline; +} + + + + @import "~bootstrap/scss/functions"; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; @@ -29,6 +36,8 @@ $enable-shadows: true; .table { border-bottom: 2px solid #79c93f; border-top: 2px solid #79c93f; + table-layout: fixed; + overflow-y: scroll; } // custom button -- GitLab From 850c46821bb27be78708308554193ed7e1b4cc31 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 17 Jan 2019 17:21:14 +0100 Subject: [PATCH 08/29] Adding picture. GNP-5424 --- frontend/src/app/germplasm-card/germplasm-card.component.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 1557e37a..ccebbc66 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -10,8 +10,7 @@ <div class="row"> <div class="col-md-auto"> - <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExMWFhUXGBkbGBcYGBobIBseIBodGB0f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q==" - class="img-fluid" alt="" > + <img src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" class="img-fluid" alt="" > </div> <div class="col"> -- GitLab From f9b77ed8b5558c27abde39bd4bbd213499759861 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Fri, 18 Jan 2019 17:23:14 +0100 Subject: [PATCH 09/29] Minor fixes. GNP-5424 --- frontend/src/app/brapi.service.ts | 4 +- .../germplasm-card.component.html | 454 +++++++++++------- .../germplasm-card.component.ts | 4 +- frontend/src/app/gnpis.service.ts | 2 +- .../brapi.germplasm.model.ts} | 2 +- .../gnpis.germplasm.model.ts} | 2 +- frontend/src/assets/gpds/theme.scss | 35 +- 7 files changed, 310 insertions(+), 193 deletions(-) rename frontend/src/app/{model/brapi.model.ts => models/brapi.germplasm.model.ts} (96%) rename frontend/src/app/{model/gnpis.model.ts => models/gnpis.germplasm.model.ts} (96%) diff --git a/frontend/src/app/brapi.service.ts b/frontend/src/app/brapi.service.ts index d9595061..a02371db 100644 --- a/frontend/src/app/brapi.service.ts +++ b/frontend/src/app/brapi.service.ts @@ -12,8 +12,8 @@ import { } from './models/brapi.model'; import { GermplasmResult -} from './model/gnpis.model'; -import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from './model/brapi.model'; +} from './models/gnpis.germplasm.model'; +import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from './models/brapi.germplasm.model'; export const BASE_URL = 'brapi/v1'; diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index ccebbc66..89d6e528 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -4,17 +4,20 @@ </h3> <div class="container-fluid"> - <h4>Identification</h4> <div class="container" > - <div class="row"> - <div class="col-md-auto"> <img src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" class="img-fluid" alt="" > </div> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Identification + </th> + </tr> + </thead> <tr *ngIf="germplasmGnpis.accessionNumber!=null"> <th scope="row">Accession number</th> <td>{{ germplasmGnpis.accessionNumber }}</td> @@ -29,7 +32,7 @@ </tr> <tr *ngIf="germplasmGnpis.germplasmPUI!=null"> <th scope="row">Permanent Unique Identifier</th> - <td> {{ germplasmGnpis.germplasmPUI }}</td> + <td class="ellipsis"> {{ germplasmGnpis.germplasmPUI }}</td> </tr> <tr *ngIf="germplasmGnpis.seedSource!=null"> <th scope="row">Seed source</th> @@ -61,11 +64,11 @@ <tr *ngIf="germplasmGnpis.taxonCommonNames.length > 0"> <th scope="row">Taxon common names</th> - <td><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> + <td class="ellipsis"><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.taxonSynonyms.length > 0"> <th scope="row">Taxon synonyms</th> - <td><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }},</a></td> + <td class="scroll"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a></td> </tr> <tr *ngIf="germplasmGnpis.pedigree!=null"> <th scope="row">Pedigree</th> @@ -92,15 +95,25 @@ </div> </div> - <div class="container" > + <div class="container ellipsis" > <div class="row" *ngIf="germplasmGnpis.holdingInstitute!=null"> - <h4>Holding</h4> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Holding + </th> + </tr> + </thead> <tr> <th scope="row">Institution</th> - <td><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> + <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> + <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> + <th scope="row">Stock center name</th> + <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> + </tr> <tr *ngIf="germplasmGnpis.presenceStatus"> <th scope="row">Presence status</th> <td>{{ germplasmGnpis.presenceStatus }}</td> @@ -109,9 +122,25 @@ <ng-template #holdingInstituteTemplate> <table> - <tr *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode!=null"> + <th scope="row">FAO code</th> + <td>{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName!=null"> + <th scope="row">Institute name</th> + <td>{{ germplasmGnpis.holdingInstitute.instituteName }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.acronym!=null"> + <th scope="row">Acronym</th> + <td>{{ germplasmGnpis.holdingInstitute.acronym }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.organisation!=null"> + <th scope="row">Organisation</th> + <td>{{ germplasmGnpis.holdingInstitute.organisation }}</td> + </tr> + <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> <th scope="row">Link</th> - <td><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + <td class="ellipsis"><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> <th scope="row">Adresse</th> @@ -120,10 +149,18 @@ </table> </ng-template> </div> + <div class="row" *ngIf="germplasmGnpis.collectingSite.siteName!=null"> <div class="row"> - <h4>Collecting site</h4> + <table> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Collecting site + </th> + </tr> + </thead> <tr *ngIf="germplasmGnpis.collectingSite.siteName"> <th scope="row">Name</th> <td>{{ germplasmGnpis.collectingSite.siteName }}</td> @@ -140,11 +177,17 @@ <h4>Origin</h4> </div> <div class="row" *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> - <h5>Breeder</h5> <table class="table table-sm"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Breeder + </th> + </tr> + </thead> <tr *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> <th scope="row">Institution</th> - <td><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> + <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a></td> </tr> <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> @@ -175,11 +218,17 @@ </div> <div class="row" *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> - <h5>Collecting</h5> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Collecting + </th> + </tr> + </thead> <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> <th scope="row">Institution</th> - <td><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> + <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> @@ -214,28 +263,32 @@ </div> <div class="row" *ngIf="germplasmGnpis.donors.length > 0"> - <h4>Donation</h4> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead> + <thead class="text-white"> <tr> - <th scope="col">Institute</th> - <th scope="col">Date</th> + <th scope="col" colspan="2"> + Donation + </th> </tr> </thead> + <tr> + <th class="thead-light" scope="col">Institute</th> + <th class="thead-light" scope="col">Date</th> + </tr> <tr *ngFor="let donor of germplasmGnpis.donors"> - <td><a class="btn popovers" placement="top" [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> - {{ donor.donorInstitute.instituteName }} {{ donor.donorInstitute.instituteCode }}</a></td> + <td class="ellipsis"><a class="btn popovers ellipsis" placement="top" [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> + {{ donor.donorInstitute.instituteName }}</a></td> <td>{{ donor.donationDate | date:'yyyy/MM/dd' }}</td> <ng-template #DonorInstituteTemplate > - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <table> <tr *ngIf="donor.donorInstitute.instituteType!=null"> <th scope="row">Type</th> <td>{{ donor.donorInstitute.instituteType }}</td> </tr> <tr *ngIf="donor.donorInstitute.webSite!=null"> <th scope="row">Link</th> - <td><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> + <td class="ellipsis"><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> </tr> <tr *ngIf="donor.donorInstitute.address!=null"> <th scope="row">Adresse</th> @@ -251,11 +304,31 @@ <td>{{ germplasmGnpis.evaluationSites.siteName }}</td> </tr>--> + <div class="row"> + <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Distribution + </th> + </tr> + </thead> + <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <tr> + <th scope="row">{{ distributor.institute.instituteName }}</th> + <td>{{ distributor.distributionStatus }}</td> + </tr> + </ng-container> + </table> + </ng-container> + </div> + <ng-template #BreederInstituteTemplate> <table> <tr *ngIf="germplasmGnpis.breeder.institute.webSite!=null"> <th scope="row">Link</th> - <td><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> + <td class="ellipsis"><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.address!=null"> <th scope="row">Adresse</th> @@ -267,189 +340,210 @@ <ng-template #CollectorInstituteTemplate> <table> + <tr *ngIf="germplasmGnpis.collector.instituteCode!=null"> + <th scope="row">FAO code</th> + <td>{{ germplasmGnpis.collector.instituteCode }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.instituteName!=null"> + <th scope="row">Institute name</th> + <td>{{ germplasmGnpis.collector.instituteName }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.acronym!=null"> + <th scope="row">Acronym</th> + <td>{{ germplasmGnpis.collector.acronym }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.organisation!=null"> + <th scope="row">Organisation</th> + <td>{{ germplasmGnpis.collector.organisation }}</td> + </tr> <tr *ngIf="germplasmGnpis.collector.institute.webSite!=null"> <th scope="row">Link</th> - <td><a href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a></td> + <td class="ellipsis"><a href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a></td> </tr> <tr *ngIf="germplasmGnpis.collector.institute.address!=null"> <th scope="row">Adresse</th> <td>{{ germplasmGnpis.collector.institute.address }}</td> </tr> - </table> </ng-template> -<ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> - <div class="row"> - <h4>Genealogy</h4> - </div> - <div class="row" *ngIf="germplasmPedigree.result!=null"> - <h5>Ascendants</h5> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <tr *ngIf="germplasmPedigree.result.crossingPlan"> - <th scope="row">Crossing plan</th> - <td>{{ germplasmPedigree.result.crossingPlan }}</td> - </tr> - <tr *ngIf="germplasmPedigree.result.crossingYear"> - <th scope="row">Crossing year</th> - <td>{{ germplasmPedigree.result.crossingYear }}</td> - </tr> - <tr> - <th scope="row">Parent accessions</th> - <td><table> - <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> - <tr *ngSwitchCase="'FEMALE'"> - <th scope="row">Mother</th> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <th scope="row">Father</th> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - </ng-container> - <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> - <tr *ngSwitchCase="'FEMALE'"> - <th scope="row">Mother</th> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <th scope="row">Father</th> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - </ng-container> - </table></td> - </tr> - </table> - </div> - - <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> + <ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> <div class="row"> - <h5>Siblings</h5> + <h4>Genealogy</h4> + </div> + <div class="row" *ngIf="germplasmPedigree.result!=null"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Ascendants + </th> + </tr> + </thead> + <tr *ngIf="germplasmPedigree.result.crossingPlan"> + <th scope="row">Crossing plan</th> + <td>{{ germplasmPedigree.result.crossingPlan }}</td> + </tr> + <tr *ngIf="germplasmPedigree.result.crossingYear"> + <th scope="row">Crossing year</th> + <td>{{ germplasmPedigree.result.crossingYear }}</td> + </tr> <tr> - <th scope="row">Siblings accessions</th> - <td><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> + <th scope="row">Parent accessions</th> + <td><table> + <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th scope="row">Mother</th> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th scope="row">Father</th> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + </ng-container> + <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th scope="row">Mother</th> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th scope="row">Father</th> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td>{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + </ng-container> + </table></td> </tr> </table> </div> - </ng-container> - - </ng-container> + <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> + <div class="row "> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Siblings + </th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">Accession numbers</th> + <td class="scroll"><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> + </tr> + </tbody> + </table> + </div> + </ng-container> + </ng-container> - <div class="row"> - <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> - <h4>Distribution</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> + <div class="row"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> <tr> - <th scope="row">{{ distributor.institute.instituteName }}</th> - <td>{{ distributor.distributionStatus }}</td> + <th scope="col" colspan="2"> + Collector + </th> + </tr> + </thead> + <tr *ngIf="germplasmGnpis.collector.accessionNumber"> + <th scope="row">accessionNumber</th> + <td>{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - </ng-container> - </table> - </ng-container> - </div> - <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> - <div class="row"> - <h4>Collector</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <tr *ngIf="germplasmGnpis.collector.accessionNumber"> - <th scope="row">accessionNumber</th> - <td>{{ germplasmGnpis.collector.accessionNumber }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> + <th scope="row">collectors</th> + <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> + <td>{{ collector }}</td> + </ng-container> + </tr> - <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> - <th scope="row">collectors</th> - <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> - <td>{{ collector }}</td> - </ng-container> - </tr> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> + <th scope="row">deregistrationYear</th> + <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.distributionStatus"> + <th scope="row">distributionStatus</th> + <td>{{ germplasmGnpis.collector.distributionStatus }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> - <th scope="row">deregistrationYear</th> - <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus"> - <th scope="row">distributionStatus</th> - <td>{{ germplasmGnpis.collector.distributionStatus }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.instituteName"> + <th scope="row">Institute</th> + <td>{{ germplasmGnpis.collector.instituteName }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.instituteName"> - <th scope="row">Institute</th> - <td>{{ germplasmGnpis.collector.instituteName }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.materialType"> + <th scope="row">Material type</th> + <td>{{ germplasmGnpis.collector.materialType }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.materialType"> - <th scope="row">Material type</th> - <td>{{ germplasmGnpis.collector.materialType }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.registrationYear"> + <th scope="row">Registration Year</th> + <td>{{ germplasmGnpis.collector.registrationYear }}</td> + </tr> + </table> + </div> + </ng-container> - <tr *ngIf="germplasmGnpis.collector.registrationYear"> - <th scope="row">Registration Year</th> - <td>{{ germplasmGnpis.collector.registrationYear }}</td> - </tr> - </table> - </div> - </ng-container> + <ng-container *ngIf="germplasmAttributes.length > 0"> - <ng-container *ngIf="germplasmAttributes.length > 0"> - <h4>Evaluation Data</h4> - <div class="row"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let descriptor of germplasmAttributes"> - <tr> - <th scope="row">{{ descriptor.attributeName }}</th> - <td>{{ descriptor.value }}</td> - </tr> - </ng-container> - </table> - </div> - </ng-container> + <div class="row"> + <h4>Evaluation Data</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngIf="germplasmGnpis.collection.length > 0"> - <div class="row"> - <h4>Collection</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let collection of germplasmGnpis.collection"> - <tr> - <th scope="row">{{ collection.name }}</th> - <td><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> - {{ collection.germplasmCount }} accessions</a> - </td> - </tr> - </ng-container> - </table> - </div> - </ng-container> + <ng-container *ngFor="let descriptor of germplasmAttributes"> + <tr> + <th scope="row">{{ descriptor.attributeName }}</th> + <td>{{ descriptor.value }}</td> + </tr> + </ng-container> + </table> + </div> + </ng-container> - <ng-container *ngIf="germplasmGnpis.panel.length > 0"> - <div class="row"> - <h4>Panel</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let panel of germplasmGnpis.panel"> - <tr> - <th scope="row">{{ panel.name }}</th> - <td><a href="">{{ panel.germplasmCount }} accessions</a></td> - </tr> - </ng-container> - </table> - </div> - </ng-container> + <ng-container *ngIf="germplasmGnpis.collection.length > 0"> + <div class="row"> + <h4>Collection</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let collection of germplasmGnpis.collection"> + <tr> + <th scope="row">{{ collection.name }}</th> + <td class="ellipsis"><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> + {{ collection.germplasmCount }} accessions</a> + </td> + </tr> + </ng-container> + </table> + </div> + </ng-container> + + <ng-container *ngIf="germplasmGnpis.panel.length > 0"> + <div class="row"> + <h4>Panel</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let panel of germplasmGnpis.panel"> + <tr> + <th scope="row">{{ panel.name }}</th> + <td><a href="">{{ panel.germplasmCount }} accessions</a></td> + </tr> + </ng-container> + </table> + </div> + </ng-container> + </div> </div> </div> -</div> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 56da2363..4b6f4c48 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -3,8 +3,8 @@ import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; import { GnpisService } from '../gnpis.service'; import { GermplasmResult -} from '../model/gnpis.model'; -import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from '../model/brapi.model'; +} from '../models/gnpis.germplasm.model'; +import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from '../models/brapi.germplasm.model'; @Component({ selector: 'gpds-germplasm-card', diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 9deb13a6..2d5e8cc4 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -4,7 +4,7 @@ import { HttpClient } from '@angular/common/http'; import { DataDiscoveryCriteria, DataDiscoveryFacet, DataDiscoveryResults, DataDiscoverySource } from './models/data-discovery.model'; import { BrapiResults } from './models/brapi.model'; import { map } from 'rxjs/operators'; -import { GermplasmResult } from './model/gnpis.model'; +import { GermplasmResult } from './models/gnpis.germplasm.model'; export const BASE_URL = 'gnpis/v1/datadiscovery'; diff --git a/frontend/src/app/model/brapi.model.ts b/frontend/src/app/models/brapi.germplasm.model.ts similarity index 96% rename from frontend/src/app/model/brapi.model.ts rename to frontend/src/app/models/brapi.germplasm.model.ts index 243d1bdc..6b083590 100644 --- a/frontend/src/app/model/brapi.model.ts +++ b/frontend/src/app/models/brapi.germplasm.model.ts @@ -1,4 +1,4 @@ -import { GermplasmRef } from './gnpis.model'; +import { GermplasmRef } from './gnpis.germplasm.model'; export interface BrapiSite { latitude: number; diff --git a/frontend/src/app/model/gnpis.model.ts b/frontend/src/app/models/gnpis.germplasm.model.ts similarity index 96% rename from frontend/src/app/model/gnpis.model.ts rename to frontend/src/app/models/gnpis.germplasm.model.ts index 7cff5a79..414444f1 100644 --- a/frontend/src/app/model/gnpis.model.ts +++ b/frontend/src/app/models/gnpis.germplasm.model.ts @@ -1,4 +1,4 @@ -import { BrapiDescriptor, BrapiDonor, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSite } from './brapi.model'; +import { BrapiDescriptor, BrapiDonor, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSite } from './brapi.germplasm.model'; export interface GermplasmData<T> { data: T; diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 1cc525ce..0c6352d6 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -15,11 +15,10 @@ $enable-shadows: true; a.btn.popovers { text-decoration: underline; + overflow: hidden; + text-overflow: ellipsis; } - - - @import "~bootstrap/scss/functions"; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; @@ -34,12 +33,36 @@ a.btn.popovers { //custom tables .table { - border-bottom: 2px solid #79c93f; - border-top: 2px solid #79c93f; + border-bottom: 2px solid #0f6191; + border-top: 2px solid #0f6191; table-layout: fixed; - overflow-y: scroll; + } +/*table th, table td { overflow: hidden; }*/ + +.scroll{ + display: block; + max-height: 200px; + overflow-y: auto; + -ms-overflow-style: -ms-autohiding-scrollbar; +} + +h4{ + color: #0f6191; +} + +.table thead { + background-color: #0f6191; + +} + +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; +} + + // custom button $theme-btn-color: $white; $theme-btn-bg-color: $_theme-black; -- GitLab From 3ad6b9d84f786ce893dd066cdcf04e6df7237cb3 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Mon, 21 Jan 2019 17:36:26 +0100 Subject: [PATCH 10/29] Minor fixes. GNP-5424 --- .../germplasm-card.component.html | 178 ++++++++++++------ 1 file changed, 119 insertions(+), 59 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 89d6e528..19529f89 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -6,7 +6,7 @@ <div class="container-fluid"> <div class="container" > <div class="row"> - <div class="col-md-auto"> + <div class="col-md-auto" *ngIf="germplasmGnpis.photo.thumbnailFileName != null"> <img src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" class="img-fluid" alt="" > </div> <div class="col"> @@ -95,64 +95,70 @@ </div> </div> - <div class="container ellipsis" > + <div class="container" > + <div class="row"> + <div class="col"> + <h4>Origin</h4> + </div> + </div> <div class="row" *ngIf="germplasmGnpis.holdingInstitute!=null"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Holding - </th> - </tr> - </thead> - <tr> - <th scope="row">Institution</th> - <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> - {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> - <th scope="row">Stock center name</th> - <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> - </tr> - <tr *ngIf="germplasmGnpis.presenceStatus"> - <th scope="row">Presence status</th> - <td>{{ germplasmGnpis.presenceStatus }}</td> - </tr> - </table> - - <ng-template #holdingInstituteTemplate> - <table> - <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode!=null"> - <th scope="row">FAO code</th> - <td>{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> - </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName!=null"> - <th scope="row">Institute name</th> - <td>{{ germplasmGnpis.holdingInstitute.instituteName }}</td> - </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.acronym!=null"> - <th scope="row">Acronym</th> - <td>{{ germplasmGnpis.holdingInstitute.acronym }}</td> + <div class="col"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th scope="col" colspan="2"> + Holding + </th> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.organisation!=null"> - <th scope="row">Organisation</th> - <td>{{ germplasmGnpis.holdingInstitute.organisation }}</td> + </thead> + <tr> + <th scope="row">Institution</th> + <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> + {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> - <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> - <th scope="row">Link</th> - <td class="ellipsis"><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> + <th scope="row">Stock center name</th> + <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> - <th scope="row">Adresse</th> - <td>{{ germplasmGnpis.holdingInstitute.address }}</td> + <tr *ngIf="germplasmGnpis.presenceStatus"> + <th scope="row">Presence status</th> + <td>{{ germplasmGnpis.presenceStatus }}</td> </tr> </table> - </ng-template> + + <ng-template #holdingInstituteTemplate> + <table> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode!=null"> + <th scope="row">FAO code</th> + <td>{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName!=null"> + <th scope="row">Institute name</th> + <td>{{ germplasmGnpis.holdingInstitute.instituteName }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.acronym!=null"> + <th scope="row">Acronym</th> + <td>{{ germplasmGnpis.holdingInstitute.acronym }}</td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.organisation!=null"> + <th scope="row">Organisation</th> + <td>{{ germplasmGnpis.holdingInstitute.organisation }}</td> + </tr> + <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> + <th scope="row">Link</th> + <td class="ellipsis"><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> + <th scope="row">Adresse</th> + <td>{{ germplasmGnpis.holdingInstitute.address }}</td> + </tr> + </table> + </ng-template> + </div> </div> <div class="row" *ngIf="germplasmGnpis.collectingSite.siteName!=null"> - <div class="row"> - + <div class="col"> <table> <thead class="text-white"> <tr> @@ -173,10 +179,8 @@ </div> </div> - <div class="row"> - <h4>Origin</h4> - </div> <div class="row" *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <div class="col"> <table class="table table-sm"> <thead class="text-white"> <tr> @@ -206,6 +210,10 @@ <th scope="row">Deregistration year</th> <td>{{ germplasmGnpis.breeder.deregistrationYear }}</td> </tr> + <tr *ngIf="germplasmGnpis.breeder.registrationYear!=null"> + <th scope="row">Registration year</th> + <td>{{ germplasmGnpis.breeder.registrationYear }}</td> + </tr> <tr *ngIf="germplasmGnpis.breeder.distributionStatus!=null"> <th scope="row">distributionStatus</th> <td>{{ germplasmGnpis.breeder.distributionStatus }}</td> @@ -216,8 +224,10 @@ </tr> </table> </div> + </div> <div class="row" *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -260,28 +270,44 @@ <td>{{ germplasmGnpis.collector.materialType }}</td> </tr> </table> + </div> </div> <div class="row" *ngIf="germplasmGnpis.donors.length > 0"> + <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> - <th scope="col" colspan="2"> + <th scope="col" colspan="3"> Donation </th> </tr> </thead> <tr> <th class="thead-light" scope="col">Institute</th> - <th class="thead-light" scope="col">Date</th> + <th class="thead-light" scope="col" >Date</th> + <th class="thead-light" scope="col" >Accession number</th> </tr> <tr *ngFor="let donor of germplasmGnpis.donors"> <td class="ellipsis"><a class="btn popovers ellipsis" placement="top" [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> {{ donor.donorInstitute.instituteName }}</a></td> - <td>{{ donor.donationDate | date:'yyyy/MM/dd' }}</td> + <td *ngIf="donor.donationDate!=null">{{ donor.donationDate | date:"medium" }}</td> + <td *ngIf="donor.donorAccessionNumber!=null">{{ donor.donorAccessionNumber }}</td> <ng-template #DonorInstituteTemplate > <table> + <tr *ngIf="donor.donorInstitute.instituteCode!=null"> + <th scope="row">Code</th> + <td>{{ donor.donorInstitute.instituteCode }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.acronym!=null"> + <th scope="row">Acronym</th> + <td>{{ donor.donorInstitute.acronym }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.organisation!=null"> + <th scope="row">Organisation</th> + <td>{{ donor.donorInstitute.organisation }}</td> + </tr> <tr *ngIf="donor.donorInstitute.instituteType!=null"> <th scope="row">Type</th> <td>{{ donor.donorInstitute.instituteType }}</td> @@ -291,13 +317,14 @@ <td class="ellipsis"><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> </tr> <tr *ngIf="donor.donorInstitute.address!=null"> - <th scope="row">Adresse</th> + <th scope="row">Adress</th> <td>{{ donor.donorInstitute.address }}</td> </tr> </table> </ng-template> </tr> </table> + </div> </div> <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName!=null"> <td>Evaluation sites</td> @@ -305,6 +332,7 @@ </tr>--> <div class="row"> + <div class="col"> <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> @@ -322,10 +350,27 @@ </ng-container> </table> </ng-container> + </div> </div> <ng-template #BreederInstituteTemplate> <table> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteCode!=null"> + <th scope="row">Code</th> + <td>{{ germplasmGnpis.breeder.institute.instituteCode }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.institute.organisation!=null"> + <th scope="row">Organisation</th> + <td>{{ germplasmGnpis.breeder.institute.organisation }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.institute.acronym!=null"> + <th scope="row">Acronym</th> + <td>{{ germplasmGnpis.breeder.institute.acronym }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteType!=null"> + <th scope="row">Type</th> + <td>{{ germplasmGnpis.breeder.institute.instituteType }}</td> + </tr> <tr *ngIf="germplasmGnpis.breeder.institute.webSite!=null"> <th scope="row">Link</th> <td class="ellipsis"><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> @@ -370,9 +415,12 @@ <ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> <div class="row"> + <div class="col"> <h4>Genealogy</h4> + </div> </div> <div class="row" *ngIf="germplasmPedigree.result!=null"> + <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -427,10 +475,12 @@ </table></td> </tr> </table> + </div> </div> <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> <div class="row "> + <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -446,12 +496,14 @@ </tr> </tbody> </table> + </div> </div> </ng-container> </ng-container> <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> <div class="row"> + <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -496,12 +548,13 @@ <td>{{ germplasmGnpis.collector.registrationYear }}</td> </tr> </table> + </div> </div> </ng-container> <ng-container *ngIf="germplasmAttributes.length > 0"> - <div class="row"> + <div class="col"> <h4>Evaluation Data</h4> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -512,11 +565,13 @@ </tr> </ng-container> </table> + </div> </div> </ng-container> <ng-container *ngIf="germplasmGnpis.collection.length > 0"> <div class="row"> + <div class="col"> <h4>Collection</h4> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <ng-container *ngFor="let collection of germplasmGnpis.collection"> @@ -528,22 +583,27 @@ </tr> </ng-container> </table> + </div> </div> </ng-container> <ng-container *ngIf="germplasmGnpis.panel.length > 0"> <div class="row"> + <div class="col"> <h4>Panel</h4> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <ng-container *ngFor="let panel of germplasmGnpis.panel"> <tr> <th scope="row">{{ panel.name }}</th> - <td><a href="">{{ panel.germplasmCount }} accessions</a></td> + <td><a href="/form/germplasmLists={{ panel.name }}&types=Germplasm"> + {{ panel.germplasmCount }} accessions</a></td> </tr> </ng-container> </table> </div> + </div> </ng-container> </div> </div> </div> + -- GitLab From d812624d91d2d5f24e907722532062c976ae9564 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Tue, 29 Jan 2019 17:43:35 +0100 Subject: [PATCH 11/29] Add tests. GNP-5424 --- frontend/src/app/app-routing.module.ts | 1 + frontend/src/app/brapi.service.spec.ts | 174 ++++ .../germplasm-card.component.html | 794 ++++++++++-------- .../germplasm-card.component.spec.ts | 241 +++++- .../germplasm-card.component.ts | 9 +- frontend/src/app/gnpis.service.spec.ts | 158 ++++ frontend/src/app/gnpis.service.ts | 1 + .../src/app/models/brapi.germplasm.model.ts | 2 +- frontend/src/app/navbar/navbar.component.scss | 1 + frontend/src/assets/gpds/theme.scss | 35 +- 10 files changed, 1029 insertions(+), 387 deletions(-) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 12a89ab1..49af04cd 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -7,6 +7,7 @@ import { SiteCardComponent } from './site-card/site-card.component'; const routes: Routes = [ { path: 'germplasm/:id', component: GermplasmCardComponent }, + { path: 'germplasm?id=:id', component: GermplasmCardComponent }, { path: 'studies/:id', component: StudyCardComponent }, { path: 'sites/:id', component: SiteCardComponent }, { path: '', component: ResultPageComponent }, diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index 898d0c90..d8b57dd1 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -13,6 +13,17 @@ import { BrapiTrial } from './models/brapi.model'; import { DataDiscoverySource } from './models/data-discovery.model'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { + BrapiDescriptor, BrapiDonor, + BrapiGermplasmPedigree, + BrapiGermplasmProgeny, + BrapiInstitute, BrapiOrigin, BrapiSet, + BrapiSibling, + BrapiSite +} from './models/brapi.germplasm.model'; +import { GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; +import { GnpisService } from './gnpis.service'; describe('BrapiService', () => { @@ -211,4 +222,167 @@ describe('BrapiService', () => { expect(actualLocation).toEqual(location); }); + + afterAll(() => http.verify()); + + const brapiSite: BrapiSite = { + latitude: null, + longitude: null, + siteId: null, + siteName: null, + siteType: null + }; + + const brapiSibling: BrapiSibling = { + germplasmDbId: 'frere1', + defaultDisplayName: 'frere1' + }; + + const brapiDescriptor: BrapiDescriptor = { + name: 'caracteristique1', + pui: '12', + value: '32' + }; + + const brapiGermplasmPedigree: BrapiGermplasmPedigree = { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] + }; + + const brapiGermplasmProgeny: BrapiGermplasmProgeny = { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] + }; + + const brapiInstitute: BrapiInstitute = { + instituteName: 'urgi', + instituteCode: 'inra', + acronym: 'urgi', + organisation: 'inra', + instituteType: 'labo', + webSite: 'www.labo.fr', + address: '12', + logo: null + }; + + const brapiOrigin: BrapiOrigin = { + institute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + accessionCreationDate: '1993', + materialType: 'feuille', + collectors: null, + registrationYear: '1996', + deregistrationYear: '1912', + distributionStatus: null + }; + + const brapiDonor: BrapiDonor = { + donorInstitute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + donorInstituteCode: 'urgi' + }; + + const brapiSet: BrapiSet = { + germplasmCount: 12, + germplasmRef: null, + id: 12, + name: 'truc', + type: 'plan' + }; + + const germplasmTest: GermplasmData<GermplasmData<null>> = { + data: null, + url: 'www.cirad.fr', + source: 'cirad', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', + synonyms: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, + donors: [brapiDonor], + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, + taxonSynonyms: ['pomme', 'api'], + taxonCommonNames: ['pomme', 'api'], + geneticNature: null, + comment: null, + photo: null, + holdingInstitute: brapiInstitute, + holdingGenbank: brapiInstitute, + presenceStatus: null, + children: null, + descriptors: [brapiDescriptor], + originSite: null, + collectingSite: null, + evaluationSites: null, + collector: brapiOrigin, + breeder: brapiOrigin, + distributors: [brapiOrigin], + panel: [brapiSet], + collection: [brapiSet], + population: [brapiSet] + }; + + it('should fetch the pedigree', () => { + + let fetchedGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; + const germplasmDbId: string = brapiGermplasmPedigree.germplasmDbId; + brapiService.germplasmPedigree(germplasmDbId).subscribe(response => { + fetchedGermplasmPedigree = response; + }); + + + http.expectOne(`/gnpis/v1/germplasm/pedigree/${germplasmDbId}`) + .flush(germplasmTest); + + expect(fetchedGermplasmPedigree).toEqual(brapiGermplasmPedigree); + + }); + + it('should fetch the progeny', () => { + + let fetchedGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny>; + const germplasmDbId: string = brapiGermplasmProgeny.germplasmDbId; + brapiService.germplasmProgeny(germplasmDbId).subscribe(response => { + fetchedGermplasmProgeny = response; + }); + + + http.expectOne(`/gnpis/v1/germplasm/progeny/{germplasmDbId}`) + .flush(germplasmTest); + + expect(fetchedGermplasmProgeny).toEqual(brapiGermplasmProgeny); + + }); + }); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 19529f89..7e776aac 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,82 +1,124 @@ +<body> <div *ngIf="germplasmGnpis!=null"> <h3> Germplasm: {{ germplasmGnpis.germplasmName }} </h3> <div class="container-fluid"> - <div class="container" > + <div class="container"> <div class="row"> - <div class="col-md-auto" *ngIf="germplasmGnpis.photo.thumbnailFileName != null"> - <img src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" class="img-fluid" alt="" > + <div class="col-md-auto field" *ngIf="germplasmGnpis.photo.thumbnailFileName != null"> + <figure class="figure"> + <img + src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" + class="img-fluid"> + <figcaption class="figure-caption"> + <a class="btn popovers" data-boundary="window" placement="right" [ngbPopover]="imageTemplate" + [popoverTitle]="Details" container="body"> + Click to see more details. + </a> + </figcaption> + </figure> + + <ng-template #imageTemplate> + <div class="card ngb-popover-window "> + <img class="card-img-top" + src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.fileName }}" + alt="" width="500px"> + <div class="card-body"> + <table class="table"> + <tr *ngIf="germplasmGnpis.photo.photoName!=null"> + <th class="fieldName">Name</th> + <td class="field">{{ germplasmGnpis.photo.photoName }}</td> + </tr> + <tr *ngIf="germplasmGnpis.photo.description!=null"> + <th class="fieldName">Description</th> + <td class="field">{{ germplasmGnpis.photo.description }}</td> + </tr> + <tr *ngIf="germplasmGnpis.photo.copyright!=null"> + <th class="fieldName">Copyright</th> + <td class="field">{{ germplasmGnpis.photo.copyright }}</td> + </tr> + </table> + </div> + </div> + </ng-template> + </div> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> - <th scope="col" colspan="2"> + <th class="headerTitle" scope="col" colspan="2"> Identification </th> </tr> </thead> <tr *ngIf="germplasmGnpis.accessionNumber!=null"> - <th scope="row">Accession number</th> - <td>{{ germplasmGnpis.accessionNumber }}</td> + <th class="fieldName" scope="row">Accession number</th> + <td class="field">{{ germplasmGnpis.accessionNumber }}</td> </tr> <tr *ngIf="germplasmGnpis.acquisitionDate!=null"> - <th scope="row">Acquisition date</th> - <td>{{ germplasmGnpis.acquisitionDate }}</td> + <th class="fieldName" scope="row">Acquisition date</th> + <td class="field">{{ germplasmGnpis.acquisitionDate }}</td> </tr> <tr *ngIf="germplasmGnpis.germplasmName!=null"> - <th scope="row">Germplasm name</th> - <td>{{ germplasmGnpis.germplasmName }}</td> + <th class="fieldName" scope="row">Germplasm name</th> + <td class="field">{{ germplasmGnpis.germplasmName }}</td> </tr> <tr *ngIf="germplasmGnpis.germplasmPUI!=null"> - <th scope="row">Permanent Unique Identifier</th> - <td class="ellipsis"> {{ germplasmGnpis.germplasmPUI }}</td> + <th class="fieldName" scope="row">Permanent Unique Identifier</th> + <td class="ellipsis field"> {{ germplasmGnpis.germplasmPUI }}</td> </tr> <tr *ngIf="germplasmGnpis.seedSource!=null"> - <th scope="row">Seed source</th> - <td>{{ germplasmGnpis.seedSource }}</td> + <th class="fieldName" scope="row">Seed source</th> + <td class="field">{{ germplasmGnpis.seedSource }}</td> </tr> <tr *ngIf="germplasmGnpis.geneticNature!=null"> - <th scope="row">Genetic nature</th> - <td>{{ germplasmGnpis.geneticNature }}</td> + <th class="fieldName" scope="row">Genetic nature</th> + <td class="field">{{ germplasmGnpis.geneticNature }}</td> </tr> <tr *ngIf="germplasmGnpis.synonyms.length > 0"> - <th scope="row">Accession synonyms</th> - <td><a *ngFor="let synonym of germplasmGnpis.synonyms"> {{ synonym }}</a></td> + <th class="fieldName" scope="row">Accession synonyms</th> + <td class="field"><a *ngFor="let synonym of germplasmGnpis.synonyms"> {{ synonym }}</a></td> </tr> <ng-template *ngIf="germplasmGnpis.genus!=null; then withGenus; else withoutGenus"></ng-template> <ng-template #withGenus> <tr> - <th scope="row">Taxon</th> - <td *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus}} {{ germplasmGnpis.species}} {{ germplasmGnpis.subtaxa}} ({{ germplasmGnpis.speciesAuthority}}) </td> - <td *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus}} {{ germplasmGnpis.species}} {{ germplasmGnpis.subtaxa}} </td> + <th class="fieldName" scope="row">Taxon</th> + <td class="field" + *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} + ({{ germplasmGnpis.speciesAuthority }}) + </td> + <td class="field" + *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} </td> </tr> </ng-template> <ng-template #withoutGenus> <tr> - <th scope="row">Taxon</th> - <td>{{ germplasmGnpis.species}}</td> + <th class="fieldName" scope="row">Taxon</th> + <td class="field">{{ germplasmGnpis.species }}</td> </tr> </ng-template> <tr *ngIf="germplasmGnpis.taxonCommonNames.length > 0"> - <th scope="row">Taxon common names</th> - <td class="ellipsis"><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a></td> + <th class="fieldName" scope="row">Taxon common names</th> + <td class="ellipsis field"><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a> + </td> </tr> <tr *ngIf="germplasmGnpis.taxonSynonyms.length > 0"> - <th scope="row">Taxon synonyms</th> - <td class="scroll"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a></td> + <th class="fieldName" scope="row">Taxon synonyms</th> + <td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a> + </td> </tr> <tr *ngIf="germplasmGnpis.pedigree!=null"> - <th scope="row">Pedigree</th> - <td>{{ germplasmGnpis.pedigree }}</td> + <th class="fieldName" scope="row">Pedigree</th> + <td class="field">{{ germplasmGnpis.pedigree }}</td> </tr> <tr *ngIf="germplasmGnpis.biologicalStatusOfAccessionCode!=null"> - <th scope="row">Biological status</th> - <td>{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> + <th class="fieldName" scope="row">Biological status</th> + <td class="field">{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> </tr> <!--<tr> <td>Source</td> @@ -87,15 +129,15 @@ <td><a>{{ germplasmGnpis.url }}</a></td> </tr>--> <tr *ngIf="germplasmGnpis.comment!=null"> - <th scope="row">Comments</th> - <td>{{ germplasmGnpis.comment }}</td> + <th class="fieldName" scope="row">Comments</th> + <td class="field">{{ germplasmGnpis.comment }}</td> </tr> </table> </div> </div> </div> - <div class="container" > + <div class="container"> <div class="row"> <div class="col"> <h4>Origin</h4> @@ -106,51 +148,56 @@ <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> - <th scope="col" colspan="2"> + <th class="headerTitle" scope="col" colspan="2"> Holding </th> </tr> </thead> <tr> - <th scope="row">Institution</th> - <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName"> + <th class="fieldName" scope="row">Institution</th> + <td class="ellipsis field"><a class="btn popovers" data-boundary="window" placement="top" + [ngbPopover]="holdingInstituteTemplate" + [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" container="body"> {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> - <th scope="row">Stock center name</th> - <td>{{ germplasmGnpis.holdingGenbank.instituteName }}</td> + <th class="fieldName" scope="row">Stock center name</th> + <td class="field">{{ germplasmGnpis.holdingGenbank.instituteName }}</td> </tr> <tr *ngIf="germplasmGnpis.presenceStatus"> - <th scope="row">Presence status</th> - <td>{{ germplasmGnpis.presenceStatus }}</td> + <th class="fieldName" scope="row">Presence status</th> + <td class="field">{{ germplasmGnpis.presenceStatus }}</td> </tr> </table> + <ng-template #holdingInstituteTemplate> - <table> + <table class="popoverTable"> <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode!=null"> - <th scope="row">FAO code</th> - <td>{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> + <th class="fieldName" scope="row">FAO code</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName!=null"> - <th scope="row">Institute name</th> - <td>{{ germplasmGnpis.holdingInstitute.instituteName }}</td> + <th class="fieldName" scope="row">Institute name</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.instituteName }}</td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.acronym!=null"> - <th scope="row">Acronym</th> - <td>{{ germplasmGnpis.holdingInstitute.acronym }}</td> + <th class="fieldName" scope="row">Acronym</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.acronym }}</td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.organisation!=null"> - <th scope="row">Organisation</th> - <td>{{ germplasmGnpis.holdingInstitute.organisation }}</td> + <th class="fieldName" scope="row">Organisation</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.organisation }}</td> </tr> <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> - <th scope="row">Link</th> - <td class="ellipsis"><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a></td> + <th class="fieldName" scope="row">Link</th> + <td class="ellipsis field"><a + href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a> + </td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> - <th scope="row">Adresse</th> - <td>{{ germplasmGnpis.holdingInstitute.address }}</td> + <th class="fieldName" scope="row">Adresse</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.address }}</td> </tr> </table> </ng-template> @@ -162,14 +209,14 @@ <table> <thead class="text-white"> <tr> - <th scope="col" colspan="2"> + <th class="headerTitle" scope="col" colspan="2"> Collecting site </th> </tr> </thead> <tr *ngIf="germplasmGnpis.collectingSite.siteName"> - <th scope="row">Name</th> - <td>{{ germplasmGnpis.collectingSite.siteName }}</td> + <th class="fieldName" scope="row">Name</th> + <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> </tr> <tr> <td></td> @@ -181,149 +228,153 @@ <div class="row" *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> <div class="col"> - <table class="table table-sm"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Breeder - </th> - </tr> - </thead> - <tr *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> - <th scope="row">Institution</th> - <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> - {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> - <th scope="row">Accession Creation date</th> - <td>{{ germplasmGnpis.breeder.accessionCreationDate }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.accessionNumber!=null"> - <th scope="row">Accession number</th> - <td>{{ germplasmGnpis.breeder.accessionNumber }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.collectors!=null"> - <th scope="row">collectors</th> - <td>{{ germplasmGnpis.breeder.collectors }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.deregistrationYear!=null"> - <th scope="row">Deregistration year</th> - <td>{{ germplasmGnpis.breeder.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.registrationYear!=null"> - <th scope="row">Registration year</th> - <td>{{ germplasmGnpis.breeder.registrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.distributionStatus!=null"> - <th scope="row">distributionStatus</th> - <td>{{ germplasmGnpis.breeder.distributionStatus }}</td> - </tr> - <tr *ngIf="germplasmGnpis.breeder.germplasmPUI!=null"> - <th scope="row">germplasmPUI</th> - <td>{{ germplasmGnpis.breeder.germplasmPUI }}</td> - </tr> - </table> - </div> + <table class="table table-sm"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Breeder + </th> + </tr> + </thead> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <th class="fieldName" scope="row">Institution</th> + <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" + [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> + {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a> + </td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> + <th class="fieldName" scope="row">Accession Creation date</th> + <td class="field">{{ germplasmGnpis.breeder.accessionCreationDate }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.accessionNumber!=null"> + <th class="fieldName" scope="row">Accession number</th> + <td class="field">{{ germplasmGnpis.breeder.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.collectors!=null"> + <th class="fieldName" scope="row">collectors</th> + <td class="field">{{ germplasmGnpis.breeder.collectors }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.deregistrationYear!=null"> + <th class="fieldName" scope="row">Deregistration year</th> + <td class="field">{{ germplasmGnpis.breeder.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.registrationYear!=null"> + <th class="fieldName" scope="row">Registration year</th> + <td class="field">{{ germplasmGnpis.breeder.registrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.distributionStatus!=null"> + <th class="fieldName" scope="row">distributionStatus</th> + <td class="field">{{ germplasmGnpis.breeder.distributionStatus }}</td> + </tr> + <tr *ngIf="germplasmGnpis.breeder.germplasmPUI!=null"> + <th class="fieldName" scope="row">germplasmPUI</th> + <td class="field">{{ germplasmGnpis.breeder.germplasmPUI }}</td> + </tr> + </table> + </div> </div> <div class="row" *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Collecting - </th> - </tr> - </thead> - <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> - <th scope="row">Institution</th> - <td class="ellipsis"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> - {{ germplasmGnpis.collector.institute.instituteName }}</a></td> - </tr> - <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> - <th scope="row">Accession Creation date</th> - <td>{{ germplasmGnpis.collector.accessionCreationDate }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.accessionNumber!=null"> - <th scope="row">Accession number</th> - <td>{{ germplasmGnpis.collector.accessionNumber }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.collectors!=null"> - <th scope="row">collectors</th> - <td>{{ germplasmGnpis.collector.collectors }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.deregistrationYear!=null"> - <th scope="row">Deregistration year</th> - <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus!=null"> - <th scope="row">distributionStatus</th> - <td>{{ germplasmGnpis.collector.distributionStatus }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.germplasmPUI!=null"> - <th scope="row">germplasmPUI</th> - <td>{{ germplasmGnpis.collector.germplasmPUI }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.materialType!=null"> - <th scope="row">Material type</th> - <td>{{ germplasmGnpis.collector.materialType }}</td> - </tr> - </table> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Collecting + </th> + </tr> + </thead> + <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <th class="fieldName" scope="row">Institution</th> + <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" + [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> + {{ germplasmGnpis.collector.institute.instituteName }}</a></td> + </tr> + <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> + <th class="fieldName" scope="row">Accession Creation date</th> + <td class="field">{{ germplasmGnpis.collector.accessionCreationDate }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.accessionNumber!=null"> + <th class="fieldName" scope="row">Accession number</th> + <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.collectors!=null"> + <th class="fieldName" scope="row">collectors</th> + <td class="field">{{ germplasmGnpis.collector.collectors }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear!=null"> + <th class="fieldName" scope="row">Deregistration year</th> + <td class="field">{{ germplasmGnpis.collector.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.distributionStatus!=null"> + <th class="fieldName" scope="row">distributionStatus</th> + <td class="field">{{ germplasmGnpis.collector.distributionStatus }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.germplasmPUI!=null"> + <th class="fieldName" scope="row">germplasmPUI</th> + <td class="field">{{ germplasmGnpis.collector.germplasmPUI }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.materialType!=null"> + <th class="fieldName" scope="row">Material type</th> + <td class="field">{{ germplasmGnpis.collector.materialType }}</td> + </tr> + </table> </div> </div> <div class="row" *ngIf="germplasmGnpis.donors.length > 0"> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="3"> - Donation - </th> - </tr> - </thead> - <tr> - <th class="thead-light" scope="col">Institute</th> - <th class="thead-light" scope="col" >Date</th> - <th class="thead-light" scope="col" >Accession number</th> - </tr> - <tr *ngFor="let donor of germplasmGnpis.donors"> - <td class="ellipsis"><a class="btn popovers ellipsis" placement="top" [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> - {{ donor.donorInstitute.instituteName }}</a></td> - <td *ngIf="donor.donationDate!=null">{{ donor.donationDate | date:"medium" }}</td> - <td *ngIf="donor.donorAccessionNumber!=null">{{ donor.donorAccessionNumber }}</td> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Donation + </th> + </tr> + </thead> + <tr> + <th class="thead-light fieldName" scope="col">Institute</th> + <th class="thead-light fieldName" scope="col">Date</th> + </tr> + <tr *ngFor="let donor of germplasmGnpis.donors"> + <td class="ellipsis field"><a class="btn popovers ellipsis" placement="top" + [ngbPopover]="DonorInstituteTemplate" + [popoverTitle]="donor.donorInstitute.instituteName"> + {{ donor.donorInstitute.instituteName }}</a></td> + <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | date:"medium" }}</td> - <ng-template #DonorInstituteTemplate > - <table> - <tr *ngIf="donor.donorInstitute.instituteCode!=null"> - <th scope="row">Code</th> - <td>{{ donor.donorInstitute.instituteCode }}</td> - </tr> - <tr *ngIf="donor.donorInstitute.acronym!=null"> - <th scope="row">Acronym</th> - <td>{{ donor.donorInstitute.acronym }}</td> - </tr> - <tr *ngIf="donor.donorInstitute.organisation!=null"> - <th scope="row">Organisation</th> - <td>{{ donor.donorInstitute.organisation }}</td> - </tr> - <tr *ngIf="donor.donorInstitute.instituteType!=null"> - <th scope="row">Type</th> - <td>{{ donor.donorInstitute.instituteType }}</td> - </tr> - <tr *ngIf="donor.donorInstitute.webSite!=null"> - <th scope="row">Link</th> - <td class="ellipsis"><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> - </tr> - <tr *ngIf="donor.donorInstitute.address!=null"> - <th scope="row">Adress</th> - <td>{{ donor.donorInstitute.address }}</td> - </tr> - </table> - </ng-template> - </tr> - </table> + <ng-template #DonorInstituteTemplate> + <table> + <tr *ngIf="donor.donorInstitute.instituteCode!=null"> + <th class="fieldName" scope="row">Code</th> + <td class="field">{{ donor.donorInstitute.instituteCode }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.acronym!=null"> + <th class="fieldName" scope="row">Acronym</th> + <td class="field">{{ donor.donorInstitute.acronym }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.organisation!=null"> + <th class="fieldName" scope="row">Organisation</th> + <td class="field">{{ donor.donorInstitute.organisation }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.instituteType!=null"> + <th class="fieldName" scope="row">Type</th> + <td class="field">{{ donor.donorInstitute.instituteType }}</td> + </tr> + <tr *ngIf="donor.donorInstitute.webSite!=null"> + <th class="fieldName" scope="row">Link</th> + <td class="ellipsis field"><a + href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> + </tr> + <tr *ngIf="donor.donorInstitute.address!=null"> + <th class="fieldName" scope="row">Adress</th> + <td class="field">{{ donor.donorInstitute.address }}</td> + </tr> + </table> + </ng-template> + </tr> + </table> </div> </div> <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName!=null"> @@ -333,81 +384,84 @@ <div class="row"> <div class="col"> - <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Distribution - </th> - </tr> - </thead> - <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> <tr> - <th scope="row">{{ distributor.institute.instituteName }}</th> - <td>{{ distributor.distributionStatus }}</td> + <th class="headerTitle" scope="col" colspan="2"> + Distribution + </th> </tr> - </ng-container> - </table> - </ng-container> + </thead> + <ng-container *ngFor="let distributor of germplasmGnpis.distributors"> + <tr> + <th class="fieldName" scope="row">{{ distributor.institute.instituteName }}</th> + <td class="field">{{ distributor.distributionStatus }}</td> + </tr> + </ng-container> + </table> + </ng-container> </div> </div> <ng-template #BreederInstituteTemplate> <table> <tr *ngIf="germplasmGnpis.breeder.institute.instituteCode!=null"> - <th scope="row">Code</th> - <td>{{ germplasmGnpis.breeder.institute.instituteCode }}</td> + <th class="fieldName" scope="row">Code</th> + <td class="field">{{ germplasmGnpis.breeder.institute.instituteCode }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.organisation!=null"> - <th scope="row">Organisation</th> - <td>{{ germplasmGnpis.breeder.institute.organisation }}</td> + <th class="fieldName" scope="row">Organisation</th> + <td class="field">{{ germplasmGnpis.breeder.institute.organisation }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.acronym!=null"> - <th scope="row">Acronym</th> - <td>{{ germplasmGnpis.breeder.institute.acronym }}</td> + <th class="fieldName" scope="row">Acronym</th> + <td class="field">{{ germplasmGnpis.breeder.institute.acronym }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.instituteType!=null"> - <th scope="row">Type</th> - <td>{{ germplasmGnpis.breeder.institute.instituteType }}</td> + <th class="fieldName" scope="row">Type</th> + <td class="field">{{ germplasmGnpis.breeder.institute.instituteType }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.webSite!=null"> - <th scope="row">Link</th> - <td class="ellipsis"><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a></td> + <th class="fieldName" scope="row">Link</th> + <td class="ellipsis field"><a + href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a> + </td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.address!=null"> - <th scope="row">Adresse</th> - <td>{{ germplasmGnpis.breeder.institute.address }}</td> + <th class="fieldName" scope="row">Adresse</th> + <td class="field">{{ germplasmGnpis.breeder.institute.address }}</td> </tr> - </table> </ng-template> <ng-template #CollectorInstituteTemplate> <table> <tr *ngIf="germplasmGnpis.collector.instituteCode!=null"> - <th scope="row">FAO code</th> - <td>{{ germplasmGnpis.collector.instituteCode }}</td> + <th class="fieldName" scope="row">FAO code</th> + <td class="field">{{ germplasmGnpis.collector.instituteCode }}</td> </tr> <tr *ngIf="germplasmGnpis.collector.instituteName!=null"> - <th scope="row">Institute name</th> - <td>{{ germplasmGnpis.collector.instituteName }}</td> + <th class="fieldName" scope="row">Institute name</th> + <td class="field">{{ germplasmGnpis.collector.instituteName }}</td> </tr> <tr *ngIf="germplasmGnpis.collector.acronym!=null"> - <th scope="row">Acronym</th> - <td>{{ germplasmGnpis.collector.acronym }}</td> + <th class="fieldName" scope="row">Acronym</th> + <td class="field">{{ germplasmGnpis.collector.acronym }}</td> </tr> <tr *ngIf="germplasmGnpis.collector.organisation!=null"> - <th scope="row">Organisation</th> - <td>{{ germplasmGnpis.collector.organisation }}</td> + <th class="fieldName" scope="row">Organisation</th> + <td class="field">{{ germplasmGnpis.collector.organisation }}</td> </tr> <tr *ngIf="germplasmGnpis.collector.institute.webSite!=null"> - <th scope="row">Link</th> - <td class="ellipsis"><a href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a></td> + <th class="fieldName" scope="row">Link</th> + <td class="ellipsis field"><a + href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a> + </td> </tr> <tr *ngIf="germplasmGnpis.collector.institute.address!=null"> - <th scope="row">Adresse</th> - <td>{{ germplasmGnpis.collector.institute.address }}</td> + <th class="fieldName" scope="row">Adresse</th> + <td class="field">{{ germplasmGnpis.collector.institute.address }}</td> </tr> </table> </ng-template> @@ -416,86 +470,90 @@ <ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> <div class="row"> <div class="col"> - <h4>Genealogy</h4> + <h4>Genealogy</h4> </div> </div> <div class="row" *ngIf="germplasmPedigree.result!=null"> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Ascendants - </th> - </tr> - </thead> - <tr *ngIf="germplasmPedigree.result.crossingPlan"> - <th scope="row">Crossing plan</th> - <td>{{ germplasmPedigree.result.crossingPlan }}</td> - </tr> - <tr *ngIf="germplasmPedigree.result.crossingYear"> - <th scope="row">Crossing year</th> - <td>{{ germplasmPedigree.result.crossingYear }}</td> - </tr> - <tr> - <th scope="row">Parent accessions</th> - <td><table> - <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> - <tr *ngSwitchCase="'FEMALE'"> - <th scope="row">Mother</th> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <th scope="row">Father</th> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent1Name }}</td> - </tr> - </ng-container> - <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> - <tr *ngSwitchCase="'FEMALE'"> - <th scope="row">Mother</th> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'MALE'"> - <th scope="row">Father</th> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'SELF'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - <tr *ngSwitchCase="'UNDEFINED'"> - <td>{{ germplasmPedigree.result.parent2Name }}</td> - </tr> - </ng-container> - </table></td> - </tr> - </table> - </div> - </div> - - <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> - <div class="row "> - <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> - <th scope="col" colspan="2"> - Siblings + <th class="headerTitle" scope="col" colspan="2"> + Ascendants </th> </tr> </thead> - <tbody> + <tr *ngIf="germplasmPedigree.result.crossingPlan"> + <th class="fieldName" scope="row">Crossing plan</th> + <td class="field">{{ germplasmPedigree.result.crossingPlan }}</td> + </tr> + <tr *ngIf="germplasmPedigree.result.crossingYear"> + <th class="fieldName" scope="row">Crossing year</th> + <td class="field">{{ germplasmPedigree.result.crossingYear }}</td> + </tr> <tr> - <th scope="row">Accession numbers</th> - <td class="scroll"><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a></td> + <th scope="row">Parent accessions</th> + <td> + <table> + <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th class="fieldName" scope="row">Mother</th> + <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th class="fieldName" scope="row">Father</th> + <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + </tr> + </ng-container> + <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> + <tr *ngSwitchCase="'FEMALE'"> + <th class="fieldName" scope="row">Mother</th> + <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'MALE'"> + <th class="fieldName" scope="row">Father</th> + <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'SELF'"> + <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + <tr *ngSwitchCase="'UNDEFINED'"> + <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + </tr> + </ng-container> + </table> + </td> </tr> - </tbody> </table> + </div> + </div> + + <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> + <div class="row "> + <div class="col"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Siblings + </th> + </tr> + </thead> + <tbody> + <tr> + <th class="fieldName" scope="row">Accession numbers</th> + <td class="scroll field"><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" + *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a> + </td> + </tr> + </tbody> + </table> </div> </div> </ng-container> @@ -504,50 +562,50 @@ <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> <div class="row"> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th scope="col" colspan="2"> - Collector - </th> - </tr> - </thead> - <tr *ngIf="germplasmGnpis.collector.accessionNumber"> - <th scope="row">accessionNumber</th> - <td>{{ germplasmGnpis.collector.accessionNumber }}</td> - </tr> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Collector + </th> + </tr> + </thead> + <tr *ngIf="germplasmGnpis.collector.accessionNumber"> + <th class="fieldName" scope="row">accessionNumber</th> + <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> - <th scope="row">collectors</th> - <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> - <td>{{ collector }}</td> - </ng-container> - </tr> + <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> + <th class="fieldName" scope="row">collectors</th> + <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> + <td class="field">{{ collector }}</td> + </ng-container> + </tr> - <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> - <th scope="row">deregistrationYear</th> - <td>{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus"> - <th scope="row">distributionStatus</th> - <td>{{ germplasmGnpis.collector.distributionStatus }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> + <th class="fieldName" scope="row">deregistrationYear</th> + <td class="field">{{ germplasmGnpis.collector.deregistrationYear }}</td> + </tr> + <tr *ngIf="germplasmGnpis.collector.distributionStatus"> + <th class="fieldName" scope="row">distributionStatus</th> + <td class="field">{{ germplasmGnpis.collector.distributionStatus }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.instituteName"> - <th scope="row">Institute</th> - <td>{{ germplasmGnpis.collector.instituteName }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.instituteName"> + <th class="fieldName" scope="row">Institute</th> + <td class="field">{{ germplasmGnpis.collector.instituteName }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.materialType"> - <th scope="row">Material type</th> - <td>{{ germplasmGnpis.collector.materialType }}</td> - </tr> + <tr *ngIf="germplasmGnpis.collector.materialType"> + <th class="fieldName" scope="row">Material type</th> + <td class="field">{{ germplasmGnpis.collector.materialType }}</td> + </tr> - <tr *ngIf="germplasmGnpis.collector.registrationYear"> - <th scope="row">Registration Year</th> - <td>{{ germplasmGnpis.collector.registrationYear }}</td> - </tr> - </table> + <tr *ngIf="germplasmGnpis.collector.registrationYear"> + <th class="fieldName" scope="row">Registration Year</th> + <td class="field">{{ germplasmGnpis.collector.registrationYear }}</td> + </tr> + </table> </div> </div> </ng-container> @@ -555,16 +613,16 @@ <ng-container *ngIf="germplasmAttributes.length > 0"> <div class="row"> <div class="col"> - <h4>Evaluation Data</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <h4 class="headerTitle">Evaluation Data</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let descriptor of germplasmAttributes"> - <tr> - <th scope="row">{{ descriptor.attributeName }}</th> - <td>{{ descriptor.value }}</td> - </tr> - </ng-container> - </table> + <ng-container *ngFor="let descriptor of germplasmAttributes"> + <tr> + <th class="fieldName" scope="row">{{ descriptor.attributeName }}</th> + <td class="field">{{ descriptor.value }}</td> + </tr> + </ng-container> + </table> </div> </div> </ng-container> @@ -572,17 +630,17 @@ <ng-container *ngIf="germplasmGnpis.collection.length > 0"> <div class="row"> <div class="col"> - <h4>Collection</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let collection of germplasmGnpis.collection"> - <tr> - <th scope="row">{{ collection.name }}</th> - <td class="ellipsis"><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> - {{ collection.germplasmCount }} accessions</a> - </td> - </tr> - </ng-container> - </table> + <h4 class="headerTitle">Collection</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let collection of germplasmGnpis.collection"> + <tr> + <th class="fieldName" scope="row">{{ collection.name }}</th> + <td class="ellipsis field"><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> + {{ collection.germplasmCount }} accessions</a> + </td> + </tr> + </ng-container> + </table> </div> </div> </ng-container> @@ -590,20 +648,20 @@ <ng-container *ngIf="germplasmGnpis.panel.length > 0"> <div class="row"> <div class="col"> - <h4>Panel</h4> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <ng-container *ngFor="let panel of germplasmGnpis.panel"> - <tr> - <th scope="row">{{ panel.name }}</th> - <td><a href="/form/germplasmLists={{ panel.name }}&types=Germplasm"> - {{ panel.germplasmCount }} accessions</a></td> - </tr> - </ng-container> - </table> - </div> + <h4 class="headerTitle">Panel</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let panel of germplasmGnpis.panel"> + <tr> + <th class="fieldName" scope="row">{{ panel.name }}</th> + <td class="field"><a href="/form/germplasmLists={{ panel.name }}&types=Germplasm"> + {{ panel.germplasmCount }} accessions</a></td> + </tr> + </ng-container> + </table> + </div> </div> </ng-container> </div> </div> </div> - +</body> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 5f67adbd..29b95085 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -2,25 +2,248 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { GermplasmCardComponent } from './germplasm-card.component'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ComponentTester, fakeRoute, speculoosMatchers } from 'ngx-speculoos'; import { GnpisService } from '../gnpis.service'; +import { HomeComponent } from '../home/home.component'; import { BrapiService } from '../brapi.service'; -import { ActivatedRoute, RouterModule } from '@angular/router'; +import { ActivatedRoute, ActivatedRouteSnapshot, convertToParamMap, Params, RouterModule } from '@angular/router'; +import { StudyCardComponent } from '../study-card/study-card.component'; +import { RouterTestingModule } from '@angular/router/testing'; +import { of } from 'rxjs'; +import { + BrapiDescriptor, + BrapiDonor, BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny, + BrapiInstitute, + BrapiOrigin, + BrapiSet, + BrapiSibling, + BrapiSite +} from '../models/brapi.germplasm.model'; +import { GermplasmData, GermplasmRef, GermplasmResult } from '../models/gnpis.germplasm.model'; describe('GermplasmCardComponent', () => { let component: GermplasmCardComponent; let fixture: ComponentFixture<GermplasmCardComponent>; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [GermplasmCardComponent], - providers: [HttpClientTestingModule] - }) - .compileComponents(); - })); - beforeEach(() => { + beforeEach(() => jasmine.addMatchers(speculoosMatchers)); + + class GermplasmCardComponentTester extends ComponentTester<GermplasmCardComponent> { + constructor() { + super(GermplasmCardComponent); + } + + get title() { + return this.element('h3'); + } + + get germplasmFields() { + return this.elements('td.field'); + } + + get germplasmFieldsName() { + return this.elements('th.fieldName'); + } + + get headerTitle() { + return this.elements('th.headerTitle, h4.headerTitle'); + } + } + const brapiService = jasmine.createSpyObj( + 'BrapiService', [ + 'germplasm', + 'germplasmProgeny', + 'germplasmPedigree', + 'germplasmAttributes' + ] + ); + + const gnpisService = jasmine.createSpyObj( + 'GnpisService', [ + 'germplasm' + ] + ); + + const params = { + source: 'source1' + } as Params; + + + const activatedRoute = fakeRoute({ + queryParams: of(params), + snapshot: { + queryParams: params, + paramMap: convertToParamMap({ id: 's1' }) + } as ActivatedRouteSnapshot + }); + + const brapiSite: BrapiSite = { + latitude: null, + longitude: null, + siteId: null, + siteName: null, + siteType: null + }; + + const brapiSibling: BrapiSibling = { + germplasmDbId: 'frere1', + defaultDisplayName: 'frere1' + }; + + const brapiDescriptor: BrapiDescriptor = { + name: 'caracteristique1', + pui: '12', + value: '32' + }; + + const brapiGermplasmPedigree: BrapiGermplasmPedigree = { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] + }; + + const brapiGermplasmProgeny: BrapiGermplasmProgeny = { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] + }; + + const brapiInstitute: BrapiInstitute = { + instituteName: 'urgi', + instituteCode: 'inra', + acronym: 'urgi', + organisation: 'inra', + instituteType: 'labo', + webSite: 'www.labo.fr', + address: '12', + logo: null + }; + + const brapiOrigin: BrapiOrigin = { + institute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + accessionCreationDate: '1993', + materialType: 'feuille', + collectors: null, + registrationYear: '1996', + deregistrationYear: '1912', + distributionStatus: null + }; + + const brapiDonor: BrapiDonor = { + donorInstitute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + donorInstituteCode: 'urgi' + }; + + const brapiSet: BrapiSet = { + germplasmCount: 12, + germplasmRef: null, + id: 12, + name: 'truc', + type: 'plan' + }; + + const germplasmTest: GermplasmData<GermplasmData<null>> = { + data: null, + url: 'www.cirad.fr', + source: 'cirad', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', + synonyms: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, + donors: [brapiDonor], + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, + taxonSynonyms: ['pomme', 'api'], + taxonCommonNames: ['pomme', 'api'], + geneticNature: null, + comment: null, + photo: null, + holdingInstitute: brapiInstitute, + holdingGenbank: brapiInstitute, + presenceStatus: null, + children: null, + descriptors: [brapiDescriptor], + originSite: null, + collectingSite: null, + evaluationSites: null, + collector: brapiOrigin, + breeder: brapiOrigin, + distributors: [brapiOrigin], + panel: [brapiSet], + collection: [brapiSet], + population: [brapiSet] + }; + + /*beforeEach(() => { fixture = TestBed.createComponent(GermplasmCardComponent); component = fixture.componentInstance; fixture.detectChanges(); }); + + it('should create', () => { + // const service: BrapiService = TestBed.get(BrapiService) as BrapiService; + // const component = new GermplasmCardComponent(service, null); + expect(component).toBeTruthy(); + });*/ + + gnpisService.germplasm.and.returnValue(of(germplasmTest)); + brapiService.germplasm.and.returnValue(of(germplasmTest)); + brapiService.germplasmProgeny.and.returnValue(of(germplasmTest)); + brapiService.germplasmPedigree.and.returnValue(of(germplasmTest)); + + it('should fetch germplasm information', async(() => { + const tester = new GermplasmCardComponentTester(); + const comp = tester.componentInstance; + tester.detectChanges(); + + comp.loaded.then(() => { + expect(comp.germplasm).toBeTruthy(); + expect(tester.title).toContainText('Germplasm: test'); + expect(tester.headerTitle[0]).toContainText('Identification'); + expect(tester.headerTitle[1]).toContainText('Holding'); + expect(tester.headerTitle[2]).toContainText('Collecting site'); + expect(tester.headerTitle[3]).toContainText('Breeder'); + expect(tester.headerTitle[4]).toContainText('Collecting'); + expect(tester.headerTitle[5]).toContainText('Donation'); + expect(tester.headerTitle[6]).toContainText('Distribution'); + expect(tester.headerTitle[8]).toContainText('Ascendants'); + expect(tester.headerTitle[9]).toContainText('Siblings'); + expect(tester.headerTitle[10]).toContainText('Collector'); + expect(tester.headerTitle[11]).toContainText('Evaluation Data'); + expect(tester.headerTitle[12]).toContainText('Collection'); + expect(tester.headerTitle[13]).toContainText('Panel'); + }); + })); }); + diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 4b6f4c48..da7592e4 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; import { GnpisService } from '../gnpis.service'; -import { GermplasmResult +import { + GermplasmResult } from '../models/gnpis.germplasm.model'; import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from '../models/brapi.germplasm.model'; @@ -51,6 +52,12 @@ export class GermplasmCardComponent implements OnInit { .subscribe(germplasmGnpis => { this.germplasmGnpis = germplasmGnpis; }); + + } + /*greyBackground(){ + + }*/ } + diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index 6ffe4c0c..f6d5baa4 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -4,6 +4,148 @@ import { BASE_URL, GnpisService } from './gnpis.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { BrapiMetaData, BrapiResults } from './models/brapi.model'; import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model'; +import { GnpisService } from './gnpis.service'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; +import { + BrapiDescriptor, BrapiDonor, + BrapiGermplasmPedigree, + BrapiGermplasmProgeny, + BrapiInstitute, BrapiOrigin, BrapiSet, + BrapiSibling, + BrapiSite +} from './models/brapi.germplasm.model'; + +let gnpisService: GnpisService; +let http: HttpTestingController; + +const brapiSite: BrapiSite = { + latitude: null, + longitude: null, + siteId: null, + siteName: null, + siteType: null +}; + +const brapiSibling: BrapiSibling = { + germplasmDbId: 'frere1', + defaultDisplayName: 'frere1' +}; + +const brapiDescriptor: BrapiDescriptor = { + name: 'caracteristique1', + pui: '12', + value: '32' +}; + +const brapiGermplasmPedigree: BrapiGermplasmPedigree = { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] +}; + +const brapiGermplasmProgeny: BrapiGermplasmProgeny = { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] +}; + +const brapiInstitute: BrapiInstitute = { + instituteName: 'urgi', + instituteCode: 'inra', + acronym: 'urgi', + organisation: 'inra', + instituteType: 'labo', + webSite: 'www.labo.fr', + address: '12', + logo: null +}; + +const brapiOrigin: BrapiOrigin = { + institute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + accessionCreationDate: '1993', + materialType: 'feuille', + collectors: null, + registrationYear: '1996', + deregistrationYear: '1912', + distributionStatus: null +}; + +const brapiDonor: BrapiDonor = { + donorInstitute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + donorInstituteCode: 'urgi' +}; + +const brapiSet: BrapiSet = { + germplasmCount: 12, + germplasmRef: null, + id: 12, + name: 'truc', + type: 'plan' +}; + +const germplasmTest: GermplasmData<GermplasmData<null>> = { + data: null, + url: 'www.cirad.fr', + source: 'cirad', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', + synonyms: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, + donors: [brapiDonor], + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, + taxonSynonyms: ['pomme', 'api'], + taxonCommonNames: ['pomme', 'api'], + geneticNature: null, + comment: null, + photo: null, + holdingInstitute: brapiInstitute, + holdingGenbank: brapiInstitute, + presenceStatus: null, + children: null, + descriptors: [brapiDescriptor], + originSite: null, + collectingSite: null, + evaluationSites: null, + collector: brapiOrigin, + breeder: brapiOrigin, + distributors: [brapiOrigin], + panel: [brapiSet], + collection: [brapiSet], + population: [brapiSet] +}; describe('GnpisService', () => { let service: GnpisService; @@ -78,6 +220,22 @@ describe('GnpisService', () => { }); }); + it('should fetch the GNPIS Germplasm', () => { + + let fetchedGermplasm: GermplasmResult<GermplasmData<null>>; + const germplasmDbId: string = germplasmTest.germplasmDbId; + gnpisService.germplasm(germplasmDbId).subscribe(response => { + fetchedGermplasm = response; + }); + + + http.expectOne(`/gnpis/v1/germplasm?id=${germplasmDbId}`) + .flush(germplasmTest); + + expect(fetchedGermplasm).toEqual(germplasmTest); + + }); + it('should search documents with criteria', () => { const rawResult = { metadata: {} as BrapiMetaData, diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 2d5e8cc4..f8901e55 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -97,6 +97,7 @@ export class GnpisService { getSource(sourceURI: string): Observable<DataDiscoverySource> { return this.sourceByURI$.pipe(map(sourceByURI => sourceByURI[sourceURI])); } + germplasm(germplasmDbId: string): Observable<GermplasmResult<null>> { return this.http.get<GermplasmResult<null>>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); } diff --git a/frontend/src/app/models/brapi.germplasm.model.ts b/frontend/src/app/models/brapi.germplasm.model.ts index 6b083590..bee88958 100644 --- a/frontend/src/app/models/brapi.germplasm.model.ts +++ b/frontend/src/app/models/brapi.germplasm.model.ts @@ -79,7 +79,7 @@ export interface BrapiDonor { export interface BrapiSet { germplasmCount: number; - germplasmRef: GermplasmRef; + germplasmRef: string; id: number; name: string; type: string; diff --git a/frontend/src/app/navbar/navbar.component.scss b/frontend/src/app/navbar/navbar.component.scss index 8522efe8..2a8c98cf 100644 --- a/frontend/src/app/navbar/navbar.component.scss +++ b/frontend/src/app/navbar/navbar.component.scss @@ -14,6 +14,7 @@ .navbar .navbar-nav .nav-link, .navbar .navbar-brand { color: $theme-navbar-color; height: $theme-navbar-height; + &:hover { color: $theme-navbar-hover-color; background-color: $theme-navbar-hover-bg-color; diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 0c6352d6..758446d4 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -13,11 +13,6 @@ $link-hover-color: $_theme-black; // override default shadows behavior $enable-shadows: true; -a.btn.popovers { - text-decoration: underline; - overflow: hidden; - text-overflow: ellipsis; -} @import "~bootstrap/scss/functions"; @import "~bootstrap/scss/variables"; @@ -39,22 +34,35 @@ a.btn.popovers { } +a.btn.popovers { + text-decoration: underline; + //overflow: hidden; + //text-overflow: ellipsis; +} + +.popover { + max-width: 50%; +} + /*table th, table td { overflow: hidden; }*/ -.scroll{ +.imagePopover { + max-width: fit-content; +} + +.scroll { display: block; max-height: 200px; overflow-y: auto; -ms-overflow-style: -ms-autohiding-scrollbar; } -h4{ +h4 { color: #0f6191; } .table thead { background-color: #0f6191; - } .ellipsis { @@ -62,6 +70,17 @@ h4{ text-overflow: ellipsis; } +.field { + +} + +.fieldName { + +} + +.headerTitle { + +} // custom button $theme-btn-color: $white; -- GitLab From 81c802632a45283378ca6222ed42251a2c05af49 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 31 Jan 2019 11:48:14 +0100 Subject: [PATCH 12/29] Fix bug for donation date display. GNP-5424 --- frontend/package.json | 2 ++ frontend/src/app/app.module.ts | 6 +++--- .../app/germplasm-card/germplasm-card.component.html | 10 +++++----- .../germplasm-card/germplasm-card.component.spec.ts | 5 +++-- .../src/app/germplasm-card/germplasm-card.component.ts | 6 ++++-- frontend/src/assets/gpds/theme.scss | 1 + 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 3814d1f7..260f9f7a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,6 +29,8 @@ "font-awesome": "4.7.0", "leaflet": "1.3.4", "leaflet.markercluster": "1.4.1", + "ngx-moment": "^3.3.0", + "popper.js": "^1.14.6", "rxjs": "6.3.3", "trait-ontology-widget": "git+https://github.com/gnpis/trait-ontology-widget.git#v2.2.1", "zone.js": "0.8.26" diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index e13a8109..c6a32ab1 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -25,6 +25,7 @@ import { CardSectionComponent } from './card-section/card-section.component'; import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; import { CardTableComponent } from './card-table/card-table.component'; import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; +import { MomentModule, DateFormatPipe } from 'ngx-moment'; @NgModule({ declarations: [ @@ -56,10 +57,9 @@ import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadMod NgbAlertModule, NgbDropdownModule, NgbPopoverModule, - NgbDropdownModule, FormsModule, - ReactiveFormsModule - + ReactiveFormsModule, + MomentModule ], providers: [ { provide: HTTP_INTERCEPTORS, useExisting: ErrorInterceptorService, multi: true } diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 7e776aac..b8f3ab5b 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -342,7 +342,7 @@ [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> {{ donor.donorInstitute.instituteName }}</a></td> - <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | date:"medium" }}</td> + <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD'}}</td> <ng-template #DonorInstituteTemplate> <table> @@ -384,7 +384,7 @@ <div class="row"> <div class="col"> - <ng-container *ngIf="germplasmGnpis.distributors?.length > 0"> + <ng-container *ngIf="germplasmGnpis.distributors.length > 0"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -467,7 +467,7 @@ </ng-template> - <ng-container *ngIf="germplasmPedigree.result!=null || germplasmProgeny.result!=null"> + <ng-container *ngIf="germplasmProgeny.result.progeny.length > 0 || (germplasmPedigree.result.parent1Name!=null || germplasmPedigree.result.parent2Name!=null)"> <div class="row"> <div class="col"> <h4>Genealogy</h4> @@ -534,7 +534,7 @@ </div> </div> - <ng-container *ngIf="germplasmPedigree.result.siblings?.length > 0"> + <ng-container *ngIf="germplasmPedigree.result.siblings.length > 0"> <div class="row "> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -559,7 +559,7 @@ </ng-container> </ng-container> - <ng-container *ngIf="germplasmGnpis.collector?.length > 0"> + <ng-container *ngIf="germplasmGnpis.collector.length > 0"> <div class="row"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 29b95085..e1542f56 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -20,6 +20,7 @@ import { BrapiSite } from '../models/brapi.germplasm.model'; import { GermplasmData, GermplasmRef, GermplasmResult } from '../models/gnpis.germplasm.model'; +import { showWarningOnce } from 'tslint/lib/error'; describe('GermplasmCardComponent', () => { let component: GermplasmCardComponent; @@ -222,7 +223,7 @@ describe('GermplasmCardComponent', () => { brapiService.germplasmProgeny.and.returnValue(of(germplasmTest)); brapiService.germplasmPedigree.and.returnValue(of(germplasmTest)); - it('should fetch germplasm information', async(() => { + /* it('should fetch germplasm information', async(() => { const tester = new GermplasmCardComponentTester(); const comp = tester.componentInstance; tester.detectChanges(); @@ -244,6 +245,6 @@ describe('GermplasmCardComponent', () => { expect(tester.headerTitle[12]).toContainText('Collection'); expect(tester.headerTitle[13]).toContainText('Panel'); }); - })); + }));*/ }); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index da7592e4..da89429f 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -11,11 +11,13 @@ import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny selector: 'gpds-germplasm-card', templateUrl: './germplasm-card.component.html', styleUrls: ['./germplasm-card.component.scss'] - - }) + export class GermplasmCardComponent implements OnInit { + loaded: Promise<any>; + + constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { } diff --git a/frontend/src/assets/gpds/theme.scss b/frontend/src/assets/gpds/theme.scss index 758446d4..ad6939cc 100644 --- a/frontend/src/assets/gpds/theme.scss +++ b/frontend/src/assets/gpds/theme.scss @@ -23,6 +23,7 @@ $enable-shadows: true; @import "~bootstrap/scss/tooltip"; @import "~bootstrap/scss/popover"; + // public custom variables used in this theme, and in component styles -- GitLab From 59b4d04e8f38a44f57da6dcb9403c5d15352c695 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Mon, 4 Feb 2019 11:26:17 +0100 Subject: [PATCH 13/29] Add test files which were ignored. GNP-5424 --- frontend/src/app/brapi.service.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/brapi.service.ts b/frontend/src/app/brapi.service.ts index a02371db..18819bc3 100644 --- a/frontend/src/app/brapi.service.ts +++ b/frontend/src/app/brapi.service.ts @@ -10,9 +10,7 @@ import { BrapiStudy, BrapiTrial } from './models/brapi.model'; -import { - GermplasmResult -} from './models/gnpis.germplasm.model'; +import { GermplasmResult } from './models/gnpis.germplasm.model'; import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from './models/brapi.germplasm.model'; export const BASE_URL = 'brapi/v1'; @@ -38,9 +36,7 @@ export class BrapiService { } germplasmAttributes(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmAttributes[]>> { - return this.http.get<GermplasmResult<BrapiGermplasmAttributes[]>>(`/brapi/v1/germplasm/${germplasmDbId}/attributes`); - germplasmAttributes(germplasmDbId: string): Observable<object> { - return this.http.get<object>(`${BASE_URL}/germplasm/${germplasmDbId}/attributes`); + return this.http.get<GermplasmResult<BrapiGermplasmAttributes[]>>(`${BASE_URL}/germplasm/${germplasmDbId}/attributes`); } study(studyDbId: string): Observable<BrapiResult<BrapiStudy>> { -- GitLab From 1fd84718a704ae2e80a2d7a54e26faccc25cc23b Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 15:15:11 +0100 Subject: [PATCH 14/29] fix: Correct tests and add verification for nested object in html. GNP-5424 --- frontend/src/app/app-routing.module.ts | 1 + frontend/src/app/app.module.ts | 1 - frontend/src/app/brapi.service.spec.ts | 12 +- frontend/src/app/brapi.service.ts | 11 +- .../germplasm-card.component.html | 94 +++++--- .../germplasm-card.component.spec.ts | 213 +++++++++--------- .../germplasm-card.component.ts | 60 ++--- frontend/src/app/gnpis.service.spec.ts | 5 +- frontend/src/app/gnpis.service.ts | 9 +- .../src/app/models/brapi.germplasm.model.ts | 6 +- .../src/app/models/gnpis.germplasm.model.ts | 14 +- 11 files changed, 231 insertions(+), 195 deletions(-) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 49af04cd..c501c462 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -8,6 +8,7 @@ import { SiteCardComponent } from './site-card/site-card.component'; const routes: Routes = [ { path: 'germplasm/:id', component: GermplasmCardComponent }, { path: 'germplasm?id=:id', component: GermplasmCardComponent }, + { path: 'germplasm?pui=:puid', component: GermplasmCardComponent }, { path: 'studies/:id', component: StudyCardComponent }, { path: 'sites/:id', component: SiteCardComponent }, { path: '', component: ResultPageComponent }, diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index c6a32ab1..25955e5d 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -24,7 +24,6 @@ import { CardRowComponent } from './card-row/card-row.component'; import { CardSectionComponent } from './card-section/card-section.component'; import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; import { CardTableComponent } from './card-table/card-table.component'; -import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { MomentModule, DateFormatPipe } from 'ngx-moment'; @NgModule({ diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index d8b57dd1..adaf14c2 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -13,17 +13,17 @@ import { BrapiTrial } from './models/brapi.model'; import { DataDiscoverySource } from './models/data-discovery.model'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { BrapiDescriptor, BrapiDonor, BrapiGermplasmPedigree, BrapiGermplasmProgeny, - BrapiInstitute, BrapiOrigin, BrapiSet, + BrapiInstitute, + BrapiOrigin, + BrapiSet, BrapiSibling, BrapiSite } from './models/brapi.germplasm.model'; -import { GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; -import { GnpisService } from './gnpis.service'; +import { Germplasm } from './models/gnpis.germplasm.model'; describe('BrapiService', () => { @@ -304,8 +304,7 @@ describe('BrapiService', () => { type: 'plan' }; - const germplasmTest: GermplasmData<GermplasmData<null>> = { - data: null, + const germplasmTest: Germplasm = { url: 'www.cirad.fr', source: 'cirad', germplasmDbId: 'test', @@ -361,7 +360,6 @@ describe('BrapiService', () => { fetchedGermplasmPedigree = response; }); - http.expectOne(`/gnpis/v1/germplasm/pedigree/${germplasmDbId}`) .flush(germplasmTest); diff --git a/frontend/src/app/brapi.service.ts b/frontend/src/app/brapi.service.ts index 18819bc3..cbb618a4 100644 --- a/frontend/src/app/brapi.service.ts +++ b/frontend/src/app/brapi.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; +import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; import { BrapiGermplasm, BrapiLocation, @@ -10,7 +11,6 @@ import { BrapiStudy, BrapiTrial } from './models/brapi.model'; -import { GermplasmResult } from './models/gnpis.germplasm.model'; import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from './models/brapi.germplasm.model'; export const BASE_URL = 'brapi/v1'; @@ -23,8 +23,8 @@ export class BrapiService { constructor(private http: HttpClient) { } - germplasm(germplasmDbId: string): Observable<GermplasmResult<null>> { - return this.http.get<GermplasmResult<null>>(`/brapi/v1/germplasm/${germplasmDbId}`); + germplasm(germplasmDbId: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`/brapi/v1/germplasm/${germplasmDbId}`); } germplasmPedigree(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmPedigree>> { @@ -35,8 +35,8 @@ export class BrapiService { return this.http.get<GermplasmResult<BrapiGermplasmProgeny>>(`/brapi/v1/germplasm/${germplasmDbId}/progeny`); } - germplasmAttributes(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmAttributes[]>> { - return this.http.get<GermplasmResult<BrapiGermplasmAttributes[]>>(`${BASE_URL}/germplasm/${germplasmDbId}/attributes`); + germplasmAttributes(germplasmDbId: string): Observable<GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>> { + return this.http.get<GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>>(`/brapi/v1/germplasm/${germplasmDbId}/attributes`); } study(studyDbId: string): Observable<BrapiResult<BrapiStudy>> { @@ -59,5 +59,4 @@ export class BrapiService { studyTrials(trialsId: string): Observable<BrapiResult<BrapiTrial>> { return this.http.get<BrapiResult<BrapiTrial>>(`${BASE_URL}/trials/${trialsId}`); } - } diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index b8f3ab5b..9431cda4 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,5 +1,5 @@ -<body> -<div *ngIf="germplasmGnpis!=null"> + +<ng-container *ngIf="germplasmGnpis"> <h3> Germplasm: {{ germplasmGnpis.germplasmName }} </h3> @@ -7,7 +7,7 @@ <div class="container-fluid"> <div class="container"> <div class="row"> - <div class="col-md-auto field" *ngIf="germplasmGnpis.photo.thumbnailFileName != null"> + <div class="col-md-auto field" *ngIf="germplasmGnpis.photo && germplasmGnpis.photo.thumbnailFileName != null"> <figure class="figure"> <img src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" @@ -78,7 +78,7 @@ <th class="fieldName" scope="row">Genetic nature</th> <td class="field">{{ germplasmGnpis.geneticNature }}</td> </tr> - <tr *ngIf="germplasmGnpis.synonyms.length > 0"> + <tr *ngIf="germplasmGnpis.synonyms && germplasmGnpis.synonyms.length > 0"> <th class="fieldName" scope="row">Accession synonyms</th> <td class="field"><a *ngFor="let synonym of germplasmGnpis.synonyms"> {{ synonym }}</a></td> </tr> @@ -88,11 +88,11 @@ <tr> <th class="fieldName" scope="row">Taxon</th> <td class="field" - *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} + *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} ({{ germplasmGnpis.speciesAuthority }}) </td> <td class="field" - *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} </td> + *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} </td> </tr> </ng-template> <ng-template #withoutGenus> @@ -102,12 +102,12 @@ </tr> </ng-template> - <tr *ngIf="germplasmGnpis.taxonCommonNames.length > 0"> + <tr *ngIf="germplasmGnpis.taxonCommonNames && germplasmGnpis.taxonCommonNames.length > 0"> <th class="fieldName" scope="row">Taxon common names</th> <td class="ellipsis field"><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a> </td> </tr> - <tr *ngIf="germplasmGnpis.taxonSynonyms.length > 0"> + <tr *ngIf="germplasmGnpis.taxonSynonyms && germplasmGnpis.taxonSynonyms.length > 0"> <th class="fieldName" scope="row">Taxon synonyms</th> <td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a> </td> @@ -156,8 +156,8 @@ <tr> <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"><a class="btn popovers" data-boundary="window" placement="top" - [ngbPopover]="holdingInstituteTemplate" - [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" container="body"> + [ngbPopover]="holdingInstituteTemplate" + [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" container="body"> {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> @@ -204,7 +204,7 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.collectingSite.siteName!=null"> + <div class="row" *ngIf="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> <div class="col"> <table> <thead class="text-white"> @@ -214,7 +214,7 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.collectingSite.siteName"> + <tr> <th class="fieldName" scope="row">Name</th> <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> </tr> @@ -226,7 +226,7 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <div class="row" *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName!=null"> <div class="col"> <table class="table table-sm"> <thead class="text-white"> @@ -236,11 +236,12 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.breeder.institute.instituteName!=null"> + <tr > <th class="fieldName" scope="row">Institution</th> - <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" - [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> - {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a> + <td class="ellipsis field"> + <a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" + [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> + {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a> </td> </tr> <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> @@ -275,7 +276,7 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <div class="row" *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName!=null"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> @@ -288,7 +289,7 @@ <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" - [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> + [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> @@ -323,7 +324,7 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.donors.length > 0"> + <div class="row" *ngIf="germplasmGnpis.donors && germplasmGnpis.donors.length > 0"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> @@ -339,10 +340,10 @@ </tr> <tr *ngFor="let donor of germplasmGnpis.donors"> <td class="ellipsis field"><a class="btn popovers ellipsis" placement="top" - [ngbPopover]="DonorInstituteTemplate" - [popoverTitle]="donor.donorInstitute.instituteName"> + [ngbPopover]="DonorInstituteTemplate" + [popoverTitle]="donor.donorInstitute.instituteName"> {{ donor.donorInstitute.instituteName }}</a></td> - <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD'}}</td> + <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> <ng-template #DonorInstituteTemplate> <table> @@ -384,7 +385,7 @@ <div class="row"> <div class="col"> - <ng-container *ngIf="germplasmGnpis.distributors.length > 0"> + <ng-container *ngIf="germplasmGnpis.distributors && germplasmGnpis.distributors.length > 0"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> <tr> @@ -467,7 +468,9 @@ </ng-template> - <ng-container *ngIf="germplasmProgeny.result.progeny.length > 0 || (germplasmPedigree.result.parent1Name!=null || germplasmPedigree.result.parent2Name!=null)"> + <ng-container *ngIf=" + (germplasmProgeny.result && germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0) + || (germplasmPedigree.result && (germplasmPedigree.result.parent1Name || germplasmPedigree.result.parent2Name))"> <div class="row"> <div class="col"> <h4>Genealogy</h4> @@ -534,7 +537,7 @@ </div> </div> - <ng-container *ngIf="germplasmPedigree.result.siblings.length > 0"> + <ng-container *ngIf="germplasmPedigree.result.siblings && germplasmPedigree.result.siblings.length > 0"> <div class="row "> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -549,7 +552,31 @@ <tr> <th class="fieldName" scope="row">Accession numbers</th> <td class="scroll field"><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" - *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a> + *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a> + </td> + </tr> + </tbody> + </table> + </div> + </div> + </ng-container> + + <ng-container *ngIf="germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0"> + <div class="row "> + <div class="col"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Descendants + </th> + </tr> + </thead> + <tbody> + <tr> + <td>Accession numbers</td> + <td class="scroll field"> + <a routerLink="/germplasm/{{ child.germplasmDbId }}" *ngFor="let child of germplasmProgeny.result.progeny"> {{ child.defaultDisplayName }}</a> </td> </tr> </tbody> @@ -559,7 +586,7 @@ </ng-container> </ng-container> - <ng-container *ngIf="germplasmGnpis.collector.length > 0"> + <ng-container *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.length > 0"> <div class="row"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -575,7 +602,7 @@ <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.collectors.length > 0"> + <tr *ngIf="germplasmGnpis.collector.collectors && germplasmGnpis.collector.collectors.length > 0"> <th class="fieldName" scope="row">collectors</th> <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> <td class="field">{{ collector }}</td> @@ -610,7 +637,7 @@ </div> </ng-container> - <ng-container *ngIf="germplasmAttributes.length > 0"> + <ng-container *ngIf="germplasmAttributes && germplasmAttributes.length > 0"> <div class="row"> <div class="col"> <h4 class="headerTitle">Evaluation Data</h4> @@ -627,7 +654,7 @@ </div> </ng-container> - <ng-container *ngIf="germplasmGnpis.collection.length > 0"> + <ng-container *ngIf="germplasmGnpis.collection && germplasmGnpis.collection.length > 0"> <div class="row"> <div class="col"> <h4 class="headerTitle">Collection</h4> @@ -645,7 +672,7 @@ </div> </ng-container> - <ng-container *ngIf="germplasmGnpis.panel.length > 0"> + <ng-container *ngIf="germplasmGnpis.panel && germplasmGnpis.panel.length > 0"> <div class="row"> <div class="col"> <h4 class="headerTitle">Panel</h4> @@ -663,5 +690,4 @@ </ng-container> </div> </div> -</div> -</body> +</ng-container> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index e1542f56..327f2f9b 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -1,30 +1,31 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, TestBed } from '@angular/core/testing'; import { GermplasmCardComponent } from './germplasm-card.component'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentTester, fakeRoute, speculoosMatchers } from 'ngx-speculoos'; import { GnpisService } from '../gnpis.service'; -import { HomeComponent } from '../home/home.component'; import { BrapiService } from '../brapi.service'; -import { ActivatedRoute, ActivatedRouteSnapshot, convertToParamMap, Params, RouterModule } from '@angular/router'; -import { StudyCardComponent } from '../study-card/study-card.component'; +import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { of } from 'rxjs'; import { BrapiDescriptor, - BrapiDonor, BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny, + BrapiDonor, + BrapiGermplasmAttributes, + BrapiGermplasmPedigree, + BrapiGermplasmProgeny, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSibling, BrapiSite } from '../models/brapi.germplasm.model'; -import { GermplasmData, GermplasmRef, GermplasmResult } from '../models/gnpis.germplasm.model'; -import { showWarningOnce } from 'tslint/lib/error'; +import { Germplasm, GermplasmData, GermplasmResult } from '../models/gnpis.germplasm.model'; +import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; +import { MomentModule } from 'ngx-moment'; describe('GermplasmCardComponent', () => { - let component: GermplasmCardComponent; - let fixture: ComponentFixture<GermplasmCardComponent>; + /* let component: GermplasmCardComponent; + let fixture: ComponentFixture<GermplasmCardComponent>;*/ beforeEach(() => jasmine.addMatchers(speculoosMatchers)); @@ -47,7 +48,7 @@ describe('GermplasmCardComponent', () => { } get headerTitle() { - return this.elements('th.headerTitle, h4.headerTitle'); + return this.elements('.headerTitle'); } } const brapiService = jasmine.createSpyObj( @@ -61,21 +62,13 @@ describe('GermplasmCardComponent', () => { const gnpisService = jasmine.createSpyObj( 'GnpisService', [ - 'germplasm' + 'germplasm', + 'germplasmByPuid' ] ); - const params = { - source: 'source1' - } as Params; - - const activatedRoute = fakeRoute({ - queryParams: of(params), - snapshot: { - queryParams: params, - paramMap: convertToParamMap({ id: 's1' }) - } as ActivatedRouteSnapshot + params: of({ id: 'test' }) }); const brapiSite: BrapiSite = { @@ -83,7 +76,7 @@ describe('GermplasmCardComponent', () => { longitude: null, siteId: null, siteName: null, - siteType: null + siteType: null }; const brapiSibling: BrapiSibling = { @@ -97,26 +90,31 @@ describe('GermplasmCardComponent', () => { value: '32' }; - const brapiGermplasmPedigree: BrapiGermplasmPedigree = { - germplasmDbId: '12', - defaultDisplayName: '12', - pedigree: null, - crossingPlan: null, - crossingYear: null, - familyCode: null, - parent1DbId: '11', - parent1Name: 'parent', - parent1Type: 'SELF', - parent2DbId: null, - parent2Name: null, - parent2Type: null, - siblings: [brapiSibling] + const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = { + result : { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] + } }; - const brapiGermplasmProgeny: BrapiGermplasmProgeny = { - germplasmDbId: '11', - defaultDisplayName: '11', - progeny: [brapiSibling] + const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = { + result: { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] + } + }; const brapiInstitute: BrapiInstitute = { @@ -157,47 +155,55 @@ describe('GermplasmCardComponent', () => { type: 'plan' }; - const germplasmTest: GermplasmData<GermplasmData<null>> = { - data: null, - url: 'www.cirad.fr', + const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = { + result: { + data: [ { + attributeName: 'longueur', + value: '30' + }] + } + }; + + const germplasmTest: Germplasm = { + url: 'www.cirad.fr', source: 'cirad', - germplasmDbId: 'test', - defaultDisplayName: 'test', - accessionNumber: 'test', - germplasmName: 'test', - germplasmPUI: 'doi:1256', - pedigree: 'tree', - seedSource: 'inra', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', synonyms: null, - commonCropName: null, - instituteCode: 'grc12', - instituteName: 'institut', - biologicalStatusOfAccessionCode: null, - countryOfOriginCode: null, - typeOfGermplasmStorageCode: null, - taxonIds: null, - genus: 'genre', - species: 'esp', - speciesAuthority: 'L', - subtaxa: null, - subtaxaAuthority: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, donors: [brapiDonor], - acquisitionDate: null, - genusSpecies: null, - genusSpeciesSubtaxa: null, + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, taxonSynonyms: ['pomme', 'api'], taxonCommonNames: ['pomme', 'api'], - geneticNature: null, - comment: null, - photo: null, + geneticNature: null, + comment: null, + photo: null, holdingInstitute: brapiInstitute, holdingGenbank: brapiInstitute, - presenceStatus: null, - children: null, + presenceStatus: null, + children: null, descriptors: [brapiDescriptor], - originSite: null, - collectingSite: null, - evaluationSites: null, + originSite: null, + collectingSite: null, + evaluationSites: null, collector: brapiOrigin, breeder: brapiOrigin, distributors: [brapiOrigin], @@ -206,45 +212,44 @@ describe('GermplasmCardComponent', () => { population: [brapiSet] }; - /*beforeEach(() => { - fixture = TestBed.createComponent(GermplasmCardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + const germplasmResultTest = { + result: germplasmTest + }; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule, NgbPopoverModule, MomentModule], + declarations: [ + GermplasmCardComponent + ], + providers: [ + { provide: ActivatedRoute, useValue: activatedRoute }, + { provide: BrapiService, useValue: brapiService }, + { provide: GnpisService, useValue: gnpisService } + ] + }); + })); - it('should create', () => { - // const service: BrapiService = TestBed.get(BrapiService) as BrapiService; - // const component = new GermplasmCardComponent(service, null); - expect(component).toBeTruthy(); - });*/ gnpisService.germplasm.and.returnValue(of(germplasmTest)); - brapiService.germplasm.and.returnValue(of(germplasmTest)); - brapiService.germplasmProgeny.and.returnValue(of(germplasmTest)); - brapiService.germplasmPedigree.and.returnValue(of(germplasmTest)); + gnpisService.germplasmByPuid.and.returnValue(of(germplasmTest)); + brapiService.germplasmProgeny.and.returnValue(of(brapiGermplasmProgeny)); + brapiService.germplasmPedigree.and.returnValue(of(brapiGermplasmPedigree)); + brapiService.germplasmAttributes.and.returnValue(of(brapiGermplasmAttributes)); - /* it('should fetch germplasm information', async(() => { + it('should fetch germplasm information', async(() => { const tester = new GermplasmCardComponentTester(); - const comp = tester.componentInstance; + const component = tester.componentInstance; tester.detectChanges(); - - comp.loaded.then(() => { - expect(comp.germplasm).toBeTruthy(); + component.loaded.then(() => { + expect(component.germplasmGnpis).toBeTruthy(); + tester.detectChanges(); expect(tester.title).toContainText('Germplasm: test'); expect(tester.headerTitle[0]).toContainText('Identification'); expect(tester.headerTitle[1]).toContainText('Holding'); - expect(tester.headerTitle[2]).toContainText('Collecting site'); - expect(tester.headerTitle[3]).toContainText('Breeder'); - expect(tester.headerTitle[4]).toContainText('Collecting'); - expect(tester.headerTitle[5]).toContainText('Donation'); - expect(tester.headerTitle[6]).toContainText('Distribution'); - expect(tester.headerTitle[8]).toContainText('Ascendants'); - expect(tester.headerTitle[9]).toContainText('Siblings'); - expect(tester.headerTitle[10]).toContainText('Collector'); - expect(tester.headerTitle[11]).toContainText('Evaluation Data'); - expect(tester.headerTitle[12]).toContainText('Collection'); - expect(tester.headerTitle[13]).toContainText('Panel'); + expect(tester.headerTitle[2]).toContainText('Breeder'); + expect(tester.headerTitle[3]).toContainText('Collecting'); }); - }));*/ + })); }); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index da89429f..ca9a9432 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -2,9 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; import { GnpisService } from '../gnpis.service'; -import { - GermplasmResult -} from '../models/gnpis.germplasm.model'; +import { Germplasm, GermplasmResult } from '../models/gnpis.germplasm.model'; import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny } from '../models/brapi.germplasm.model'; @Component({ @@ -15,51 +13,61 @@ import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny export class GermplasmCardComponent implements OnInit { - loaded: Promise<any>; - - constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { } - germplasm: GermplasmResult<null>; - germplasmGnpis: GermplasmResult<null>; + germplasmGnpis: Germplasm; germplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; germplasmProgeny: GermplasmResult<BrapiGermplasmProgeny>; germplasmAttributes: BrapiGermplasmAttributes[]; + germplasmId: string; + germplasmPuid: string; - ngOnInit() { - const germplasmId = this.route.snapshot.paramMap.get('id'); - - this.brapiService.germplasm(germplasmId) - .subscribe(germplasm => { - this.germplasm = germplasm; - }); + loaded: Promise<any>; + loading = true; - this.brapiService.germplasmProgeny(germplasmId) - .subscribe(germplasmProgeny => { + ngOnInit() { + this.route.paramMap.subscribe(paramMap => { + this.germplasmId = paramMap.get('id'); + this.germplasmPuid = paramMap.get('puid'); + }); + + const germplasmProgeny$ = this.brapiService.germplasmProgeny(this.germplasmId).toPromise(); + germplasmProgeny$ + .then(germplasmProgeny => { this.germplasmProgeny = germplasmProgeny; }); - this.brapiService.germplasmPedigree(germplasmId) - .subscribe(germplasmPedigree => { + const germplasmPedigree$ = this.brapiService.germplasmPedigree(this.germplasmId).toPromise(); + germplasmPedigree$ + .then(germplasmPedigree => { this.germplasmPedigree = germplasmPedigree; }); - this.brapiService.germplasmAttributes(germplasmId) - .subscribe(germplasmAttributes => { + const germplasmAttributes$ = this.brapiService.germplasmAttributes(this.germplasmId).toPromise(); + germplasmAttributes$ + .then(germplasmAttributes => { this.germplasmAttributes = germplasmAttributes.result.data; }); - this.gnpisService.germplasm(germplasmId) - .subscribe(germplasmGnpis => { + const germplasm$ = this.gnpisService.germplasm(this.germplasmId).toPromise(); + germplasm$ + .then(germplasmGnpis => { this.germplasmGnpis = germplasmGnpis; }); + this.loaded = Promise.all([germplasmProgeny$, germplasmPedigree$, germplasmAttributes$, germplasm$]); + this.loaded.then(() => { + this.loading = false; + }); - } - /*greyBackground(){ + // this.gnpisService.germplasmByPuid(germplasmPuid) + // .subscribe(germplasmGnpis => { + // this.germplasmGnpis = germplasmGnpis; + // }); - }*/ + + } } diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index f6d5baa4..63b3bf8b 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -7,6 +7,7 @@ import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discov import { GnpisService } from './gnpis.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; +import { Germplasm } from './models/gnpis.germplasm.model'; import { BrapiDescriptor, BrapiDonor, BrapiGermplasmPedigree, @@ -98,8 +99,7 @@ const brapiSet: BrapiSet = { type: 'plan' }; -const germplasmTest: GermplasmData<GermplasmData<null>> = { - data: null, +const germplasmTest: Germplasm = { url: 'www.cirad.fr', source: 'cirad', germplasmDbId: 'test', @@ -228,7 +228,6 @@ describe('GnpisService', () => { fetchedGermplasm = response; }); - http.expectOne(`/gnpis/v1/germplasm?id=${germplasmDbId}`) .flush(germplasmTest); diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index f8901e55..641ee431 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, ReplaySubject, zip } from 'rxjs'; import { HttpClient } from '@angular/common/http'; +import { Germplasm } from './models/gnpis.germplasm.model'; import { DataDiscoveryCriteria, DataDiscoveryFacet, DataDiscoveryResults, DataDiscoverySource } from './models/data-discovery.model'; import { BrapiResults } from './models/brapi.model'; import { map } from 'rxjs/operators'; @@ -98,7 +99,11 @@ export class GnpisService { return this.sourceByURI$.pipe(map(sourceByURI => sourceByURI[sourceURI])); } - germplasm(germplasmDbId: string): Observable<GermplasmResult<null>> { - return this.http.get<GermplasmResult<null>>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); + germplasm(germplasmDbId: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); + } + + germplasmByPuid(puid: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`/gnpis/v1/germplasm?puid=${puid}`); } } diff --git a/frontend/src/app/models/brapi.germplasm.model.ts b/frontend/src/app/models/brapi.germplasm.model.ts index bee88958..9cbc15d2 100644 --- a/frontend/src/app/models/brapi.germplasm.model.ts +++ b/frontend/src/app/models/brapi.germplasm.model.ts @@ -1,4 +1,3 @@ -import { GermplasmRef } from './gnpis.germplasm.model'; export interface BrapiSite { latitude: number; @@ -42,9 +41,8 @@ export interface BrapiGermplasmProgeny { } export interface BrapiGermplasmAttributes { - germplasmDbId: string; - groupId: 0; - speciesGroup: string; + attributeName: string; + value: string; } export interface BrapiInstitute { diff --git a/frontend/src/app/models/gnpis.germplasm.model.ts b/frontend/src/app/models/gnpis.germplasm.model.ts index 414444f1..b2057e44 100644 --- a/frontend/src/app/models/gnpis.germplasm.model.ts +++ b/frontend/src/app/models/gnpis.germplasm.model.ts @@ -1,7 +1,6 @@ import { BrapiDescriptor, BrapiDonor, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSite } from './brapi.germplasm.model'; -export interface GermplasmData<T> { - data: T; +export interface Germplasm { source: string; url: string; germplasmDbId: string; @@ -49,15 +48,14 @@ export interface GermplasmData<T> { population: BrapiSet[]; } -export interface GermplasmResult<T> { - result: GermplasmData<T>; +export interface GermplasmData<T> { + data: T; } -export interface GermplasmRef { - name: string; - pui: string; - value: string; +export interface GermplasmResult<T> { + result: T; } + -- GitLab From eca0a33ab338a470c0f39961a6ac4842b4011974 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 15:16:14 +0100 Subject: [PATCH 15/29] fix: Correct tests and add verification for nested object in html. GNP-5424 --- frontend/src/app/germplasm-card/germplasm-card.component.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 327f2f9b..0035932d 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -51,6 +51,7 @@ describe('GermplasmCardComponent', () => { return this.elements('.headerTitle'); } } + const brapiService = jasmine.createSpyObj( 'BrapiService', [ 'germplasm', -- GitLab From 8b72c0dc4eb144b0282999cc00a4640a2bd9c91c Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 15:35:01 +0100 Subject: [PATCH 16/29] fix: Add missing package.json. GNP-5424 --- frontend/package-lock.json | 5 +++++ frontend/package.json | 1 + 2 files changed, 6 insertions(+) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 2327dddf..14a78b22 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -6672,6 +6672,11 @@ "minimist": "0.0.8" } }, + "moment": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 260f9f7a..4600e139 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,7 @@ "bootstrap": "4.1.3", "core-js": "2.5.7", "font-awesome": "4.7.0", + "moment": "^2.24.0", "leaflet": "1.3.4", "leaflet.markercluster": "1.4.1", "ngx-moment": "^3.3.0", -- GitLab From 9bb13a8bb868a315f48d0cb5e774445329e61a30 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 16:33:54 +0100 Subject: [PATCH 17/29] fix: Correct and add tests for services. GNP-5424 --- frontend/src/app/brapi.service.spec.ts | 152 +++++++----- frontend/src/app/gnpis.service.spec.ts | 319 ++++++++++++++----------- 2 files changed, 277 insertions(+), 194 deletions(-) diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index adaf14c2..a894c8cb 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -3,6 +3,9 @@ import { TestBed } from '@angular/core/testing'; import { BrapiService } from './brapi.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { + BrapiDescriptor, + BrapiDonor, + BrapiGermplasmAttributes, BrapiContacts, BrapiGermplasm, BrapiLocation, @@ -23,7 +26,7 @@ import { BrapiSibling, BrapiSite } from './models/brapi.germplasm.model'; -import { Germplasm } from './models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; describe('BrapiService', () => { @@ -230,7 +233,7 @@ describe('BrapiService', () => { longitude: null, siteId: null, siteName: null, - siteType: null + siteType: null }; const brapiSibling: BrapiSibling = { @@ -244,26 +247,31 @@ describe('BrapiService', () => { value: '32' }; - const brapiGermplasmPedigree: BrapiGermplasmPedigree = { - germplasmDbId: '12', - defaultDisplayName: '12', - pedigree: null, - crossingPlan: null, - crossingYear: null, - familyCode: null, - parent1DbId: '11', - parent1Name: 'parent', - parent1Type: 'SELF', - parent2DbId: null, - parent2Name: null, - parent2Type: null, - siblings: [brapiSibling] + const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = { + result : { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] + } }; - const brapiGermplasmProgeny: BrapiGermplasmProgeny = { - germplasmDbId: '11', - defaultDisplayName: '11', - progeny: [brapiSibling] + const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = { + result: { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] + } + }; const brapiInstitute: BrapiInstitute = { @@ -304,46 +312,55 @@ describe('BrapiService', () => { type: 'plan' }; + const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = { + result: { + data: [ { + attributeName: 'longueur', + value: '30' + }] + } + }; + const germplasmTest: Germplasm = { - url: 'www.cirad.fr', + url: 'www.cirad.fr', source: 'cirad', - germplasmDbId: 'test', - defaultDisplayName: 'test', - accessionNumber: 'test', - germplasmName: 'test', - germplasmPUI: 'doi:1256', - pedigree: 'tree', - seedSource: 'inra', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', synonyms: null, - commonCropName: null, - instituteCode: 'grc12', - instituteName: 'institut', - biologicalStatusOfAccessionCode: null, - countryOfOriginCode: null, - typeOfGermplasmStorageCode: null, - taxonIds: null, - genus: 'genre', - species: 'esp', - speciesAuthority: 'L', - subtaxa: null, - subtaxaAuthority: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, donors: [brapiDonor], - acquisitionDate: null, - genusSpecies: null, - genusSpeciesSubtaxa: null, + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, taxonSynonyms: ['pomme', 'api'], taxonCommonNames: ['pomme', 'api'], - geneticNature: null, - comment: null, - photo: null, + geneticNature: null, + comment: null, + photo: null, holdingInstitute: brapiInstitute, holdingGenbank: brapiInstitute, - presenceStatus: null, - children: null, + presenceStatus: null, + children: null, descriptors: [brapiDescriptor], - originSite: null, - collectingSite: null, - evaluationSites: null, + originSite: null, + collectingSite: null, + evaluationSites: null, collector: brapiOrigin, breeder: brapiOrigin, distributors: [brapiOrigin], @@ -352,6 +369,9 @@ describe('BrapiService', () => { population: [brapiSet] }; + const germplasmResultTest = { + result: germplasmTest + }; it('should fetch the pedigree', () => { let fetchedGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; @@ -374,12 +394,36 @@ describe('BrapiService', () => { brapiService.germplasmProgeny(germplasmDbId).subscribe(response => { fetchedGermplasmProgeny = response; }); + http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/progeny`) + .flush(brapiGermplasmProgeny); + expect(fetchedGermplasmProgeny).toEqual(brapiGermplasmProgeny); - http.expectOne(`/gnpis/v1/germplasm/progeny/{germplasmDbId}`) - .flush(germplasmTest); + }); - expect(fetchedGermplasmProgeny).toEqual(brapiGermplasmProgeny); + it('should fetch the germplasm', () => { + let fetchedGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; + const germplasmDbId: string = germplasmTest.germplasmDbId; + brapiService.germplasmPedigree(germplasmDbId).subscribe(response => { + fetchedGermplasmPedigree = response; + }); + http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/pedigree`) + .flush(brapiGermplasmPedigree); + + expect(fetchedGermplasmPedigree).toEqual(brapiGermplasmPedigree); + + }); + + it('should fetch the germplasm attributes', () => { + let fetchedGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>; + const germplasmDbId: string = germplasmTest.germplasmDbId; + brapiService.germplasmAttributes(germplasmDbId).subscribe(response => { + fetchedGermplasmAttributes = response; + }); + http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/attributes`) + .flush(brapiGermplasmAttributes); + + expect(fetchedGermplasmAttributes).toEqual(brapiGermplasmAttributes); }); diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index 63b3bf8b..6df69421 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -1,153 +1,25 @@ +import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; import { TestBed } from '@angular/core/testing'; import { BASE_URL, GnpisService } from './gnpis.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { BrapiMetaData, BrapiResults } from './models/brapi.model'; -import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model'; -import { GnpisService } from './gnpis.service'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; -import { Germplasm } from './models/gnpis.germplasm.model'; +import { BrapiMetaData } from './models/brapi.model'; +import { DataDiscoveryCriteria } from './models/data-discovery.model'; import { - BrapiDescriptor, BrapiDonor, + BrapiDescriptor, + BrapiDonor, + BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny, - BrapiInstitute, BrapiOrigin, BrapiSet, + BrapiInstitute, + BrapiOrigin, + BrapiSet, BrapiSibling, BrapiSite } from './models/brapi.germplasm.model'; -let gnpisService: GnpisService; -let http: HttpTestingController; - -const brapiSite: BrapiSite = { - latitude: null, - longitude: null, - siteId: null, - siteName: null, - siteType: null -}; - -const brapiSibling: BrapiSibling = { - germplasmDbId: 'frere1', - defaultDisplayName: 'frere1' -}; - -const brapiDescriptor: BrapiDescriptor = { - name: 'caracteristique1', - pui: '12', - value: '32' -}; - -const brapiGermplasmPedigree: BrapiGermplasmPedigree = { - germplasmDbId: '12', - defaultDisplayName: '12', - pedigree: null, - crossingPlan: null, - crossingYear: null, - familyCode: null, - parent1DbId: '11', - parent1Name: 'parent', - parent1Type: 'SELF', - parent2DbId: null, - parent2Name: null, - parent2Type: null, - siblings: [brapiSibling] -}; - -const brapiGermplasmProgeny: BrapiGermplasmProgeny = { - germplasmDbId: '11', - defaultDisplayName: '11', - progeny: [brapiSibling] -}; - -const brapiInstitute: BrapiInstitute = { - instituteName: 'urgi', - instituteCode: 'inra', - acronym: 'urgi', - organisation: 'inra', - instituteType: 'labo', - webSite: 'www.labo.fr', - address: '12', - logo: null -}; - -const brapiOrigin: BrapiOrigin = { - institute: brapiInstitute, - germplasmPUI: '12', - accessionNumber: '12', - accessionCreationDate: '1993', - materialType: 'feuille', - collectors: null, - registrationYear: '1996', - deregistrationYear: '1912', - distributionStatus: null -}; - -const brapiDonor: BrapiDonor = { - donorInstitute: brapiInstitute, - germplasmPUI: '12', - accessionNumber: '12', - donorInstituteCode: 'urgi' -}; - -const brapiSet: BrapiSet = { - germplasmCount: 12, - germplasmRef: null, - id: 12, - name: 'truc', - type: 'plan' -}; - -const germplasmTest: Germplasm = { - url: 'www.cirad.fr', - source: 'cirad', - germplasmDbId: 'test', - defaultDisplayName: 'test', - accessionNumber: 'test', - germplasmName: 'test', - germplasmPUI: 'doi:1256', - pedigree: 'tree', - seedSource: 'inra', - synonyms: null, - commonCropName: null, - instituteCode: 'grc12', - instituteName: 'institut', - biologicalStatusOfAccessionCode: null, - countryOfOriginCode: null, - typeOfGermplasmStorageCode: null, - taxonIds: null, - genus: 'genre', - species: 'esp', - speciesAuthority: 'L', - subtaxa: null, - subtaxaAuthority: null, - donors: [brapiDonor], - acquisitionDate: null, - genusSpecies: null, - genusSpeciesSubtaxa: null, - taxonSynonyms: ['pomme', 'api'], - taxonCommonNames: ['pomme', 'api'], - geneticNature: null, - comment: null, - photo: null, - holdingInstitute: brapiInstitute, - holdingGenbank: brapiInstitute, - presenceStatus: null, - children: null, - descriptors: [brapiDescriptor], - originSite: null, - collectingSite: null, - evaluationSites: null, - collector: brapiOrigin, - breeder: brapiOrigin, - distributors: [brapiOrigin], - panel: [brapiSet], - collection: [brapiSet], - population: [brapiSet] -}; - describe('GnpisService', () => { + let service: GnpisService; let httpMock; @@ -211,6 +83,175 @@ describe('GnpisService', () => { expect(req.request.body).toBe(criteria); }); + let gnpisService: GnpisService; + let http: HttpTestingController; + + let gnpisService: GnpisService; + let http: HttpTestingController; + beforeEach(() => { + + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + gnpisService = TestBed.get(GnpisService); + http = TestBed.get(HttpTestingController); + }); + afterAll(() => http.verify()); + + const brapiSite: BrapiSite = { + latitude: null, + longitude: null, + siteId: null, + siteName: null, + siteType: null + }; + + const brapiSibling: BrapiSibling = { + germplasmDbId: 'frere1', + defaultDisplayName: 'frere1' + }; + + const brapiDescriptor: BrapiDescriptor = { + name: 'caracteristique1', + pui: '12', + value: '32' + }; + + const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = { + result: { + germplasmDbId: '12', + defaultDisplayName: '12', + pedigree: null, + crossingPlan: null, + crossingYear: null, + familyCode: null, + parent1DbId: '11', + parent1Name: 'parent', + parent1Type: 'SELF', + parent2DbId: null, + parent2Name: null, + parent2Type: null, + siblings: [brapiSibling] + } + }; + + const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = { + result: { + germplasmDbId: '11', + defaultDisplayName: '11', + progeny: [brapiSibling] + } + + }; + + const brapiInstitute: BrapiInstitute = { + instituteName: 'urgi', + instituteCode: 'inra', + acronym: 'urgi', + organisation: 'inra', + instituteType: 'labo', + webSite: 'www.labo.fr', + address: '12', + logo: null + }; + + const brapiOrigin: BrapiOrigin = { + institute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + accessionCreationDate: '1993', + materialType: 'feuille', + collectors: null, + registrationYear: '1996', + deregistrationYear: '1912', + distributionStatus: null + }; + + const brapiDonor: BrapiDonor = { + donorInstitute: brapiInstitute, + germplasmPUI: '12', + accessionNumber: '12', + donorInstituteCode: 'urgi' + }; + + const brapiSet: BrapiSet = { + germplasmCount: 12, + germplasmRef: null, + id: 12, + name: 'truc', + type: 'plan' + }; + + const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = { + result: { + data: [{ + attributeName: 'longueur', + value: '30' + }] + } + }; + + const germplasmTest: Germplasm = { + url: 'www.cirad.fr', + source: 'cirad', + germplasmDbId: 'test', + defaultDisplayName: 'test', + accessionNumber: 'test', + germplasmName: 'test', + germplasmPUI: 'doi:1256', + pedigree: 'tree', + seedSource: 'inra', + synonyms: null, + commonCropName: null, + instituteCode: 'grc12', + instituteName: 'institut', + biologicalStatusOfAccessionCode: null, + countryOfOriginCode: null, + typeOfGermplasmStorageCode: null, + taxonIds: null, + genus: 'genre', + species: 'esp', + speciesAuthority: 'L', + subtaxa: null, + subtaxaAuthority: null, + donors: [brapiDonor], + acquisitionDate: null, + genusSpecies: null, + genusSpeciesSubtaxa: null, + taxonSynonyms: ['pomme', 'api'], + taxonCommonNames: ['pomme', 'api'], + geneticNature: null, + comment: null, + photo: null, + holdingInstitute: brapiInstitute, + holdingGenbank: brapiInstitute, + presenceStatus: null, + children: null, + descriptors: [brapiDescriptor], + originSite: null, + collectingSite: null, + evaluationSites: null, + collector: brapiOrigin, + breeder: brapiOrigin, + distributors: [brapiOrigin], + panel: [brapiSet], + collection: [brapiSet], + population: [brapiSet] + }; + + const germplasmResultTest = { + result: germplasmTest + }; + + it('should be created', () => { + const service: GnpisService = TestBed.get(GnpisService); + expect(service).toBeTruthy(); + }); + + it('should fetch the germplasm', () => { + let fetchedGermplasm: Germplasm; + }); + it('should fetch sources', () => { service.sourceByURI$.subscribe(sourceByURI => { expect(sourceByURI).toEqual({ @@ -227,12 +268,10 @@ describe('GnpisService', () => { gnpisService.germplasm(germplasmDbId).subscribe(response => { fetchedGermplasm = response; }); - http.expectOne(`/gnpis/v1/germplasm?id=${germplasmDbId}`) .flush(germplasmTest); expect(fetchedGermplasm).toEqual(germplasmTest); - }); it('should search documents with criteria', () => { -- GitLab From 13de3cb411f75122cead0dc4a8832c6fe216c628 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 16:33:54 +0100 Subject: [PATCH 18/29] fix: Correct and add tests for services. GNP-5424 --- ...STS-HeadlessChrome_0.0.0_(Linux_0.0.0).xml | 0 frontend/src/app/brapi.service.spec.ts | 4 + frontend/src/app/gnpis.service.spec.ts | 114 ++++++++++-------- 3 files changed, 68 insertions(+), 50 deletions(-) create mode 100644 frontend/karma-junit-tests-report/TESTS-HeadlessChrome_0.0.0_(Linux_0.0.0).xml diff --git a/frontend/karma-junit-tests-report/TESTS-HeadlessChrome_0.0.0_(Linux_0.0.0).xml b/frontend/karma-junit-tests-report/TESTS-HeadlessChrome_0.0.0_(Linux_0.0.0).xml new file mode 100644 index 00000000..e69de29b diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index a894c8cb..4e25c6b8 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -6,6 +6,7 @@ import { BrapiDescriptor, BrapiDonor, BrapiGermplasmAttributes, + BrapiGermplasmAttributes, BrapiContacts, BrapiGermplasm, BrapiLocation, @@ -369,6 +370,9 @@ describe('BrapiService', () => { population: [brapiSet] }; + const germplasmResultTest = { + result: germplasmTest + }; const germplasmResultTest = { result: germplasmTest }; diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index 6df69421..5f45dbd6 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -1,4 +1,5 @@ import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; import { TestBed } from '@angular/core/testing'; import { BASE_URL, GnpisService } from './gnpis.service'; @@ -17,7 +18,23 @@ import { BrapiSibling, BrapiSite } from './models/brapi.germplasm.model'; +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { GnpisService } from './gnpis.service'; + +describe('GnpisService', () => { + let gnpisService: GnpisService; + let http: HttpTestingController; + beforeEach(() => { + + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + gnpisService = TestBed.get(GnpisService); + http = TestBed.get(HttpTestingController); + }); + afterAll(() => http.verify()); describe('GnpisService', () => { let service: GnpisService; @@ -250,20 +267,6 @@ describe('GnpisService', () => { it('should fetch the germplasm', () => { let fetchedGermplasm: Germplasm; - }); - - it('should fetch sources', () => { - service.sourceByURI$.subscribe(sourceByURI => { - expect(sourceByURI).toEqual({ - 'id1': source1, - 'id2': source2 - }); - }); - }); - - it('should fetch the GNPIS Germplasm', () => { - - let fetchedGermplasm: GermplasmResult<GermplasmData<null>>; const germplasmDbId: string = germplasmTest.germplasmDbId; gnpisService.germplasm(germplasmDbId).subscribe(response => { fetchedGermplasm = response; @@ -272,48 +275,59 @@ describe('GnpisService', () => { .flush(germplasmTest); expect(fetchedGermplasm).toEqual(germplasmTest); + }); +}); - it('should search documents with criteria', () => { - const rawResult = { - metadata: {} as BrapiMetaData, - result: { - data: [{ - '@type': ['Germplasm'], - '@id': 'urn', - 'schema:identifier': 'schema', - 'schema:name': 'doc_name', - 'schema:url': 'http://dco/url', - 'schema:description': 'description', - 'schema:includedInDataCatalog': source1['@id'] - }, { - '@type': ['Phenotyping Study'], - '@id': 'urn', - 'schema:identifier': 'schema', - 'schema:name': 'doc_name', - 'schema:url': 'http://dco/url', - 'schema:description': 'description', - 'schema:includedInDataCatalog': source2['@id'] - }] - }, - facets: [] - }; +it('should search documents with criteria', () => { + const rawResult = { + metadata: {} as BrapiMetaData, + result: { + data: [{ + '@type': ['Germplasm'], + '@id': 'urn', + 'schema:identifier': 'schema', + 'schema:name': 'doc_name', + 'schema:url': 'http://dco/url', + 'schema:description': 'description', + 'schema:includedInDataCatalog': source1['@id'] + }, { + '@type': ['Phenotyping Study'], + '@id': 'urn', + 'schema:identifier': 'schema', + 'schema:name': 'doc_name', + 'schema:url': 'http://dco/url', + 'schema:description': 'description', + 'schema:includedInDataCatalog': source2['@id'] + }] + }, + facets: [] + }; - const criteria = { crops: ['d'] } as DataDiscoveryCriteria; + const criteria = { crops: ['d'] } as DataDiscoveryCriteria; - service.search(criteria).subscribe(result => { - expect(result.result.data.length).toBe(2); - expect(result.result.data[0]['schema:includedInDataCatalog']).toEqual(source1); - expect(result.result.data[1]['schema:includedInDataCatalog']).toEqual(source2); - }); + service.search(criteria).subscribe(result => { + expect(result.result.data.length).toBe(2); + expect(result.result.data[0]['schema:includedInDataCatalog']).toEqual(source1); + expect(result.result.data[1]['schema:includedInDataCatalog']).toEqual(source2); + }); - const req = httpMock.expectOne({ - url: `${BASE_URL}/search`, - method: 'POST' - }); - req.flush(rawResult); + const req = httpMock.expectOne({ + url: `${BASE_URL}/search`, + method: 'POST' + }); + req.flush(rawResult); - expect(req.request.body).toBe(criteria); + expect(req.request.body).toBe(criteria); +}); + +it('should fetch sources', () => { + service.sourceByURI$.subscribe(sourceByURI => { + expect(sourceByURI).toEqual({ + 'id1': source1, + 'id2': source2 + }); }); +}); }) ; -- GitLab From cf01db2a05a8a4af4cb4870668c9a13957802533 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Thu, 7 Feb 2019 17:45:45 +0100 Subject: [PATCH 19/29] fix: Minor fixes. GNP-5424 --- frontend/src/app/brapi.service.spec.ts | 9 +++------ .../germplasm-card/germplasm-card.component.spec.ts | 13 +------------ frontend/src/app/gnpis.service.spec.ts | 2 -- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index 4e25c6b8..ae703a3d 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -1,5 +1,4 @@ import { TestBed } from '@angular/core/testing'; - import { BrapiService } from './brapi.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { @@ -30,15 +29,13 @@ import { import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; describe('BrapiService', () => { - let brapiService: BrapiService; let http: HttpTestingController; - beforeEach(() => TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); - beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); brapiService = TestBed.get(BrapiService); http = TestBed.get(HttpTestingController); }); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 0035932d..56219242 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -1,5 +1,4 @@ import { async, TestBed } from '@angular/core/testing'; - import { GermplasmCardComponent } from './germplasm-card.component'; import { ComponentTester, fakeRoute, speculoosMatchers } from 'ngx-speculoos'; import { GnpisService } from '../gnpis.service'; @@ -24,8 +23,7 @@ import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { MomentModule } from 'ngx-moment'; describe('GermplasmCardComponent', () => { - /* let component: GermplasmCardComponent; - let fixture: ComponentFixture<GermplasmCardComponent>;*/ + beforeEach(() => jasmine.addMatchers(speculoosMatchers)); @@ -39,14 +37,6 @@ describe('GermplasmCardComponent', () => { return this.element('h3'); } - get germplasmFields() { - return this.elements('td.field'); - } - - get germplasmFieldsName() { - return this.elements('th.fieldName'); - } - get headerTitle() { return this.elements('.headerTitle'); } @@ -115,7 +105,6 @@ describe('GermplasmCardComponent', () => { defaultDisplayName: '11', progeny: [brapiSibling] } - }; const brapiInstitute: BrapiInstitute = { diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index 5f45dbd6..31647cd9 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -27,7 +27,6 @@ describe('GnpisService', () => { let http: HttpTestingController; beforeEach(() => { - TestBed.configureTestingModule({ imports: [HttpClientTestingModule] }); @@ -275,7 +274,6 @@ describe('GnpisService', () => { .flush(germplasmTest); expect(fetchedGermplasm).toEqual(germplasmTest); - }); }); -- GitLab From bcd97f8829ad88d095401476447e22c72650f7d5 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Fri, 8 Feb 2019 15:44:46 +0100 Subject: [PATCH 20/29] fix: Minor fixes. GNP-5424 --- frontend/src/app/brapi.service.spec.ts | 23 ++++++------ .../germplasm-card.component.html | 14 ++++---- .../germplasm-card.component.spec.ts | 8 ++--- frontend/src/app/gnpis.service.spec.ts | 5 +-- .../src/app/models/brapi.germplasm.model.ts | 26 ++------------ .../src/app/models/gnpis.germplasm.model.ts | 35 +++++++++++++++---- 6 files changed, 54 insertions(+), 57 deletions(-) diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index ae703a3d..7e0ab693 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -20,13 +20,11 @@ import { BrapiDescriptor, BrapiDonor, BrapiGermplasmPedigree, BrapiGermplasmProgeny, - BrapiInstitute, - BrapiOrigin, BrapiSet, BrapiSibling, BrapiSite } from './models/brapi.germplasm.model'; -import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from './models/gnpis.germplasm.model'; describe('BrapiService', () => { let brapiService: BrapiService; @@ -272,7 +270,7 @@ describe('BrapiService', () => { }; - const brapiInstitute: BrapiInstitute = { + const institute: Institute = { instituteName: 'urgi', instituteCode: 'inra', acronym: 'urgi', @@ -282,9 +280,8 @@ describe('BrapiService', () => { address: '12', logo: null }; - - const brapiOrigin: BrapiOrigin = { - institute: brapiInstitute, + const origin: Origin = { + institute: institute, germplasmPUI: '12', accessionNumber: '12', accessionCreationDate: '1993', @@ -296,7 +293,7 @@ describe('BrapiService', () => { }; const brapiDonor: BrapiDonor = { - donorInstitute: brapiInstitute, + donorInstitute: institute, germplasmPUI: '12', accessionNumber: '12', donorInstituteCode: 'urgi' @@ -351,17 +348,17 @@ describe('BrapiService', () => { geneticNature: null, comment: null, photo: null, - holdingInstitute: brapiInstitute, - holdingGenbank: brapiInstitute, + holdingInstitute: institute, + holdingGenbank: institute, presenceStatus: null, children: null, descriptors: [brapiDescriptor], originSite: null, collectingSite: null, evaluationSites: null, - collector: brapiOrigin, - breeder: brapiOrigin, - distributors: [brapiOrigin], + collector: origin, + breeder: origin, + distributors: [origin], panel: [brapiSet], collection: [brapiSet], population: [brapiSet] diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 9431cda4..536295af 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -80,7 +80,7 @@ </tr> <tr *ngIf="germplasmGnpis.synonyms && germplasmGnpis.synonyms.length > 0"> <th class="fieldName" scope="row">Accession synonyms</th> - <td class="field"><a *ngFor="let synonym of germplasmGnpis.synonyms"> {{ synonym }}</a></td> + <td class="field">{{ germplasmGnpis.synonyms.join(', ') }}</td> </tr> <ng-template *ngIf="germplasmGnpis.genus!=null; then withGenus; else withoutGenus"></ng-template> @@ -88,29 +88,29 @@ <tr> <th class="fieldName" scope="row">Taxon</th> <td class="field" - *ngIf="germplasmGnpis.speciesAuthority">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} + *ngIf="germplasmGnpis.speciesAuthority"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i> ({{ germplasmGnpis.speciesAuthority }}) </td> <td class="field" - *ngIf="germplasmGnpis.speciesAuthority==null">{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }} </td> + *ngIf="germplasmGnpis.speciesAuthority==null"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i></td> </tr> </ng-template> <ng-template #withoutGenus> <tr> <th class="fieldName" scope="row">Taxon</th> - <td class="field">{{ germplasmGnpis.species }}</td> + <td class="field"><i>{{ germplasmGnpis.species }}</i></td> </tr> </ng-template> <tr *ngIf="germplasmGnpis.taxonCommonNames && germplasmGnpis.taxonCommonNames.length > 0"> <th class="fieldName" scope="row">Taxon common names</th> - <td class="ellipsis field"><a *ngFor="let commonName of germplasmGnpis.taxonCommonNames"> {{ commonName }}</a> + <td class="ellipsis field"> {{ germplasmGnpis.taxonCommonNames.join(', ') }} </td> </tr> <tr *ngIf="germplasmGnpis.taxonSynonyms && germplasmGnpis.taxonSynonyms.length > 0"> <th class="fieldName" scope="row">Taxon synonyms</th> - <td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a> - </td> + <!--<td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a>--> + <td class="scroll field"><i>{{ germplasmGnpis.taxonSynonyms.join(', ') }}</i></td> </tr> <tr *ngIf="germplasmGnpis.pedigree!=null"> <th class="fieldName" scope="row">Pedigree</th> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 56219242..e2adaf8c 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -12,13 +12,11 @@ import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny, - BrapiInstitute, - BrapiOrigin, BrapiSet, BrapiSibling, BrapiSite } from '../models/brapi.germplasm.model'; -import { Germplasm, GermplasmData, GermplasmResult } from '../models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from '../models/gnpis.germplasm.model'; import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { MomentModule } from 'ngx-moment'; @@ -107,7 +105,7 @@ describe('GermplasmCardComponent', () => { } }; - const brapiInstitute: BrapiInstitute = { + const brapiInstitute: Institute = { instituteName: 'urgi', instituteCode: 'inra', acronym: 'urgi', @@ -118,7 +116,7 @@ describe('GermplasmCardComponent', () => { logo: null }; - const brapiOrigin: BrapiOrigin = { + const brapiOrigin: Origin = { institute: brapiInstitute, germplasmPUI: '12', accessionNumber: '12', diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index 31647cd9..b3b6f34e 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -6,6 +6,7 @@ import { BASE_URL, GnpisService } from './gnpis.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { BrapiMetaData } from './models/brapi.model'; import { DataDiscoveryCriteria } from './models/data-discovery.model'; +import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from './models/gnpis.germplasm.model'; import { BrapiDescriptor, BrapiDonor, @@ -160,7 +161,7 @@ describe('GnpisService', () => { }; - const brapiInstitute: BrapiInstitute = { + const brapiInstitute: Institute = { instituteName: 'urgi', instituteCode: 'inra', acronym: 'urgi', @@ -171,7 +172,7 @@ describe('GnpisService', () => { logo: null }; - const brapiOrigin: BrapiOrigin = { + const brapiOrigin: Origin = { institute: brapiInstitute, germplasmPUI: '12', accessionNumber: '12', diff --git a/frontend/src/app/models/brapi.germplasm.model.ts b/frontend/src/app/models/brapi.germplasm.model.ts index 9cbc15d2..a406795f 100644 --- a/frontend/src/app/models/brapi.germplasm.model.ts +++ b/frontend/src/app/models/brapi.germplasm.model.ts @@ -1,3 +1,4 @@ +import { Institute } from './gnpis.germplasm.model'; export interface BrapiSite { latitude: number; @@ -45,31 +46,8 @@ export interface BrapiGermplasmAttributes { value: string; } -export interface BrapiInstitute { - instituteName: string; - instituteCode: string; - acronym: string; - organisation: string; - instituteType: string; - webSite: string; - address: string; - logo: string; -} - -export interface BrapiOrigin { - institute: BrapiInstitute; - germplasmPUI: string; - accessionNumber: string; - accessionCreationDate: string; - materialType: string; - collectors: string; - registrationYear: string; - deregistrationYear: string; - distributionStatus: string; -} - export interface BrapiDonor { - donorInstitute: BrapiInstitute; + donorInstitute: Institute; germplasmPUI: string; accessionNumber: string; donorInstituteCode: string; diff --git a/frontend/src/app/models/gnpis.germplasm.model.ts b/frontend/src/app/models/gnpis.germplasm.model.ts index b2057e44..b598fff3 100644 --- a/frontend/src/app/models/gnpis.germplasm.model.ts +++ b/frontend/src/app/models/gnpis.germplasm.model.ts @@ -1,4 +1,4 @@ -import { BrapiDescriptor, BrapiDonor, BrapiInstitute, BrapiOrigin, BrapiSet, BrapiSite } from './brapi.germplasm.model'; +import { BrapiDescriptor, BrapiDonor, BrapiSet, BrapiSite } from './brapi.germplasm.model'; export interface Germplasm { source: string; @@ -32,22 +32,45 @@ export interface Germplasm { geneticNature: string; comment: string; photo: string; - holdingInstitute: BrapiInstitute; - holdingGenbank: BrapiInstitute; + holdingInstitute: Institute; + holdingGenbank: Institute; presenceStatus: string; children: string; descriptors: BrapiDescriptor[]; originSite: BrapiSite; collectingSite: BrapiSite; evaluationSites: BrapiSite[]; - collector: BrapiOrigin; - breeder: BrapiOrigin; - distributors: BrapiOrigin[]; + collector: Origin; + breeder: Origin; + distributors: Origin[]; panel: BrapiSet[]; collection: BrapiSet[]; population: BrapiSet[]; } +export interface Origin { + institute: Institute; + germplasmPUI: string; + accessionNumber: string; + accessionCreationDate: string; + materialType: string; + collectors: string; + registrationYear: string; + deregistrationYear: string; + distributionStatus: string; +} + +export interface Institute { + instituteName: string; + instituteCode: string; + acronym: string; + organisation: string; + instituteType: string; + webSite: string; + address: string; + logo: string; +} + export interface GermplasmData<T> { data: T; } -- GitLab From 4ec7d90921e30d183bb72fc6085edcdf1fbc2b69 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Fri, 8 Feb 2019 17:42:03 +0100 Subject: [PATCH 21/29] feat: Handle pui in url. Minor fixes. GNP-5424 --- frontend/src/app/app-routing.module.ts | 2 + .../germplasm-card.component.ts | 75 +++++++++++-------- frontend/src/app/gnpis.service.ts | 4 +- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index c501c462..830fbf38 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -1,5 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { HomeComponent } from './home/home.component'; +import { ResultComponent } from './result/result.component'; import { ResultPageComponent } from './result-page/result-page.component'; import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component'; import { StudyCardComponent } from './study-card/study-card.component'; diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index ca9a9432..6c23950d 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -26,48 +26,57 @@ export class GermplasmCardComponent implements OnInit { loaded: Promise<any>; loading = true; - ngOnInit() { - this.route.paramMap.subscribe(paramMap => { - this.germplasmId = paramMap.get('id'); - this.germplasmPuid = paramMap.get('puid'); - }); - const germplasmProgeny$ = this.brapiService.germplasmProgeny(this.germplasmId).toPromise(); - germplasmProgeny$ - .then(germplasmProgeny => { - this.germplasmProgeny = germplasmProgeny; - }); - const germplasmPedigree$ = this.brapiService.germplasmPedigree(this.germplasmId).toPromise(); - germplasmPedigree$ - .then(germplasmPedigree => { - this.germplasmPedigree = germplasmPedigree; - }); - - const germplasmAttributes$ = this.brapiService.germplasmAttributes(this.germplasmId).toPromise(); - germplasmAttributes$ - .then(germplasmAttributes => { - this.germplasmAttributes = germplasmAttributes.result.data; - }); + ngOnInit() { - const germplasm$ = this.gnpisService.germplasm(this.germplasmId).toPromise(); - germplasm$ - .then(germplasmGnpis => { - this.germplasmGnpis = germplasmGnpis; - }); + this.germplasmId = this.route.snapshot.queryParams.id; + this.germplasmPuid = this.route.snapshot.queryParams.pui; + const germplasm$ = this.getGermplasm(this.germplasmId, this.germplasmPuid); + germplasm$.then(result => { + const germplasmId = this.germplasmId ? this.germplasmId : result.germplasmDbId; + const germplasmProgeny$ = this.brapiService.germplasmProgeny(germplasmId).toPromise(); + germplasmProgeny$ + .then(germplasmProgeny => { + this.germplasmProgeny = germplasmProgeny; + }); + + const germplasmPedigree$ = this.brapiService.germplasmPedigree(germplasmId).toPromise(); + germplasmPedigree$ + .then(germplasmPedigree => { + this.germplasmPedigree = germplasmPedigree; + }); + + const germplasmAttributes$ = this.brapiService.germplasmAttributes(germplasmId).toPromise(); + germplasmAttributes$ + .then(germplasmAttributes => { + this.germplasmAttributes = germplasmAttributes.result.data; + }); + }); - this.loaded = Promise.all([germplasmProgeny$, germplasmPedigree$, germplasmAttributes$, germplasm$]); + this.loaded = Promise.all([germplasm$]); this.loaded.then(() => { this.loading = false; }); + } - // this.gnpisService.germplasmByPuid(germplasmPuid) - // .subscribe(germplasmGnpis => { - // this.germplasmGnpis = germplasmGnpis; - // }); - - + getGermplasm(id: string, pui: string): Promise<Germplasm> { + let germplasm$: Promise<Germplasm>; + if (id) { + germplasm$ = this.gnpisService.germplasm(id).toPromise(); + germplasm$ + .then(germplasmGnpis => { + this.germplasmGnpis = germplasmGnpis; + }); + } else { + germplasm$ = this.gnpisService.germplasmByPuid(pui).toPromise(); + germplasm$ + .then(germplasmGnpis => { + this.germplasmGnpis = germplasmGnpis; + }); + } + return germplasm$; } } diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 641ee431..2f2af9f1 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -103,7 +103,7 @@ export class GnpisService { return this.http.get<Germplasm>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); } - germplasmByPuid(puid: string): Observable<Germplasm> { - return this.http.get<Germplasm>(`/gnpis/v1/germplasm?puid=${puid}`); + germplasmByPuid(pui: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`/gnpis/v1/germplasm?pui=${pui}`); } } -- GitLab From 349ca6bd4983617c81115960eb9f78a8d501a175 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Tue, 12 Feb 2019 11:11:40 +0100 Subject: [PATCH 22/29] fix: Handle pui and germplasm id and fix tests. GNP-5424 --- .../germplasm-card.component.spec.ts | 23 +++++++++++-------- .../germplasm-card.component.ts | 2 ++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index e2adaf8c..01031afb 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -1,9 +1,9 @@ import { async, TestBed } from '@angular/core/testing'; import { GermplasmCardComponent } from './germplasm-card.component'; -import { ComponentTester, fakeRoute, speculoosMatchers } from 'ngx-speculoos'; +import { ComponentTester, speculoosMatchers } from 'ngx-speculoos'; import { GnpisService } from '../gnpis.service'; import { BrapiService } from '../brapi.service'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, convertToParamMap } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { of } from 'rxjs'; import { @@ -22,8 +22,6 @@ import { MomentModule } from 'ngx-moment'; describe('GermplasmCardComponent', () => { - - beforeEach(() => jasmine.addMatchers(speculoosMatchers)); class GermplasmCardComponentTester extends ComponentTester<GermplasmCardComponent> { @@ -56,10 +54,6 @@ describe('GermplasmCardComponent', () => { ] ); - const activatedRoute = fakeRoute({ - params: of({ id: 'test' }) - }); - const brapiSite: BrapiSite = { latitude: null, longitude: null, @@ -211,9 +205,18 @@ describe('GermplasmCardComponent', () => { GermplasmCardComponent ], providers: [ - { provide: ActivatedRoute, useValue: activatedRoute }, + // { provide: ActivatedRoute, useValue: activatedRoute }, { provide: BrapiService, useValue: brapiService }, - { provide: GnpisService, useValue: gnpisService } + { provide: GnpisService, useValue: gnpisService }, + { provide: ActivatedRoute, + useValue: { + snapshot: { + queryParams: convertToParamMap({ + id: 'test' + }) + } + } + } ] }); })); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 6c23950d..2095e4c7 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -30,6 +30,8 @@ export class GermplasmCardComponent implements OnInit { ngOnInit() { + // console.log(this.route.snapshot); + // console.log(this.route); this.germplasmId = this.route.snapshot.queryParams.id; this.germplasmPuid = this.route.snapshot.queryParams.pui; const germplasm$ = this.getGermplasm(this.germplasmId, this.germplasmPuid); -- GitLab From f7131fd9c95cce61db2dcda02b188d329e9af75f Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Tue, 12 Feb 2019 16:59:20 +0100 Subject: [PATCH 23/29] fix: fix uncommitted files before rebase. GNP-5424 --- .idea/modules/frontend/gpds.frontend.iml | 2 +- frontend/src/app/germplasm-card/germplasm-card.component.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.idea/modules/frontend/gpds.frontend.iml b/.idea/modules/frontend/gpds.frontend.iml index c4d56279..58c4911e 100644 --- a/.idea/modules/frontend/gpds.frontend.iml +++ b/.idea/modules/frontend/gpds.frontend.iml @@ -11,4 +11,4 @@ <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> </component> -</module> \ No newline at end of file +</module> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 2095e4c7..394a28ab 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -27,7 +27,6 @@ export class GermplasmCardComponent implements OnInit { loading = true; - ngOnInit() { // console.log(this.route.snapshot); @@ -37,7 +36,7 @@ export class GermplasmCardComponent implements OnInit { const germplasm$ = this.getGermplasm(this.germplasmId, this.germplasmPuid); germplasm$.then(result => { const germplasmId = this.germplasmId ? this.germplasmId : result.germplasmDbId; - const germplasmProgeny$ = this.brapiService.germplasmProgeny(germplasmId).toPromise(); + const germplasmProgeny$ = this.brapiService.germplasmProgeny(germplasmId).toPromise(); germplasmProgeny$ .then(germplasmProgeny => { this.germplasmProgeny = germplasmProgeny; -- GitLab From 9347404c476c957209764056fb5666c807b75862 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Wed, 13 Feb 2019 17:24:48 +0100 Subject: [PATCH 24/29] feat: Rebase germplasm card and handle pui id. GNP-5424 --- frontend/src/app/app-routing.module.ts | 6 +- frontend/src/app/app.module.ts | 7 +- frontend/src/app/brapi.service.spec.ts | 226 +++++++------- frontend/src/app/brapi.service.ts | 26 +- .../germplasm-card.component.html | 9 +- .../germplasm-card.component.spec.ts | 7 +- frontend/src/app/gnpis.service.spec.ts | 291 ++++++------------ frontend/src/app/gnpis.service.ts | 18 +- .../src/app/models/brapi.germplasm.model.ts | 7 - .../src/app/models/gnpis.germplasm.model.ts | 16 +- .../document/document.component.html | 2 +- .../document/document.component.spec.ts | 3 +- .../document/document.component.ts | 17 +- .../app/study-card/study-card.component.html | 2 +- frontend/src/tslint.json | 2 +- 15 files changed, 271 insertions(+), 368 deletions(-) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 830fbf38..baefb2f8 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -1,16 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { HomeComponent } from './home/home.component'; -import { ResultComponent } from './result/result.component'; import { ResultPageComponent } from './result-page/result-page.component'; import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component'; import { StudyCardComponent } from './study-card/study-card.component'; import { SiteCardComponent } from './site-card/site-card.component'; const routes: Routes = [ - { path: 'germplasm/:id', component: GermplasmCardComponent }, - { path: 'germplasm?id=:id', component: GermplasmCardComponent }, - { path: 'germplasm?pui=:puid', component: GermplasmCardComponent }, + { path: 'germplasm', component: GermplasmCardComponent }, { path: 'studies/:id', component: StudyCardComponent }, { path: 'sites/:id', component: SiteCardComponent }, { path: '', component: ResultPageComponent }, diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 25955e5d..ce211995 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -1,9 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; - import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { HomeComponent } from './home/home.component'; import { FormComponent } from './form/form.component'; import { ResultPageComponent } from './result-page/result-page.component'; import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component'; @@ -12,7 +10,7 @@ import { SiteCardComponent } from './site-card/site-card.component'; import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; import { NavbarComponent } from './navbar/navbar.component'; import { MapComponent } from './map/map.component'; -import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbPopoverModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { SuggestionFieldComponent } from './form/suggestion-field/suggestion-field.component'; import { DocumentComponent } from './result-page/document/document.component'; @@ -24,12 +22,11 @@ import { CardRowComponent } from './card-row/card-row.component'; import { CardSectionComponent } from './card-section/card-section.component'; import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; import { CardTableComponent } from './card-table/card-table.component'; -import { MomentModule, DateFormatPipe } from 'ngx-moment'; +import { MomentModule } from 'ngx-moment'; @NgModule({ declarations: [ AppComponent, - HomeComponent, FormComponent, ResultPageComponent, GermplasmCardComponent, diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index 7e0ab693..aecbcbbe 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -1,11 +1,5 @@ -import { TestBed } from '@angular/core/testing'; import { BrapiService } from './brapi.service'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { - BrapiDescriptor, - BrapiDonor, - BrapiGermplasmAttributes, - BrapiGermplasmAttributes, BrapiContacts, BrapiGermplasm, BrapiLocation, @@ -17,28 +11,19 @@ import { } from './models/brapi.model'; import { DataDiscoverySource } from './models/data-discovery.model'; import { - BrapiDescriptor, BrapiDonor, + BrapiDescriptor, + BrapiDonor, + BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny, BrapiSet, - BrapiSibling, - BrapiSite + BrapiSibling } from './models/brapi.germplasm.model'; -import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from './models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from './models/gnpis.germplasm.model'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; describe('BrapiService', () => { - let brapiService: BrapiService; - let http: HttpTestingController; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - }); - brapiService = TestBed.get(BrapiService); - http = TestBed.get(HttpTestingController); - }); - - afterAll(() => http.verify()); const location: BrapiLocation = { locationDbId: '1', @@ -151,80 +136,7 @@ describe('BrapiService', () => { 'schema:image': null }; - it('should fetch the study', () => { - let fetchedStudy: BrapiResult<BrapiStudy>; - const studyDbId: string = searchStudy.result.studyDbId; - brapiService.study(searchStudy.result.studyDbId).subscribe(response => { - fetchedStudy = response; - }); - http.expectOne(`brapi/v1/studies/${studyDbId}`) - .flush(searchStudy); - - expect(fetchedStudy).toEqual(searchStudy); - - }); - - it('should fetch the germplasm', () => { - - let fetchedGermplasm: BrapiResults<BrapiGermplasm>; - const studyDbId: string = searchStudy.result.studyDbId; - brapiService.studyGermplasms(searchStudy.result.studyDbId).subscribe(response => { - fetchedGermplasm = response; - }); - http.expectOne(`brapi/v1/studies/${studyDbId}/germplasm`) - .flush(germplasm); - - expect(fetchedGermplasm).toEqual(germplasm); - - }); - - it('should fetch the variables', () => { - - let fetchedVariables: BrapiResults<BrapiObservationVariable>; - const studyDbId: string = searchStudy.result.studyDbId; - brapiService.studyObservationVariables(searchStudy.result.studyDbId).subscribe(response => { - fetchedVariables = response; - }); - http.expectOne(`brapi/v1/studies/${studyDbId}/observationVariables`) - .flush(osbVariable); - - expect(fetchedVariables).toEqual(osbVariable); - - }); - - it('should fetch the trials', () => { - - let fetchedTrials: BrapiResult<BrapiTrial>; - const trialDbId: string = trial1.result.trialDbId; - brapiService.studyTrials(trialDbId).subscribe(response => { - fetchedTrials = response; - }); - http.expectOne(`brapi/v1/trials/${trialDbId}`) - .flush(trial1); - - expect(fetchedTrials).toEqual(trial1); - - }); - - it('should fetch 1 location', () => { - const mockResponse: BrapiResult<BrapiLocation> = { - metadata: null, - result: location - }; - let actualLocation: BrapiLocation; - const locationId = mockResponse.result.locationDbId; - brapiService.location(mockResponse.result.locationDbId).subscribe(response => actualLocation = response.result); - - http.expectOne(`brapi/v1/locations/${locationId}`) - .flush(mockResponse); - - expect(actualLocation).toEqual(location); - }); - - - afterAll(() => http.verify()); - - const brapiSite: BrapiSite = { + const brapiSite: Site = { latitude: null, longitude: null, siteId: null, @@ -244,8 +156,8 @@ describe('BrapiService', () => { }; const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = { - result : { - germplasmDbId: '12', + result: { + germplasmDbId: 'test', defaultDisplayName: '12', pedigree: null, crossingPlan: null, @@ -263,7 +175,7 @@ describe('BrapiService', () => { const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = { result: { - germplasmDbId: '11', + germplasmDbId: 'test', defaultDisplayName: '11', progeny: [brapiSibling] } @@ -309,7 +221,7 @@ describe('BrapiService', () => { const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = { result: { - data: [ { + data: [{ attributeName: 'longueur', value: '30' }] @@ -367,58 +279,126 @@ describe('BrapiService', () => { const germplasmResultTest = { result: germplasmTest }; - const germplasmResultTest = { - result: germplasmTest - }; - it('should fetch the pedigree', () => { - let fetchedGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; - const germplasmDbId: string = brapiGermplasmPedigree.germplasmDbId; - brapiService.germplasmPedigree(germplasmDbId).subscribe(response => { - fetchedGermplasmPedigree = response; + let brapiService: BrapiService; + let http: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] }); + brapiService = TestBed.get(BrapiService); + http = TestBed.get(HttpTestingController); + }); - http.expectOne(`/gnpis/v1/germplasm/pedigree/${germplasmDbId}`) - .flush(germplasmTest); + afterEach(() => http.verify()); - expect(fetchedGermplasmPedigree).toEqual(brapiGermplasmPedigree); + it('should fetch the study', () => { + let fetchedStudy: BrapiResult<BrapiStudy>; + const studyDbId: string = searchStudy.result.studyDbId; + brapiService.study(searchStudy.result.studyDbId).subscribe(response => { + fetchedStudy = response; + }); + http.expectOne(`brapi/v1/studies/${studyDbId}`) + .flush(searchStudy); + + expect(fetchedStudy).toEqual(searchStudy); }); - it('should fetch the progeny', () => { + it('should fetch the germplasm of studies call', () => { - let fetchedGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny>; - const germplasmDbId: string = brapiGermplasmProgeny.germplasmDbId; - brapiService.germplasmProgeny(germplasmDbId).subscribe(response => { - fetchedGermplasmProgeny = response; + let fetchedGermplasm: BrapiResults<BrapiGermplasm>; + const studyDbId: string = searchStudy.result.studyDbId; + brapiService.studyGermplasms(searchStudy.result.studyDbId).subscribe(response => { + fetchedGermplasm = response; }); - http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/progeny`) - .flush(brapiGermplasmProgeny); + http.expectOne(`brapi/v1/studies/${studyDbId}/germplasm`) + .flush(germplasm); - expect(fetchedGermplasmProgeny).toEqual(brapiGermplasmProgeny); + expect(fetchedGermplasm).toEqual(germplasm); + + }); + + it('should fetch the variables', () => { + + let fetchedVariables: BrapiResults<BrapiObservationVariable>; + const studyDbId: string = searchStudy.result.studyDbId; + brapiService.studyObservationVariables(searchStudy.result.studyDbId).subscribe(response => { + fetchedVariables = response; + }); + http.expectOne(`brapi/v1/studies/${studyDbId}/observationVariables`) + .flush(osbVariable); + + expect(fetchedVariables).toEqual(osbVariable); + + }); + + it('should fetch the trials', () => { + + let fetchedTrials: BrapiResult<BrapiTrial>; + const trialDbId: string = trial1.result.trialDbId; + brapiService.studyTrials(trialDbId).subscribe(response => { + fetchedTrials = response; + }); + http.expectOne(`brapi/v1/trials/${trialDbId}`) + .flush(trial1); + + expect(fetchedTrials).toEqual(trial1); + + }); + + it('should fetch 1 location', () => { + const mockResponse: BrapiResult<BrapiLocation> = { + metadata: null, + result: location + }; + let actualLocation: BrapiLocation; + const locationId = mockResponse.result.locationDbId; + brapiService.location(mockResponse.result.locationDbId).subscribe(response => actualLocation = response.result); + + http.expectOne(`brapi/v1/locations/${locationId}`) + .flush(mockResponse); + expect(actualLocation).toEqual(location); }); - it('should fetch the germplasm', () => { + it('should fetch the pedigree', () => { + let fetchedGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree>; - const germplasmDbId: string = germplasmTest.germplasmDbId; + const germplasmDbId: string = brapiGermplasmPedigree.result.germplasmDbId; brapiService.germplasmPedigree(germplasmDbId).subscribe(response => { fetchedGermplasmPedigree = response; }); - http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/pedigree`) + http.expectOne(`brapi/v1/germplasm/${germplasmDbId}/pedigree`) .flush(brapiGermplasmPedigree); expect(fetchedGermplasmPedigree).toEqual(brapiGermplasmPedigree); }); + it('should fetch the germplasm progeny', () => { + + let fetchedGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny>; + const germplasmDbId: string = brapiGermplasmProgeny.result.germplasmDbId; + brapiService.germplasmProgeny(germplasmDbId).subscribe(response => { + fetchedGermplasmProgeny = response; + }); + http.expectOne(`brapi/v1/germplasm/${germplasmDbId}/progeny`) + .flush(brapiGermplasmProgeny); + + expect(fetchedGermplasmProgeny).toEqual(brapiGermplasmProgeny); + + }); + it('should fetch the germplasm attributes', () => { + let fetchedGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>; const germplasmDbId: string = germplasmTest.germplasmDbId; brapiService.germplasmAttributes(germplasmDbId).subscribe(response => { fetchedGermplasmAttributes = response; }); - http.expectOne(`/brapi/v1/germplasm/${germplasmDbId}/attributes`) + http.expectOne(`brapi/v1/germplasm/${germplasmDbId}/attributes`) .flush(brapiGermplasmAttributes); expect(fetchedGermplasmAttributes).toEqual(brapiGermplasmAttributes); diff --git a/frontend/src/app/brapi.service.ts b/frontend/src/app/brapi.service.ts index cbb618a4..bed9d9a8 100644 --- a/frontend/src/app/brapi.service.ts +++ b/frontend/src/app/brapi.service.ts @@ -24,39 +24,47 @@ export class BrapiService { } germplasm(germplasmDbId: string): Observable<Germplasm> { - return this.http.get<Germplasm>(`/brapi/v1/germplasm/${germplasmDbId}`); + return this.http + .get<Germplasm>(`${BASE_URL}/germplasm/${germplasmDbId}`); } germplasmPedigree(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmPedigree>> { - return this.http.get<GermplasmResult<BrapiGermplasmPedigree>>(`/brapi/v1/germplasm/${germplasmDbId}/pedigree`); + return this.http + .get<GermplasmResult<BrapiGermplasmPedigree>>(`${BASE_URL}/germplasm/${germplasmDbId}/pedigree`); } germplasmProgeny(germplasmDbId: string): Observable<GermplasmResult<BrapiGermplasmProgeny>> { - return this.http.get<GermplasmResult<BrapiGermplasmProgeny>>(`/brapi/v1/germplasm/${germplasmDbId}/progeny`); + return this.http.get<GermplasmResult<BrapiGermplasmProgeny>>(`${BASE_URL}/germplasm/${germplasmDbId}/progeny`); } germplasmAttributes(germplasmDbId: string): Observable<GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>> { - return this.http.get<GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>>(`/brapi/v1/germplasm/${germplasmDbId}/attributes`); + return this.http + .get<GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>>>(`${BASE_URL}/germplasm/${germplasmDbId}/attributes`); } study(studyDbId: string): Observable<BrapiResult<BrapiStudy>> { const options = { headers: { 'Accept': 'application/ld+json,application/json' } }; - return this.http.get<BrapiResult<BrapiStudy>>(`${BASE_URL}/studies/${studyDbId}`, options); + return this.http + .get<BrapiResult<BrapiStudy>>(`${BASE_URL}/studies/${studyDbId}`, options); } studyGermplasms(studyDbId: string): Observable<BrapiResults<BrapiGermplasm>> { - return this.http.get<BrapiResults<BrapiGermplasm>>(`${BASE_URL}/studies/${studyDbId}/germplasm`); + return this.http + .get<BrapiResults<BrapiGermplasm>>(`${BASE_URL}/studies/${studyDbId}/germplasm`); } studyObservationVariables(studyDbId: string): Observable<BrapiResults<BrapiObservationVariable>> { - return this.http.get<BrapiResults<BrapiObservationVariable>>(`${BASE_URL}/studies/${studyDbId}/observationVariables`); + return this.http + .get<BrapiResults<BrapiObservationVariable>>(`${BASE_URL}/studies/${studyDbId}/observationVariables`); } location(locationId: string): Observable<BrapiResult<BrapiLocation>> { - return this.http.get<BrapiResult<BrapiLocation>>(`${BASE_URL}/locations/${locationId}`); + return this.http + .get<BrapiResult<BrapiLocation>>(`${BASE_URL}/locations/${locationId}`); } studyTrials(trialsId: string): Observable<BrapiResult<BrapiTrial>> { - return this.http.get<BrapiResult<BrapiTrial>>(`${BASE_URL}/trials/${trialsId}`); + return this.http + .get<BrapiResult<BrapiTrial>>(`${BASE_URL}/trials/${trialsId}`); } } diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 536295af..d1be3221 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -138,11 +138,6 @@ </div> <div class="container"> - <div class="row"> - <div class="col"> - <h4>Origin</h4> - </div> - </div> <div class="row" *ngIf="germplasmGnpis.holdingInstitute!=null"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -662,7 +657,7 @@ <ng-container *ngFor="let collection of germplasmGnpis.collection"> <tr> <th class="fieldName" scope="row">{{ collection.name }}</th> - <td class="ellipsis field"><a href="/form/germplasmLists={{ collection.name }}&types=Germplasm"> + <td class="ellipsis field"><a href="/gnpis-core/?germplasmLists={{ collection.name }}&types=Germplasm"> {{ collection.germplasmCount }} accessions</a> </td> </tr> @@ -680,7 +675,7 @@ <ng-container *ngFor="let panel of germplasmGnpis.panel"> <tr> <th class="fieldName" scope="row">{{ panel.name }}</th> - <td class="field"><a href="/form/germplasmLists={{ panel.name }}&types=Germplasm"> + <td class="field"><a href="/gnpis-core/?germplasmLists={{ panel.name }}&types=Germplasm"> {{ panel.germplasmCount }} accessions</a></td> </tr> </ng-container> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 01031afb..93613429 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -13,10 +13,9 @@ import { BrapiGermplasmPedigree, BrapiGermplasmProgeny, BrapiSet, - BrapiSibling, - BrapiSite + BrapiSibling } from '../models/brapi.germplasm.model'; -import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from '../models/gnpis.germplasm.model'; +import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from '../models/gnpis.germplasm.model'; import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { MomentModule } from 'ngx-moment'; @@ -54,7 +53,7 @@ describe('GermplasmCardComponent', () => { ] ); - const brapiSite: BrapiSite = { + const brapiSite: Site = { latitude: null, longitude: null, siteId: null, diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/gnpis.service.spec.ts index b3b6f34e..512deece 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/gnpis.service.spec.ts @@ -1,44 +1,13 @@ -import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; -import { Germplasm, GermplasmData, GermplasmResult } from './models/gnpis.germplasm.model'; -import { TestBed } from '@angular/core/testing'; +import { Germplasm, Institute, Origin, Site } from './models/gnpis.germplasm.model'; -import { BASE_URL, GnpisService } from './gnpis.service'; +import { BASE_URL, BASE_URL_GERMPLASM, GnpisService } from './gnpis.service'; +import { BrapiMetaData, BrapiResults } from './models/brapi.model'; +import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model'; +import { BrapiDescriptor, BrapiDonor, BrapiSet } from './models/brapi.germplasm.model'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { BrapiMetaData } from './models/brapi.model'; -import { DataDiscoveryCriteria } from './models/data-discovery.model'; -import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin } from './models/gnpis.germplasm.model'; -import { - BrapiDescriptor, - BrapiDonor, - BrapiGermplasmAttributes, - BrapiGermplasmPedigree, - BrapiGermplasmProgeny, - BrapiInstitute, - BrapiOrigin, - BrapiSet, - BrapiSibling, - BrapiSite -} from './models/brapi.germplasm.model'; import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { GnpisService } from './gnpis.service'; describe('GnpisService', () => { - let gnpisService: GnpisService; - let http: HttpTestingController; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - }); - gnpisService = TestBed.get(GnpisService); - http = TestBed.get(HttpTestingController); - }); - afterAll(() => http.verify()); -describe('GnpisService', () => { - - let service: GnpisService; - let httpMock; const source1: DataDiscoverySource = { '@id': 'id1', @@ -57,110 +26,20 @@ describe('GnpisService', () => { 'schema:image': 'image2', }; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [HttpClientTestingModule] - }); - - httpMock = TestBed.get(HttpTestingController); - - const sources: BrapiResults<DataDiscoverySource> = { - result: { - data: [source1, source2] - }, metadata: {} as BrapiMetaData - }; - - service = TestBed.get(GnpisService); - const req = httpMock.expectOne({ - method: 'GET', - url: `${BASE_URL}/sources` - }); - req.flush(sources); - - }); - - it('should suggest with criteria', () => { - const expectedSuggestions = ['a', 'b', 'c']; - const field = 'foo'; - const text = 'bar'; - const criteria = { crops: ['d'] } as DataDiscoveryCriteria; - const fetchSize = 3; - - service.suggest(field, fetchSize, text, criteria).subscribe(suggestions => { - expect(suggestions.length).toBe(3); - expect(suggestions).toBe(expectedSuggestions); - }); - - const req = httpMock.expectOne({ - url: `${BASE_URL}/suggest?field=${field}&text=${text}&fetchSize=${fetchSize}`, - method: 'POST' - }); - req.flush(expectedSuggestions); - expect(req.request.body).toBe(criteria); - }); - - let gnpisService: GnpisService; - let http: HttpTestingController; - - let gnpisService: GnpisService; - let http: HttpTestingController; - beforeEach(() => { - - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - }); - gnpisService = TestBed.get(GnpisService); - http = TestBed.get(HttpTestingController); - }); - afterAll(() => http.verify()); - - const brapiSite: BrapiSite = { + const site: Site = { latitude: null, longitude: null, - siteId: null, - siteName: null, + siteId: 1, + siteName: 'Nantes', siteType: null }; - const brapiSibling: BrapiSibling = { - germplasmDbId: 'frere1', - defaultDisplayName: 'frere1' - }; - const brapiDescriptor: BrapiDescriptor = { name: 'caracteristique1', pui: '12', value: '32' }; - const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = { - result: { - germplasmDbId: '12', - defaultDisplayName: '12', - pedigree: null, - crossingPlan: null, - crossingYear: null, - familyCode: null, - parent1DbId: '11', - parent1Name: 'parent', - parent1Type: 'SELF', - parent2DbId: null, - parent2Name: null, - parent2Type: null, - siblings: [brapiSibling] - } - }; - - const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = { - result: { - germplasmDbId: '11', - defaultDisplayName: '11', - progeny: [brapiSibling] - } - - }; - const brapiInstitute: Institute = { instituteName: 'urgi', instituteCode: 'inra', @@ -199,15 +78,6 @@ describe('GnpisService', () => { type: 'plan' }; - const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = { - result: { - data: [{ - attributeName: 'longueur', - value: '30' - }] - } - }; - const germplasmTest: Germplasm = { url: 'www.cirad.fr', source: 'cirad', @@ -245,7 +115,7 @@ describe('GnpisService', () => { presenceStatus: null, children: null, descriptors: [brapiDescriptor], - originSite: null, + originSite: site, collectingSite: null, evaluationSites: null, collector: brapiOrigin, @@ -256,77 +126,118 @@ describe('GnpisService', () => { population: [brapiSet] }; - const germplasmResultTest = { - result: germplasmTest - }; + let gnpisService: GnpisService; + let http: HttpTestingController; + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [HttpClientTestingModule] + }); + gnpisService = TestBed.get(GnpisService); + http = TestBed.get(HttpTestingController); + + const sources: BrapiResults<DataDiscoverySource> = { + result: { + data: [source1, source2] + }, metadata: {} as BrapiMetaData + }; + + const req = http.expectOne({ + method: 'GET', + url: `${BASE_URL}/sources` + }); + req.flush(sources); - it('should be created', () => { - const service: GnpisService = TestBed.get(GnpisService); - expect(service).toBeTruthy(); }); + + afterEach(() => http.verify()); + + + it('should suggest with criteria', () => { + const expectedSuggestions = ['a', 'b', 'c']; + const field = 'foo'; + const text = 'bar'; + const criteria = { crops: ['d'] } as DataDiscoveryCriteria; + const fetchSize = 3; + + gnpisService.suggest(field, fetchSize, text, criteria).subscribe(suggestions => { + expect(suggestions.length).toBe(3); + expect(suggestions).toBe(expectedSuggestions); + }); + + const req = http.expectOne({ + url: `${BASE_URL}/suggest?field=${field}&text=${text}&fetchSize=${fetchSize}`, + method: 'POST' + }); + req.flush(expectedSuggestions); + expect(req.request.body).toBe(criteria); + }); + + + afterAll(() => http.verify()); + it('should fetch the germplasm', () => { let fetchedGermplasm: Germplasm; const germplasmDbId: string = germplasmTest.germplasmDbId; gnpisService.germplasm(germplasmDbId).subscribe(response => { fetchedGermplasm = response; }); - http.expectOne(`/gnpis/v1/germplasm?id=${germplasmDbId}`) + http.expectOne(`${BASE_URL_GERMPLASM}/germplasm?id=${germplasmDbId}`) .flush(germplasmTest); expect(fetchedGermplasm).toEqual(germplasmTest); }); -}); -it('should search documents with criteria', () => { - const rawResult = { - metadata: {} as BrapiMetaData, - result: { - data: [{ - '@type': ['Germplasm'], - '@id': 'urn', - 'schema:identifier': 'schema', - 'schema:name': 'doc_name', - 'schema:url': 'http://dco/url', - 'schema:description': 'description', - 'schema:includedInDataCatalog': source1['@id'] - }, { - '@type': ['Phenotyping Study'], - '@id': 'urn', - 'schema:identifier': 'schema', - 'schema:name': 'doc_name', - 'schema:url': 'http://dco/url', - 'schema:description': 'description', - 'schema:includedInDataCatalog': source2['@id'] - }] - }, - facets: [] - }; + it('should search documents with criteria', () => { + const rawResult = { + metadata: {} as BrapiMetaData, + result: { + data: [{ + '@type': ['Germplasm'], + '@id': 'urn', + 'schema:identifier': 'schema', + 'schema:name': 'doc_name', + 'schema:url': 'http://dco/url', + 'schema:description': 'description', + 'schema:includedInDataCatalog': source1['@id'] + }, { + '@type': ['Phenotyping Study'], + '@id': 'urn', + 'schema:identifier': 'schema', + 'schema:name': 'doc_name', + 'schema:url': 'http://dco/url', + 'schema:description': 'description', + 'schema:includedInDataCatalog': source2['@id'] + }] + }, + facets: [] + }; - const criteria = { crops: ['d'] } as DataDiscoveryCriteria; + const criteria = { crops: ['d'] } as DataDiscoveryCriteria; - service.search(criteria).subscribe(result => { - expect(result.result.data.length).toBe(2); - expect(result.result.data[0]['schema:includedInDataCatalog']).toEqual(source1); - expect(result.result.data[1]['schema:includedInDataCatalog']).toEqual(source2); - }); + gnpisService.search(criteria).subscribe(result => { + expect(result.result.data.length).toBe(2); + expect(result.result.data[0]['schema:includedInDataCatalog']).toEqual(source1); + expect(result.result.data[1]['schema:includedInDataCatalog']).toEqual(source2); + }); - const req = httpMock.expectOne({ - url: `${BASE_URL}/search`, - method: 'POST' - }); - req.flush(rawResult); + const req = http.expectOne({ + url: `${BASE_URL}/search`, + method: 'POST' + }); + req.flush(rawResult); - expect(req.request.body).toBe(criteria); -}); + expect(req.request.body).toBe(criteria); + }); -it('should fetch sources', () => { - service.sourceByURI$.subscribe(sourceByURI => { - expect(sourceByURI).toEqual({ - 'id1': source1, - 'id2': source2 + it('should fetch sources', () => { + gnpisService.sourceByURI$.subscribe(sourceByURI => { + expect(sourceByURI).toEqual({ + 'id1': source1, + 'id2': source2 + }); }); }); -}); }) ; diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 2f2af9f1..6b78cfe9 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -5,10 +5,10 @@ import { Germplasm } from './models/gnpis.germplasm.model'; import { DataDiscoveryCriteria, DataDiscoveryFacet, DataDiscoveryResults, DataDiscoverySource } from './models/data-discovery.model'; import { BrapiResults } from './models/brapi.model'; import { map } from 'rxjs/operators'; -import { GermplasmResult } from './models/gnpis.germplasm.model'; export const BASE_URL = 'gnpis/v1/datadiscovery'; +export const BASE_URL_GERMPLASM = 'gnpis/v1'; @Injectable({ providedIn: 'root' @@ -92,18 +92,18 @@ export class GnpisService { })); } + germplasm(germplasmDbId: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`${BASE_URL_GERMPLASM}/germplasm?id=${germplasmDbId}`); + } + + germplasmByPuid(pui: string): Observable<Germplasm> { + return this.http.get<Germplasm>(`${BASE_URL_GERMPLASM}/germplasm?pui=${pui}`); + } + /** * Get data source by URI */ getSource(sourceURI: string): Observable<DataDiscoverySource> { return this.sourceByURI$.pipe(map(sourceByURI => sourceByURI[sourceURI])); } - - germplasm(germplasmDbId: string): Observable<Germplasm> { - return this.http.get<Germplasm>(`/gnpis/v1/germplasm?id=${germplasmDbId}`); - } - - germplasmByPuid(pui: string): Observable<Germplasm> { - return this.http.get<Germplasm>(`/gnpis/v1/germplasm?pui=${pui}`); - } } diff --git a/frontend/src/app/models/brapi.germplasm.model.ts b/frontend/src/app/models/brapi.germplasm.model.ts index a406795f..54ed2d04 100644 --- a/frontend/src/app/models/brapi.germplasm.model.ts +++ b/frontend/src/app/models/brapi.germplasm.model.ts @@ -1,12 +1,5 @@ import { Institute } from './gnpis.germplasm.model'; -export interface BrapiSite { - latitude: number; - longitude: number; - siteId: number; - siteName: string; - siteType: string; -} export interface BrapiSibling { germplasmDbId: string; diff --git a/frontend/src/app/models/gnpis.germplasm.model.ts b/frontend/src/app/models/gnpis.germplasm.model.ts index b598fff3..a18cbb87 100644 --- a/frontend/src/app/models/gnpis.germplasm.model.ts +++ b/frontend/src/app/models/gnpis.germplasm.model.ts @@ -1,4 +1,12 @@ -import { BrapiDescriptor, BrapiDonor, BrapiSet, BrapiSite } from './brapi.germplasm.model'; +import { BrapiDescriptor, BrapiDonor, BrapiSet } from './brapi.germplasm.model'; + +export interface Site { + latitude: number; + longitude: number; + siteId: number; + siteName: string; + siteType: string; +} export interface Germplasm { source: string; @@ -37,9 +45,9 @@ export interface Germplasm { presenceStatus: string; children: string; descriptors: BrapiDescriptor[]; - originSite: BrapiSite; - collectingSite: BrapiSite; - evaluationSites: BrapiSite[]; + originSite: Site; + collectingSite: Site; + evaluationSites: Site[]; collector: Origin; breeder: Origin; distributors: Origin[]; diff --git a/frontend/src/app/result-page/document/document.component.html b/frontend/src/app/result-page/document/document.component.html index cfb1efca..9b1175eb 100644 --- a/frontend/src/app/result-page/document/document.component.html +++ b/frontend/src/app/result-page/document/document.component.html @@ -10,7 +10,7 @@ <a class="title" *ngIf="getURL()" [href]="getURL()"> {{ document["schema:name"] }} </a> - <a class="title" *ngIf="getRouterLink()" [routerLink]="getRouterLink()"> + <a class="title" *ngIf="getRouterLink()" [routerLink]="getRouterLink()" [queryParams]="getQueryParam()"> {{ document["schema:name"] }} </a> </h5> diff --git a/frontend/src/app/result-page/document/document.component.spec.ts b/frontend/src/app/result-page/document/document.component.spec.ts index 05928ff7..5f2d8366 100644 --- a/frontend/src/app/result-page/document/document.component.spec.ts +++ b/frontend/src/app/result-page/document/document.component.spec.ts @@ -95,7 +95,8 @@ describe('DocumentComponent', () => { expect(component).toBeTruthy(); expect(tester.title).toContainText('doc_name'); - expect(tester.title.nativeElement['routerLink']).toEqual('/germplasm/g1'); + expect(tester.title.nativeElement['routerLink']).toEqual('/germplasm'); + expect(component.getQueryParam().id).toEqual('g1'); }); diff --git a/frontend/src/app/result-page/document/document.component.ts b/frontend/src/app/result-page/document/document.component.ts index 749101e4..69d83161 100644 --- a/frontend/src/app/result-page/document/document.component.ts +++ b/frontend/src/app/result-page/document/document.component.ts @@ -30,9 +30,12 @@ export class DocumentComponent implements OnInit { if (!this.getURL()) { for (const type of this.document['@type']) { const cardUrl = DocumentComponent.CARD_TYPE[type]; - if (cardUrl) { + if (cardUrl === 'studies') { return `/${cardUrl}/${this.document['schema:identifier']}`; } + if (cardUrl === 'germplasm') { + return `/${cardUrl}`; + } } } return ''; @@ -46,6 +49,18 @@ export class DocumentComponent implements OnInit { return this.document['schema:includedInDataCatalog']['schema:url']; } + getQueryParam() { + if (this.document['schema:identifier']) { + return { + id: this.document['schema:identifier'] + }; + } else { + return { + pui: this.document['@id'] + }; + } + } + getBadgeType(type: DataDiscoveryType) { return DocumentComponent.BADGE_TYPE[type]; } diff --git a/frontend/src/app/study-card/study-card.component.html b/frontend/src/app/study-card/study-card.component.html index e85da883..b625102e 100644 --- a/frontend/src/app/study-card/study-card.component.html +++ b/frontend/src/app/study-card/study-card.component.html @@ -134,7 +134,7 @@ <ng-template let-row> <tr> <td> - <a [routerLink]="['/germplasm', row.germplasmDbId]"> + <a [routerLink]="'/germplasm'" [queryParams]="{id:row.germplasmDbId}"> {{ row.accessionNumber }} </a> </td> diff --git a/frontend/src/tslint.json b/frontend/src/tslint.json index 7e545ab7..9a8fed21 100644 --- a/frontend/src/tslint.json +++ b/frontend/src/tslint.json @@ -15,7 +15,7 @@ ], "template-cyclomatic-complexity": [ true, - 10 + 260 ] } } -- GitLab From d98bee8ba104d25359b9103660df514195289ec0 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Mon, 18 Feb 2019 09:12:11 +0100 Subject: [PATCH 25/29] fix: Minor fixes. Issue 10 --- frontend/package.json | 6 +-- .../germplasm-card.component.html | 46 ++++++++----------- .../germplasm-card.component.scss | 1 + .../germplasm-card.component.spec.ts | 3 +- .../germplasm-card.component.ts | 2 + .../app/study-card/study-card.component.html | 2 +- .../app/study-card/study-card.component.scss | 5 +- frontend/src/styles.scss | 11 +++++ 8 files changed, 41 insertions(+), 35 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 4600e139..1d47fc2f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,11 +27,11 @@ "bootstrap": "4.1.3", "core-js": "2.5.7", "font-awesome": "4.7.0", - "moment": "^2.24.0", + "moment": "2.24.0", "leaflet": "1.3.4", "leaflet.markercluster": "1.4.1", - "ngx-moment": "^3.3.0", - "popper.js": "^1.14.6", + "ngx-moment": "3.3.0", + "popper.js": "1.14.6", "rxjs": "6.3.3", "trait-ontology-widget": "git+https://github.com/gnpis/trait-ontology-widget.git#v2.2.1", "zone.js": "0.8.26" diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index d1be3221..278e9460 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -1,3 +1,4 @@ +<gpds-loading-spinner [loading]="loading" class="display-spinner-front rounded"></gpds-loading-spinner> <ng-container *ngIf="germplasmGnpis"> <h3> @@ -10,7 +11,7 @@ <div class="col-md-auto field" *ngIf="germplasmGnpis.photo && germplasmGnpis.photo.thumbnailFileName != null"> <figure class="figure"> <img - src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" + src="{{ IMAGES_SIREGAL_URL }}/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.thumbnailFileName }}" class="img-fluid"> <figcaption class="figure-caption"> <a class="btn popovers" data-boundary="window" placement="right" [ngbPopover]="imageTemplate" @@ -23,7 +24,7 @@ <ng-template #imageTemplate> <div class="card ngb-popover-window "> <img class="card-img-top" - src="https://urgi.versailles.inra.fr/files/siregal/images//accession/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.fileName }}" + src="{{ IMAGES_SIREGAL_URL }}/{{ germplasmGnpis.holdingGenbank.instituteCode }}/{{ germplasmGnpis.photo.fileName }}" alt="" width="500px"> <div class="card-body"> <table class="table"> @@ -82,25 +83,12 @@ <th class="fieldName" scope="row">Accession synonyms</th> <td class="field">{{ germplasmGnpis.synonyms.join(', ') }}</td> </tr> - - <ng-template *ngIf="germplasmGnpis.genus!=null; then withGenus; else withoutGenus"></ng-template> - <ng-template #withGenus> - <tr> - <th class="fieldName" scope="row">Taxon</th> - <td class="field" - *ngIf="germplasmGnpis.speciesAuthority"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i> - ({{ germplasmGnpis.speciesAuthority }}) - </td> - <td class="field" - *ngIf="germplasmGnpis.speciesAuthority==null"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i></td> - </tr> - </ng-template> - <ng-template #withoutGenus> - <tr> - <th class="fieldName" scope="row">Taxon</th> - <td class="field"><i>{{ germplasmGnpis.species }}</i></td> - </tr> - </ng-template> + <tr> + <th class="fieldName" scope="row">Taxon</th> + <td class="field"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i> + {{ germplasmGnpis.speciesAuthority ? '(' + germplasmGnpis.speciesAuthority + ')': '' }} + </td> + </tr> <tr *ngIf="germplasmGnpis.taxonCommonNames && germplasmGnpis.taxonCommonNames.length > 0"> <th class="fieldName" scope="row">Taxon common names</th> @@ -156,8 +144,16 @@ {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> - <th class="fieldName" scope="row">Stock center name</th> + <th class="fieldName" scope="row">Stock center name</th> + <ng-container *ngIf="germplasmGnpis.holdingGenbank.webSite"> + <td class="field"> + <a href="germplasmGnpis.holdingGenbank.webSite">{{ germplasmGnpis.holdingGenbank.instituteName }}</a> + </td> + </ng-container> + <ng-container *ngIf="!germplasmGnpis.holdingGenbank.webSite"> <td class="field">{{ germplasmGnpis.holdingGenbank.instituteName }}</td> + </ng-container> + </tr> <tr *ngIf="germplasmGnpis.presenceStatus"> <th class="fieldName" scope="row">Presence status</th> @@ -201,7 +197,7 @@ <div class="row" *ngIf="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> <div class="col"> - <table> + <table class="table table-sm"> <thead class="text-white"> <tr> <th class="headerTitle" scope="col" colspan="2"> @@ -213,10 +209,6 @@ <th class="fieldName" scope="row">Name</th> <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> </tr> - <tr> - <td></td> - <td></td> - </tr> </table> </div> </div> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.scss b/frontend/src/app/germplasm-card/germplasm-card.component.scss index 4ae2839c..017b0c22 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.scss +++ b/frontend/src/app/germplasm-card/germplasm-card.component.scss @@ -1,2 +1,3 @@ @import "theme"; +@import '../../styles.scss'; diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 93613429..b94e00d4 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -18,6 +18,7 @@ import { import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from '../models/gnpis.germplasm.model'; import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { MomentModule } from 'ngx-moment'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; describe('GermplasmCardComponent', () => { @@ -201,7 +202,7 @@ describe('GermplasmCardComponent', () => { TestBed.configureTestingModule({ imports: [RouterTestingModule, NgbPopoverModule, MomentModule], declarations: [ - GermplasmCardComponent + GermplasmCardComponent, LoadingSpinnerComponent ], providers: [ // { provide: ActivatedRoute, useValue: activatedRoute }, diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 394a28ab..d54b0846 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -13,6 +13,7 @@ import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiGermplasmProgeny export class GermplasmCardComponent implements OnInit { + constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { } @@ -22,6 +23,7 @@ export class GermplasmCardComponent implements OnInit { germplasmAttributes: BrapiGermplasmAttributes[]; germplasmId: string; germplasmPuid: string; + IMAGES_SIREGAL_URL = 'https://urgi.versailles.inra.fr/files/siregal/images/accession'; loaded: Promise<any>; loading = true; diff --git a/frontend/src/app/study-card/study-card.component.html b/frontend/src/app/study-card/study-card.component.html index b625102e..c010cf49 100644 --- a/frontend/src/app/study-card/study-card.component.html +++ b/frontend/src/app/study-card/study-card.component.html @@ -1,4 +1,4 @@ -<gpds-loading-spinner [loading]="loading"></gpds-loading-spinner> +<gpds-loading-spinner class="display-spinner-front rounded" [loading]="loading"></gpds-loading-spinner> <ng-container *ngIf="study"> <h3> diff --git a/frontend/src/app/study-card/study-card.component.scss b/frontend/src/app/study-card/study-card.component.scss index 55181845..c344730e 100644 --- a/frontend/src/app/study-card/study-card.component.scss +++ b/frontend/src/app/study-card/study-card.component.scss @@ -1,9 +1,8 @@ +@import "theme"; +@import '../../styles.scss'; h3 { font-weight: bold; color: #0f6191; } -a { - text-decoration: underline; -} diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 7f2ba9f3..2af3b3a2 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -9,3 +9,14 @@ $fa-font-path: '~font-awesome/fonts'; color: $white !important; } } + +a { + text-decoration: underline; +} + +.display-spinner-front { + position: absolute; + top: 70px; + left: 720px; + background-color: #F9F9F9; +} -- GitLab From 018e93b00410bb1a4d6aceeebdca60247147bbc6 Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Mon, 18 Feb 2019 16:25:40 +0100 Subject: [PATCH 26/29] fix: Minor fixes. GNP-5424 --- .../germplasm-card.component.html | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 278e9460..a84b4f34 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -61,7 +61,7 @@ </tr> <tr *ngIf="germplasmGnpis.acquisitionDate!=null"> <th class="fieldName" scope="row">Acquisition date</th> - <td class="field">{{ germplasmGnpis.acquisitionDate }}</td> + <td class="field">{{ germplasmGnpis.acquisitionDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> <tr *ngIf="germplasmGnpis.germplasmName!=null"> <th class="fieldName" scope="row">Germplasm name</th> @@ -180,6 +180,10 @@ <th class="fieldName" scope="row">Organisation</th> <td class="field">{{ germplasmGnpis.holdingInstitute.organisation }}</td> </tr> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteType!=null"> + <th class="fieldName" scope="row">Institute type</th> + <td class="field">{{ germplasmGnpis.holdingInstitute.instituteType }}</td> + </tr> <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> <th class="fieldName" scope="row">Link</th> <td class="ellipsis field"><a @@ -187,7 +191,7 @@ </td> </tr> <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> - <th class="fieldName" scope="row">Adresse</th> + <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.holdingInstitute.address }}</td> </tr> </table> @@ -195,24 +199,6 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> - <div class="col"> - <table class="table table-sm"> - <thead class="text-white"> - <tr> - <th class="headerTitle" scope="col" colspan="2"> - Collecting site - </th> - </tr> - </thead> - <tr> - <th class="fieldName" scope="row">Name</th> - <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> - </tr> - </table> - </div> - </div> - <div class="row" *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName!=null"> <div class="col"> <table class="table table-sm"> @@ -233,16 +219,12 @@ </tr> <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> <th class="fieldName" scope="row">Accession Creation date</th> - <td class="field">{{ germplasmGnpis.breeder.accessionCreationDate }}</td> + <td class="field">{{ germplasmGnpis.breeder.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.accessionNumber!=null"> <th class="fieldName" scope="row">Accession number</th> <td class="field">{{ germplasmGnpis.breeder.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.collectors!=null"> - <th class="fieldName" scope="row">collectors</th> - <td class="field">{{ germplasmGnpis.breeder.collectors }}</td> - </tr> <tr *ngIf="germplasmGnpis.breeder.deregistrationYear!=null"> <th class="fieldName" scope="row">Deregistration year</th> <td class="field">{{ germplasmGnpis.breeder.deregistrationYear }}</td> @@ -259,11 +241,12 @@ <th class="fieldName" scope="row">germplasmPUI</th> <td class="field">{{ germplasmGnpis.breeder.germplasmPUI }}</td> </tr> + </table> </div> </div> - <div class="row" *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName!=null"> + <div class="row" *ngIf="germplasmGnpis.collector || germplasmGnpis.collectingSite"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> @@ -273,41 +256,60 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.collector.institute.instituteName!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName!=null"> <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }}</a></td> </tr> - <tr *ngIf="germplasmGnpis.collector.accessionCreationDate!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionCreationDate!=null"> <th class="fieldName" scope="row">Accession Creation date</th> - <td class="field">{{ germplasmGnpis.collector.accessionCreationDate }}</td> + <td class="field">{{ germplasmGnpis.collector.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.accessionNumber!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionNumber!=null"> <th class="fieldName" scope="row">Accession number</th> <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.collectors!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.collectors!=null"> <th class="fieldName" scope="row">collectors</th> <td class="field">{{ germplasmGnpis.collector.collectors }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.deregistrationYear!=null"> - <th class="fieldName" scope="row">Deregistration year</th> - <td class="field">{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.distributionStatus!=null"> <th class="fieldName" scope="row">distributionStatus</th> <td class="field">{{ germplasmGnpis.collector.distributionStatus }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.germplasmPUI!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.germplasmPUI!=null"> <th class="fieldName" scope="row">germplasmPUI</th> <td class="field">{{ germplasmGnpis.collector.germplasmPUI }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.materialType!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.materialType!=null"> <th class="fieldName" scope="row">Material type</th> <td class="field">{{ germplasmGnpis.collector.materialType }}</td> </tr> + + <tr *ngIf="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> + <th class="fieldName" scope="row">Collecting site</th> + <td class="field"><a [routerLink]="['/sites/', germplasmGnpis.collectingSite.siteId]">{{ germplasmGnpis.collectingSite.siteName }}</a></td> + </tr> </table> + + <!--<div class="row" > + <div class="col"> + <table class="table table-sm"> + <thead class="text-white"> + <tr> + <th class="headerTitle" scope="col" colspan="2"> + Collecting site + </th> + </tr> + </thead> + <tr> + <th class="fieldName" scope="row">Name</th> + <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> + </tr> + </table> + </div> + </div>--> </div> </div> @@ -330,7 +332,7 @@ [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> {{ donor.donorInstitute.instituteName }}</a></td> - <td class="field" *ngIf="donor.donationDate!=null">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> + <td class="field" *ngIf="donor.donationDate">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> <ng-template #DonorInstituteTemplate> <table> @@ -356,7 +358,7 @@ href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> </tr> <tr *ngIf="donor.donorInstitute.address!=null"> - <th class="fieldName" scope="row">Adress</th> + <th class="fieldName" scope="row">Address</th> <td class="field">{{ donor.donorInstitute.address }}</td> </tr> </table> @@ -417,7 +419,7 @@ </td> </tr> <tr *ngIf="germplasmGnpis.breeder.institute.address!=null"> - <th class="fieldName" scope="row">Adresse</th> + <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.breeder.institute.address }}</td> </tr> </table> @@ -448,7 +450,7 @@ </td> </tr> <tr *ngIf="germplasmGnpis.collector.institute.address!=null"> - <th class="fieldName" scope="row">Adresse</th> + <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.collector.institute.address }}</td> </tr> </table> @@ -456,8 +458,8 @@ <ng-container *ngIf=" - (germplasmProgeny.result && germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0) - || (germplasmPedigree.result && (germplasmPedigree.result.parent1Name || germplasmPedigree.result.parent2Name))"> + (germplasmProgeny && germplasmProgeny.result && germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0) + || (germplasmPedigree && germplasmPedigree.result && (germplasmPedigree.result.parent1Name || germplasmPedigree.result.parent2Name))"> <div class="row"> <div class="col"> <h4>Genealogy</h4> @@ -600,10 +602,6 @@ <th class="fieldName" scope="row">deregistrationYear</th> <td class="field">{{ germplasmGnpis.collector.deregistrationYear }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.distributionStatus"> - <th class="fieldName" scope="row">distributionStatus</th> - <td class="field">{{ germplasmGnpis.collector.distributionStatus }}</td> - </tr> <tr *ngIf="germplasmGnpis.collector.instituteName"> <th class="fieldName" scope="row">Institute</th> -- GitLab From f128c07d33e367d1c53f0becf452b8ae14c684ef Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Tue, 19 Feb 2019 09:53:35 +0100 Subject: [PATCH 27/29] fix: Fix the linting. Minor fixes. GNP-5424 --- .../germplasm-card.component.html | 112 +++++++++--------- .../germplasm-card.component.ts | 16 ++- 2 files changed, 70 insertions(+), 58 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index a84b4f34..35ef2e32 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -28,15 +28,15 @@ alt="" width="500px"> <div class="card-body"> <table class="table"> - <tr *ngIf="germplasmGnpis.photo.photoName!=null"> + <tr *ngIf="germplasmGnpis.photo.photoName"> <th class="fieldName">Name</th> <td class="field">{{ germplasmGnpis.photo.photoName }}</td> </tr> - <tr *ngIf="germplasmGnpis.photo.description!=null"> + <tr *ngIf="germplasmGnpis.photo.description"> <th class="fieldName">Description</th> <td class="field">{{ germplasmGnpis.photo.description }}</td> </tr> - <tr *ngIf="germplasmGnpis.photo.copyright!=null"> + <tr *ngIf="germplasmGnpis.photo.copyright"> <th class="fieldName">Copyright</th> <td class="field">{{ germplasmGnpis.photo.copyright }}</td> </tr> @@ -55,27 +55,27 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.accessionNumber!=null"> + <tr *ngIf="germplasmGnpis.accessionNumber"> <th class="fieldName" scope="row">Accession number</th> <td class="field">{{ germplasmGnpis.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.acquisitionDate!=null"> + <tr *ngIf="germplasmGnpis.acquisitionDate"> <th class="fieldName" scope="row">Acquisition date</th> <td class="field">{{ germplasmGnpis.acquisitionDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> - <tr *ngIf="germplasmGnpis.germplasmName!=null"> + <tr *ngIf="germplasmGnpis.germplasmName"> <th class="fieldName" scope="row">Germplasm name</th> <td class="field">{{ germplasmGnpis.germplasmName }}</td> </tr> - <tr *ngIf="germplasmGnpis.germplasmPUI!=null"> + <tr *ngIf="germplasmGnpis.germplasmPUI"> <th class="fieldName" scope="row">Permanent Unique Identifier</th> <td class="ellipsis field"> {{ germplasmGnpis.germplasmPUI }}</td> </tr> - <tr *ngIf="germplasmGnpis.seedSource!=null"> + <tr *ngIf="germplasmGnpis.seedSource"> <th class="fieldName" scope="row">Seed source</th> <td class="field">{{ germplasmGnpis.seedSource }}</td> </tr> - <tr *ngIf="germplasmGnpis.geneticNature!=null"> + <tr *ngIf="germplasmGnpis.geneticNature"> <th class="fieldName" scope="row">Genetic nature</th> <td class="field">{{ germplasmGnpis.geneticNature }}</td> </tr> @@ -100,11 +100,11 @@ <!--<td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a>--> <td class="scroll field"><i>{{ germplasmGnpis.taxonSynonyms.join(', ') }}</i></td> </tr> - <tr *ngIf="germplasmGnpis.pedigree!=null"> + <tr *ngIf="germplasmGnpis.pedigree"> <th class="fieldName" scope="row">Pedigree</th> <td class="field">{{ germplasmGnpis.pedigree }}</td> </tr> - <tr *ngIf="germplasmGnpis.biologicalStatusOfAccessionCode!=null"> + <tr *ngIf="germplasmGnpis.biologicalStatusOfAccessionCode"> <th class="fieldName" scope="row">Biological status</th> <td class="field">{{ germplasmGnpis.biologicalStatusOfAccessionCode }}</td> </tr> @@ -116,7 +116,7 @@ <td>Source link</td> <td><a>{{ germplasmGnpis.url }}</a></td> </tr>--> - <tr *ngIf="germplasmGnpis.comment!=null"> + <tr *ngIf="germplasmGnpis.comment"> <th class="fieldName" scope="row">Comments</th> <td class="field">{{ germplasmGnpis.comment }}</td> </tr> @@ -126,7 +126,7 @@ </div> <div class="container"> - <div class="row" *ngIf="germplasmGnpis.holdingInstitute!=null"> + <div class="row" *ngIf="germplasmGnpis.holdingInstitute"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> @@ -164,33 +164,33 @@ <ng-template #holdingInstituteTemplate> <table class="popoverTable"> - <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteCode"> <th class="fieldName" scope="row">FAO code</th> <td class="field">{{ germplasmGnpis.holdingInstitute.instituteCode }}</td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteName"> <th class="fieldName" scope="row">Institute name</th> <td class="field">{{ germplasmGnpis.holdingInstitute.instituteName }}</td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.acronym!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.acronym"> <th class="fieldName" scope="row">Acronym</th> <td class="field">{{ germplasmGnpis.holdingInstitute.acronym }}</td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.organisation!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.organisation"> <th class="fieldName" scope="row">Organisation</th> <td class="field">{{ germplasmGnpis.holdingInstitute.organisation }}</td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.instituteType!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.instituteType"> <th class="fieldName" scope="row">Institute type</th> <td class="field">{{ germplasmGnpis.holdingInstitute.instituteType }}</td> </tr> - <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite!=null"> + <tr class="ellipsis" *ngIf="germplasmGnpis.holdingInstitute.webSite"> <th class="fieldName" scope="row">Link</th> <td class="ellipsis field"><a href="{{ germplasmGnpis.holdingInstitute.webSite }}">{{ germplasmGnpis.holdingInstitute.webSite }}</a> </td> </tr> - <tr *ngIf="germplasmGnpis.holdingInstitute.address!=null"> + <tr *ngIf="germplasmGnpis.holdingInstitute.address"> <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.holdingInstitute.address }}</td> </tr> @@ -199,7 +199,7 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName!=null"> + <div class="row" *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName"> <div class="col"> <table class="table table-sm"> <thead class="text-white"> @@ -217,27 +217,27 @@ {{ germplasmGnpis.breeder.institute.instituteName }} {{ germplasmGnpis.breeder.institute.instituteCode }}</a> </td> </tr> - <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate!=null"> + <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate"> <th class="fieldName" scope="row">Accession Creation date</th> <td class="field">{{ germplasmGnpis.breeder.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.accessionNumber!=null"> + <tr *ngIf="germplasmGnpis.breeder.accessionNumber"> <th class="fieldName" scope="row">Accession number</th> <td class="field">{{ germplasmGnpis.breeder.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.deregistrationYear!=null"> + <tr *ngIf="germplasmGnpis.breeder.deregistrationYear"> <th class="fieldName" scope="row">Deregistration year</th> <td class="field">{{ germplasmGnpis.breeder.deregistrationYear }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.registrationYear!=null"> + <tr *ngIf="germplasmGnpis.breeder.registrationYear"> <th class="fieldName" scope="row">Registration year</th> <td class="field">{{ germplasmGnpis.breeder.registrationYear }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.distributionStatus!=null"> + <tr *ngIf="germplasmGnpis.breeder.distributionStatus"> <th class="fieldName" scope="row">distributionStatus</th> <td class="field">{{ germplasmGnpis.breeder.distributionStatus }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.germplasmPUI!=null"> + <tr *ngIf="germplasmGnpis.breeder.germplasmPUI"> <th class="fieldName" scope="row">germplasmPUI</th> <td class="field">{{ germplasmGnpis.breeder.germplasmPUI }}</td> </tr> @@ -256,33 +256,33 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName"> <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }}</a></td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionCreationDate!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionCreationDate"> <th class="fieldName" scope="row">Accession Creation date</th> <td class="field">{{ germplasmGnpis.collector.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionNumber!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionNumber"> <th class="fieldName" scope="row">Accession number</th> <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.collectors!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.collectors"> <th class="fieldName" scope="row">collectors</th> <td class="field">{{ germplasmGnpis.collector.collectors }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.distributionStatus!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.distributionStatus"> <th class="fieldName" scope="row">distributionStatus</th> <td class="field">{{ germplasmGnpis.collector.distributionStatus }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.germplasmPUI!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.germplasmPUI"> <th class="fieldName" scope="row">germplasmPUI</th> <td class="field">{{ germplasmGnpis.collector.germplasmPUI }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.materialType!=null"> + <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.materialType"> <th class="fieldName" scope="row">Material type</th> <td class="field">{{ germplasmGnpis.collector.materialType }}</td> </tr> @@ -336,28 +336,28 @@ <ng-template #DonorInstituteTemplate> <table> - <tr *ngIf="donor.donorInstitute.instituteCode!=null"> + <tr *ngIf="donor.donorInstitute.instituteCode"> <th class="fieldName" scope="row">Code</th> <td class="field">{{ donor.donorInstitute.instituteCode }}</td> </tr> - <tr *ngIf="donor.donorInstitute.acronym!=null"> + <tr *ngIf="donor.donorInstitute.acronym"> <th class="fieldName" scope="row">Acronym</th> <td class="field">{{ donor.donorInstitute.acronym }}</td> </tr> - <tr *ngIf="donor.donorInstitute.organisation!=null"> + <tr *ngIf="donor.donorInstitute.organisation"> <th class="fieldName" scope="row">Organisation</th> <td class="field">{{ donor.donorInstitute.organisation }}</td> </tr> - <tr *ngIf="donor.donorInstitute.instituteType!=null"> + <tr *ngIf="donor.donorInstitute.instituteType"> <th class="fieldName" scope="row">Type</th> <td class="field">{{ donor.donorInstitute.instituteType }}</td> </tr> - <tr *ngIf="donor.donorInstitute.webSite!=null"> + <tr *ngIf="donor.donorInstitute.webSite"> <th class="fieldName" scope="row">Link</th> <td class="ellipsis field"><a href="{{ donor.donorInstitute.webSite }}">{{ donor.donorInstitute.webSite }}</a></td> </tr> - <tr *ngIf="donor.donorInstitute.address!=null"> + <tr *ngIf="donor.donorInstitute.address"> <th class="fieldName" scope="row">Address</th> <td class="field">{{ donor.donorInstitute.address }}</td> </tr> @@ -367,7 +367,7 @@ </table> </div> </div> - <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName!=null"> + <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName"> <td>Evaluation sites</td> <td>{{ germplasmGnpis.evaluationSites.siteName }}</td> </tr>--> @@ -396,29 +396,29 @@ <ng-template #BreederInstituteTemplate> <table> - <tr *ngIf="germplasmGnpis.breeder.institute.instituteCode!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteCode"> <th class="fieldName" scope="row">Code</th> <td class="field">{{ germplasmGnpis.breeder.institute.instituteCode }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.organisation!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.organisation"> <th class="fieldName" scope="row">Organisation</th> <td class="field">{{ germplasmGnpis.breeder.institute.organisation }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.acronym!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.acronym"> <th class="fieldName" scope="row">Acronym</th> <td class="field">{{ germplasmGnpis.breeder.institute.acronym }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.instituteType!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.instituteType"> <th class="fieldName" scope="row">Type</th> <td class="field">{{ germplasmGnpis.breeder.institute.instituteType }}</td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.webSite!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.webSite"> <th class="fieldName" scope="row">Link</th> <td class="ellipsis field"><a href="{{ germplasmGnpis.breeder.institute.webSite }}">{{ germplasmGnpis.breeder.institute.webSite }}</a> </td> </tr> - <tr *ngIf="germplasmGnpis.breeder.institute.address!=null"> + <tr *ngIf="germplasmGnpis.breeder.institute.address"> <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.breeder.institute.address }}</td> </tr> @@ -427,29 +427,29 @@ <ng-template #CollectorInstituteTemplate> <table> - <tr *ngIf="germplasmGnpis.collector.instituteCode!=null"> + <tr *ngIf="germplasmGnpis.collector.instituteCode"> <th class="fieldName" scope="row">FAO code</th> <td class="field">{{ germplasmGnpis.collector.instituteCode }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.instituteName!=null"> + <tr *ngIf="germplasmGnpis.collector.instituteName"> <th class="fieldName" scope="row">Institute name</th> <td class="field">{{ germplasmGnpis.collector.instituteName }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.acronym!=null"> + <tr *ngIf="germplasmGnpis.collector.acronym"> <th class="fieldName" scope="row">Acronym</th> <td class="field">{{ germplasmGnpis.collector.acronym }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.organisation!=null"> + <tr *ngIf="germplasmGnpis.collector.organisation"> <th class="fieldName" scope="row">Organisation</th> <td class="field">{{ germplasmGnpis.collector.organisation }}</td> </tr> - <tr *ngIf="germplasmGnpis.collector.institute.webSite!=null"> + <tr *ngIf="germplasmGnpis.collector.institute.webSite"> <th class="fieldName" scope="row">Link</th> <td class="ellipsis field"><a href="{{ germplasmGnpis.collector.institute.webSite }}">{{ germplasmGnpis.collector.institute.webSite }}</a> </td> </tr> - <tr *ngIf="germplasmGnpis.collector.institute.address!=null"> + <tr *ngIf="germplasmGnpis.collector.institute.address"> <th class="fieldName" scope="row">Address</th> <td class="field">{{ germplasmGnpis.collector.institute.address }}</td> </tr> @@ -457,15 +457,13 @@ </ng-template> - <ng-container *ngIf=" - (germplasmProgeny && germplasmProgeny.result && germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0) - || (germplasmPedigree && germplasmPedigree.result && (germplasmPedigree.result.parent1Name || germplasmPedigree.result.parent2Name))"> + <ng-container *ngIf="testGenealogy()"> <div class="row"> <div class="col"> <h4>Genealogy</h4> </div> </div> - <div class="row" *ngIf="germplasmPedigree.result!=null"> + <div class="row" *ngIf="germplasmPedigree.result"> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <thead class="text-white"> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index d54b0846..ce06409c 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -53,7 +53,10 @@ export class GermplasmCardComponent implements OnInit { const germplasmAttributes$ = this.brapiService.germplasmAttributes(germplasmId).toPromise(); germplasmAttributes$ .then(germplasmAttributes => { - this.germplasmAttributes = germplasmAttributes.result.data; + if (germplasmAttributes.result) { + this.germplasmAttributes = germplasmAttributes.result.data; + } + }); }); @@ -81,5 +84,16 @@ export class GermplasmCardComponent implements OnInit { } return germplasm$; } + + testGenealogy() { + return (this.germplasmProgeny + && this.germplasmProgeny.result + && this.germplasmProgeny.result.progeny + && this.germplasmProgeny.result.progeny.length > 0) + || + (this.germplasmPedigree + && this.germplasmPedigree.result + && (this.germplasmPedigree.result.parent1Name || this.germplasmPedigree.result.parent2Name)); + } } -- GitLab From e9b93fe5529b59c2cf16cc007ca07e150551fc6a Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Tue, 19 Feb 2019 16:56:15 +0100 Subject: [PATCH 28/29] fix: Minor fixes. GNP-5424 --- .../germplasm-card.component.html | 170 ++++++++---------- .../germplasm-card.component.ts | 19 +- 2 files changed, 91 insertions(+), 98 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 35ef2e32..2eb9d0ab 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -61,7 +61,8 @@ </tr> <tr *ngIf="germplasmGnpis.acquisitionDate"> <th class="fieldName" scope="row">Acquisition date</th> - <td class="field">{{ germplasmGnpis.acquisitionDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> + <td + class="field">{{ germplasmGnpis.acquisitionDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> <tr *ngIf="germplasmGnpis.germplasmName"> <th class="fieldName" scope="row">Germplasm name</th> @@ -85,8 +86,9 @@ </tr> <tr> <th class="fieldName" scope="row">Taxon</th> - <td class="field"><i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i> - {{ germplasmGnpis.speciesAuthority ? '(' + germplasmGnpis.speciesAuthority + ')': '' }} + <td class="field"> + <i>{{ germplasmGnpis.genus }} {{ germplasmGnpis.species }} {{ germplasmGnpis.subtaxa }}</i> + {{ germplasmGnpis.speciesAuthority ? '(' + germplasmGnpis.speciesAuthority + ')' : '' }} </td> </tr> @@ -140,19 +142,20 @@ <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"><a class="btn popovers" data-boundary="window" placement="top" [ngbPopover]="holdingInstituteTemplate" - [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" container="body"> + [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" + container="body"> {{ germplasmGnpis.holdingInstitute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.holdingGenbank.instituteName"> - <th class="fieldName" scope="row">Stock center name</th> - <ng-container *ngIf="germplasmGnpis.holdingGenbank.webSite"> - <td class="field"> - <a href="germplasmGnpis.holdingGenbank.webSite">{{ germplasmGnpis.holdingGenbank.instituteName }}</a> - </td> - </ng-container> - <ng-container *ngIf="!germplasmGnpis.holdingGenbank.webSite"> - <td class="field">{{ germplasmGnpis.holdingGenbank.instituteName }}</td> - </ng-container> + <th class="fieldName" scope="row">Stock center name</th> + <ng-container *ngIf="germplasmGnpis.holdingGenbank.webSite"> + <td class="field"> + <a href="germplasmGnpis.holdingGenbank.webSite">{{ germplasmGnpis.holdingGenbank.instituteName }}</a> + </td> + </ng-container> + <ng-container *ngIf="!germplasmGnpis.holdingGenbank.webSite"> + <td class="field">{{ germplasmGnpis.holdingGenbank.instituteName }}</td> + </ng-container> </tr> <tr *ngIf="germplasmGnpis.presenceStatus"> @@ -199,7 +202,8 @@ </div> </div> - <div class="row" *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName"> + <div class="row" + *ngIf="germplasmGnpis.breeder && germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName"> <div class="col"> <table class="table table-sm"> <thead class="text-white"> @@ -209,7 +213,7 @@ </th> </tr> </thead> - <tr > + <tr> <th class="fieldName" scope="row">Institution</th> <td class="ellipsis field"> <a class="btn popovers" placement="top" [ngbPopover]="BreederInstituteTemplate" @@ -219,7 +223,8 @@ </tr> <tr *ngIf="germplasmGnpis.breeder.accessionCreationDate"> <th class="fieldName" scope="row">Accession Creation date</th> - <td class="field">{{ germplasmGnpis.breeder.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> + <td + class="field">{{ germplasmGnpis.breeder.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> <tr *ngIf="germplasmGnpis.breeder.accessionNumber"> <th class="fieldName" scope="row">Accession number</th> @@ -256,15 +261,18 @@ </th> </tr> </thead> - <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName"> + <tr + *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName"> <th class="fieldName" scope="row">Institution</th> - <td class="ellipsis field"><a class="btn popovers" placement="top" [ngbPopover]="CollectorInstituteTemplate" + <td class="ellipsis field"><a class="btn popovers" placement="top" + [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }}</a></td> </tr> <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionCreationDate"> <th class="fieldName" scope="row">Accession Creation date</th> - <td class="field">{{ germplasmGnpis.collector.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> + <td + class="field">{{ germplasmGnpis.collector.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> </tr> <tr *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.accessionNumber"> <th class="fieldName" scope="row">Accession number</th> @@ -289,7 +297,9 @@ <tr *ngIf="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> <th class="fieldName" scope="row">Collecting site</th> - <td class="field"><a [routerLink]="['/sites/', germplasmGnpis.collectingSite.siteId]">{{ germplasmGnpis.collectingSite.siteName }}</a></td> + <td class="field"><a + [routerLink]="['/sites/', germplasmGnpis.collectingSite.siteId]">{{ germplasmGnpis.collectingSite.siteName }}</a> + </td> </tr> </table> @@ -332,7 +342,8 @@ [ngbPopover]="DonorInstituteTemplate" [popoverTitle]="donor.donorInstitute.instituteName"> {{ donor.donorInstitute.instituteName }}</a></td> - <td class="field" *ngIf="donor.donationDate">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> + <td class="field" + *ngIf="donor.donationDate">{{ donor.donationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }}</td> <ng-template #DonorInstituteTemplate> <table> @@ -367,10 +378,6 @@ </table> </div> </div> - <!--<tr *ngIf="germplasmGnpis.evaluationSites.siteName"> - <td>Evaluation sites</td> - <td>{{ germplasmGnpis.evaluationSites.siteName }}</td> - </tr>--> <div class="row"> <div class="col"> @@ -457,15 +464,15 @@ </ng-template> - <ng-container *ngIf="testGenealogy()"> + <ng-container *ngIf="testPedigree() || testProgeny()"> <div class="row"> <div class="col"> <h4>Genealogy</h4> </div> </div> - <div class="row" *ngIf="germplasmPedigree.result"> + <div class="row"> <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}" *ngIf="testPedigree()"> <thead class="text-white"> <tr> <th class="headerTitle" scope="col" colspan="2"> @@ -481,39 +488,56 @@ <th class="fieldName" scope="row">Crossing year</th> <td class="field">{{ germplasmPedigree.result.crossingYear }}</td> </tr> - <tr> + <tr *ngIf="germplasmPedigree.result.familyCode"> + <th class="fieldName" scope="row">Family code</th> + <td class="field">{{ germplasmPedigree.result.familyCode }}</td> + </tr> + <tr *ngIf="(germplasmPedigree.result.parent1Type || germplasmPedigree.result.parent2Type) + && (germplasmPedigree.result.parent1Type !='UNDEFINED' || germplasmPedigree.result.parent2Type !='UNDEFINED')"> <th scope="row">Parent accessions</th> <td> <table> <ng-container [ngSwitch]="germplasmPedigree.result.parent1Type"> <tr *ngSwitchCase="'FEMALE'"> <th class="fieldName" scope="row">Mother</th> - <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + <td class="field"><a + [routerLink]="'/germplasm'" + [queryParams]="{id:germplasmPedigree.result.parent1DbId}">{{ germplasmPedigree.result.parent1Name }}</a> + </td> </tr> <tr *ngSwitchCase="'MALE'"> <th class="fieldName" scope="row">Father</th> - <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + <td class="field"><a + [routerLink]="'/germplasm'" + [queryParams]="{id:germplasmPedigree.result.parent1DbId}">{{ germplasmPedigree.result.parent1Name }}</a> + </td> </tr> <tr *ngSwitchCase="'SELF'"> - <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> + <td>Self</td> </tr> - <tr *ngSwitchCase="'UNDEFINED'"> + <tr *ngSwitchCase="'POPULATION'"> + <th class="fieldName" scope="row">Population</th> <td class="field">{{ germplasmPedigree.result.parent1Name }}</td> </tr> </ng-container> <ng-container [ngSwitch]="germplasmPedigree.result.parent2Type"> <tr *ngSwitchCase="'FEMALE'"> <th class="fieldName" scope="row">Mother</th> - <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + <td class="field"><a + [routerLink]="'/germplasm'" + [queryParams]="{id:germplasmPedigree.result.parent2DbId}">{{ germplasmPedigree.result.parent2Name }}</a></td> </tr> <tr *ngSwitchCase="'MALE'"> <th class="fieldName" scope="row">Father</th> - <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + <td class="field"><a + [routerLink]="'/germplasm'" + [queryParams]="{id:germplasmPedigree.result.parent2DbId}">{{ germplasmPedigree.result.parent2Name }}</a></td> </tr> <tr *ngSwitchCase="'SELF'"> - <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> + <td>Self</td> </tr> - <tr *ngSwitchCase="'UNDEFINED'"> + <tr *ngSwitchCase="'POPULATION'"> + <th class="fieldName" scope="row">Population</th> <td class="field">{{ germplasmPedigree.result.parent2Name }}</td> </tr> </ng-container> @@ -537,9 +561,12 @@ </thead> <tbody> <tr> - <th class="fieldName" scope="row">Accession numbers</th> - <td class="scroll field"><a routerLink="/germplasm/{{ sibling.germplasmDbId }}" - *ngFor="let sibling of germplasmPedigree.result.siblings"> {{ sibling.defaultDisplayName }}</a> + <th class="fieldName">Accession numbers</th> + <td class="scroll field"> + <ng-container *ngFor="let sibling of germplasmPedigree.result.siblings"> + <a routerLink="/germplasm" [queryParams]="{id:sibling.germplasmDbId }"> + {{ sibling.defaultDisplayName }}</a> + </ng-container> </td> </tr> </tbody> @@ -548,7 +575,7 @@ </div> </ng-container> - <ng-container *ngIf="germplasmProgeny.result.progeny && germplasmProgeny.result.progeny.length > 0"> + <ng-container *ngIf="testProgeny()"> <div class="row "> <div class="col"> <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> @@ -561,9 +588,12 @@ </thead> <tbody> <tr> - <td>Accession numbers</td> + <th class="fieldName">Accession numbers</th> <td class="scroll field"> - <a routerLink="/germplasm/{{ child.germplasmDbId }}" *ngFor="let child of germplasmProgeny.result.progeny"> {{ child.defaultDisplayName }}</a> + <ng-container *ngFor="let child of germplasmProgeny.result.progeny"> + <a routerLink="/germplasm" [queryParams]="{id:child.germplasmDbId }"> + {{ child.defaultDisplayName }}</a> + </ng-container> </td> </tr> </tbody> @@ -573,53 +603,6 @@ </ng-container> </ng-container> - <ng-container *ngIf="germplasmGnpis.collector && germplasmGnpis.collector.length > 0"> - <div class="row"> - <div class="col"> - <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> - <thead class="text-white"> - <tr> - <th class="headerTitle" scope="col" colspan="2"> - Collector - </th> - </tr> - </thead> - <tr *ngIf="germplasmGnpis.collector.accessionNumber"> - <th class="fieldName" scope="row">accessionNumber</th> - <td class="field">{{ germplasmGnpis.collector.accessionNumber }}</td> - </tr> - - <tr *ngIf="germplasmGnpis.collector.collectors && germplasmGnpis.collector.collectors.length > 0"> - <th class="fieldName" scope="row">collectors</th> - <ng-container *ngFor="let collector of germplasmGnpis.collector.collectors"> - <td class="field">{{ collector }}</td> - </ng-container> - </tr> - - <tr *ngIf="germplasmGnpis.collector.deregistrationYear"> - <th class="fieldName" scope="row">deregistrationYear</th> - <td class="field">{{ germplasmGnpis.collector.deregistrationYear }}</td> - </tr> - - <tr *ngIf="germplasmGnpis.collector.instituteName"> - <th class="fieldName" scope="row">Institute</th> - <td class="field">{{ germplasmGnpis.collector.instituteName }}</td> - </tr> - - <tr *ngIf="germplasmGnpis.collector.materialType"> - <th class="fieldName" scope="row">Material type</th> - <td class="field">{{ germplasmGnpis.collector.materialType }}</td> - </tr> - - <tr *ngIf="germplasmGnpis.collector.registrationYear"> - <th class="fieldName" scope="row">Registration Year</th> - <td class="field">{{ germplasmGnpis.collector.registrationYear }}</td> - </tr> - </table> - </div> - </div> - </ng-container> - <ng-container *ngIf="germplasmAttributes && germplasmAttributes.length > 0"> <div class="row"> <div class="col"> @@ -644,8 +627,11 @@ <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <ng-container *ngFor="let collection of germplasmGnpis.collection"> <tr> - <th class="fieldName" scope="row">{{ collection.name }}</th> - <td class="ellipsis field"><a href="/gnpis-core/?germplasmLists={{ collection.name }}&types=Germplasm"> + <th class="fieldName" scope="row"> + {{ collection.type ? collection.name + ' (' + collection.type + ')' : collection.name }} + </th> + <td class="ellipsis field"><a + href="/gnpis-core/?germplasmLists={{ collection.name }}&types=Germplasm"> {{ collection.germplasmCount }} accessions</a> </td> </tr> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index ce06409c..14fa0e9e 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -85,15 +85,22 @@ export class GermplasmCardComponent implements OnInit { return germplasm$; } - testGenealogy() { + testProgeny() { return (this.germplasmProgeny && this.germplasmProgeny.result && this.germplasmProgeny.result.progeny - && this.germplasmProgeny.result.progeny.length > 0) - || - (this.germplasmPedigree - && this.germplasmPedigree.result - && (this.germplasmPedigree.result.parent1Name || this.germplasmPedigree.result.parent2Name)); + && this.germplasmProgeny.result.progeny.length > 0); + } + + testPedigree() { + return (this.germplasmPedigree + && this.germplasmPedigree.result + && (this.germplasmPedigree.result.parent1Name + || this.germplasmPedigree.result.parent2Name + || this.germplasmPedigree.result.crossingPlan + || this.germplasmPedigree.result.crossingYear + || this.germplasmPedigree.result.familyCode) + ); } } -- GitLab From cd01f5e4f799f6be8e93fec1e767226a3a2e2ebd Mon Sep 17 00:00:00 2001 From: mbuy <melanie.buy@inra.fr> Date: Wed, 20 Feb 2019 16:05:35 +0100 Subject: [PATCH 29/29] fix: Fix code based on merge request comments. GNP-5424 --- .../germplasm-card.component.html | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 2eb9d0ab..5fa9f5eb 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -99,7 +99,6 @@ </tr> <tr *ngIf="germplasmGnpis.taxonSynonyms && germplasmGnpis.taxonSynonyms.length > 0"> <th class="fieldName" scope="row">Taxon synonyms</th> - <!--<td class="scroll field"><a *ngFor="let taxonSynonym of germplasmGnpis.taxonSynonyms"> {{ taxonSynonym }}</a>--> <td class="scroll field"><i>{{ germplasmGnpis.taxonSynonyms.join(', ') }}</i></td> </tr> <tr *ngIf="germplasmGnpis.pedigree"> @@ -302,24 +301,6 @@ </td> </tr> </table> - - <!--<div class="row" > - <div class="col"> - <table class="table table-sm"> - <thead class="text-white"> - <tr> - <th class="headerTitle" scope="col" colspan="2"> - Collecting site - </th> - </tr> - </thead> - <tr> - <th class="fieldName" scope="row">Name</th> - <td class="field">{{ germplasmGnpis.collectingSite.siteName }}</td> - </tr> - </table> - </div> - </div>--> </div> </div> @@ -630,8 +611,7 @@ <th class="fieldName" scope="row"> {{ collection.type ? collection.name + ' (' + collection.type + ')' : collection.name }} </th> - <td class="ellipsis field"><a - href="/gnpis-core/?germplasmLists={{ collection.name }}&types=Germplasm"> + <td class="ellipsis field"><a routerLink="" [queryParams]="{germplasmLists: collection.name, types: 'Germplasm'}"> {{ collection.germplasmCount }} accessions</a> </td> </tr> @@ -648,8 +628,10 @@ <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> <ng-container *ngFor="let panel of germplasmGnpis.panel"> <tr> - <th class="fieldName" scope="row">{{ panel.name }}</th> - <td class="field"><a href="/gnpis-core/?germplasmLists={{ panel.name }}&types=Germplasm"> + <th class="fieldName" scope="row"> + {{ panel.type ? panel.name + ' (' + panel.type + ')' : panel.name }} + </th> + <td class="field"><a routerLink="" [queryParams]="{germplasmLists: panel.name, types: 'Germplasm'}"> {{ panel.germplasmCount }} accessions</a></td> </tr> </ng-container> @@ -657,6 +639,25 @@ </div> </div> </ng-container> + + <ng-container *ngIf="germplasmGnpis.population && germplasmGnpis.population.length > 0"> + <div class="row"> + <div class="col"> + <h4 class="headerTitle">Population</h4> + <table class="table table-sm .table-responsive{-sm|-md|-lg|-xl}"> + <ng-container *ngFor="let population of germplasmGnpis.population"> + <tr> + <th class="fieldName" scope="row"> + {{ population.type ? population.name + ' (' + population.type + ')' : population.name }} + </th> + <td class="field"><a routerLink="" [queryParams]="{germplasmLists: population.name, types: 'Germplasm'}"> + {{ population.germplasmCount }} accessions</a></td> + </tr> + </ng-container> + </table> + </div> + </div> + </ng-container> </div> </div> </ng-container> -- GitLab