mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 06:18:11 +08:00
consume custom middleware in reducer, set initial allCells & selected
This commit is contained in:
Vendored
+10
-5
@@ -8,6 +8,7 @@ const Controls = (state = {
|
|||||||
colorAccessor: null,
|
colorAccessor: null,
|
||||||
colorScale: null,
|
colorScale: null,
|
||||||
graphBrushSelection: null,
|
graphBrushSelection: null,
|
||||||
|
continuousSelection: null,
|
||||||
axesHaveBeenDrawn: false,
|
axesHaveBeenDrawn: false,
|
||||||
}, action) => {
|
}, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@@ -19,12 +20,14 @@ const Controls = (state = {
|
|||||||
_ranges: action.data.data.ranges
|
_ranges: action.data.data.ranges
|
||||||
});
|
});
|
||||||
case "request cells success":
|
case "request cells success":
|
||||||
const graphMap = {}
|
const graphMap = {};
|
||||||
_.each(action.data.data.graph, (g) => { graphMap[g[0]] = [g[1], g[2]] })
|
const currentCellSelection = action.data.data.metadata.slice(0);
|
||||||
|
_.each(action.data.data.graph, (g) => { graphMap[g[0]] = [g[1], g[2]] });
|
||||||
|
_.each(currentCellSelection, (cell) => { cell["__selected__"] = true } );
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
allCellsOnClient: action.data.data,
|
allCellsOnClient: action.data.data,
|
||||||
currentCellSelection: action.data.data.metadata,
|
currentCellSelection,
|
||||||
graphMap,
|
graphMap,
|
||||||
graphBrushSelection: null, /* if we are getting new cells from the server, the layout (probably? definitely?) just changed, so this is now irrelevant, and we WILL need to call a function to reset state of this kind when cells success happens */
|
graphBrushSelection: null, /* if we are getting new cells from the server, the layout (probably? definitely?) just changed, so this is now irrelevant, and we WILL need to call a function to reset state of this kind when cells success happens */
|
||||||
});
|
});
|
||||||
@@ -36,13 +39,15 @@ const Controls = (state = {
|
|||||||
axesHaveBeenDrawn: true
|
axesHaveBeenDrawn: true
|
||||||
});
|
});
|
||||||
case "continuous selection using parallel coords brushing": {
|
case "continuous selection using parallel coords brushing": {
|
||||||
|
console.log("controls reducer", action)
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
currentCellSelection: action.data,
|
continuousSelection: action.data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case "graph brush selection change":
|
case "graph brush selection change":
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
graphBrushSelection: action.brushCoords
|
graphBrushSelection: action.brushCoords, /* this has already been applied in middleware but store it for next time */
|
||||||
|
currentCellSelection: action.newSelection /* this comes from middleware */
|
||||||
})
|
})
|
||||||
case "graph brush deselect":
|
case "graph brush deselect":
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
|||||||
Reference in New Issue
Block a user