Clean up
parent
c8979d50e9
commit
f0a14115f8
|
@ -1,6 +1,4 @@
|
||||||
import React, {PropTypes, Component} from 'react'
|
import React, {PropTypes, Component} from 'react'
|
||||||
import buildInfluxQLQuery from 'utils/influxql'
|
|
||||||
import classnames from 'classnames'
|
|
||||||
|
|
||||||
import DatabaseList from 'src/shared/components/DatabaseList'
|
import DatabaseList from 'src/shared/components/DatabaseList'
|
||||||
import MeasurementList from 'src/shared/components/MeasurementList'
|
import MeasurementList from 'src/shared/components/MeasurementList'
|
||||||
|
@ -13,10 +11,6 @@ class DataSection extends Component {
|
||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildContext = () => {
|
|
||||||
return {source: this.props.source}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleChooseNamespace = namespace => {
|
handleChooseNamespace = namespace => {
|
||||||
this.props.actions.chooseNamespace(this.props.query.id, namespace)
|
this.props.actions.chooseNamespace(this.props.query.id, namespace)
|
||||||
}
|
}
|
||||||
|
@ -56,32 +50,10 @@ class DataSection extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {query, timeRange: {lower}, isKapacitorRule} = this.props
|
const {query, isKapacitorRule, isDeadman} = this.props
|
||||||
const statement =
|
|
||||||
query.rawText || buildInfluxQLQuery({lower}, query, isKapacitorRule)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rule-section">
|
<div className="rule-section">
|
||||||
<h3 className="rule-section--heading">Select a Time Series</h3>
|
|
||||||
<div className="rule-section--body">
|
|
||||||
<pre className="rule-section--border-bottom">
|
|
||||||
<code
|
|
||||||
className={classnames({
|
|
||||||
'metric-placeholder': !statement,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{statement || 'Build a query below'}
|
|
||||||
</code>
|
|
||||||
</pre>
|
|
||||||
{this.renderQueryBuilder()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderQueryBuilder = () => {
|
|
||||||
const {query, isKapacitorRule, isDeadman} = this.props
|
|
||||||
return (
|
|
||||||
<div className="query-builder rule-section--border-bottom">
|
<div className="query-builder rule-section--border-bottom">
|
||||||
<DatabaseList
|
<DatabaseList
|
||||||
query={query}
|
query={query}
|
||||||
|
@ -104,18 +76,14 @@ class DataSection extends Component {
|
||||||
isKapacitorRule={isKapacitorRule}
|
isKapacitorRule={isKapacitorRule}
|
||||||
/>}
|
/>}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const {string, func, shape, bool} = PropTypes
|
const {bool, func, shape, string} = PropTypes
|
||||||
|
|
||||||
DataSection.propTypes = {
|
DataSection.propTypes = {
|
||||||
source: shape({
|
|
||||||
links: shape({
|
|
||||||
kapacitors: string.isRequired,
|
|
||||||
}).isRequired,
|
|
||||||
}),
|
|
||||||
query: shape({
|
query: shape({
|
||||||
id: string.isRequired,
|
id: string.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
@ -134,15 +102,6 @@ DataSection.propTypes = {
|
||||||
onRemoveEvery: func.isRequired,
|
onRemoveEvery: func.isRequired,
|
||||||
timeRange: shape({}).isRequired,
|
timeRange: shape({}).isRequired,
|
||||||
isKapacitorRule: bool,
|
isKapacitorRule: bool,
|
||||||
}
|
|
||||||
|
|
||||||
DataSection.childContextTypes = {
|
|
||||||
source: PropTypes.shape({
|
|
||||||
links: PropTypes.shape({
|
|
||||||
proxy: PropTypes.string.isRequired,
|
|
||||||
self: PropTypes.string.isRequired,
|
|
||||||
}).isRequired,
|
|
||||||
}).isRequired,
|
|
||||||
isDeadman: bool,
|
isDeadman: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue