Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
urgi-is
FAIDARE
Commits
a6db1694
Commit
a6db1694
authored
Mar 07, 2019
by
Jérémy Destin
Committed by
Célia Michotey
Mar 19, 2019
Browse files
feat: Manage fields displayed in germplasm card. Minor fixes. issue 11
parent
b21eb5d7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
frontend/src/app/germplasm-card/germplasm-card.component.html
View file @
a6db1694
This diff is collapsed.
Click to expand it.
frontend/src/app/germplasm-card/germplasm-card.component.ts
View file @
a6db1694
...
...
@@ -2,8 +2,9 @@ import { Component, OnInit } from '@angular/core';
import
{
ActivatedRoute
,
NavigationEnd
,
Router
}
from
'
@angular/router
'
;
import
{
BrapiService
}
from
'
../brapi.service
'
;
import
{
GnpisService
}
from
'
../gnpis.service
'
;
import
{
Germplasm
,
GermplasmProgeny
}
from
'
../models/gnpis.germplasm.model
'
;
import
{
Germplasm
,
GermplasmProgeny
,
Site
}
from
'
../models/gnpis.germplasm.model
'
;
import
{
BrapiGermplasmAttributes
,
BrapiGermplasmPedigree
}
from
'
../models/brapi.germplasm.model
'
;
import
{
BrapiLocation
}
from
'
../models/brapi.model
'
;
@
Component
({
selector
:
'
gpds-germplasm-card
'
,
...
...
@@ -32,9 +33,13 @@ export class GermplasmCardComponent implements OnInit {
germplasmPedigree
:
BrapiGermplasmPedigree
;
germplasmProgeny
:
GermplasmProgeny
[];
germplasmAttributes
:
BrapiGermplasmAttributes
[];
germplasmLocations
:
BrapiLocation
[]
=
[];
germplasmId
:
string
;
germplasmPuid
:
string
;
IMAGES_SIREGAL_URL
=
'
https://urgi.versailles.inra.fr/files/siregal/images/accession
'
;
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
'
;
loaded
:
Promise
<
any
>
;
loading
=
true
;
...
...
@@ -89,6 +94,11 @@ export class GermplasmCardComponent implements OnInit {
.
then
(
germplasmGnpis
=>
{
this
.
germplasmGnpis
=
germplasmGnpis
;
this
.
germplasmProgeny
=
germplasmGnpis
.
children
;
this
.
siteToBrapiLocation
(
this
.
germplasmGnpis
.
collectingSite
);
this
.
siteToBrapiLocation
(
this
.
germplasmGnpis
.
originSite
);
for
(
const
site
of
this
.
germplasmGnpis
.
evaluationSites
)
{
this
.
siteToBrapiLocation
(
site
);
}
});
}
else
{
germplasm$
=
this
.
gnpisService
.
germplasmByPuid
(
pui
).
toPromise
();
...
...
@@ -100,26 +110,38 @@ export class GermplasmCardComponent implements OnInit {
return
germplasm$
;
}
siteToBrapiLocation
(
site
:
Site
)
{
if
(
site
.
siteId
&&
site
.
latitude
&&
site
.
longitude
)
{
this
.
germplasmLocations
.
push
({
locationDbId
:
site
.
siteId
,
locationName
:
site
.
siteName
,
locationType
:
site
.
siteType
,
latitude
:
site
.
latitude
,
longitude
:
site
.
longitude
});
}
}
// TODO: use a generic function to get path in object (or null if non-existent)
test
Progeny
()
{
check
Progeny
()
{
return
(
this
.
germplasmProgeny
&&
this
.
germplasmProgeny
.
length
>
0
);
}
test
Breeder
()
{
check
Breeder
()
{
return
(
this
.
germplasmGnpis
.
breeder
)
&&
(
this
.
germplasmGnpis
.
breeder
.
institute
.
instituteName
||
this
.
germplasmGnpis
.
breeder
.
germplasmPUI
||
this
.
germplasmGnpis
.
breeder
.
accessionNumber
||
this
.
germplasmGnpis
.
breeder
.
accessionCreationDate
||
this
.
germplasmGnpis
.
breeder
.
materialType
||
this
.
germplasmGnpis
.
breeder
.
collectors
||
this
.
germplasmGnpis
.
breeder
.
registrationYear
||
this
.
germplasmGnpis
.
breeder
.
deregistrationYear
||
this
.
germplasmGnpis
.
breeder
.
distributionStatus
);
||
this
.
germplasmGnpis
.
breeder
.
germplasmPUI
||
this
.
germplasmGnpis
.
breeder
.
accessionNumber
||
this
.
germplasmGnpis
.
breeder
.
accessionCreationDate
||
this
.
germplasmGnpis
.
breeder
.
materialType
||
this
.
germplasmGnpis
.
breeder
.
collectors
||
this
.
germplasmGnpis
.
breeder
.
registrationYear
||
this
.
germplasmGnpis
.
breeder
.
deregistrationYear
||
this
.
germplasmGnpis
.
breeder
.
distributionStatus
);
}
test
Pedigree
()
{
check
Pedigree
()
{
return
(
this
.
germplasmPedigree
&&
(
this
.
germplasmPedigree
.
parent1Name
||
this
.
germplasmPedigree
.
parent2Name
...
...
@@ -130,14 +152,14 @@ export class GermplasmCardComponent implements OnInit {
}
test
CollectorInstituteObject
()
{
check
CollectorInstituteObject
()
{
return
(
this
.
germplasmGnpis
.
collector
&&
this
.
germplasmGnpis
.
collector
.
institute
&&
this
.
germplasmGnpis
.
collector
.
institute
.
instituteName
);
}
test
CollectorInstituteFields
()
{
check
CollectorInstituteFields
()
{
return
(
this
.
germplasmGnpis
.
collector
)
&&
(
this
.
germplasmGnpis
.
collector
.
germplasmPUI
||
this
.
germplasmGnpis
.
collector
.
accessionNumber
...
...
@@ -150,12 +172,10 @@ export class GermplasmCardComponent implements OnInit {
);
}
test
Origin
()
{
check
Origin
Collecting
()
{
return
(
this
.
germplasmGnpis
.
originSite
&&
this
.
germplasmGnpis
.
originSite
.
siteName
)
||
(
this
.
germplasmGnpis
.
donors
&&
this
.
germplasmGnpis
.
donors
.
length
>
0
)
||
((
this
.
testCollectorInstituteObject
()
||
this
.
testCollectorInstituteFields
())
||
(
this
.
germplasmGnpis
.
collectingSite
&&
this
.
germplasmGnpis
.
collectingSite
.
siteName
))
||
(
this
.
germplasmGnpis
.
breeder
);
||
(
this
.
germplasmGnpis
.
collectingSite
&&
this
.
germplasmGnpis
.
collectingSite
.
siteName
)
||
(
this
.
checkCollectorInstituteObject
()
||
this
.
checkCollectorInstituteFields
());
}
}
frontend/src/app/models/brapi.germplasm.model.ts
View file @
a6db1694
...
...
@@ -47,10 +47,3 @@ export interface BrapiDonor {
donorInstitute
:
Institute
;
}
export
interface
BrapiSet
{
germplasmCount
:
number
;
germplasmRef
:
string
;
id
:
number
;
name
:
string
;
type
:
string
;
}
frontend/src/app/models/brapi.model.ts
View file @
a6db1694
...
...
@@ -55,12 +55,12 @@ export interface BrapiLocation extends BrapiHasDocumentationURL {
locationDbId
:
string
;
locationName
:
string
;
locationType
:
string
;
abbreviation
:
string
;
countryCode
:
string
;
countryName
:
string
;
institutionAddress
:
string
;
institutionName
:
string
;
altitude
:
number
;
abbreviation
?
:
string
;
countryCode
?
:
string
;
countryName
?
:
string
;
institutionAddress
?
:
string
;
institutionName
?
:
string
;
altitude
?
:
number
;
latitude
:
number
;
longitude
:
number
;
additionalInfo
?:
AdditionalInfo
;
...
...
frontend/src/app/models/gnpis.germplasm.model.ts
View file @
a6db1694
import
{
BrapiDescriptor
,
BrapiDonor
,
BrapiSet
}
from
'
./brapi.germplasm.model
'
;
import
{
BrapiDescriptor
,
BrapiDonor
}
from
'
./brapi.germplasm.model
'
;
export
interface
Site
{
latitude
:
number
;
longitude
:
number
;
siteId
:
number
;
siteId
:
string
;
siteName
:
string
;
siteType
:
string
;
}
...
...
@@ -54,7 +54,6 @@ export interface GermplasmProgeny {
sibblings
:
{
name
:
string
;
pui
:
string
;
value
:
string
;
}[];
}
...
...
@@ -102,11 +101,23 @@ export interface Germplasm {
collector
:
Origin
;
breeder
:
Origin
;
distributors
:
Origin
[];
panel
:
Brapi
Set
[];
collection
:
Brapi
Set
[];
population
:
Brapi
Set
[];
panel
:
Germplasm
Set
[];
collection
:
Germplasm
Set
[];
population
:
Germplasm
Set
[];
}
export
interface
GermplasmSet
{
id
:
number
;
name
:
string
;
type
:
string
;
germplasmCount
:
number
;
germplasmRef
:
{
pui
:
string
;
name
:
string
;
};
}
export
interface
GermplasmData
<
T
>
{
data
:
T
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment