Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
7d01a432
Commit
7d01a432
authored
Aug 17, 2015
by
Marco Sehrer
Browse files
Let UIStore trigger element fetching when collection is selected
Store currentCollectionID in UIStore
parent
8cd31405
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/components/CollectionSubtree.js
View file @
7d01a432
...
...
@@ -27,15 +27,8 @@ export default class CollectionSubtree extends React.Component {
UIStore
.
unlisten
(
this
.
onChange
.
bind
(
this
));
}
componentWillUpdate
(
nextProps
,
nextState
)
{
if
(
nextState
.
selected
)
{
// TODO also for reactions and so on
ElementActions
.
fetchSamplesByCollectionId
(
this
.
state
.
root
.
id
)
}
}
onChange
(
state
)
{
if
(
state
.
selected
CollectionId
s
[
0
]
==
this
.
state
.
root
.
id
)
{
if
(
state
.
current
CollectionId
==
this
.
state
.
root
.
id
)
{
this
.
setState
({
selected
:
true
});
}
else
{
this
.
setState
({
selected
:
false
});
...
...
app/assets/javascripts/components/stores/UIStore.js
View file @
7d01a432
import
alt
from
'
../alt
'
;
import
UIActions
from
'
../actions/UIActions
'
;
import
ElementActions
from
'
../actions/ElementActions
'
;
import
ElementStore
from
'
./ElementStore
'
;
import
ArrayUtils
from
'
../utils/ArrayUtils
'
;
...
...
@@ -9,7 +10,7 @@ class UIStore {
constructor
()
{
this
.
state
=
{
checkedSampleIds
:
Immutable
.
List
(),
selected
CollectionId
s
:
[]
current
CollectionId
:
null
};
this
.
bindListeners
({
...
...
@@ -60,7 +61,7 @@ class UIStore {
handleDeselectAllElements
(
type
)
{
switch
(
type
)
{
case
'
collection
'
:
this
.
state
.
selected
CollectionId
s
=
[]
;
this
.
state
.
current
CollectionId
=
null
;
break
;
}
}
...
...
@@ -68,7 +69,9 @@ class UIStore {
handleSelectElement
(
element
)
{
switch
(
element
.
type
)
{
case
'
collection
'
:
this
.
state
.
selectedCollectionIds
.
push
(
element
.
id
);
this
.
state
.
currentCollectionId
=
element
.
id
;
// TODO also for reactions and so on
ElementActions
.
fetchSamplesByCollectionId
(
element
.
id
)
break
;
}
}
...
...
Write
Preview
Supports
Markdown
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