Convert QueryMakerTab to tsx

pull/3095/head
Andrew Watkins 2018-03-29 13:38:19 -07:00
parent ab31beab7f
commit 2cff0c98f5
2 changed files with 26 additions and 25 deletions

View File

@ -1,29 +1,21 @@
import React from 'react'
import PropTypes from 'prop-types'
import React, {PureComponent} from 'react'
import classnames from 'classnames'
const QueryMakerTab = React.createClass({
propTypes: {
isActive: PropTypes.bool,
query: PropTypes.shape({
rawText: PropTypes.string,
}).isRequired,
onSelect: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired,
queryTabText: PropTypes.string,
queryIndex: PropTypes.number,
},
interface Query {
rawText: string
}
handleSelect() {
this.props.onSelect(this.props.queryIndex)
},
interface Props {
isActive: boolean
query: Query
onSelect: (index: number) => void
onDelete: (index: number) => void
queryTabText: string
queryIndex: number
}
handleDelete(e) {
e.stopPropagation()
this.props.onDelete(this.props.queryIndex)
},
render() {
class QueryMakerTab extends PureComponent<Props> {
public render() {
return (
<div
className={classnames('query-maker--tab', {
@ -39,7 +31,16 @@ const QueryMakerTab = React.createClass({
/>
</div>
)
},
})
}
private handleSelect() {
this.props.onSelect(this.props.queryIndex)
}
private handleDelete(e) {
e.stopPropagation()
this.props.onDelete(this.props.queryIndex)
}
}
export default QueryMakerTab

View File

@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import QueryMakerTab from 'src/data_explorer/components/QueryMakerTab'
import QueryMakerTab from 'src/data_explorer/components/QueryMakerTab.tsx'
import buildInfluxQLQuery from 'utils/influxql'
const QueryTabList = ({