Add comments to elucidate various influxQL states

pull/1081/head
Andrew Watkins 2017-04-04 14:42:59 -07:00
parent bc922215a3
commit f8a03e2f88
1 changed files with 4 additions and 0 deletions

View File

@ -84,21 +84,25 @@ const ChronoTable = React.createClass({
return
}
// 200 from server and no results = warn
if (_.isEmpty(results)) {
this.setState({cellData: emptyCells})
return onEditRawStatus(query.id, {warn: 'Your query is syntactically correct but returned no results'})
}
// 200 from chrono server but influx returns an error = warn
const warn = _.get(results, 'error', false)
if (warn) {
this.setState({cellData: emptyCells})
return onEditRawStatus(query.id, {warn})
}
// 200 from server and results contains data = success
const cellData = _.get(results, ['series', '0'], {})
onEditRawStatus(query.id, {success: 'Success!'})
this.setState({cellData})
} catch (error) {
// 400 from chrono server = fail
const message = _.get(error, ['data', 'message'], error)
this.setState({isLoading: false})
console.error(message)