Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
4fc694a4
Commit
4fc694a4
authored
Jun 21, 2018
by
Iker Hurtado
Browse files
Dynamic filters (Methodology details page- Issue 114) and some refactoring
parent
d167389c
Pipeline
#31579
passed with stages
in 6 seconds
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
client/bundle.js
View file @
4fc694a4
This diff is collapsed.
Click to expand it.
client/src/material-mod/MethodologyDetails.view.js
View file @
4fc694a4
...
...
@@ -30,7 +30,6 @@
let
DetailsViewBase
=
require
(
'
./DetailsViewBase.js
'
);
let
util
=
require
(
'
../common/util.js
'
);
let
InfoSys
=
require
(
'
../common/InfoSys.js
'
);
//let FilterInGroupsComponent = require('./FilterInGroupsComponent.js');
let
DataStore
=
require
(
'
./DataStore.js
'
);
let
SortingButton
=
require
(
'
./SortingButton.js
'
);
...
...
@@ -38,38 +37,43 @@ let SortingButton = require('./SortingButton.js');
const
REPOSITORY_LINK
=
'
https://repository.nomad-coe.eu/NomadRepository-1.1/views/calculation.zul?pid=
'
;
let
calcTypesMap
=
new
Map
();
calcTypesMap
.
set
(
'
Single point
'
,
'
single point
'
);
calcTypesMap
.
set
(
'
GW
'
,
'
GW calculation
'
);
calcTypesMap
.
set
(
'
Geometry optimization
'
,
'
geometry optimization
'
);
calcTypesMap
.
set
(
'
Molecular dynamics
'
,
'
molecular dynamics
'
);
calcTypesMap
.
set
(
'
Phonon
'
,
'
phonon calculation
'
);
calcTypesMap
.
set
(
'
Equation of state
'
,
'
equation of state
'
);
calcTypesMap
.
set
(
'
Parameter variation
'
,
'
parameter variation
'
);
//calcTypesMap.set('Convergence', 'convergence');
calcTypesMap
.
set
(
'
QHA
'
,
'
QHA calculation
'
);
let
densityFunctionalMap
=
new
Map
();
densityFunctionalMap
.
set
(
'
LDA
'
,
'
LDA
'
);
densityFunctionalMap
.
set
(
'
GGA
'
,
'
GGA
'
);
densityFunctionalMap
.
set
(
'
meta-GGA
'
,
'
meta-GGA
'
);
densityFunctionalMap
.
set
(
'
hybrid-GGA
'
,
'
hybrid-GGA
'
);
densityFunctionalMap
.
set
(
'
meta-hybrid-GGA
'
,
'
meta-hybrid-GGA
'
);
densityFunctionalMap
.
set
(
'
HF
'
,
'
HF
'
);
let
codeMap
=
new
Map
();
codeMap
.
set
(
'
exciting
'
,
'
exciting
'
);
codeMap
.
set
(
'
VASP
'
,
'
VASP
'
);
codeMap
.
set
(
'
FHI-aims
'
,
'
FHI-aims
'
);
let
potentialMap
=
new
Map
();
potentialMap
.
set
(
'
Full potential
'
,
'
full all electron
'
);
potentialMap
.
set
(
'
Pseudo potential
'
,
'
pseudopotential
'
);
let
basicSetMap
=
new
Map
();
basicSetMap
.
set
(
'
Numeric AOs
'
,
'
numeric AOs
'
);
basicSetMap
.
set
(
'
Gaussians
'
,
'
gaussians
'
);
basicSetMap
.
set
(
'
(L)APW+lo
'
,
'
(L)APW+lo
'
);
basicSetMap
.
set
(
'
Plane waves
'
,
'
plane waves
'
);
const
calcTypesMap
=
new
Map
([
[
'
single point
'
,
'
Single point
'
],
[
'
GW calculation
'
,
'
GW
'
],
[
'
geometry optimization
'
,
'
Geometry optimization
'
],
[
'
molecular dynamics
'
,
'
Molecular dynamics
'
],
[
'
phonon calculation
'
,
'
Phonon
'
],
[
'
equation of state
'
,
'
Equation of state
'
],
[
'
parameter variation
'
,
'
Parameter variation
'
],
//['Convergence', 'convergence'],
[
'
QHA calculation
'
,
'
QHA
'
]
]);
const
densityFunctionalMap
=
new
Map
([
[
'
LDA
'
,
'
LDA
'
],
[
'
GGA
'
,
'
GGA
'
],
[
'
meta-GGA
'
,
'
meta-GGA
'
],
[
'
hybrid-GGA
'
,
'
hybrid-GGA
'
],
[
'
meta-hybrid-GGA
'
,
'
meta-hybrid-GGA
'
],
[
'
HF
'
,
'
HF
'
]
]);
const
codeMap
=
new
Map
([
[
'
exciting
'
,
'
exciting
'
],
[
'
VASP
'
,
'
VASP
'
],
[
'
FHI-aims
'
,
'
FHI-aims
'
]
]);
const
potentialMap
=
new
Map
([
[
'
full all electron
'
,
'
Full potential
'
],
[
'
pseudopotential
'
,
'
Pseudo potential
'
]
]);
const
basicSetMap
=
new
Map
([
[
'
numeric AOs
'
,
'
Numeric AOs
'
],
[
'
gaussians
'
,
'
Gaussians
'
],
[
'
(L)APW+lo
'
,
'
(L)APW+lo
'
],
[
'
plane waves
'
,
'
Plane waves
'
]
]);
...
...
@@ -135,14 +139,6 @@ class FilterInGroupsComponent {
this
.
unfoldedPanel
.
style
.
display
=
(
this
.
folded
?
'
none
'
:
'
block
'
);
});
this
.
filterItemsRow
.
innerHTML
=
'
<td></td>
'
;
// calculation Id column
this
.
addGroupItems
(
'
Calculation type
'
,
calcTypesMap
);
this
.
addGroupItems
(
'
Density functional
'
,
densityFunctionalMap
);
this
.
addGroupItems
(
'
Code
'
,
codeMap
);
this
.
addGroupItems
(
'
Potential
'
,
potentialMap
);
this
.
addGroupItems
(
'
Basic set
'
,
basicSetMap
);
this
.
filterItemsRow
.
innerHTML
+=
'
<td></td>
'
;
// link column
// Add listener for checkboxes events
this
.
element
.
addEventListener
(
'
click
'
,
(
e
)
=>
{
...
...
@@ -157,9 +153,38 @@ class FilterInGroupsComponent {
}
addGroupItems
(
group
,
groupItemsMap
){
addGroupsItems
(
calcs
){
let
lCalcTypesMap
=
new
Map
();
let
lDensityFunctionalMap
=
new
Map
();
let
lCodeMap
=
new
Map
();
let
lPotentialMap
=
new
Map
();
let
lBasicSetMap
=
new
Map
();
calcs
.
forEach
(
c
=>
{
if
(
!
lCalcTypesMap
.
has
(
c
.
type
))
lCalcTypesMap
.
set
(
c
.
type
,
calcTypesMap
.
get
(
c
.
type
));
if
(
!
lDensityFunctionalMap
.
has
(
c
.
functional
))
lDensityFunctionalMap
.
set
(
c
.
functional
,
densityFunctionalMap
.
get
(
c
.
functional
));
if
(
!
lCodeMap
.
has
(
c
.
code
))
lCodeMap
.
set
(
c
.
code
,
codeMap
.
get
(
c
.
code
));
if
(
!
lPotentialMap
.
has
(
c
.
potential
))
lPotentialMap
.
set
(
c
.
potential
,
potentialMap
.
get
(
c
.
potential
));
if
(
!
lBasicSetMap
.
has
(
c
.
basisSet
))
lBasicSetMap
.
set
(
c
.
basisSet
,
basicSetMap
.
get
(
c
.
basisSet
));
});
this
.
filterItemsRow
.
innerHTML
=
'
<td></td>
'
;
// calculation Id column
this
.
filtersOn
=
[];
this
.
addGroupItems
(
lCalcTypesMap
);
this
.
addGroupItems
(
lDensityFunctionalMap
);
this
.
addGroupItems
(
lCodeMap
);
this
.
addGroupItems
(
lPotentialMap
);
this
.
addGroupItems
(
lBasicSetMap
);
this
.
filterItemsRow
.
innerHTML
+=
'
<td></td>
'
;
// link column
}
addGroupItems
(
groupItemsMap
){
let
html
=
'
<td>
'
;
groupItemsMap
.
forEach
(
(
item
Id
,
item
Name
)
=>
{
groupItemsMap
.
forEach
(
(
item
Name
,
item
Id
)
=>
{
this
.
filtersOn
.
push
(
itemId
);
html
+=
'
<input type="checkbox" value="
'
+
itemId
+
'
" checked>
'
+
'
<span style="vertical-align: 20%">
'
+
itemName
+
'
</span> <br>
'
;
...
...
@@ -292,7 +317,7 @@ class MethodologyDetails extends DetailsViewBase {
this
.
sortingButtons
.
forEach
(
el
=>
{
if
(
el
!==
component
)
el
.
init
();
});
this
.
sortRowsCalcDataBy
(
descendingOrder
,
field
);
this
.
_
sortRowsCalcDataBy
(
descendingOrder
,
field
);
this
.
_render
();
});
});
...
...
@@ -388,22 +413,14 @@ class MethodologyDetails extends DetailsViewBase {
}
updateSelection
(
leafIds
){
updateSelection
(
leafIds
/* Not used */
){
this
.
sortedCalcs
=
[];
DataStore
.
getCalculations
().
forEach
(
c
=>
{
/*let calc = DataStore.getCalc(DataStore.getCalcReprIntId(leafId));
let calcType = calc.run_type;
if (DataStore.getGroups().has(calc.id)){//leafId)){
calcType = DataStore.getGroupType(calc.id);//leafId);
if (calcType === 'convergence') calcType = 'parameter variation';
//console.log('Group',DataStore.getGroupType(leafId));
}*/
let
calcType
=
c
.
run_type
;
if
(
DataStore
.
getGroups
().
has
(
c
.
id
)){
//leafId))
{
if
(
DataStore
.
getGroups
().
has
(
c
.
id
)){
//leafId))
calcType
=
DataStore
.
getGroupType
(
c
.
id
);
//leafId);
if
(
calcType
===
'
convergence
'
)
calcType
=
'
parameter variation
'
;
//console.log('Group',DataStore.getGroupType(leafId));
...
...
@@ -419,14 +436,16 @@ class MethodologyDetails extends DetailsViewBase {
});
});
this
.
sortRowsCalcDataBy
(
true
,
'
id
'
);
this
.
filterComponent
.
addGroupsItems
(
this
.
sortedCalcs
);
this
.
_sortRowsCalcDataBy
(
true
,
'
id
'
);
//console.log('sortedCalcs:', this.sortedCalcs);
this
.
_render
();
}
sortRowsCalcDataBy
(
descendingOrder
,
field
){
_
sortRowsCalcDataBy
(
descendingOrder
,
field
){
this
.
sortedCalcs
.
sort
(
(
a
,
b
)
=>
{
if
(
a
[
field
]
<
b
[
field
])
return
(
descendingOrder
?
-
1
:
1
);
...
...
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