Merge pull request #5613 from influxdata/5561/alert_rule
fix(alert rule): warn about unsupported datapull/5622/head
commit
be6b9e9216
|
@ -64,6 +64,17 @@ class RuleGraphDygraph extends Component<Props, State> {
|
||||||
if (!timeSeriesToDygraphResult) {
|
if (!timeSeriesToDygraphResult) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
if (timeSeriesToDygraphResult.unsupportedValue) {
|
||||||
|
console.error(
|
||||||
|
'Unsupported y-axis value, cannot display data',
|
||||||
|
timeSeriesToDygraphResult
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<p className="unexpected-error">
|
||||||
|
Unsupported y-axis value, only numbers are supported.
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dygraph
|
<Dygraph
|
||||||
|
|
|
@ -253,10 +253,10 @@ class FieldList extends PureComponent<Props, State> {
|
||||||
const newFields = _.get(fieldSets, measurement, []).map(f => ({
|
const newFields = _.get(fieldSets, measurement, []).map(f => ({
|
||||||
value: f,
|
value: f,
|
||||||
type: 'field',
|
type: 'field',
|
||||||
}))
|
})) as Field[]
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
fields: newFields,
|
fields: _.uniqBy(newFields, 'value'), // do not duplicate items
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface TimeSeriesToDyGraphReturnType {
|
||||||
labels: string[]
|
labels: string[]
|
||||||
timeSeries: DygraphValue[][]
|
timeSeries: DygraphValue[][]
|
||||||
dygraphSeries: DygraphSeries
|
dygraphSeries: DygraphSeries
|
||||||
|
unsupportedValue?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export const timeSeriesToDygraph = async (
|
export const timeSeriesToDygraph = async (
|
||||||
|
@ -19,12 +20,18 @@ export const timeSeriesToDygraph = async (
|
||||||
): Promise<TimeSeriesToDyGraphReturnType> => {
|
): Promise<TimeSeriesToDyGraphReturnType> => {
|
||||||
const result = await manager.timeSeriesToDygraph(raw, pathname)
|
const result = await manager.timeSeriesToDygraph(raw, pathname)
|
||||||
const {timeSeries} = result
|
const {timeSeries} = result
|
||||||
|
let unsupportedValue: any
|
||||||
const newTimeSeries = fastMap<DygraphValue[], DygraphValue[]>(
|
const newTimeSeries = fastMap<DygraphValue[], DygraphValue[]>(
|
||||||
timeSeries,
|
timeSeries,
|
||||||
([time, ...values]) => [new Date(time), ...values]
|
([time, ...values]) => {
|
||||||
|
if (unsupportedValue === undefined) {
|
||||||
|
unsupportedValue = values.find(x => x !== null && typeof x !== 'number')
|
||||||
|
}
|
||||||
|
return [new Date(time), ...values]
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return {...result, timeSeries: newTimeSeries}
|
return {...result, timeSeries: newTimeSeries, unsupportedValue}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const timeSeriesToTableGraph = async (
|
export const timeSeriesToTableGraph = async (
|
||||||
|
|
Loading…
Reference in New Issue