Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urgi-is
FAIDARE
Commits
12534586
Commit
12534586
authored
Jun 26, 2019
by
Célia Michotey
Browse files
Correct test bugs after rebase. Linting corrections.
parent
822b9ac1
Changes
10
Hide whitespace changes
Inline
Side-by-side
frontend/src/app/app-routing.module.ts
View file @
12534586
...
...
@@ -4,8 +4,8 @@ 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
{
MarkdownPageComponent
}
from
"
./markdown-page/markdown-page.component
"
;
import
{
environment
}
from
"
../environments/environment
"
;
import
{
MarkdownPageComponent
}
from
'
./markdown-page/markdown-page.component
'
;
import
{
environment
}
from
'
../environments/environment
'
;
export
const
routes
:
Routes
=
[
{
path
:
'
studies/:id
'
,
component
:
StudyCardComponent
},
...
...
frontend/src/app/app.module.ts
View file @
12534586
...
...
@@ -26,8 +26,8 @@ import { MomentModule } from 'ngx-moment';
import
{
XrefsComponent
}
from
'
./xrefs/xrefs.component
'
;
import
{
CoordinatesModule
}
from
'
angular-coordinates
'
;
import
{
CardGenericDocumentComponent
}
from
'
./card-generic-document/card-generic-document.component
'
;
import
{
MarkdownModule
,
MarkedOptions
,
MarkedRenderer
}
from
"
ngx-markdown
"
;
import
{
MarkdownPageComponent
}
from
"
./markdown-page/markdown-page.component
"
;
import
{
MarkdownModule
,
MarkedOptions
,
MarkedRenderer
}
from
'
ngx-markdown
'
;
import
{
MarkdownPageComponent
}
from
'
./markdown-page/markdown-page.component
'
;
@
NgModule
({
declarations
:
[
...
...
frontend/src/app/germplasm-card/germplasm-card.component.ts
View file @
12534586
...
...
@@ -4,7 +4,7 @@ import { BrapiService } from '../brapi.service';
import
{
GnpisService
}
from
'
../gnpis.service
'
;
import
{
BrapiAttributeData
,
BrapiGermplasmPedigree
,
BrapiLocation
,
BrapiTaxonIds
}
from
'
../models/brapi.model
'
;
import
{
Children
,
Germplasm
,
Site
}
from
'
../models/gnpis.model
'
;
import
{
environment
}
from
"
../../environments/environment
"
;
import
{
environment
}
from
'
../../environments/environment
'
;
@
Component
({
selector
:
'
faidare-germplasm-card
'
,
...
...
@@ -21,7 +21,7 @@ export class GermplasmCardComponent implements OnInit {
private
route
:
ActivatedRoute
)
{
}
taxonIdsWithURL
:
BrapiTaxonIds
[]
=
[];
taxonIdsWithURL
:
BrapiTaxonIds
[]
=
[];
germplasmGnpis
:
Germplasm
;
germplasmPedigree
:
BrapiGermplasmPedigree
;
germplasmProgeny
:
Children
[];
...
...
@@ -141,9 +141,9 @@ export class GermplasmCardComponent implements OnInit {
addRefURL
(
taxonIds
:
BrapiTaxonIds
[])
{
for
(
const
taxonId
of
taxonIds
)
{
if
(
environment
.
taxaLinks
[
taxonId
.
sourceName
])
{
taxonId
.
url
=
environment
.
taxaLinks
[
taxonId
.
sourceName
]
+
taxonId
.
taxonId
;
taxonId
.
url
=
environment
.
taxaLinks
[
taxonId
.
sourceName
]
+
taxonId
.
taxonId
;
}
else
{
taxonId
.
url
=
null
;
taxonId
.
url
=
null
;
}
this
.
taxonIdsWithURL
.
push
(
taxonId
);
}
...
...
frontend/src/app/markdown-page/markdown-page.component.spec.ts
View file @
12534586
...
...
@@ -2,9 +2,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import
{
NO_ERRORS_SCHEMA
}
from
'
@angular/core
'
;
import
{
MarkdownPageComponent
}
from
'
./markdown-page.component
'
;
import
{
ActivatedRoute
}
from
"
@angular/router
"
;
import
{
environment
}
from
"
../../environments/environment
"
;
import
{
of
}
from
"
rxjs
"
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
environment
}
from
'
../../environments/environment
'
;
import
{
of
}
from
'
rxjs
'
;
describe
(
'
MarkdownPageComponent
'
,
()
=>
{
let
component
:
MarkdownPageComponent
;
...
...
frontend/src/app/markdown-page/markdown-page.component.ts
View file @
12534586
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
}
from
"
@angular/router
"
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
@
Component
({
selector
:
'
dd-about
'
,
templateUrl
:
'
./markdown-page.component.html
'
,
styleUrls
:
[
'
./markdown-page.component.scss
'
]
selector
:
'
faidare-markdown
'
,
templateUrl
:
'
./markdown-page.component.html
'
,
styleUrls
:
[
'
./markdown-page.component.scss
'
]
})
export
class
MarkdownPageComponent
implements
OnInit
{
mdFile
:
string
=
""
;
mdFile
=
''
;
constructor
(
private
route
:
ActivatedRoute
)
{
}
constructor
(
private
route
:
ActivatedRoute
)
{
}
ngOnInit
()
{
this
.
route
.
data
.
subscribe
(
value
=>
this
.
mdFile
=
value
.
mdFile
);
}
ngOnInit
()
{
this
.
route
.
data
.
subscribe
(
value
=>
this
.
mdFile
=
value
.
mdFile
);
}
onLoad
(
e
:
any
)
{
// console.log('Into onLoad');
// console.log(e);
}
onLoad
(
e
:
any
)
{
// console.log('Into onLoad');
// console.log(e);
}
onError
(
e
:
any
)
{
console
.
log
(
'
Got error
'
,
e
);
}
onError
(
e
:
any
)
{
console
.
log
(
'
Got error
'
,
e
);
}
}
frontend/src/app/navbar/navbar.component.html
View file @
12534586
...
...
@@ -39,9 +39,7 @@
<a
class=
"nav-link d-flex align-items-center dropdown-toggle"
ngbDropdownToggle
role=
"button"
aria-haspopup=
"true"
aria-expanded=
"false"
>
More ...
</a>
aria-expanded=
"false"
>
More...
</a>
<div
class=
"dropdown-menu"
ngbDropdownMenu
>
<!-- About link -->
<a
class=
"dropdown-item"
routerLink=
"/about"
routerLinkActive=
"true"
title=
"About"
>
About
</a>
...
...
@@ -58,7 +56,7 @@
</div>
<a
class=
"navbar-brand d-flex align-items-center"
[href]=
"navbar.contributor.url"
target=
"_blank"
>
<img
src=
"{{ navbar.contributor.logo }}"
alt=
"{{ navbar.contributor.name }} logo"
height=
"60px"
/>
<img
src=
"{{ navbar.contributor.logo }}"
alt=
"{{ navbar.contributor.name }} logo"
title=
"{{ navbar.contributor.name }}"
height=
"60px"
/>
</a>
<div>
<!--<a *ngIf="displayBackButton"
...
...
frontend/src/app/navbar/navbar.component.spec.ts
View file @
12534586
...
...
@@ -27,32 +27,62 @@ class NavbarComponentTester extends ComponentTester<NavbarComponent> {
return
this
.
element
(
'
li
'
).
element
(
'
a
'
);
}
get
firstLinkSub
Links
()
{
return
this
.
element
(
'
li
'
)
.
elements
(
'
a
'
);
get
provider
Links
()
{
return
this
.
links
[
1
]
.
elements
(
'
a
'
);
}
get
logo
()
{
return
this
.
element
(
'
img
'
);
get
logo
s
()
{
return
this
.
element
s
(
'
img
'
);
}
}
describe
(
'
NavbarComponent
'
,
()
=>
{
beforeEach
(()
=>
TestBed
.
configureTestingModule
({
declarations
:
[
NavbarComponent
]
}));
const
dataSource1
:
DataDiscoverySource
=
{
'
@id
'
:
'
urn:source1
'
,
'
@type
'
:
[
'
schema:DataCatalog
'
],
'
schema:name
'
:
'
Example source1
'
,
'
schema:url
'
:
'
http://example1.com
'
,
'
schema:image
'
:
'
http://example1.com/logo.png
'
};
const
dataSource2
:
DataDiscoverySource
=
{
'
@id
'
:
'
urn:source2
'
,
'
@type
'
:
[
'
schema:DataCatalog
'
],
'
schema:name
'
:
'
Example source2
'
,
'
schema:url
'
:
'
http://example2.com
'
,
'
schema:image
'
:
'
http://example2.com/logo.png
'
};
let
gnpisService
;
beforeEach
(()
=>
{
gnpisService
=
jasmine
.
createSpyObj
(
'
GnpisService
'
,
[
'
getSource
'
,
'
suggest
'
]
);
gnpisService
.
suggest
.
and
.
returnValue
(
of
([
dataSource1
[
'
@id
'
],
dataSource2
[
'
@id
'
]]));
gnpisService
.
getSource
.
withArgs
(
dataSource1
[
'
@id
'
]).
and
.
returnValue
(
of
(
dataSource1
));
gnpisService
.
getSource
.
withArgs
(
dataSource2
[
'
@id
'
]).
and
.
returnValue
(
of
(
dataSource2
));
TestBed
.
configureTestingModule
({
declarations
:
[
NavbarComponent
],
providers
:
[
{
provide
:
GnpisService
,
useValue
:
gnpisService
}
]
}).
compileComponents
();
});
it
(
'
should toggle the class on click
'
,
()
=>
{
const
tester
=
new
NavbarComponentTester
();
tester
.
detectChanges
();
expect
(
tester
.
navBar
.
classes
).
toContain
(
'
collapse
'
);
tester
.
toggler
.
click
();
tester
.
detectChanges
();
expect
(
tester
.
navBar
.
classes
).
not
.
toContain
(
'
collapse
'
);
});
...
...
@@ -65,14 +95,7 @@ describe('NavbarComponent', () => {
title
:
'
FAIR Data-finder for Agronomic REsearch
'
,
logo
:
'
assets/applicationLogo.png
'
,
links
:
[
{
label
:
'
Data providers
'
,
url
:
'
#
'
,
subMenu
:
[
{
label
:
'
GNPIS
'
,
url
:
'
https://urgi.versailles.inra.fr/gnpis/
'
},
{
label
:
'
URGI
'
,
url
:
'
https://urgi.versailles.inra.fr/
'
}
]
}
{
label
:
'
URGI
'
,
url
:
'
https://urgi.versailles.inra.fr/
'
}
],
contributor
:
{
name
:
'
Elixir
'
,
...
...
@@ -85,19 +108,29 @@ describe('NavbarComponent', () => {
expect
(
gnpisService
.
suggest
).
toHaveBeenCalledTimes
(
1
);
expect
(
gnpisService
.
getSource
).
toHaveBeenCalledTimes
(
2
);
expect
(
tester
.
logo
.
attr
(
'
title
'
)).
toBe
(
'
FAIR Data-finder for Agronomic REsearch
'
);
expect
(
tester
.
logos
.
length
).
toBe
(
2
);
expect
(
tester
.
logos
.
shift
().
attr
(
'
title
'
)).
toBe
(
'
FAIR Data-finder for Agronomic REsearch
'
);
expect
(
tester
.
logos
.
pop
().
attr
(
'
title
'
)).
toBe
(
'
Elixir
'
);
expect
(
tester
.
links
.
length
).
toBe
(
3
);
// 'More...' section (containing Help, About, Join and Legal links) added automatically
// 'Data providers' section (containing data sources) fetch and added automatically
expect
(
tester
.
links
.
length
-
1
).
toBe
(
1
);
// minus 1 because of More section (containing Help, About, Join and Legal links) added automatically
// Two static links + two dynamic links (fetched data sources)
//expect(tester.links.length).toBe(4);
expect
(
tester
.
firstLink
.
textContent
).
toBe
(
'
URGI
'
);
expect
(
tester
.
firstLink
.
attr
(
'
href
'
)).
toBe
(
'
https://urgi.versailles.inra.fr/
'
);
expect
(
tester
.
firstLink
.
attr
(
'
target
'
)).
toBe
(
'
_blank
'
);
expect
(
tester
.
firstLink
.
textContent
).
toBe
(
'
Data providers
'
);
expect
(
tester
.
firstLinkSubLinks
.
length
-
1
).
toBe
(
2
);
expect
(
tester
.
providerLinks
.
length
-
1
).
toBe
(
2
);
// minus 1 because of the dropdown link
expect
(
tester
.
providerLinks
.
shift
().
textContent
).
toBe
(
'
Data providers
'
);
expect
(
tester
.
providerLinks
.
pop
().
textContent
).
toBe
(
'
Example source2
'
);
expect
(
tester
.
providerLinks
.
pop
().
attr
(
'
href
'
)).
toBe
(
'
http://example2.com
'
);
expect
(
tester
.
providerLinks
.
pop
().
attr
(
'
target
'
)).
toBe
(
'
_blank
'
);
expect
(
tester
.
firstLinkSubLinks
.
pop
().
attr
(
'
href
'
)).
toBe
(
'
https://urgi.versailles.inra.fr/
'
);
expect
(
tester
.
firstLinkSubLinks
.
pop
().
textContent
).
toBe
(
'
URGI
'
);
expect
(
tester
.
firstLinkSubLinks
.
pop
().
attr
(
'
target
'
)).
toBe
(
'
_blank
'
);
});
});
expect
(
tester
.
links
[
2
].
element
(
'
a
'
).
textContent
).
toBe
(
'
More...
'
);
}));
})
;
frontend/src/app/navbar/navbar.component.ts
View file @
12534586
...
...
@@ -53,6 +53,12 @@ export class NavbarComponent implements OnInit {
navbar
:
NavBar
=
environment
.
navbar
;
navbarCollapsed
=
true
;
dataProvider
:
Link
=
{
label
:
'
Data providers
'
,
url
:
'
#
'
,
subMenu
:
[]
};
constructor
(
private
gnpisService
:
GnpisService
)
{
}
...
...
@@ -66,12 +72,13 @@ export class NavbarComponent implements OnInit {
flatMap
(
dataSourceURI
=>
this
.
gnpisService
.
getSource
(
dataSourceURI
)),
)
.
subscribe
(
dataSource
=>
{
// Add each data source to the nav bar
links
this
.
navbar
.
links
.
push
({
// Add each data source to the nav bar
, under 'Data providers'
this
.
dataProvider
.
subMenu
.
push
({
label
:
dataSource
[
'
schema:name
'
],
url
:
dataSource
[
'
schema:url
'
]
});
});
this
.
navbar
.
links
.
push
(
this
.
dataProvider
);
}
toggleNavbar
()
{
...
...
frontend/src/environments/environment.prod.ts
View file @
12534586
...
...
@@ -14,16 +14,6 @@ export const environment = {
{
label
:
'
News
'
,
url
:
'
https://urgi.versailles.inra.fr/About-us/News
'
},
{
label
:
'
About us
'
,
url
:
'
https://urgi.versailles.inra.fr/About-us
'
}
]
},
{
label
:
'
Data providers
'
,
url
:
'
#
'
,
subMenu
:
[
{
label
:
'
GNPIS
'
,
url
:
'
https://urgi.versailles.inra.fr/gnpis/
'
},
{
label
:
'
CIRAD TropGENE
'
,
url
:
'
http://tropgenedb.cirad.fr/
'
},
{
label
:
'
VIB Pippa
'
,
url
:
'
http://pippa.psb.ugent.be
'
},
{
label
:
'
IBET BioData
'
,
url
:
'
https://biodata.pt
'
}
]
}
],
contributor
:
{
...
...
@@ -38,8 +28,8 @@ export const environment = {
legalMentionsMdFile
:
'
assets/legal.md
'
,
taxaLinks
:
{
NCBI
:
'
https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=
'
,
ThePlantList
:
'
http://www.theplantlist.org/tpl1.1/record/
'
,
ThePlantList
:
'
http://www.theplantlist.org/tpl1.1/record/
'
,
TAXREF
:
'
https://inpn.mnhn.fr/espece/cd_nom/
'
,
CatalogueOfLife
:
'
http://www.catalogueoflife.org/col/details/species/id/
'
CatalogueOfLife
:
'
http://www.catalogueoflife.org/col/details/species/id/
'
}
};
frontend/src/environments/environment.ts
View file @
12534586
...
...
@@ -17,16 +17,6 @@ export const environment = {
{
label
:
'
News
'
,
url
:
'
https://urgi.versailles.inra.fr/About-us/News
'
},
{
label
:
'
About us
'
,
url
:
'
https://urgi.versailles.inra.fr/About-us
'
}
]
},
{
label
:
'
Data providers
'
,
url
:
'
#
'
,
subMenu
:
[
{
label
:
'
GNPIS
'
,
url
:
'
https://urgi.versailles.inra.fr/gnpis/
'
},
{
label
:
'
CIRAD TropGENE
'
,
url
:
'
http://tropgenedb.cirad.fr/
'
},
{
label
:
'
VIB Pippa
'
,
url
:
'
http://pippa.psb.ugent.be
'
},
{
label
:
'
IBET BioData
'
,
url
:
'
https://biodata.pt
'
}
]
}
],
contributor
:
{
...
...
@@ -41,9 +31,9 @@ export const environment = {
legalMentionsMdFile
:
'
assets/legal.md
'
,
taxaLinks
:
{
NCBI
:
'
https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=
'
,
ThePlantList
:
'
http://www.theplantlist.org/tpl1.1/record/
'
,
ThePlantList
:
'
http://www.theplantlist.org/tpl1.1/record/
'
,
TAXREF
:
'
https://inpn.mnhn.fr/espece/cd_nom/
'
,
CatalogueOfLife
:
'
http://www.catalogueoflife.org/col/details/species/id/
'
CatalogueOfLife
:
'
http://www.catalogueoflife.org/col/details/species/id/
'
}
};
...
...
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