Add function to set service when flux toggled on dynamic source

pull/4403/head
Alirie Gray 2018-09-10 11:46:43 -07:00
parent e9e417e427
commit deda6c936b
2 changed files with 16 additions and 2 deletions

View File

@ -125,7 +125,7 @@ class CellEditorOverlay extends Component<Props, State> {
queryStatus, queryStatus,
} = this.props } = this.props
const {isStaticLegend} = this.state const {isStaticLegend, currentService} = this.state
return ( return (
<div <div
@ -147,6 +147,7 @@ class CellEditorOverlay extends Component<Props, State> {
onResetFocus={this.handleResetFocus} onResetFocus={this.handleResetFocus}
isInCEO={true} isInCEO={true}
sources={sources} sources={sources}
service={currentService}
services={services} services={services}
updateQueryDrafts={updateQueryDrafts} updateQueryDrafts={updateQueryDrafts}
onToggleStaticLegend={this.handleToggleStaticLegend} onToggleStaticLegend={this.handleToggleStaticLegend}

View File

@ -1022,7 +1022,20 @@ class TimeMachine extends PureComponent<Props, State> {
} }
private toggleFlux = (): void => { private toggleFlux = (): void => {
console.log('toggling!') const {services, updateService} = this.props
if (this.isFluxSource) {
this.setState({selectedService: null})
updateService(null)
} else {
const foundFluxForSource = services.find(service => {
return service.sourceID === this.source.id
})
if (foundFluxForSource) {
updateService(foundFluxForSource)
}
}
} }
} }