mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 11:58:11 +08:00
Async on long running operations (#543)
* compute differential button * add user gene loading state to reducer * create input group, consume usergeneloading * add loading state
This commit is contained in:
@@ -68,6 +68,7 @@ class Expression extends React.Component {
|
|||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
disabled={!haveBothCellSets}
|
disabled={!haveBothCellSets}
|
||||||
intent="primary"
|
intent="primary"
|
||||||
|
loading={differential.loading}
|
||||||
fill
|
fill
|
||||||
type="button"
|
type="button"
|
||||||
onClick={this.computeDiffExp.bind(this)}
|
onClick={this.computeDiffExp.bind(this)}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as d3 from "d3";
|
|||||||
import fuzzysort from "fuzzysort";
|
import fuzzysort from "fuzzysort";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { MenuItem } from "@blueprintjs/core";
|
import { MenuItem, Button } from "@blueprintjs/core";
|
||||||
import { Suggest } from "@blueprintjs/select";
|
import { Suggest } from "@blueprintjs/select";
|
||||||
import HistogramBrush from "../brushableHistogram";
|
import HistogramBrush from "../brushableHistogram";
|
||||||
import * as globals from "../../globals";
|
import * as globals from "../../globals";
|
||||||
@@ -59,6 +59,7 @@ const filterGenes = (query, genes) => {
|
|||||||
metadata,
|
metadata,
|
||||||
initializeRanges,
|
initializeRanges,
|
||||||
userDefinedGenes: state.controls.userDefinedGenes,
|
userDefinedGenes: state.controls.userDefinedGenes,
|
||||||
|
userDefinedGenesLoading: state.controls.userDefinedGenesLoading,
|
||||||
world: state.controls.world,
|
world: state.controls.world,
|
||||||
colorAccessor: state.controls.colorAccessor,
|
colorAccessor: state.controls.colorAccessor,
|
||||||
allGeneNames: state.controls.allGeneNames,
|
allGeneNames: state.controls.allGeneNames,
|
||||||
@@ -87,7 +88,12 @@ class GeneExpression extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { world, userDefinedGenes, differential } = this.props;
|
const {
|
||||||
|
world,
|
||||||
|
userDefinedGenes,
|
||||||
|
userDefinedGenesLoading,
|
||||||
|
differential
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -109,9 +115,11 @@ class GeneExpression extends React.Component {
|
|||||||
className="bp3-control-group"
|
className="bp3-control-group"
|
||||||
>
|
>
|
||||||
<Suggest
|
<Suggest
|
||||||
|
disabled={true}
|
||||||
closeOnSelect
|
closeOnSelect
|
||||||
openOnKeyDown
|
openOnKeyDown
|
||||||
resetOnSelect
|
resetOnSelect
|
||||||
|
itemDisabled={userDefinedGenesLoading ? () => true : () => false}
|
||||||
noResults={<MenuItem disabled text="No matching genes." />}
|
noResults={<MenuItem disabled text="No matching genes." />}
|
||||||
onItemSelect={g => {
|
onItemSelect={g => {
|
||||||
/* this happens on 'enter' */
|
/* this happens on 'enter' */
|
||||||
@@ -129,6 +137,12 @@ class GeneExpression extends React.Component {
|
|||||||
}
|
}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
className="bp3-button bp3-intent-primary"
|
||||||
|
loading={userDefinedGenesLoading}
|
||||||
|
>
|
||||||
|
Add
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{world && userDefinedGenes.length > 0
|
{world && userDefinedGenes.length > 0
|
||||||
? _.map(userDefinedGenes, (geneName, index) => {
|
? _.map(userDefinedGenes, (geneName, index) => {
|
||||||
|
|||||||
Vendored
+15
-1
@@ -117,6 +117,7 @@ const Controls = (
|
|||||||
crossfilter: null,
|
crossfilter: null,
|
||||||
dimensionMap: null,
|
dimensionMap: null,
|
||||||
userDefinedGenes: [],
|
userDefinedGenes: [],
|
||||||
|
userDefinedGenesLoading: false,
|
||||||
diffexpGenes: [],
|
diffexpGenes: [],
|
||||||
|
|
||||||
colorAccessor: null,
|
colorAccessor: null,
|
||||||
@@ -323,6 +324,18 @@ const Controls = (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case "request user defined gene started": {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
userDefinedGenesLoading: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case "request user defined gene error": {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
userDefinedGenesLoading: false
|
||||||
|
};
|
||||||
|
}
|
||||||
case "request user defined gene success": {
|
case "request user defined gene success": {
|
||||||
const { world, crossfilter, dimensionMap, userDefinedGenes } = state;
|
const { world, crossfilter, dimensionMap, userDefinedGenes } = state;
|
||||||
const worldVarDataCache = world.varDataCache;
|
const worldVarDataCache = world.varDataCache;
|
||||||
@@ -340,7 +353,8 @@ const Controls = (
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
dimensionMap,
|
dimensionMap,
|
||||||
userDefinedGenes: _userDefinedGenes
|
userDefinedGenes: _userDefinedGenes,
|
||||||
|
userDefinedGenesLoading: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case "request differential expression success": {
|
case "request differential expression success": {
|
||||||
|
|||||||
Reference in New Issue
Block a user