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