Remove FillQuery component from Kapacitor rule alert query builder
parent
c40b0a35a0
commit
b5ea9dbbca
|
@ -61,11 +61,3 @@ export const groupByTime = (queryId, time) => ({
|
||||||
time,
|
time,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const fill = (queryId, value) => ({
|
|
||||||
type: 'KAPA_FILL',
|
|
||||||
payload: {
|
|
||||||
queryId,
|
|
||||||
value,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ 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'
|
||||||
import FieldList from 'src/shared/components/FieldList'
|
import FieldList from 'src/shared/components/FieldList'
|
||||||
import FillQuery from 'shared/components/FillQuery'
|
|
||||||
|
|
||||||
import {defaultEveryFrequency} from 'src/kapacitor/constants'
|
import {defaultEveryFrequency} from 'src/kapacitor/constants'
|
||||||
|
|
||||||
|
@ -35,10 +34,6 @@ class DataSection extends Component {
|
||||||
this.props.actions.groupByTime(this.props.query.id, null)
|
this.props.actions.groupByTime(this.props.query.id, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFillQuery = value => {
|
|
||||||
this.props.actions.fill(this.props.query.id, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
handleGroupByTime = time => {
|
handleGroupByTime = time => {
|
||||||
this.props.actions.groupByTime(this.props.query.id, time)
|
this.props.actions.groupByTime(this.props.query.id, time)
|
||||||
}
|
}
|
||||||
|
@ -61,19 +56,13 @@ class DataSection extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {query, timeRange: {lower}} = this.props
|
const {query, timeRange: {lower}, isKapacitorRule} = this.props
|
||||||
const statement = query.rawText || buildInfluxQLQuery({lower}, query)
|
const statement =
|
||||||
|
query.rawText || buildInfluxQLQuery({lower}, query, isKapacitorRule)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rule-section">
|
<div className="rule-section">
|
||||||
<h3 className="rule-section--heading">
|
<h3 className="rule-section--heading">Select a Time Series</h3>
|
||||||
Select a Time Series
|
|
||||||
<FillQuery
|
|
||||||
onSelection={this.handleFillQuery}
|
|
||||||
theme="GREEN"
|
|
||||||
size="sm"
|
|
||||||
/>
|
|
||||||
</h3>
|
|
||||||
<div className="rule-section--body">
|
<div className="rule-section--body">
|
||||||
<pre className="rule-section--border-bottom">
|
<pre className="rule-section--border-bottom">
|
||||||
<code
|
<code
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
chooseTag,
|
chooseTag,
|
||||||
groupByTag,
|
groupByTag,
|
||||||
groupByTime,
|
groupByTime,
|
||||||
fill,
|
|
||||||
toggleField,
|
toggleField,
|
||||||
toggleTagAcceptance,
|
toggleTagAcceptance,
|
||||||
} from 'src/utils/queryTransitions'
|
} from 'src/utils/queryTransitions'
|
||||||
|
@ -109,16 +108,6 @@ const queryConfigs = (state = {}, action) => {
|
||||||
[queryId]: nextQueryConfig,
|
[queryId]: nextQueryConfig,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'KAPA_FILL': {
|
|
||||||
const {queryId, value} = action.payload
|
|
||||||
const nextQueryConfig = fill(state[queryId], value)
|
|
||||||
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
[queryId]: nextQueryConfig,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,11 @@ export const quoteIfTimestamp = ({lower, upper}) => {
|
||||||
}
|
}
|
||||||
/* eslint-enable quotes */
|
/* eslint-enable quotes */
|
||||||
|
|
||||||
export default function buildInfluxQLQuery(timeBounds, config) {
|
export default function buildInfluxQLQuery(
|
||||||
|
timeBounds,
|
||||||
|
config,
|
||||||
|
isKapacitorRule
|
||||||
|
) {
|
||||||
const {groupBy, fill, tags, areTagsAccepted} = config
|
const {groupBy, fill, tags, areTagsAccepted} = config
|
||||||
const {upper, lower} = quoteIfTimestamp(timeBounds)
|
const {upper, lower} = quoteIfTimestamp(timeBounds)
|
||||||
|
|
||||||
|
@ -30,7 +34,7 @@ export default function buildInfluxQLQuery(timeBounds, config) {
|
||||||
|
|
||||||
const condition = _buildWhereClause({lower, upper, tags, areTagsAccepted})
|
const condition = _buildWhereClause({lower, upper, tags, areTagsAccepted})
|
||||||
const dimensions = _buildGroupBy(groupBy)
|
const dimensions = _buildGroupBy(groupBy)
|
||||||
const fillClause = _buildFill(fill)
|
const fillClause = isKapacitorRule ? '' : _buildFill(fill)
|
||||||
|
|
||||||
return `${select}${condition}${dimensions}${fillClause}`
|
return `${select}${condition}${dimensions}${fillClause}`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue