prepopulate input (#2129)

This commit is contained in:
Colin Megill
2021-04-01 06:21:59 -04:00
committed by GitHub
parent 2fa19c756c
commit 20bfa4cc97
3 changed files with 17 additions and 8 deletions
@@ -8,6 +8,7 @@ import { memoize } from "../../util/dataframe/util";
import Truncate from "../util/truncate"; import Truncate from "../util/truncate";
import * as globals from "../../globals"; import * as globals from "../../globals";
import GenesetMenus from "./menus/genesetMenus"; import GenesetMenus from "./menus/genesetMenus";
import EditGenesetNameDialogue from "./menus/editGenesetNameDialogue";
import HistogramBrush from "../brushableHistogram"; import HistogramBrush from "../brushableHistogram";
@connect((state, ownProps) => { @connect((state, ownProps) => {
@@ -115,6 +116,8 @@ class GeneSet extends React.Component {
const { setName, setGenes } = this.props; const { setName, setGenes } = this.props;
const { isOpen, toggleSummaryHisto } = this.state; const { isOpen, toggleSummaryHisto } = this.state;
const genesetNameLengthVisible = 120; /* this magic number determines how much of a long geneset name we see */ const genesetNameLengthVisible = 120; /* this magic number determines how much of a long geneset name we see */
const genesetIsEmpty = setGenes.length === 0;
return ( return (
<div style={{ marginBottom: 3 }}> <div style={{ marginBottom: 3 }}>
<div <div
@@ -166,7 +169,7 @@ class GeneSet extends React.Component {
</div> </div>
<div style={{ marginLeft: 15, marginTop: 5, marginRight: 0 }}> <div style={{ marginLeft: 15, marginTop: 5, marginRight: 0 }}>
{isOpen ? ( {isOpen && !genesetIsEmpty && (
<Tooltip <Tooltip
content="Aggregate all genes in this geneset, and allow coloring by and selecting on the entire set." content="Aggregate all genes in this geneset, and allow coloring by and selecting on the entire set."
position={Position.BOTTOM_RIGHT} position={Position.BOTTOM_RIGHT}
@@ -187,11 +190,17 @@ class GeneSet extends React.Component {
onChange={this.toggleSummaryHisto} onChange={this.toggleSummaryHisto}
/> />
</Tooltip> </Tooltip>
) : null} )}
{isOpen && genesetIsEmpty && (
<p style={{ fontStyle: "italic", color: "lightgrey" }}>
No genes to display
</p>
)}
</div> </div>
{isOpen && {isOpen &&
(!toggleSummaryHisto (!toggleSummaryHisto && !genesetIsEmpty
? this.renderGenes() ? this.renderGenes()
: setGenes.length > 0 && ( : setGenes.length > 0 && (
<HistogramBrush <HistogramBrush
@@ -200,6 +209,7 @@ class GeneSet extends React.Component {
setGenes={setGenes} setGenes={setGenes}
/> />
))} ))}
<EditGenesetNameDialogue parentGeneset={setName} />
</div> </div>
); );
} }
@@ -4,7 +4,6 @@ import { Button } from "@blueprintjs/core";
import GeneSet from "./geneSet"; import GeneSet from "./geneSet";
import CreateGenesetDialogue from "./menus/createGenesetDialogue"; import CreateGenesetDialogue from "./menus/createGenesetDialogue";
import EditGenesetNameDialogue from "./menus/editGenesetNameDialogue";
@connect((state) => { @connect((state) => {
return { return {
@@ -66,7 +65,6 @@ class GeneExpression extends React.Component {
</Button> </Button>
</div> </div>
<CreateGenesetDialogue /> <CreateGenesetDialogue />
<EditGenesetNameDialogue />
</div> </div>
<div>{this.renderDiffexpGeneSets()}</div> <div>{this.renderDiffexpGeneSets()}</div>
<div>{this.renderGeneSets()}</div> <div>{this.renderGeneSets()}</div>
@@ -14,7 +14,7 @@ class RenameGeneset extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
genesetName: "", genesetName: props.parentGeneset,
}; };
} }
@@ -54,12 +54,12 @@ class RenameGeneset extends React.PureComponent {
render() { render() {
const { genesetName } = this.state; const { genesetName } = this.state;
const { genesetsUI } = this.props; const { genesetsUI, parentGeneset } = this.props;
return ( return (
<> <>
<AnnoDialog <AnnoDialog
isActive={genesetsUI.isEditingGenesetName} isActive={genesetsUI.isEditingGenesetName === parentGeneset}
inputProps={{ inputProps={{
"data-testid": `${genesetsUI.isEditingGenesetName}:rename-geneset-dialog`, "data-testid": `${genesetsUI.isEditingGenesetName}:rename-geneset-dialog`,
}} }}
@@ -74,6 +74,7 @@ class RenameGeneset extends React.PureComponent {
validationError={genesetsUI.isEditingGenesetName === genesetName} validationError={genesetsUI.isEditingGenesetName === genesetName}
annoInput={ annoInput={
<LabelInput <LabelInput
label={genesetName}
onChange={this.handleChange} onChange={this.handleChange}
inputProps={{ inputProps={{
"data-testid": "rename-geneset-modal", "data-testid": "rename-geneset-modal",