Move active query logic to container

pull/1934/head
Andrew Watkins 2017-08-10 15:48:07 -07:00
parent d27c4fe3e5
commit 49de19014a
1 changed files with 50 additions and 3 deletions

View File

@ -88,6 +88,22 @@ class CellEditorOverlay extends Component {
this.setState({axes: {...axes, y: {...axes.y, label}}})
}
handleSetPrefixSuffix = e => {
const {axes} = this.state
const {prefix, suffix} = e.target.form
this.setState({
axes: {
...axes,
y: {
...axes.y,
prefix: prefix.value,
suffix: suffix.value,
},
},
})
}
handleAddQuery = () => {
const {queriesWorkingDraft} = this.state
const newIndex = queriesWorkingDraft.length
@ -149,6 +165,34 @@ class CellEditorOverlay extends Component {
this.setState({activeQueryIndex})
}
handleSetBase = base => () => {
const {axes} = this.state
this.setState({
axes: {
...axes,
y: {
...axes.y,
base,
},
},
})
}
handleSetScale = scale => () => {
const {axes} = this.state
this.setState({
axes: {
...axes,
y: {
...axes.y,
scale,
},
},
})
}
getActiveQuery = () => {
const {queriesWorkingDraft, activeQueryIndex} = this.state
const activeQuery = queriesWorkingDraft[activeQueryIndex]
@ -230,13 +274,16 @@ class CellEditorOverlay extends Component {
/>
{isDisplayOptionsTabActive
? <DisplayOptions
axes={axes}
onSetBase={this.handleSetBase}
onSetLabel={this.handleSetLabel}
onSetScale={this.handleSetScale}
queryConfigs={queriesWorkingDraft}
selectedGraphType={cellWorkingType}
onSetPrefixSuffix={this.handleSetPrefixSuffix}
onSelectGraphType={this.handleSelectGraphType}
onSetYAxisBoundMin={this.handleSetYAxisBoundMin}
onSetYAxisBoundMax={this.handleSetYAxisBoundMax}
onSetLabel={this.handleSetLabel}
axes={axes}
queryConfigs={queriesWorkingDraft}
/>
: <QueryMaker
source={source}