From 2b77f8146bacb4010172d8ccf68b4b06875a92d2 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Thu, 11 Oct 2018 16:13:24 -0700 Subject: [PATCH] namespacing --- .../components/brushableHistogram/index.js | 13 ++- .../src/components/continuous/continuous.js | 1 + client/src/components/geneExpression/index.js | 30 +++--- client/src/reducers/controls.js | 99 ++++++++++++------- client/src/reducers/differential.js | 3 +- client/src/util/nameCreators.js | 43 ++++++++ client/src/util/stateManager/world.js | 19 ++-- 7 files changed, 151 insertions(+), 57 deletions(-) create mode 100644 client/src/util/nameCreators.js diff --git a/client/src/components/brushableHistogram/index.js b/client/src/components/brushableHistogram/index.js index 72642b54..b1b36527 100644 --- a/client/src/components/brushableHistogram/index.js +++ b/client/src/components/brushableHistogram/index.js @@ -83,17 +83,28 @@ class HistogramBrush extends React.Component { onBrush(selection, x) { return () => { - const { dispatch, field } = this.props; + const { dispatch, field, isObs, isUserDefined, isDiffExp } = this.props; + if (d3.event.selection) { dispatch({ type: "continuous metadata histogram brush", selection: field, + continuousNamespace: { + isObs, + isUserDefined, + isDiffExp + }, range: [x(d3.event.selection[0]), x(d3.event.selection[1])] }); } else { dispatch({ type: "continuous metadata histogram brush", selection: field, + continuousNamespace: { + isObs, + isUserDefined, + isDiffExp + }, range: null }); } diff --git a/client/src/components/continuous/continuous.js b/client/src/components/continuous/continuous.js index 78976616..74242411 100644 --- a/client/src/components/continuous/continuous.js +++ b/client/src/components/continuous/continuous.js @@ -58,6 +58,7 @@ class Continuous extends React.Component { { const metadata = _.get(state.controls.world, "obsAnnotations", null); @@ -22,7 +22,6 @@ import actions from "../../actions/"; initializeRanges, userDefinedGenes: state.controls.userDefinedGenes, world: state.controls.world, - dimensionMap: state.controls.dimensionMap, colorAccessor: state.controls.colorAccessor, allGeneNames: state.controls.allGeneNames, differential: state.differential @@ -32,40 +31,42 @@ class GeneExpression extends React.Component { constructor(props) { super(props); this.state = { - svg: null, - ctx: null, - axes: null, - dimensions: null, gene: "" }; } + keyPress(e) { - if (e.keyCode == 13) { + if (e.keyCode === 13) { this.handleClick(); } } + handleClick() { const { world, dispatch, userDefinedGenes } = this.props; + const { gene } = this.state; - if (userDefinedGenes.indexOf(this.state.gene) !== -1) { + if (userDefinedGenes.indexOf(gene) !== -1) { console.log("That gene already exists"); } else if (userDefinedGenes.length > 15) { console.log( "That's too many genes, you can have at most 15 user defined genes" ); - } else if (!_.find(world.varAnnotations, { name: this.state.gene })) { + } else if (!_.find(world.varAnnotations, { name: gene })) { console.log("That doesn't appear to be a valid gene name."); } else { - dispatch(actions.requestGeneExpressionCountsPOST([this.state.gene])); + dispatch(actions.requestGeneExpressionCountsPOST([gene])); dispatch({ type: "user defined gene", - data: this.state.gene + data: gene }); this.setState({ gene: "" }); } } + render() { const { world, userDefinedGenes } = this.props; + const { gene } = this.state; + return (