Add stronger types to handleSetQuerySource in CellEditorOverlay and make sure it conforms to types
parent
b5cedfc3c2
commit
bf9a02b158
|
@ -326,11 +326,13 @@ class CellEditorOverlay extends Component<Props, State> {
|
||||||
this.setState({isStaticLegend})
|
this.setState({isStaticLegend})
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleSetQuerySource = source => {
|
private handleSetQuerySource = (source: Source): void => {
|
||||||
const queriesWorkingDraft = this.state.queriesWorkingDraft.map(q => ({
|
const queriesWorkingDraft: QueryConfig[] = this.state.queriesWorkingDraft.map(
|
||||||
|
q => ({
|
||||||
..._.cloneDeep(q),
|
..._.cloneDeep(q),
|
||||||
source,
|
source: source.links.self,
|
||||||
}))
|
})
|
||||||
|
)
|
||||||
|
|
||||||
this.setState({queriesWorkingDraft})
|
this.setState({queriesWorkingDraft})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,11 @@ import classnames from 'classnames'
|
||||||
|
|
||||||
import ConfirmOrCancel from 'src/shared/components/ConfirmOrCancel'
|
import ConfirmOrCancel from 'src/shared/components/ConfirmOrCancel'
|
||||||
import SourceSelector from 'src/dashboards/components/SourceSelector'
|
import SourceSelector from 'src/dashboards/components/SourceSelector'
|
||||||
import {QueryConfig} from 'src/types/query'
|
import {QueryConfig, Source} from 'src/types'
|
||||||
|
|
||||||
|
interface SourceOption extends Source {
|
||||||
|
text: string
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onCancel: () => void
|
onCancel: () => void
|
||||||
|
@ -12,8 +16,8 @@ interface Props {
|
||||||
onClickDisplayOptions: (
|
onClickDisplayOptions: (
|
||||||
displayOptions: boolean
|
displayOptions: boolean
|
||||||
) => (event: MouseEvent<HTMLLIElement>) => void
|
) => (event: MouseEvent<HTMLLIElement>) => void
|
||||||
isSavable?: boolean
|
isSavable: boolean
|
||||||
sources: any[]
|
sources: SourceOption[]
|
||||||
onSetQuerySource: (source: any) => void
|
onSetQuerySource: (source: any) => void
|
||||||
selected: string
|
selected: string
|
||||||
queries: QueryConfig[]
|
queries: QueryConfig[]
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import React, {SFC} from 'react'
|
import React, {SFC} from 'react'
|
||||||
import Dropdown from 'src/shared/components/Dropdown'
|
import Dropdown from 'src/shared/components/Dropdown'
|
||||||
import {QueryConfig} from 'src/types/query'
|
import {QueryConfig, Source} from 'src/types'
|
||||||
|
|
||||||
interface Options {
|
interface SourceOption extends Source {
|
||||||
text: string
|
text: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
sources: Options[]
|
sources: SourceOption[]
|
||||||
selected: string
|
selected: string
|
||||||
onSetQuerySource: (source: any) => void
|
onSetQuerySource: (source: SourceOption) => void
|
||||||
queries: QueryConfig[]
|
queries: QueryConfig[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue