Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urgi-is
data-discovery
Commits
933d6aa0
Commit
933d6aa0
authored
Aug 13, 2018
by
Jean-Baptiste Nizet
Browse files
feat: display alert on home page when no data
fix
#14
parent
44c8a0bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/src/app/pillars/pillars.component.html
View file @
933d6aa0
<ul
class=
"list-unstyled pillar"
>
<li
*ngFor=
"let pillar of (pillars$ | async)"
>
<span
class=
"pillar-name"
>
{{ pillar.name }}
</span>
<ul
class=
"list-unstyled source"
>
<li
*ngFor=
"let databaseSource of pillar.databaseSources"
>
<rare-document-count
[name]=
"databaseSource.name"
[url]=
"databaseSource.url"
[count]=
"databaseSource.documentCount"
>
</rare-document-count>
</li>
</ul>
</li>
</ul>
<ng-container
*ngIf=
"(pillars$ | async) as pillars"
>
<ul
*ngIf=
"pillars.length > 0; else noPillar"
class=
"list-unstyled pillar"
>
<li
*ngFor=
"let pillar of pillars"
>
<span
class=
"pillar-name"
>
{{ pillar.name }}
</span>
<ul
class=
"list-unstyled source"
>
<li
*ngFor=
"let databaseSource of pillar.databaseSources"
>
<rare-document-count
[name]=
"databaseSource.name"
[url]=
"databaseSource.url"
[count]=
"databaseSource.documentCount"
>
</rare-document-count>
</li>
</ul>
</li>
</ul>
<ng-template
#noPillar
>
<div
class=
"alert alert-warning"
role=
"alert"
>
<div
class=
"text-center"
style=
"font-size: 6em;"
><span
class=
"fa fa-frown-o"
></span></div>
<div>
Aucune donnée trouvée.
<br/>
Merci de contacter l'administrateur de l'application pour qu'il remplisse la base de données.
</div>
</div>
</ng-template>
</ng-container>
frontend/src/app/pillars/pillars.component.spec.ts
View file @
933d6aa0
...
...
@@ -32,6 +32,10 @@ class PillarsComponentTester extends ComponentTester<PillarsComponent> {
databaseSourceLink
(
pillarIndex
:
number
,
sourceIndex
:
number
)
{
return
this
.
databaseSourceItem
(
pillarIndex
,
sourceIndex
).
element
(
'
a
'
);
}
get
noDataAlert
()
{
return
this
.
element
(
'
.alert
'
);
}
}
describe
(
'
PillarsComponent
'
,
()
=>
{
...
...
@@ -57,12 +61,13 @@ describe('PillarsComponent', () => {
jasmine
.
addMatchers
(
speculoosMatchers
);
});
it
(
'
should not display any pillar while pillars are not available yet
'
,
()
=>
{
it
(
'
should not display any pillar
nor any alert
while pillars are not available yet
'
,
()
=>
{
spyOn
(
pillarService
,
'
list
'
).
and
.
returnValue
(
EMPTY
);
tester
.
detectChanges
();
expect
(
tester
.
pillarListItems
.
length
).
toBe
(
0
);
expect
(
tester
.
noDataAlert
).
toBeNull
();
});
it
(
'
should display pillars
'
,
()
=>
{
...
...
@@ -104,4 +109,12 @@ describe('PillarsComponent', () => {
.
toBe
(
'
http://florilege.arcad-project.org/fr/collections
'
);
expect
(
tester
.
databaseSourceLink
(
0
,
1
)).
toBeNull
();
});
it
(
'
should display alert if no pillar has been found
'
,
()
=>
{
spyOn
(
pillarService
,
'
list
'
).
and
.
returnValue
(
of
([]));
tester
.
detectChanges
();
expect
(
tester
.
noDataAlert
).
toContainText
(
'
Aucune donnée trouvée
'
);
});
});
frontend/src/custom-bootstrap.scss
View file @
933d6aa0
...
...
@@ -24,7 +24,7 @@
@import
"../node_modules/bootstrap/scss/pagination"
;
@import
"../node_modules/bootstrap/scss/badge"
;
// @import "../node_modules/bootstrap/scss/jumbotron";
//
@import "../node_modules/bootstrap/scss/alert";
@import
"../node_modules/bootstrap/scss/alert"
;
// @import "../node_modules/bootstrap/scss/progress";
// @import "../node_modules/bootstrap/scss/media";
// @import "../node_modules/bootstrap/scss/list-group";
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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