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,66 +50,40 @@ 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="query-builder rule-section--border-bottom">
|
||||||
<div className="rule-section--body">
|
<DatabaseList
|
||||||
<pre className="rule-section--border-bottom">
|
query={query}
|
||||||
<code
|
onChooseNamespace={this.handleChooseNamespace}
|
||||||
className={classnames({
|
/>
|
||||||
'metric-placeholder': !statement,
|
<MeasurementList
|
||||||
})}
|
query={query}
|
||||||
>
|
onChooseMeasurement={this.handleChooseMeasurement}
|
||||||
{statement || 'Build a query below'}
|
onChooseTag={this.handleChooseTag}
|
||||||
</code>
|
onGroupByTag={this.handleGroupByTag}
|
||||||
</pre>
|
onToggleTagAcceptance={this.handleToggleTagAcceptance}
|
||||||
{this.renderQueryBuilder()}
|
/>
|
||||||
|
{isDeadman
|
||||||
|
? null
|
||||||
|
: <FieldList
|
||||||
|
query={query}
|
||||||
|
onToggleField={this.handleToggleField}
|
||||||
|
onGroupByTime={this.handleGroupByTime}
|
||||||
|
applyFuncsToField={this.handleApplyFuncsToField}
|
||||||
|
isKapacitorRule={isKapacitorRule}
|
||||||
|
/>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
renderQueryBuilder = () => {
|
|
||||||
const {query, isKapacitorRule, isDeadman} = this.props
|
|
||||||
return (
|
|
||||||
<div className="query-builder rule-section--border-bottom">
|
|
||||||
<DatabaseList
|
|
||||||
query={query}
|
|
||||||
onChooseNamespace={this.handleChooseNamespace}
|
|
||||||
/>
|
|
||||||
<MeasurementList
|
|
||||||
query={query}
|
|
||||||
onChooseMeasurement={this.handleChooseMeasurement}
|
|
||||||
onChooseTag={this.handleChooseTag}
|
|
||||||
onGroupByTag={this.handleGroupByTag}
|
|
||||||
onToggleTagAcceptance={this.handleToggleTagAcceptance}
|
|
||||||
/>
|
|
||||||
{isDeadman
|
|
||||||
? null
|
|
||||||
: <FieldList
|
|
||||||
query={query}
|
|
||||||
onToggleField={this.handleToggleField}
|
|
||||||
onGroupByTime={this.handleGroupByTime}
|
|
||||||
applyFuncsToField={this.handleApplyFuncsToField}
|
|
||||||
isKapacitorRule={isKapacitorRule}
|
|
||||||
/>}
|
|
||||||
</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