diff --git a/src/pages/studyView/studyPageHeader/rightPanel/RightPanel.tsx b/src/pages/studyView/studyPageHeader/rightPanel/RightPanel.tsx index 23dedd01b76..3383d1a24ee 100644 --- a/src/pages/studyView/studyPageHeader/rightPanel/RightPanel.tsx +++ b/src/pages/studyView/studyPageHeader/rightPanel/RightPanel.tsx @@ -57,12 +57,14 @@ export default class RightPanel extends React.Component { return (
+
+
- {props.genes.suggestions.map((suggestion, index) => ( + { + props.genes.suggestions.map((suggestion, index) => - ))} + />) + }
); } @@ -213,7 +221,7 @@ class GeneSymbolValidatorMessage extends React.Component< return (
- +
); } diff --git a/src/shared/components/GeneSelectionBox/OQLTextArea.tsx b/src/shared/components/GeneSelectionBox/OQLTextArea.tsx index e27088a8c94..3141cc28ba2 100644 --- a/src/shared/components/GeneSelectionBox/OQLTextArea.tsx +++ b/src/shared/components/GeneSelectionBox/OQLTextArea.tsx @@ -12,7 +12,7 @@ import { } from 'mobx'; import { Gene } from 'shared/api/generated/CBioPortalAPI'; import { SingleGeneQuery } from 'shared/lib/oql/oql-parser'; -import { GeneReplacement, Focus } from 'shared/components/query/QueryStore'; +import {GeneReplacement, Focus, normalizeQuery} from 'shared/components/query/QueryStore'; import { getEmptyGeneValidationResult, getFocusOutText, @@ -22,6 +22,7 @@ import GeneSymbolValidator, { GeneValidationResult, } from './GeneSymbolValidator'; import autobind from 'autobind-decorator'; +import bind from "bind-decorator"; export interface IGeneSelectionBoxProps { focus?: Focus; @@ -208,8 +209,7 @@ export default class OQLTextArea extends React.Component< oql: OQL ) { this.geneQueryIsValid = validQuery; - // no matter whether the query is valid, we need to sync queryToBeValidated with geneQuery - this.geneQuery = this.queryToBeValidated; + if (this.props.callback) { this.props.callback(oql, validationResult, this.geneQuery); } @@ -235,38 +235,65 @@ export default class OQLTextArea extends React.Component< : 'Click gene symbols below or enter here'; } + @bind onChange(event:any){ + this.currentTextAreaValue = event.currentTarget.value; + this.geneQuery = this.currentTextAreaValue; + this.updateQueryToBeValidateDebounce(); + } + + @bind onFocus(){ + this.isFocused = true; + } + + @bind onBlur(){ + this.isFocused = false; + } + + @bind replaceGene(oldSymbol: string, newSymbol: string) { + let updatedQuery = normalizeQuery( + this.getTextAreaValue() + .toUpperCase() + .replace( + new RegExp(`\\b${oldSymbol.toUpperCase()}\\b`, 'g'), + () => newSymbol.toUpperCase() + ) + ); + this.updateGeneQuery(updatedQuery); + } + render() { return (
+