Commit d79623eb authored by Célia Michotey's avatar Célia Michotey
Browse files

Add link on external taxon ids. Rename photo file attributes. GNP-5096

parent 00ba78e7
......@@ -8,10 +8,10 @@ import fr.inra.urgi.gpds.domain.JSONView;
*/
public interface Photo {
@JsonView(JSONView.GnpISFields.class)
String getFileName();
String getFile();
@JsonView(JSONView.GnpISFields.class)
String getThumbnailFileName();
String getThumbnailFile();
@JsonView(JSONView.GnpISFields.class)
String getPhotoName();
......
......@@ -6,28 +6,28 @@ public class PhotoVO implements Serializable, Photo {
private static final long serialVersionUID = -4993890419772211643L;
private String fileName;
private String thumbnailFileName;
private String file;
private String thumbnailFile;
private String photoName;
private String description;
private String copyright;
@Override
public String getFileName() {
return fileName;
public String getFile() {
return file;
}
public void setFileName(String fileName) {
this.fileName = fileName;
public void setFile(String file) {
this.file = file;
}
@Override
public String getThumbnailFileName() {
return thumbnailFileName;
public String getThumbnailFile() {
return thumbnailFile;
}
public void setThumbnailFileName(String thumbnailFileName) {
this.thumbnailFileName = thumbnailFileName;
public void setThumbnailFile(String thumbnailFile) {
this.thumbnailFile = thumbnailFile;
}
@Override
......
This diff is collapsed.
......@@ -291,6 +291,7 @@ describe('BrapiService', () => {
genusSpeciesSubtaxa: null,
taxonSynonyms: ['pomme', 'api'],
taxonCommonNames: ['pomme', 'api'],
taxonComment: null,
geneticNature: null,
comment: null,
photo: null,
......
......@@ -29,6 +29,7 @@
[test]="germplasmGnpis.species">
<ng-template>
<i>{{ germplasmGnpis.species }}</i>
{{ germplasmGnpis.speciesAuthority ? '(' + germplasmGnpis.speciesAuthority + ')' : '' }}
</ng-template>
</gpds-card-row>
......@@ -37,6 +38,7 @@
[test]="germplasmGnpis.subtaxa">
<ng-template>
<i>{{ germplasmGnpis.subtaxa }}</i>
{{ germplasmGnpis.subtaxaAuthority ? '(' + germplasmGnpis.subtaxaAuthority + ')' : '' }}
</ng-template>
</gpds-card-row>
......@@ -50,53 +52,30 @@
<gpds-card-row
label="Taxon ID"
[test]="germplasmGnpis.taxonIds && germplasmGnpis.taxonIds.length > 0">
<ng-container *ngFor="let taxonId of germplasmGnpis.taxonIds">
<gpds-card-row
[label]="taxonId.sourceName">
[test]="taxonId.url">
<ng-template>
<a [href]="" target="_blank">
{{ taxonId.taxonId }}
</a>
</ng-template>
</gpds-card-row>
<gpds-card-row
[label]="taxonId.sourceName">
[test]="!taxonId.url">
<ng-template></ng-template>
{{ taxonId.taxonId }}
</ng-template>
</gpds-card-row>
</ng-container>
</gpds-card-row>
<gpds-card-row
label="Taxon ID (test)"
[test]="taxonIdsWithURL && taxonIdsWithURL.length > 0">
<ng-container *ngFor="let taxonId of taxonIdsWithURL">
<ng-template>
<ng-container *ngFor="let taxonRef of taxonIdsWithURL">
<gpds-card-row
[label]="taxonId.sourceName">
[test]="taxonId.url">
<ng-template>
<a [href]="" target="_blank">
{{ taxonId.taxonId }}
</a>
</ng-template>
</gpds-card-row>
<gpds-card-row
[label]="taxonRef.sourceName"
[test]="taxonRef.url">
<ng-template>
<a [href]="taxonRef.url" target="_blank">
{{ taxonRef.taxonId }}
</a>
</ng-template>
</gpds-card-row>
<gpds-card-row
[label]="taxonId.sourceName">
[test]="!taxonId.url">
<ng-template></ng-template>
{{ taxonId.taxonId }}
</ng-template>
</gpds-card-row>
</ng-container>
<gpds-card-row
[label]="taxonRef.sourceName"
[test]="!taxonRef.url">
<ng-template>
{{ taxonRef.taxonId }}
</ng-template>
</gpds-card-row>
</ng-container>
</ng-template>
</gpds-card-row>
<gpds-card-row
......@@ -190,12 +169,12 @@
</ng-template>
<!--Section for the image representing the germplasm and the details about this image-->
<div class="col-auto field" *ngIf="germplasmGnpis.photo && germplasmGnpis.photo.thumbnailFileName">
<div class="col-auto field" *ngIf="germplasmGnpis.photo && germplasmGnpis.photo.thumbnailFile">
<a class="btn popovers" data-boundary="window" placement="right"
[ngbPopover]="imageTemplate"
[popoverTitle]="germplasmGnpis.photo.photoName" container="body">
<img
[src]="germplasmGnpis.photo.thumbnailFileName"
[src]="germplasmGnpis.photo.thumbnailFile"
class="img-fluid">
<figcaption class="figure-caption">
Click to see more details
......@@ -205,7 +184,7 @@
<ng-template #imageTemplate>
<div class="card ngb-popover-window ">
<img class="card-img-top"
[src]="germplasmGnpis.photo.fileName"
[src]="germplasmGnpis.photo.file"
alt="" width="250px">
<div class="card-body">
......@@ -291,6 +270,7 @@
[test]="germplasmTaxon">
<ng-template>
<a class="popover-underline" data-boundary="window" placement="top"
[autoClose]="'outside'"
[ngbPopover]="taxonTemplate"
[popoverTitle]="germplasmTaxon"
container="body">
......@@ -666,7 +646,7 @@
<ng-container *ngFor="let sibling of germplasmPedigree.siblings">
<a [routerLink]="['/germplasm']" [queryParams]="{id:sibling.germplasmDbId }">
{{ sibling.defaultDisplayName }}
</a>,
</a>
</ng-container>
</div>
......@@ -689,7 +669,7 @@
<ng-container *ngFor="let sibling of child.sibblings">
<a [routerLink]="['/germplasm']" [queryParams]="{id:sibling.pui}">
{{ sibling.name }}
</a>,
</a>
</ng-container>
</ng-template>
......
......@@ -177,6 +177,7 @@ describe('GermplasmCardComponent', () => {
genusSpeciesSubtaxa: null,
taxonSynonyms: ['pomme', 'api'],
taxonCommonNames: ['pomme', 'api'],
taxonComment: null,
geneticNature: null,
comment: null,
photo: null,
......
......@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { BrapiService } from '../brapi.service';
import { GnpisService } from '../gnpis.service';
import {BrapiAttributeData, BrapiGermplasmPedigree, BrapiLocation, BrapiTaxonIds} from '../models/brapi.model';
import { BrapiAttributeData, BrapiGermplasmPedigree, BrapiLocation, BrapiTaxonIds } from '../models/brapi.model';
import { Children, Germplasm, Site } from '../models/gnpis.model';
import { DataDiscoverySource } from '../models/data-discovery.model';
......@@ -29,10 +29,10 @@ export class GermplasmCardComponent implements OnInit {
});
}
NCBI_URL = "https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=";
THEPLANTLIST_URL = "http://www.theplantlist.org/tpl1.1/record/";
TAXREF_URL = "https://inpn.mnhn.fr/espece/cd_nom/";
CATALOGUEOFLIFE_URL = "http://www.catalogueoflife.org/col/details/species/id/";
NCBI_URL = 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=';
THEPLANTLIST_URL = 'http://www.theplantlist.org/tpl1.1/record/';
TAXREF_URL = 'https://inpn.mnhn.fr/espece/cd_nom/';
CATALOGUEOFLIFE_URL = 'http://www.catalogueoflife.org/col/details/species/id/';
taxonIdsWithURL: BrapiTaxonIds[] = [];
germplasmGnpis: Germplasm;
......@@ -171,8 +171,8 @@ export class GermplasmCardComponent implements OnInit {
this.siteToBrapiLocation(site);
}
}
if (this.germplasmGnpis.taxonIds && germplasmGnpis.taxonId.length > 0) {
this.addRefURL(this.germplasmGnpis.taxonIds);
if (this.germplasmGnpis.taxonIds && this.germplasmGnpis.taxonIds.length > 0) {
this.addRefURL(this.germplasmGnpis.taxonIds);
}
}
......@@ -190,14 +190,14 @@ export class GermplasmCardComponent implements OnInit {
addRefURL(taxonIds: BrapiTaxonIds[]) {
for (const taxonId of taxonIds) {
if (taxonId.sourceName == "NCBI") {
taxonId.url = this.NCBI_URL;
} else if (taxonId.sourceName == "ThePlantList") {
taxonId.url = this.THEPLANTLIST_URL;
} else if (taxonId.sourceName == "TAXREF") {
taxonId.url = this.TAXREF_URL;
} else if (taxonId.sourceName == "CatalogueOfLife") {
taxonId.url = this.CATALOGUEOFLIFE_URL
if (taxonId.sourceName === 'NCBI') {
taxonId.url = this.NCBI_URL + taxonId.taxonId;
} else if (taxonId.sourceName === 'ThePlantList') {
taxonId.url = this.THEPLANTLIST_URL + taxonId.taxonId;
} else if (taxonId.sourceName === 'TAXREF') {
taxonId.url = this.TAXREF_URL + taxonId.taxonId;
} else if (taxonId.sourceName === 'CatalogueOfLife') {
taxonId.url = this.CATALOGUEOFLIFE_URL + taxonId.taxonId;
} else {
taxonId.url = null;
}
......
......@@ -98,6 +98,7 @@ describe('GnpisService', () => {
genusSpeciesSubtaxa: null,
taxonSynonyms: ['pomme', 'api'],
taxonCommonNames: ['pomme', 'api'],
taxonComment: null,
geneticNature: null,
comment: null,
photo: null,
......
......@@ -58,9 +58,9 @@ export interface GermplasmInstitute extends Institute {
export interface Photo {
copyright: string;
description: string;
fileName: string;
file: string;
photoName: string;
thumbnailFileName: string;
thumbnailFile: string;
}
......
......@@ -15,7 +15,7 @@
],
"template-cyclomatic-complexity": [
true,
10
11
]
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment