Merge pull request #2153 from influxdata/blocker/field-value-condition
Fix field name not displaying in KapacitorRule builderpull/2156/head
commit
34eabba071
|
@ -1,10 +1,19 @@
|
||||||
import React, {PropTypes} from 'react'
|
import React, {PropTypes} from 'react'
|
||||||
import {OPERATORS} from 'src/kapacitor/constants'
|
import {OPERATORS} from 'src/kapacitor/constants'
|
||||||
import Dropdown from 'shared/components/Dropdown'
|
import Dropdown from 'shared/components/Dropdown'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
const mapToItems = (arr, type) => arr.map(text => ({text, type}))
|
const mapToItems = (arr, type) => arr.map(text => ({text, type}))
|
||||||
const operators = mapToItems(OPERATORS, 'operator')
|
const operators = mapToItems(OPERATORS, 'operator')
|
||||||
const noopSubmit = e => e.preventDefault()
|
const noopSubmit = e => e.preventDefault()
|
||||||
|
const getField = ({fields}) => {
|
||||||
|
const alias = _.get(fields, ['0', 'alias'], false)
|
||||||
|
if (!alias) {
|
||||||
|
return _.get(fields, ['0', 'value'], 'Select a Time-Series')
|
||||||
|
}
|
||||||
|
|
||||||
|
return alias
|
||||||
|
}
|
||||||
|
|
||||||
const Threshold = ({
|
const Threshold = ({
|
||||||
rule: {values: {operator, value, rangeValue}},
|
rule: {values: {operator, value, rangeValue}},
|
||||||
|
@ -15,7 +24,7 @@ const Threshold = ({
|
||||||
<div className="rule-section--row rule-section--row-first rule-section--border-bottom">
|
<div className="rule-section--row rule-section--row-first rule-section--border-bottom">
|
||||||
<p>Send Alert where</p>
|
<p>Send Alert where</p>
|
||||||
<span className="rule-builder--metric">
|
<span className="rule-builder--metric">
|
||||||
{query.fields.length ? query.fields[0].field : 'Select a Time-Series'}
|
{getField(query)}
|
||||||
</span>
|
</span>
|
||||||
<p>is</p>
|
<p>is</p>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
|
Loading…
Reference in New Issue