From 2dbf42c4f36b9578fef35ebdddb926904f59d861 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Wed, 20 Mar 2019 14:44:43 +0100 Subject: [PATCH 1/7] refactor: Use angular-coordinates to display the coordinates with degrees on site card. Issue #15 --- .../app/site-card/site-card.component.html | 10 ++++-- .../app/site-card/site-card.component.spec.ts | 9 ++++-- .../src/app/site-card/site-card.component.ts | 32 ++----------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/frontend/src/app/site-card/site-card.component.html b/frontend/src/app/site-card/site-card.component.html index ba9d335e..f015ec8f 100644 --- a/frontend/src/app/site-card/site-card.component.html +++ b/frontend/src/app/site-card/site-card.component.html @@ -75,12 +75,18 @@ <gpds-card-row label="Latitude" - [value]="formatCoordinates(location.latitude, 'latitude')"> + [test]="location.latitude"> + <ng-template> + {{ location.latitude }} ({{ location.latitude | coordinates:type.ToDegrees:direction.Latitude }}) + </ng-template> </gpds-card-row> <gpds-card-row label="Longitude" - [value]="formatCoordinates(location.longitude, 'longitude')"> + [test]="location.longitude"> + <ng-template> + {{ location.longitude }} ({{ location.longitude | coordinates:type.ToDegrees:direction.Longitude }}) + </ng-template> </gpds-card-row> <gpds-card-row diff --git a/frontend/src/app/site-card/site-card.component.spec.ts b/frontend/src/app/site-card/site-card.component.spec.ts index a8d0604c..bbf6a293 100644 --- a/frontend/src/app/site-card/site-card.component.spec.ts +++ b/frontend/src/app/site-card/site-card.component.spec.ts @@ -14,6 +14,7 @@ import { DataDiscoverySource } from '../models/data-discovery.model'; import { GnpisService } from '../gnpis.service'; import { MockComponent } from 'ng-mocks'; import { XrefsComponent } from '../xrefs/xrefs.component'; +import { CoordinatesPipe, CoordinatesService } from 'angular-coordinates'; describe('SiteCardComponent', () => { @@ -23,6 +24,10 @@ describe('SiteCardComponent', () => { const gnpisService = jasmine.createSpyObj( 'GnpisService', ['getSource'] ); + const coordinatesService = jasmine.createSpyObj( + 'CoordinatesService', ['transform'] + ); + const response: BrapiResult<BrapiLocation> = { metadata: null, result: { @@ -65,12 +70,13 @@ describe('SiteCardComponent', () => { TestBed.configureTestingModule({ declarations: [ SiteCardComponent, MapComponent, LoadingSpinnerComponent, - CardRowComponent, CardSectionComponent, CardTableComponent, + CardRowComponent, CardSectionComponent, CardTableComponent, CoordinatesPipe, MockComponent(XrefsComponent) ], providers: [ { provide: BrapiService, useValue: brapiService }, { provide: GnpisService, useValue: gnpisService }, + { provide: CoordinatesService, useValue: coordinatesService }, { provide: ActivatedRoute, useValue: { @@ -89,7 +95,6 @@ describe('SiteCardComponent', () => { it('should display site', () => { const fixture = TestBed.createComponent(SiteCardComponent); - const component = fixture.componentInstance; brapiService.location.and.returnValues(of(response)); gnpisService.getSource.and.returnValue(of(source)); fixture.detectChanges(); diff --git a/frontend/src/app/site-card/site-card.component.ts b/frontend/src/app/site-card/site-card.component.ts index 0705744e..43bf59a0 100644 --- a/frontend/src/app/site-card/site-card.component.ts +++ b/frontend/src/app/site-card/site-card.component.ts @@ -5,6 +5,7 @@ import { BrapiLocation } from '../models/brapi.model'; import { KeyValueObject } from '../utils'; import { DataDiscoverySource } from '../models/data-discovery.model'; import { GnpisService } from '../gnpis.service'; +import { Direction, TransformationType } from 'angular-coordinates'; @Component({ selector: 'gpds-site-card', @@ -16,6 +17,8 @@ export class SiteCardComponent implements OnInit { location: BrapiLocation; locationSource: DataDiscoverySource; additionalInfos: KeyValueObject[]; + direction = Direction; + type = TransformationType; loading = true; constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { @@ -73,34 +76,5 @@ export class SiteCardComponent implements OnInit { } } } - - formatCoordinates(decimalDegrees: number, type: string): string { - if (decimalDegrees && type) { - const degree = Math.floor(decimalDegrees); - const decimalMinute = (decimalDegrees - degree) * 60; - const minute = Math.floor(decimalMinute); - const decimalSeconde = (decimalMinute - minute) * 60; - const seconde = Math.floor(decimalSeconde); - - let direction = ''; - if (type === 'latitude') { - if (decimalDegrees >= 0) { - direction = 'N'; - } else { - direction = 'S'; - } - } else if (type === 'longitude') { - if (decimalDegrees >= 0) { - direction = 'E'; - } else { - direction = 'W'; - } - } - return decimalDegrees + '° (' + degree + '° ' + minute + '\' ' + seconde + '\'\' ' + direction + ')'; - } else { - return null; - } - } - } -- GitLab From 3feb18c833b3b966c98a8208aada5e08f9cf2822 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Thu, 21 Mar 2019 10:31:59 +0100 Subject: [PATCH 2/7] fix: Center horizontally the image on small screen. Use auto for popover placement. Add non breakable space and space for some field to break on small screen. Fix the point of the markers. Issue #16 --- .../germplasm-card.component.html | 22 +++++++++---------- frontend/src/app/map/map.component.ts | 3 ++- .../result-page/result-page.component.html | 2 +- frontend/src/styles.scss | 4 ++++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 7e3129e8..2d0037ce 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -2,7 +2,7 @@ <ng-container *ngIf="germplasmGnpis"> <h3 class="mb-4"> - <img *ngIf="germplasmGnpis.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName" + <img *ngIf="!loading && germplasmGnpis.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName" [src]="IMAGES_BRC_URL" align="right"/> Germplasm: {{ germplasmGnpis.germplasmName }} @@ -11,7 +11,7 @@ <!-- Display the map --> <gpds-map [locations]="germplasmLocations"></gpds-map> - <div class="row align-items-center"> + <div class="row align-items-center justify-content-center"> <!--Templates for gerplasm card--> <ng-template #holdingInstituteTemplate> @@ -157,7 +157,7 @@ <!--Section for the image representing the germplasm and the details about this image--> <div class="col-auto field" *ngIf="germplasmGnpis.photo && germplasmGnpis.photo.thumbnailFileName"> - <a class="btn popovers" data-boundary="window" placement="right" [ngbPopover]="imageTemplate" + <a class="btn popovers" data-boundary="window" placement="auto" [ngbPopover]="imageTemplate" [popoverTitle]="germplasmGnpis.photo.photoName" container="body"> <img [src]="IMAGES_ACCESSION_URL + germplasmGnpis.holdingGenbank.instituteCode + '/' + germplasmGnpis.photo.thumbnailFileName" @@ -321,7 +321,7 @@ <gpds-card-row label="Institution"> <ng-template> - <a class="popover-underline" data-boundary="window" placement="top" + <a class="popovers" data-boundary="window" placement="auto" [ngbPopover]="holdingInstituteTemplate" [popoverTitle]="germplasmGnpis.holdingInstitute.instituteName" container="body"> @@ -400,15 +400,15 @@ </gpds-card-row> <gpds-card-row - label="Acquisition/Creation date" + label="Acquisition / Creation date" [test]="germplasmGnpis.collector.accessionCreationDate"> <ng-template> - {{ germplasmGnpis.collector.accessionCreationDate | amParse:'YYYYMMDD' | amDateFormat:'YYYY-MM-DD' }} + {{ germplasmGnpis.collector.accessionCreationDate }} </ng-template> </gpds-card-row> <gpds-card-row - label="Acquisition/Creation date" + label="Acquisition / Creation date" [test]="germplasmGnpis.acquisitionDate && !germplasmGnpis.collector.accessionCreationDate"> <ng-template> {{ germplasmGnpis.acquisitionDate }} @@ -419,7 +419,7 @@ label="Institution" [test]="germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName"> <ng-template> - <a class="popovers" placement="top" + <a class="popovers" placement="auto" [ngbPopover]="CollectorInstituteTemplate" [popoverTitle]="germplasmGnpis.collector.institute.instituteName"> {{ germplasmGnpis.collector.institute.instituteName }} @@ -448,7 +448,7 @@ label="Institute" [test]="germplasmGnpis.breeder.institute && germplasmGnpis.breeder.institute.instituteName"> <ng-template> - <a class="popovers" placement="top" + <a class="popovers" placement="auto" [ngbPopover]="BreederInstituteTemplate" [popoverTitle]="germplasmGnpis.breeder.institute.instituteName"> {{ germplasmGnpis.breeder.institute.instituteName }} @@ -542,7 +542,7 @@ </ng-template> <td> - <a class="popovers" placement="top" + <a class="popovers" placement="auto" [ngbPopover]="InstituteTemplate" [popoverTitle]="row.donorInstitute.instituteName"> {{ row.donorInstitute.instituteName }} @@ -623,7 +623,7 @@ </ng-template> <td> - <a class="popovers" placement="top" + <a class="popovers" placement="auto" [ngbPopover]="InstituteTemplate" [popoverTitle]="row.institute.instituteName"> {{ row.institute.instituteName }} diff --git a/frontend/src/app/map/map.component.ts b/frontend/src/app/map/map.component.ts index bc566b84..b4239ecd 100644 --- a/frontend/src/app/map/map.component.ts +++ b/frontend/src/app/map/map.component.ts @@ -37,7 +37,8 @@ export class MapComponent implements OnInit { const markers = new MarkerClusterGroup(); for (const location of this.curatedLocationList) { const icon = L.icon({ - iconUrl: this.getMarkerIconUrl(location) + iconUrl: this.getMarkerIconUrl(location), + iconAnchor: [12, 41], // point of the icon which will correspond to marker's location }); const popupText = ` <b>${location.locationName}</b><br/> diff --git a/frontend/src/app/result-page/result-page.component.html b/frontend/src/app/result-page/result-page.component.html index b8bd5aad..e90fec27 100644 --- a/frontend/src/app/result-page/result-page.component.html +++ b/frontend/src/app/result-page/result-page.component.html @@ -47,7 +47,7 @@ <div class="container"> <div class="row result align-content-center"> <span class="col-4 mt-2 bolder"> - Results : + Results : </span> <span *ngIf="pagination.totalResult" class="col-8 text-right small text-muted mt-3"> From {{ pagination.startResult | number }} to {{ pagination.endResult | number }} diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index e5b4643c..03303a34 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -46,3 +46,7 @@ h3 { left: 720px; background-color: #F9F9F9; } + +.popover { + width: 100%; +} -- GitLab From dfdb41703b2c02030193253bf77b62403ff6b7cc Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Thu, 21 Mar 2019 18:14:25 +0100 Subject: [PATCH 3/7] refactor: Set all the sources images to the same size. Issue #16 --- 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 2d0037ce..a5554c66 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -226,7 +226,7 @@ <ng-template> <a target="_blank" [href]="germplasmSource['schema:url']"> - <img [src]="germplasmSource['schema:image']" alt="Germplasm source image"/> + <img [src]="germplasmSource['schema:image']" alt="Germplasm source image" style="height: 60px"/> </a> </ng-template> </gpds-card-row> -- GitLab From b3829ecf7edd50079cd27646146ca28dd225073e Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Mon, 25 Mar 2019 16:38:49 +0100 Subject: [PATCH 4/7] fix: Fix some issues reference in Issue #15 --- .../app/card-table/card-table.component.html | 32 ++-- .../app/card-table/card-table.component.scss | 20 +- .../germplasm-card.component.html | 37 ++-- .../germplasm-card.component.spec.ts | 4 +- .../germplasm-card.component.ts | 6 +- frontend/src/app/map/map.component.scss | 4 +- frontend/src/app/navbar/navbar.component.html | 4 +- .../document/document.component.html | 14 +- .../result-page/result-page.component.html | 2 +- .../app/site-card/site-card.component.html | 6 +- .../app/study-card/study-card.component.html | 172 +++++++++--------- frontend/src/app/xrefs/xrefs.component.html | 26 +-- frontend/src/environments/environment.ts | 6 +- frontend/src/styles.scss | 19 +- 14 files changed, 185 insertions(+), 167 deletions(-) diff --git a/frontend/src/app/card-table/card-table.component.html b/frontend/src/app/card-table/card-table.component.html index 93b0d733..ad60e888 100644 --- a/frontend/src/app/card-table/card-table.component.html +++ b/frontend/src/app/card-table/card-table.component.html @@ -1,17 +1,15 @@ -<div class="table-responsive scroll-table table-card-body"> - <table class="table table-sm table-striped"> - <thead *ngIf="headers"> - <tr> - <th *ngFor="let header of headers" scope="col"> - {{ header }} - </th> - </tr> - </thead> - <tbody> - <ng-container *ngFor="let row of rows" - [ngTemplateOutlet]="template" - [ngTemplateOutletContext]="{$implicit: row}"> - </ng-container> - </tbody> - </table> -</div> +<table class="table table-sm table-striped"> + <thead *ngIf="headers"> + <tr> + <th *ngFor="let header of headers" scope="col"> + {{ header }} + </th> + </tr> + </thead> + <tbody> + <ng-container *ngFor="let row of rows" + [ngTemplateOutlet]="template" + [ngTemplateOutletContext]="{$implicit: row}"> + </ng-container> + </tbody> +</table> diff --git a/frontend/src/app/card-table/card-table.component.scss b/frontend/src/app/card-table/card-table.component.scss index 85f3be7e..bcf9e148 100644 --- a/frontend/src/app/card-table/card-table.component.scss +++ b/frontend/src/app/card-table/card-table.component.scss @@ -1,19 +1,7 @@ -.scroll-table { - max-height: 200px; - overflow-y: auto; - - thead th { - position: sticky; - top: 0; - background-color: white; - } +thead th { + position: sticky; + top: 0; + background-color: white; } -.table-card-body { - padding: 0; - border: 2px solid rgb(195, 214, 226); - border-top-width: 0px; - border-bottom-left-radius: 0.25rem; - border-bottom-right-radius: 0.25rem; -} diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index a5554c66..36d2a548 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -162,8 +162,8 @@ <img [src]="IMAGES_ACCESSION_URL + germplasmGnpis.holdingGenbank.instituteCode + '/' + germplasmGnpis.photo.thumbnailFileName" class="img-fluid"> - <figcaption class="figure-caption"> - Click to see more details + <figcaption class="figure-caption" style="color: #0f6fa1;"> + © {{ germplasmGnpis.photo.copyright }} </figcaption> </a> @@ -236,7 +236,7 @@ [test]="germplasmSource['schema:identifier'] && germplasmGnpis.documentationURL"> <ng-template> <a target="_blank" [href]="germplasmGnpis.documentationURL"> - Link to this study on {{ germplasmSource['schema:identifier'] }} + Link to this germplasm on {{ germplasmSource['schema:name'] }} </a> </ng-template> </gpds-card-row> @@ -306,6 +306,16 @@ [value]="germplasmGnpis.comment"> </gpds-card-row> + <gpds-card-row + label="Origin site" + [test]="germplasmGnpis.originSite && germplasmGnpis.originSite.siteName"> + <ng-template> + <a [routerLink]="['/sites/', germplasmGnpis.originSite.siteId]"> + {{ germplasmGnpis.originSite.siteName }} + </a> + </ng-template> + </gpds-card-row> + </div> </ng-template> </gpds-card-section> @@ -313,7 +323,7 @@ <!--Section for the information about the holding of the germplasm--> <gpds-card-section - header="Holding" + header="Depositary" [test]="germplasmGnpis.holdingInstitute"> <ng-template> <div class="card-body card-section-body"> @@ -358,21 +368,11 @@ <gpds-card-section - header="Collecting" + header="Collector" [test]="checkOriginCollecting()"> <ng-template> <div class="card-body card-section-body"> - <gpds-card-row - label="Origin site" - [test]="germplasmGnpis.originSite && germplasmGnpis.originSite.siteName"> - <ng-template> - <a [routerLink]="['/sites/', germplasmGnpis.originSite.siteId]"> - {{ germplasmGnpis.originSite.siteName }} - </a> - </ng-template> - </gpds-card-row> - <gpds-card-row label="Collecting site" [test]="germplasmGnpis.collectingSite && germplasmGnpis.collectingSite.siteName"> @@ -483,6 +483,7 @@ header="Donor" [test]="germplasmGnpis.donors && germplasmGnpis.donors.length > 0"> <ng-template> + <div class="table-responsive scroll-table table-card-body"> <gpds-card-table [headers]="[ 'Institute name', @@ -556,6 +557,7 @@ </ng-template> </gpds-card-table> + </div> </ng-template> </gpds-card-section> @@ -563,6 +565,7 @@ header="Distributor" [test]="germplasmGnpis.distributors && germplasmGnpis.distributors.length>0"> <ng-template> + <div class="table-responsive scroll-table table-card-body"> <!--TODO : Add order column when ordering URL will be available--> <gpds-card-table @@ -635,7 +638,7 @@ </ng-template> </gpds-card-table> - + </div> </ng-template> </gpds-card-section> @@ -840,7 +843,7 @@ <ng-container *ngFor="let panel of germplasmGnpis.panel"> <gpds-card-row - [label]="panel.type ? panel.name + ' (' + panel.type + ')' : panel.name"> + [label]="panel.type ? panel.name.replace(toReplace, ' ') + ' (' + panel.type + ')' : panel.name.replace(toReplace,' ')"> <ng-template> <a [routerLink]="['/']" [queryParams]="{germplasmLists: panel.name, types: 'Germplasm'}"> 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 5b068168..b235e43a 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -245,8 +245,8 @@ describe('GermplasmCardComponent', () => { tester.detectChanges(); expect(tester.title).toContainText('Germplasm: test'); expect(tester.cardHeader[0]).toContainText('Identification'); - expect(tester.cardHeader[1]).toContainText('Holding'); - expect(tester.cardHeader[2]).toContainText('Collecting'); + expect(tester.cardHeader[1]).toContainText('Depositary'); + expect(tester.cardHeader[2]).toContainText('Collector'); expect(tester.cardHeader[3]).toContainText('Breeder'); expect(tester.cardHeader[4]).toContainText('Donor'); expect(tester.cardHeader[5]).toContainText('Distributor'); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index fa665b58..1b76c9f6 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -37,8 +37,9 @@ export class GermplasmCardComponent implements OnInit { germplasmId: string; germplasmPuid: string; germplasmSource: DataDiscoverySource; + toReplace = /_/g; - // TODO extract those url in a configuration file. + // TODO extract those url in a configuration file. URL maybe be added during extraction. IMAGES_ACCESSION_URL = 'https://urgi.versailles.inra.fr/files/siregal/images/accession/'; IMAGES_INSTITUTION_URL = 'https://urgi.versailles.inra.fr/files/siregal/images//institution/'; IMAGES_BRC_URL = 'https://urgi.versailles.inra.fr/files/siregal/images/grc/inra_brc_en.png'; @@ -211,8 +212,7 @@ export class GermplasmCardComponent implements OnInit { checkOriginCollecting() { - return (this.germplasmGnpis.originSite && this.germplasmGnpis.originSite.siteName) - || (this.germplasmGnpis.collectingSite && this.germplasmGnpis.collectingSite.siteName) + return (this.germplasmGnpis.collectingSite && this.germplasmGnpis.collectingSite.siteName) || (this.checkCollectorInstituteObject() || this.checkCollectorInstituteFields()); } diff --git a/frontend/src/app/map/map.component.scss b/frontend/src/app/map/map.component.scss index 5f9ab2fd..90a43b30 100644 --- a/frontend/src/app/map/map.component.scss +++ b/frontend/src/app/map/map.component.scss @@ -1,7 +1,7 @@ #map { border: #0f6e9f solid 1px; - height: 600px; - width: 100% + height: 400px; + width: 100%; } #maplegend { diff --git a/frontend/src/app/navbar/navbar.component.html b/frontend/src/app/navbar/navbar.component.html index 0f8b7fc4..bc6e1f49 100644 --- a/frontend/src/app/navbar/navbar.component.html +++ b/frontend/src/app/navbar/navbar.component.html @@ -11,13 +11,13 @@ <li class="nav-item" *ngFor="let link of navbar.links"> <!-- Simple link --> - <div *ngIf="!link.subMenu"> + <div class="mr-2" *ngIf="!link.subMenu"> <a class="nav-link d-flex align-items-center" [href]="link.url" target="_blank">{{ link.label }}</a> </div> <!-- OR Dropdown button --> - <div *ngIf="link.subMenu" class="dropdown-container" ngbDropdown> + <div class="mr-2" *ngIf="link.subMenu" class="dropdown-container" ngbDropdown> <!-- Toggle button --> <a class="nav-link d-flex align-items-center dropdown-toggle" ngbDropdownToggle diff --git a/frontend/src/app/result-page/document/document.component.html b/frontend/src/app/result-page/document/document.component.html index af8a669f..9933a612 100644 --- a/frontend/src/app/result-page/document/document.component.html +++ b/frontend/src/app/result-page/document/document.component.html @@ -13,16 +13,18 @@ </a> <a class="title" *ngIf="getRouterLink() && !document['@type'].includes('Phenotyping Study')" [routerLink]="getRouterLink()" [queryParams]="getQueryParam()"> - {{ document["schema:name"] }} + {{ document["schema:name"] }}, </a> + <small> + or link to this + <a *ngIf="getURL()" [href]="getURL()" target="_blank"> + {{ document['@type'] }} on {{ document['schema:includedInDataCatalog']['schema:name'] }} + </a> + </small> </h5> - <h5> - <a class="title" *ngIf="getURL()" [href]="getURL()" target="_blank"> - ({{ document['schema:includedInDataCatalog']['schema:identifier'] }} data source link) - </a> - </h5> <span class="text-justify description"> + <strong>Description :</strong><br> <ng-container *ngIf="!needTruncation || opened"> {{ document["schema:description"] }} diff --git a/frontend/src/app/result-page/result-page.component.html b/frontend/src/app/result-page/result-page.component.html index e90fec27..9d881d09 100644 --- a/frontend/src/app/result-page/result-page.component.html +++ b/frontend/src/app/result-page/result-page.component.html @@ -47,7 +47,7 @@ <div class="container"> <div class="row result align-content-center"> <span class="col-4 mt-2 bolder"> - Results : + Results: </span> <span *ngIf="pagination.totalResult" class="col-8 text-right small text-muted mt-3"> From {{ pagination.startResult | number }} to {{ pagination.endResult | number }} diff --git a/frontend/src/app/site-card/site-card.component.html b/frontend/src/app/site-card/site-card.component.html index f015ec8f..a7e46465 100644 --- a/frontend/src/app/site-card/site-card.component.html +++ b/frontend/src/app/site-card/site-card.component.html @@ -9,8 +9,6 @@ <gpds-map [locations]="[location]"></gpds-map> - - <gpds-card-section header="Details"> <ng-template> @@ -22,7 +20,7 @@ <ng-template> <a target="_blank" [href]="locationSource['schema:url']"> - <img [src]="locationSource['schema:image']" alt="Location source image"/> + <img [src]="locationSource['schema:image']" alt="Location source image" style="height: 60px"/> </a> </ng-template> </gpds-card-row> @@ -32,7 +30,7 @@ [test]="location && location['schema:identifier'] && location.documentationURL"> <ng-template> <a target="_blank" [href]="location.documentationURL"> - Link to this study on {{ location['schema:identifier'] }} + Link to this site on {{ location['schema:name'] }} </a> </ng-template> </gpds-card-row> diff --git a/frontend/src/app/study-card/study-card.component.html b/frontend/src/app/study-card/study-card.component.html index 358fd637..96e859d4 100644 --- a/frontend/src/app/study-card/study-card.component.html +++ b/frontend/src/app/study-card/study-card.component.html @@ -36,7 +36,7 @@ <ng-template> <a target="_blank" [href]="studySource['schema:url']"> - <img [src]="studySource['schema:image']" alt="Study source image"/> + <img [src]="studySource['schema:image']" alt="Study source image" style="height: 60px"/> </a> </ng-template> </gpds-card-row> @@ -46,7 +46,7 @@ [test]="studySource && studySource['schema:identifier'] && study.documentationURL"> <ng-template> <a target="_blank" [href]="study.documentationURL"> - Link to this study on {{ studySource["schema:identifier"] }} + Link to this study on {{ studySource["schema:name"] }} </a> </ng-template> </gpds-card-row> @@ -118,25 +118,27 @@ header="Genotype" [test]="studyGermplasms && studyGermplasms.length != 0"> <ng-template> - <gpds-card-table - [headers]="[ + <div class="table-responsive scroll-table table-card-body"> + <gpds-card-table + [headers]="[ 'Accession number', 'Name', 'Taxon' ]" - [rows]="studyGermplasms"> - <ng-template let-row> - <tr> - <td> - <a [routerLink]="'/germplasm'" [queryParams]="{id:row.germplasmDbId}"> - {{ row.accessionNumber }} - </a> - </td> - <td>{{ row.germplasmName }}</td> - <td>{{ row.genus }} {{ row.species }} {{ row.subtaxa }}</td> - </tr> - </ng-template> - </gpds-card-table> + [rows]="studyGermplasms"> + <ng-template let-row> + <tr> + <td> + <a [routerLink]="'/germplasm'" [queryParams]="{id:row.germplasmDbId}"> + {{ row.accessionNumber }} + </a> + </td> + <td>{{ row.germplasmName }}</td> + <td>{{ row.genus }} {{ row.species }} {{ row.subtaxa }}</td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> @@ -145,31 +147,33 @@ header="Variables" [test]="studyObservationVariables && studyObservationVariables.length != 0"> <ng-template> - <gpds-card-table - [headers]="[ + <div class="table-responsive scroll-table table-card-body"> + <gpds-card-table + [headers]="[ 'Variable id', 'Variable short name', 'Variable long name', 'Ontology name', 'Trait description' ]" - [rows]="studyObservationVariables"> - <ng-template let-row> - <tr> - <td> - <ng-template #name>{{ row.observationVariableDbId }}</ng-template> - <ng-template #link> - <a target="_blank" [href]=row.documentationURL>{{ row.observationVariableDbId }}</a> - </ng-template> - <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> - </td> - <td>{{ row.name }}</td> - <td>{{ row.synonyms[0] }}</td> - <td>{{ row.ontologyName }}</td> - <td>{{ row.trait.description }}</td> - </tr> - </ng-template> - </gpds-card-table> + [rows]="studyObservationVariables"> + <ng-template let-row> + <tr> + <td> + <ng-template #name>{{ row.observationVariableDbId }}</ng-template> + <ng-template #link> + <a target="_blank" [href]=row.documentationURL>{{ row.observationVariableDbId }}</a> + </ng-template> + <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> + </td> + <td>{{ row.name }}</td> + <td>{{ row.synonyms[0] }}</td> + <td>{{ row.ontologyName }}</td> + <td>{{ row.trait.description }}</td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> @@ -177,34 +181,36 @@ header="Data Set" [test]="studyDataset && studyDataset.length != 0"> <ng-template> - <gpds-card-table - [headers]="[ + <div class="table-responsive scroll-big-table table-card-body"> + <gpds-card-table + [headers]="[ 'Name', 'Type', 'Linked studies identifiers' ]" - [rows]="studyDataset"> - <ng-template let-row> - <tr> - <td> - <ng-template #name>{{ row.trialName }}</ng-template> - <ng-template #link> - <a target="_blank" [href]=row.documentationURL>{{ row.trialName }}</a> - </ng-template> - <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> - </td> - <td>{{ row.trialType }}</td> - <td width="60%"> - <ng-container *ngFor="let trialStudy of row.studies"> - <a - [routerLink]="['/studies', trialStudy.studyDbId]"> - {{ trialStudy.studyName.trim() }} - </a>; - </ng-container> - </td> - </tr> - </ng-template> - </gpds-card-table> + [rows]="studyDataset"> + <ng-template let-row> + <tr> + <td> + <ng-template #name>{{ row.trialName }}</ng-template> + <ng-template #link> + <a target="_blank" [href]=row.documentationURL>{{ row.trialName }}</a> + </ng-template> + <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> + </td> + <td>{{ row.trialType }}</td> + <td width="60%"> + <ng-container *ngFor="let trialStudy of row.studies"> + <a + [routerLink]="['/studies', trialStudy.studyDbId]"> + {{ trialStudy.studyName.trim() }} + </a>; + </ng-container> + </td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> @@ -212,23 +218,25 @@ header="Contact" [test]="study.contacts && study.contacts.length != 0"> <ng-template> - <gpds-card-table - [headers]="[ + <div class="table-responsive scroll-table table-card-body"> + <gpds-card-table + [headers]="[ 'Role', 'Name', 'Email', 'Institution' ]" - [rows]="study.contacts"> - <ng-template let-row> - <tr> - <td>{{ row.type }}</td> - <td>{{ row.name }}</td> - <td>{{ row.email }}</td> - <td>{{ row.institutionName }}</td> - </tr> - </ng-template> - </gpds-card-table> + [rows]="study.contacts"> + <ng-template let-row> + <tr> + <td>{{ row.type }}</td> + <td>{{ row.name }}</td> + <td>{{ row.email.replace('@', ' at ') }}</td> + <td>{{ row.institutionName }}</td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> @@ -236,15 +244,17 @@ header="Additional information" [test]="additionalInfos && additionalInfos.length != 0"> <ng-template> - <gpds-card-table - [rows]="additionalInfos"> - <ng-template let-row> - <tr> - <td width="50%">{{ row.key }}</td> - <td>{{ row.value }}</td> - </tr> - </ng-template> - </gpds-card-table> + <div class="table-responsive scroll-table table-card-body"> + <gpds-card-table + [rows]="additionalInfos"> + <ng-template let-row> + <tr> + <td width="50%">{{ row.key }}</td> + <td>{{ row.value }}</td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> diff --git a/frontend/src/app/xrefs/xrefs.component.html b/frontend/src/app/xrefs/xrefs.component.html index 36d80e9b..139a96d9 100644 --- a/frontend/src/app/xrefs/xrefs.component.html +++ b/frontend/src/app/xrefs/xrefs.component.html @@ -1,22 +1,24 @@ <gpds-card-section *ngIf="xrefs.length > 0" header="Cross References"> <ng-template> - <gpds-card-table - [headers]="[ + <div class="table-responsive scroll-big-table table-card-body"> + <gpds-card-table + [headers]="[ 'Name', 'Source', 'Type', 'Description' ]" - [rows]=xrefs> - <ng-template let-crossRef> - <tr> - <td><a [href]="crossRef.url">{{ crossRef.db_version }}</a></td> - <td>{{ crossRef.database_name }}</td> - <td>{{ crossRef.entry_type }}</td> - <td>{{ crossRef.description | slice:0:120 }}...</td> - </tr> - </ng-template> - </gpds-card-table> + [rows]=xrefs> + <ng-template let-crossRef> + <tr> + <td><a [href]="crossRef.url" target="_blank">{{ crossRef.db_version }}</a></td> + <td>{{ crossRef.database_name }}</td> + <td>{{ crossRef.entry_type }}</td> + <td>{{ crossRef.description | slice:0:120 }}...</td> + </tr> + </ng-template> + </gpds-card-table> + </div> </ng-template> </gpds-card-section> diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index 081a6813..6694c2ec 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -17,9 +17,9 @@ export const environment = { ] }, { label: 'GNPIS', url: 'https://urgi.versailles.inra.fr/gnpis/' }, - { label: 'CIRAD', url: 'http://tropgenedb.cirad.fr/' }, - { label: 'VIB', url: 'http://pippa.psb.ugent.be' }, - { label: 'IBET', url: 'https://biodata.pt' } + { label: 'CIRAD TropGENE', url: 'http://tropgenedb.cirad.fr/' }, + { label: 'VIB Pippa', url: 'http://pippa.psb.ugent.be' }, + { label: 'IBET BioData', url: 'https://biodata.pt' } ] } diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 03303a34..704f989f 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -22,6 +22,14 @@ h3 { border-bottom-right-radius: 0.25rem; } +.table-card-body { + padding: 0; + border: 2px solid rgb(195, 214, 226); + border-top-width: 0px; + border-bottom-left-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; +} + .row-sep { border-top: 1px solid #f0f0f0; } @@ -31,7 +39,7 @@ h3 { } .content-overflow { - max-height: 175px; + max-height: 200px; overflow-y: auto; } @@ -39,6 +47,15 @@ h3 { max-height: 275px; overflow: auto; } +.scroll-table { + max-height: 200px; + overflow-y: auto; +} + +.scroll-big-table { + max-height: 500px; + overflow-y: auto; +} .display-spinner-front { position: absolute; -- GitLab From 0b6527a9f77786300a42b6ffcdc78593cc86fb57 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Tue, 26 Mar 2019 17:07:34 +0100 Subject: [PATCH 5/7] fix: Use subscribe on queryParams to reload germplasm card. Fix a max size for popover. Fix prod environment. Change logo name to see if fix image display. #15 --- .../gpds/repository/file/datasources.jsonld | 2 +- .../file/logos/{VIB_40h.png => VIB.png} | Bin .../germplasm-card.component.html | 2 +- .../germplasm-card.component.spec.ts | 19 ++--- .../germplasm-card.component.ts | 72 ++++++++---------- .../document/document.component.html | 10 +-- frontend/src/app/xrefs/xrefs.component.html | 6 +- frontend/src/app/xrefs/xrefs.component.ts | 1 - frontend/src/environments/environment.prod.ts | 6 +- frontend/src/styles.scss | 1 + 10 files changed, 54 insertions(+), 65 deletions(-) rename backend/src/main/resources/fr/inra/urgi/gpds/repository/file/logos/{VIB_40h.png => VIB.png} (100%) diff --git a/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/datasources.jsonld b/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/datasources.jsonld index 6b319a01..a019c38e 100644 --- a/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/datasources.jsonld +++ b/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/datasources.jsonld @@ -17,7 +17,7 @@ "schema:identifier": "VIB", "schema:name": "VIB PIPPA", "schema:url": "http://pippa.psb.ugent.be", - "schema:image": "./logos/VIB_40h.png" + "schema:image": "./logos/VIB.png" }, { "@type": "schema:DataCatalog", diff --git a/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/logos/VIB_40h.png b/backend/src/main/resources/fr/inra/urgi/gpds/repository/file/logos/VIB.png similarity index 100% rename from backend/src/main/resources/fr/inra/urgi/gpds/repository/file/logos/VIB_40h.png rename to backend/src/main/resources/fr/inra/urgi/gpds/repository/file/logos/VIB.png diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 36d2a548..11599fd6 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -171,7 +171,7 @@ <div class="card ngb-popover-window "> <img class="card-img-top" [src]="IMAGES_ACCESSION_URL + germplasmGnpis.holdingGenbank.instituteCode + '/' + germplasmGnpis.photo.fileName" - alt="" width="250px"> + alt="" style="max-width:500px; max-height:550px"> <div class="card-body"> <gpds-card-row 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 b235e43a..8cfddcc5 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, speculoosMatchers } from 'ngx-speculoos'; +import { ComponentTester, fakeRoute, speculoosMatchers } from 'ngx-speculoos'; import { GnpisService } from '../gnpis.service'; import { BrapiService } from '../brapi.service'; -import { ActivatedRoute, convertToParamMap } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { of } from 'rxjs'; @@ -204,6 +204,10 @@ describe('GermplasmCardComponent', () => { 'schema:image': null }; + const activatedRoute = fakeRoute({ + queryParams: of({ id: 'test' }) + }); + beforeEach(async(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule, NgbPopoverModule, MomentModule], @@ -214,16 +218,7 @@ describe('GermplasmCardComponent', () => { providers: [ { provide: BrapiService, useValue: brapiService }, { provide: GnpisService, useValue: gnpisService }, - { - provide: ActivatedRoute, - useValue: { - snapshot: { - queryParams: convertToParamMap({ - id: 'test' - }) - } - } - } + { 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 1b76c9f6..369d48a8 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; import { GnpisService } from '../gnpis.service'; import { BrapiAttributeData, BrapiGermplasmPedigree, BrapiLocation } from '../models/brapi.model'; @@ -18,15 +18,7 @@ export class GermplasmCardComponent implements OnInit { constructor(private brapiService: BrapiService, private gnpisService: GnpisService, - private route: ActivatedRoute, - private router: Router) { - - this.router.events.subscribe((event: any) => { - // If it is a NavigationEnd event re-initalise the component - if (this.alreadyInitialize && event instanceof NavigationEnd) { - this.ngOnInit(); - } - }); + private route: ActivatedRoute) { } germplasmGnpis: Germplasm; @@ -51,42 +43,44 @@ export class GermplasmCardComponent implements OnInit { ngOnInit() { - this.germplasmId = this.route.snapshot.queryParams.id; - this.germplasmPuid = this.route.snapshot.queryParams.pui; + this.route.queryParams.subscribe(queryParams => { - const germplasm$ = this.getGermplasm(this.germplasmId, this.germplasmPuid); - germplasm$.then(result => { - const germplasmId = this.germplasmId ? this.germplasmId : result.germplasmDbId; + this.germplasmId = queryParams.id; + this.germplasmPuid = queryParams.pui; - // TODO use the progeny call when the information about parent will be added. - /*const germplasmProgeny$ = this.brapiService.germplasmProgeny(germplasmId).toPromise(); - germplasmProgeny$ - .then(germplasmProgeny => { - this.germplasmProgeny = germplasmProgeny.result; - });*/ + const germplasm$ = this.getGermplasm(this.germplasmId, this.germplasmPuid); + germplasm$.then(result => { + const germplasmId = this.germplasmId ? this.germplasmId : result.germplasmDbId; - const germplasmPedigree$ = this.brapiService.germplasmPedigree(germplasmId).toPromise(); - germplasmPedigree$ - .then(germplasmPedigree => { - this.germplasmPedigree = germplasmPedigree.result; - }); + // TODO use the progeny call when the information about parent will be added. + /*const germplasmProgeny$ = this.brapiService.germplasmProgeny(germplasmId).toPromise(); + germplasmProgeny$ + .then(germplasmProgeny => { + this.germplasmProgeny = germplasmProgeny.result; + });*/ - const germplasmAttributes$ = this.brapiService.germplasmAttributes(germplasmId).toPromise(); - germplasmAttributes$ - .then(germplasmAttributes => { - if (germplasmAttributes.result.data) { - this.germplasmAttributes = germplasmAttributes.result.data.sort(this.compareAttributes); - } + const germplasmPedigree$ = this.brapiService.germplasmPedigree(germplasmId).toPromise(); + germplasmPedigree$ + .then(germplasmPedigree => { + this.germplasmPedigree = germplasmPedigree.result; + }); - }); - }); + const germplasmAttributes$ = this.brapiService.germplasmAttributes(germplasmId).toPromise(); + germplasmAttributes$ + .then(germplasmAttributes => { + if (germplasmAttributes.result && germplasmAttributes.result.data) { + this.germplasmAttributes = germplasmAttributes.result.data.sort(this.compareAttributes); + } - this.loaded = Promise.all([germplasm$]); - this.loaded.then(() => { - this.loading = false; - this.alreadyInitialize = true; - }); + }); + }); + this.loaded = Promise.all([germplasm$]); + this.loaded.then(() => { + this.loading = false; + this.alreadyInitialize = true; + }); + }); } getGermplasm(id: string, pui: string): Promise<Germplasm> { diff --git a/frontend/src/app/result-page/document/document.component.html b/frontend/src/app/result-page/document/document.component.html index 9933a612..9d45b021 100644 --- a/frontend/src/app/result-page/document/document.component.html +++ b/frontend/src/app/result-page/document/document.component.html @@ -13,12 +13,12 @@ </a> <a class="title" *ngIf="getRouterLink() && !document['@type'].includes('Phenotyping Study')" [routerLink]="getRouterLink()" [queryParams]="getQueryParam()"> - {{ document["schema:name"] }}, + {{ document["schema:name"] }} </a> - <small> - or link to this - <a *ngIf="getURL()" [href]="getURL()" target="_blank"> - {{ document['@type'] }} on {{ document['schema:includedInDataCatalog']['schema:name'] }} + <small *ngIf="getURL()"> + or link to + <a [href]="getURL()" target="_blank"> + this {{ document['@type'] }} on {{ document['schema:includedInDataCatalog']['schema:name'] }} </a> </small> </h5> diff --git a/frontend/src/app/xrefs/xrefs.component.html b/frontend/src/app/xrefs/xrefs.component.html index 139a96d9..fad07520 100644 --- a/frontend/src/app/xrefs/xrefs.component.html +++ b/frontend/src/app/xrefs/xrefs.component.html @@ -5,9 +5,9 @@ <gpds-card-table [headers]="[ 'Name', - 'Source', - 'Type', - 'Description' + 'Source', + 'Type', + 'Description' ]" [rows]=xrefs> <ng-template let-crossRef> diff --git a/frontend/src/app/xrefs/xrefs.component.ts b/frontend/src/app/xrefs/xrefs.component.ts index 3a7ff5c7..67b885cc 100644 --- a/frontend/src/app/xrefs/xrefs.component.ts +++ b/frontend/src/app/xrefs/xrefs.component.ts @@ -21,6 +21,5 @@ export class XrefsComponent implements OnInit { this.xrefs = xrefs; } ); - } } diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index 2b34b7fd..835e5cc9 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -14,9 +14,9 @@ export const environment = { ] }, { label: 'GNPIS', url: 'https://urgi.versailles.inra.fr/gnpis/' }, - { label: 'CIRAD', url: 'http://tropgenedb.cirad.fr/' }, - { label: 'VIB', url: 'http://pippa.psb.ugent.be' }, - { label: 'IBET', url: 'https://biodata.pt' } + { label: 'CIRAD TropGENE', url: 'http://tropgenedb.cirad.fr/' }, + { label: 'VIB Pippa', url: 'http://pippa.psb.ugent.be' }, + { label: 'IBET BioData', url: 'https://biodata.pt' } ] } diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 704f989f..71d08582 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -66,4 +66,5 @@ h3 { .popover { width: 100%; + max-width:500px; } -- GitLab From 3bfcc671f3ed94052a8d9bc29fcfd954bc3a85b1 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Tue, 30 Apr 2019 19:08:36 +0200 Subject: [PATCH 6/7] feat: Create Germplasm-Result-Page component. Implement web service to get germplasm list for Germplasm-result-page. GNP-4309 --- .../v1/GermplasmResultController.java | 40 +++++++++++++ .../criteria/GermplasmCriteriaImpl.java | 58 +++++++++++++++++++ .../urgi/gpds/filter/AngularRouteFilter.java | 2 +- frontend/angular.json | 13 ++++- frontend/package.json | 5 ++ frontend/src/app/app-routing.module.ts | 4 +- frontend/src/app/app.module.ts | 10 +++- .../germplasm-result-page.component.html | 45 ++++++++++++++ .../germplasm-result-page.component.scss | 0 .../germplasm-result-page.component.spec.ts | 25 ++++++++ .../germplasm-result-page.component.ts | 43 ++++++++++++++ 11 files changed, 239 insertions(+), 6 deletions(-) create mode 100644 backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java create mode 100644 backend/src/main/java/fr/inra/urgi/gpds/domain/criteria/GermplasmCriteriaImpl.java create mode 100644 frontend/src/app/germplasm-result-page/germplasm-result-page.component.html create mode 100644 frontend/src/app/germplasm-result-page/germplasm-result-page.component.scss create mode 100644 frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts create mode 100644 frontend/src/app/germplasm-result-page/germplasm-result-page.component.ts diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java new file mode 100644 index 00000000..018be8b7 --- /dev/null +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java @@ -0,0 +1,40 @@ +package fr.inra.urgi.gpds.api.faidaire.v1; + +import fr.inra.urgi.gpds.domain.brapi.v1.response.BrapiListResponse; +import fr.inra.urgi.gpds.domain.criteria.GermplasmCriteriaImpl; +import fr.inra.urgi.gpds.domain.data.germplasm.GermplasmVO; +import fr.inra.urgi.gpds.domain.response.ApiResponseFactory; +import fr.inra.urgi.gpds.domain.response.PaginatedList; +import fr.inra.urgi.gpds.domain.response.Pagination; +import fr.inra.urgi.gpds.repository.es.GermplasmRepository; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +@Api(tags = {"Faidare API"}, description = "Faidare API") +@RestController +@RequestMapping(value = "/faidare/v1/germplasmResults") +public class GermplasmResultController { + + private final GermplasmRepository germplasmRepository; + + @Autowired + public GermplasmResultController(GermplasmRepository germplasmRepository) { + this.germplasmRepository = germplasmRepository; + } + + @ApiOperation("Get list of germplasm according to criteria") + @GetMapping() + public BrapiListResponse<GermplasmVO> getGermplasmResults(@Valid GermplasmCriteriaImpl criteria) { + PaginatedList<GermplasmVO> pager = germplasmRepository.find(criteria); + Pagination pagination = pager.getPagination(); + return ApiResponseFactory.createListResponse(pagination,null, pager); + } + + +} diff --git a/backend/src/main/java/fr/inra/urgi/gpds/domain/criteria/GermplasmCriteriaImpl.java b/backend/src/main/java/fr/inra/urgi/gpds/domain/criteria/GermplasmCriteriaImpl.java new file mode 100644 index 00000000..57edd381 --- /dev/null +++ b/backend/src/main/java/fr/inra/urgi/gpds/domain/criteria/GermplasmCriteriaImpl.java @@ -0,0 +1,58 @@ +package fr.inra.urgi.gpds.domain.criteria; + +import fr.inra.urgi.gpds.domain.criteria.base.PaginationCriteriaImpl; +import fr.inra.urgi.gpds.domain.data.germplasm.GermplasmVO; +import fr.inra.urgi.gpds.elasticsearch.criteria.annotation.CriteriaForDocument; +import fr.inra.urgi.gpds.elasticsearch.criteria.annotation.DocumentPath; + +import java.util.List; + + +@CriteriaForDocument(GermplasmVO.class) +public class GermplasmCriteriaImpl extends PaginationCriteriaImpl implements GermplasmSearchCriteria { + + @DocumentPath({"accessionNumber"}) + private List<String> accessionNumber; + + public List<String> getAccessionNumber() { + return accessionNumber; + } + + public void setAccessionNumber(List<String> accessionNumber) { + this.accessionNumber = accessionNumber; + } + + + @DocumentPath({"germplasmName"}) + private List<String> accessionName; + + public List<String> getAccessionName() { + return accessionName; + } + public void setAccessionName(List<String> accessionName) { + this.accessionName = accessionName; + } + + + @DocumentPath({"species"}) + private List<String> taxon; + + public List<String> getTaxon() { + return taxon; + } + public void setTaxon(List<String> taxon) { + this.taxon = taxon; + } + + + @DocumentPath("instituteName") + private List<String> institution; + + public List<String> getInstitution() { + return institution; + } + public void setInstitution(List<String> institution) { + this.institution = institution; + } + +} diff --git a/backend/src/main/java/fr/inra/urgi/gpds/filter/AngularRouteFilter.java b/backend/src/main/java/fr/inra/urgi/gpds/filter/AngularRouteFilter.java index d307c542..d9166068 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/filter/AngularRouteFilter.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/filter/AngularRouteFilter.java @@ -34,7 +34,7 @@ import java.util.Arrays; public class AngularRouteFilter implements Filter { private static final String[] API_PREFIXES = { - "/brapi/v1", "/gnpis/v1", "/actuator", "/v2/api-docs", "/swagger-resources" + "/brapi/v1", "/gnpis/v1", "/faidare/v1", "/actuator", "/v2/api-docs", "/swagger-resources" }; private static final String[] STATIC_SUFFIXES = { diff --git a/frontend/angular.json b/frontend/angular.json index 76b5e5d4..6f6d4803 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -39,9 +39,18 @@ "src/styles.scss", "node_modules/leaflet/dist/leaflet.css", "node_modules/leaflet.markercluster/dist/MarkerCluster.css", - "node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css" + "node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css", + "node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss", + "node_modules/@fortawesome/fontawesome-free/scss/solid.scss", + "node_modules/@fortawesome/fontawesome-free/scss/regular.scss", + "node_modules/@fortawesome/fontawesome-free/scss/brands.scss", + "node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss", + "node_modules/angular-bootstrap-md/scss/mdb-free.scss" + ], + "scripts": [ + "node_modules/chart.js/dist/Chart.js", + "node_modules/hammerjs/hammer.min.js" ], - "scripts": [], "baseHref": "/gpds-dev/", "es5BrowserSupport": true }, diff --git a/frontend/package.json b/frontend/package.json index 20b0faab..55516b3d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,14 +21,19 @@ "@angular/platform-browser": "7.2.7", "@angular/platform-browser-dynamic": "7.2.7", "@angular/router": "7.2.7", + "@fortawesome/fontawesome-free": "^5.8.1", "@ng-bootstrap/ng-bootstrap": "4.0.0", + "@types/chart.js": "^2.7.51", "@types/leaflet": "1.2.14", "@types/leaflet.markercluster": "1.0.3", + "angular-bootstrap-md": "7.5.0", "angular-coordinates": "1.0.0", "angular-mocks": "1.7.8", "bootstrap": "4.1.3", + "chart.js": "^2.5.0", "core-js": "2.5.7", "font-awesome": "4.7.0", + "hammerjs": "^2.0.8", "leaflet": "1.3.4", "leaflet.markercluster": "1.4.1", "moment": "2.24.0", diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 3833afd2..63d6f103 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -4,12 +4,14 @@ 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'; +import { GermplasmResultPageComponent } from './germplasm-result-page/germplasm-result-page.component'; export const routes: Routes = [ { path: 'studies/:id', component: StudyCardComponent }, { path: 'sites/:id', component: SiteCardComponent }, { path: '', component: ResultPageComponent }, - { path: 'germplasm', component: GermplasmCardComponent } + { path: 'germplasm', component: GermplasmCardComponent }, + { path: 'germplasm-result-page', component: GermplasmResultPageComponent } ]; @NgModule({ diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index a6a37d9d..4d64f38f 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -25,6 +25,8 @@ import { CardTableComponent } from './card-table/card-table.component'; import { MomentModule } from 'ngx-moment'; import { XrefsComponent } from './xrefs/xrefs.component'; import { CoordinatesModule } from 'angular-coordinates'; +import { BadgeModule, IconsModule, MDBBootstrapModule } from 'angular-bootstrap-md'; +import { GermplasmResultPageComponent } from './germplasm-result-page/germplasm-result-page.component'; @NgModule({ @@ -46,7 +48,8 @@ import { CoordinatesModule } from 'angular-coordinates'; CardSectionComponent, LoadingSpinnerComponent, CardTableComponent, - XrefsComponent + XrefsComponent, + GermplasmResultPageComponent ], imports: [ BrowserModule, @@ -60,7 +63,10 @@ import { CoordinatesModule } from 'angular-coordinates'; FormsModule, ReactiveFormsModule, MomentModule, - CoordinatesModule + CoordinatesModule, + MDBBootstrapModule.forRoot(), + IconsModule, + BadgeModule ], providers: [ { provide: HTTP_INTERCEPTORS, useExisting: ErrorInterceptorService, multi: true } diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html new file mode 100644 index 00000000..1970397f --- /dev/null +++ b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html @@ -0,0 +1,45 @@ +<div class="table-responsive"> + <table mdbTable #tableEl="mdbTable" class="z-depth-1"> + <thead> + <tr> + <th [mdbTableSort]="elements" sortBy="id">Accession number + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + <th [mdbTableSort]="elements" sortBy="first.nick">Accession name + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + <th [mdbTableSort]="elements" sortBy="last">Taxon + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + <th [mdbTableSort]="elements" sortBy="handle">Biological status + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + <th [mdbTableSort]="elements" sortBy="handle">Country of origin + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + <th [mdbTableSort]="elements" sortBy="handle">Country of collect + <mdb-icon fas="" icon="sort" class="fas"><i class="fa-sort fas"></i></mdb-icon> + </th> + </tr> + </thead> + <tbody> + <tr *ngFor="let el of elements; let i = index"> + <th *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" + scope="row">{{el.id}}</th> + <td + *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.first.nick }}</td> + <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.last }}</td> + <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.handle }}</td> + <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.handle }}</td> + <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.handle }}</td> + </tr> + </tbody> + <tfoot class="grey lighten-5 w-100"> + <tr> + <td colspan="6"> + <mdb-table-pagination [tableEl]="tableEl" [searchDataSource]="elements"></mdb-table-pagination> + </td> + </tr> + </tfoot> + </table> +</div> diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.scss b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts new file mode 100644 index 00000000..dc6b03f9 --- /dev/null +++ b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GermplasmResultPageComponent } from './germplasm-result-page.component'; + +describe('GermplasmResultPageComponent', () => { + let component: GermplasmResultPageComponent; + let fixture: ComponentFixture<GermplasmResultPageComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [GermplasmResultPageComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(GermplasmResultPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.ts b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.ts new file mode 100644 index 00000000..9fc7e3cb --- /dev/null +++ b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.ts @@ -0,0 +1,43 @@ +import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; +import { MdbTableDirective, MdbTablePaginationComponent } from 'angular-bootstrap-md'; + +@Component({ + selector: 'gpds-germplasm-result-page', + templateUrl: './germplasm-result-page.component.html', + styleUrls: ['./germplasm-result-page.component.scss'] +}) +export class GermplasmResultPageComponent implements OnInit, AfterViewInit { + + @ViewChild(MdbTablePaginationComponent) mdbTablePagination: MdbTablePaginationComponent; + @ViewChild(MdbTableDirective) mdbTable: MdbTableDirective; + + constructor(private cdRef: ChangeDetectorRef) { + } + + elements: any = []; + previous: any = []; + + ngOnInit() { + for (let i = 1; i <= 11; i++) { + this.elements.push({ + id: i, + first: { nick: 'Nick ' + i, name: 'Name ' + i }, + last: 'Name ' + i, + handle: 'Handle ' + i + }); + } + + this.mdbTable.setDataSource(this.elements); + this.elements = this.mdbTable.getDataSource(); + this.previous = this.mdbTable.getDataSource(); + } + + ngAfterViewInit() { + this.mdbTablePagination.setMaxVisibleItemsNumberTo(10); + + this.mdbTablePagination.calculateFirstItemIndex(); + this.mdbTablePagination.calculateLastItemIndex(); + this.cdRef.detectChanges(); + } + +} -- GitLab From ebcc55020d5744eb5f259b066e728621de5d3a87 Mon Sep 17 00:00:00 2001 From: jdestin <jeremy.destin@inra.fr> Date: Mon, 6 May 2019 16:39:13 +0200 Subject: [PATCH 7/7] refactor: Change GnpIs api to Faidare api. GNP-4309 --- .../{gnpis => faidare}/v1/DataDiscoveryController.java | 6 +++--- .../v1/GermplasmResultController.java | 2 +- .../api/{gnpis => faidare}/v1/GnpISExceptionHandler.java | 4 ++-- .../{gnpis => faidare}/v1/GnpISGermplasmController.java | 6 +++--- .../api/{gnpis => faidare}/v1/GnpISJSONViewHandler.java | 4 ++-- .../api/{gnpis => faidare}/v1/XRefDocumentController.java | 6 +++--- .../gpds/repository/es/DataDiscoveryRepositoryImpl.java | 2 +- .../inra/urgi/gpds/service/es/GermplasmServiceImpl.java | 2 +- .../v1/GnpISGermplasmControllerTest.java | 8 ++++---- frontend/proxy.conf.js | 2 +- .../germplasm-result-page.component.html | 2 +- .../germplasm-result-page.component.spec.ts | 2 ++ frontend/src/app/gnpis.service.ts | 2 +- 13 files changed, 25 insertions(+), 23 deletions(-) rename backend/src/main/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/DataDiscoveryController.java (94%) rename backend/src/main/java/fr/inra/urgi/gpds/api/{faidaire => faidare}/v1/GermplasmResultController.java (97%) rename backend/src/main/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/GnpISExceptionHandler.java (95%) rename backend/src/main/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/GnpISGermplasmController.java (96%) rename backend/src/main/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/GnpISJSONViewHandler.java (89%) rename backend/src/main/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/XRefDocumentController.java (89%) rename backend/src/test/java/fr/inra/urgi/gpds/api/{gnpis => faidare}/v1/GnpISGermplasmControllerTest.java (96%) diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/DataDiscoveryController.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/DataDiscoveryController.java similarity index 94% rename from backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/DataDiscoveryController.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/DataDiscoveryController.java index 25579d0f..34de0a10 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/DataDiscoveryController.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/DataDiscoveryController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.domain.brapi.v1.response.BrapiListResponse; import fr.inra.urgi.gpds.domain.datadiscovery.criteria.DataDiscoveryCriteriaImpl; @@ -20,9 +20,9 @@ import java.util.Collection; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"Faidare API"}, description = "Faidare API") @RestController -@RequestMapping(value = "/gnpis/v1/datadiscovery") +@RequestMapping(value = "/faidare/v1/datadiscovery") public class DataDiscoveryController { private final DataDiscoveryRepository dataDiscoveryRepository; diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GermplasmResultController.java similarity index 97% rename from backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GermplasmResultController.java index 018be8b7..018b48a2 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/faidaire/v1/GermplasmResultController.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GermplasmResultController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.faidaire.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.domain.brapi.v1.response.BrapiListResponse; import fr.inra.urgi.gpds.domain.criteria.GermplasmCriteriaImpl; diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISExceptionHandler.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISExceptionHandler.java similarity index 95% rename from backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISExceptionHandler.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISExceptionHandler.java index a1849425..0a5952be 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISExceptionHandler.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISExceptionHandler.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.api.BadRequestException; import fr.inra.urgi.gpds.api.NotFoundException; @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; * * @author gcornut */ -@ControllerAdvice(basePackages = "fr.inra.urgi.gpds.api.gnpis.v1") +@ControllerAdvice(basePackages = "fr.inra.urgi.gpds.api.faidare.v1") public class GnpISExceptionHandler { /** diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmController.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmController.java similarity index 96% rename from backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmController.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmController.java index 7a075530..f062608e 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmController.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import com.google.common.base.Strings; import fr.inra.urgi.gpds.api.BadRequestException; @@ -23,9 +23,9 @@ import java.util.Collections; import static org.springframework.web.bind.annotation.RequestMethod.GET; -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"Faidare API"}, description = "Faidare API") @RestController -@RequestMapping(value = "/gnpis/v1/germplasm") +@RequestMapping(value = "/faidare/v1/germplasm") public class GnpISGermplasmController { private final GermplasmService germplasmService; diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISJSONViewHandler.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISJSONViewHandler.java similarity index 89% rename from backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISJSONViewHandler.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISJSONViewHandler.java index 41e14ce7..270cd8da 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISJSONViewHandler.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISJSONViewHandler.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.domain.JSONView; import org.springframework.core.MethodParameter; @@ -12,7 +12,7 @@ import org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJack /** * @author gcornut */ -@ControllerAdvice(basePackages = "fr.inra.urgi.gpds.api.gnpis.v1") +@ControllerAdvice(basePackages = "fr.inra.urgi.gpds.api.faidare.v1") public class GnpISJSONViewHandler extends AbstractMappingJacksonResponseBodyAdvice { @Override diff --git a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/XRefDocumentController.java b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/XRefDocumentController.java similarity index 89% rename from backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/XRefDocumentController.java rename to backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/XRefDocumentController.java index 1ae63a8a..34df38a7 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/api/gnpis/v1/XRefDocumentController.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/api/faidare/v1/XRefDocumentController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.domain.response.PaginatedList; import fr.inra.urgi.gpds.domain.xref.XRefDocumentSearchCriteria; @@ -17,7 +17,7 @@ import java.util.List; /** * Imported and adapted from unified-interface legacy */ -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"Faidare API"}, description = "Faidare API") @RestController public class XRefDocumentController { @@ -29,7 +29,7 @@ public class XRefDocumentController { } @ApiOperation("Find xref documents") - @GetMapping(value = "/gnpis/v1/xref/documentbyfulltextid") + @GetMapping(value = "/faidare/v1/xref/documentbyfulltextid") public PaginatedList<XRefDocumentVO> documentByFullTextId( @RequestParam(required = false, value = "entry_type") String entryType, @RequestParam(required = false) List<String> linkedRessourcesID diff --git a/backend/src/main/java/fr/inra/urgi/gpds/repository/es/DataDiscoveryRepositoryImpl.java b/backend/src/main/java/fr/inra/urgi/gpds/repository/es/DataDiscoveryRepositoryImpl.java index e171ee28..dfbf1740 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/repository/es/DataDiscoveryRepositoryImpl.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/repository/es/DataDiscoveryRepositoryImpl.java @@ -1,6 +1,6 @@ package fr.inra.urgi.gpds.repository.es; -import fr.inra.urgi.gpds.api.gnpis.v1.DataDiscoveryController; +import fr.inra.urgi.gpds.api.faidare.v1.DataDiscoveryController; import fr.inra.urgi.gpds.domain.datadiscovery.criteria.DataDiscoveryCriteria; import fr.inra.urgi.gpds.domain.datadiscovery.criteria.DataDiscoveryCriteriaImpl; import fr.inra.urgi.gpds.domain.datadiscovery.data.DataDiscoveryDocument; diff --git a/backend/src/main/java/fr/inra/urgi/gpds/service/es/GermplasmServiceImpl.java b/backend/src/main/java/fr/inra/urgi/gpds/service/es/GermplasmServiceImpl.java index d48999a9..3e076459 100644 --- a/backend/src/main/java/fr/inra/urgi/gpds/service/es/GermplasmServiceImpl.java +++ b/backend/src/main/java/fr/inra/urgi/gpds/service/es/GermplasmServiceImpl.java @@ -1,7 +1,7 @@ package fr.inra.urgi.gpds.service.es; import com.opencsv.CSVWriter; -import fr.inra.urgi.gpds.api.gnpis.v1.GnpISGermplasmController; +import fr.inra.urgi.gpds.api.faidare.v1.GnpISGermplasmController; import fr.inra.urgi.gpds.domain.criteria.GermplasmSearchCriteria; import fr.inra.urgi.gpds.domain.data.germplasm.GermplasmVO; import fr.inra.urgi.gpds.domain.data.germplasm.PedigreeVO; diff --git a/backend/src/test/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmControllerTest.java b/backend/src/test/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmControllerTest.java similarity index 96% rename from backend/src/test/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmControllerTest.java rename to backend/src/test/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmControllerTest.java index a446c818..3d74afcc 100644 --- a/backend/src/test/java/fr/inra/urgi/gpds/api/gnpis/v1/GnpISGermplasmControllerTest.java +++ b/backend/src/test/java/fr/inra/urgi/gpds/api/faidare/v1/GnpISGermplasmControllerTest.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.gpds.api.gnpis.v1; +package fr.inra.urgi.gpds.api.faidare.v1; import fr.inra.urgi.gpds.domain.criteria.GermplasmGETSearchCriteria; import fr.inra.urgi.gpds.domain.criteria.GermplasmSearchCriteria; @@ -71,7 +71,7 @@ class GnpISGermplasmControllerTest { when(service.find(criteriaCaptor.capture())).thenReturn(germplasmPage); String pui = "doi:10.15454/1.4921786234137117E12"; - mockMvc.perform(get("/gnpis/v1/germplasm?pui=" + pui) + mockMvc.perform(get("/faidare/v1/germplasm?pui=" + pui) .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); @@ -85,7 +85,7 @@ class GnpISGermplasmControllerTest { @Test void should_Return_Bad_Request_With_No_Param() throws Exception { - mockMvc.perform(get("/gnpis/v1/germplasm") + mockMvc.perform(get("/faidare/v1/germplasm") .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isBadRequest()); } @@ -114,7 +114,7 @@ class GnpISGermplasmControllerTest { when(service.find(any(GermplasmSearchCriteria.class))).thenReturn(germplasmPage); - mockMvc.perform(get("/gnpis/v1/germplasm?pui=foo") + mockMvc.perform(get("/faidare/v1/germplasm?pui=foo") .contentType(MediaType.APPLICATION_JSON_UTF8)) // Should not have private fields diff --git a/frontend/proxy.conf.js b/frontend/proxy.conf.js index 28c5f743..b89ebbaf 100644 --- a/frontend/proxy.conf.js +++ b/frontend/proxy.conf.js @@ -2,7 +2,7 @@ const PROXY_CONFIG = [ { context: [ "/gpds-dev/brapi", - "/gpds-dev/gnpis", + "/gpds-dev/faidare", ], target: "http://localhost:8380", secure: false diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html index 1970397f..6a2f9ead 100644 --- a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html +++ b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.html @@ -25,7 +25,7 @@ <tbody> <tr *ngFor="let el of elements; let i = index"> <th *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" - scope="row">{{el.id}}</th> + scope="row">{{ el.id }}</th> <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.first.nick }}</td> <td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex">{{ el.last }}</td> diff --git a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts index dc6b03f9..fcddcb47 100644 --- a/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts +++ b/frontend/src/app/germplasm-result-page/germplasm-result-page.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { GermplasmResultPageComponent } from './germplasm-result-page.component'; +import { MDBBootstrapModule } from 'angular-bootstrap-md'; describe('GermplasmResultPageComponent', () => { let component: GermplasmResultPageComponent; @@ -8,6 +9,7 @@ describe('GermplasmResultPageComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ + imports: [MDBBootstrapModule.forRoot()], declarations: [GermplasmResultPageComponent] }) .compileComponents(); diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/gnpis.service.ts index 7b47607f..f93dfe71 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/gnpis.service.ts @@ -8,7 +8,7 @@ import { Germplasm } from './models/gnpis.model'; import { XrefResponse } from './models/xref.model'; -export const BASE_URL = 'gnpis/v1'; +export const BASE_URL = 'faidare/v1'; @Injectable({ providedIn: 'root' -- GitLab