Add default uuid to defaultQueryConfig in case it's not supplied. Fix how a new query config is added if there is not one present in the DE.

pull/10616/head
Hunter Trujillo 2017-12-18 16:10:59 -07:00
parent 9478a28c06
commit e522cd44f7
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import {setAutoRefresh} from 'shared/actions/app'
import * as dataExplorerActionCreators from 'src/data_explorer/actions/view'
import {writeLineProtocolAsync} from 'src/data_explorer/actions/view/write'
import {buildRawText} from 'src/utils/influxql'
import defaultQueryConfig from 'src/utils/defaultQueryConfig'
class DataExplorer extends Component {
constructor(props) {
@ -33,8 +34,9 @@ class DataExplorer extends Component {
getActiveQuery = () => {
const {queryConfigs} = this.props
if (queryConfigs.length === 0) {
this.props.queryConfigActions.addQuery()
queryConfigs.push(defaultQueryConfig())
}
return queryConfigs[0]

View File

@ -1,6 +1,10 @@
import uuid from 'node-uuid'
import {NULL_STRING} from 'shared/constants/queryFillOptions'
const defaultQueryConfig = ({id, isKapacitorRule = false}) => {
const defaultQueryConfig = (
{id, isKapacitorRule = false} = {id: uuid.v4()}
) => {
const queryConfig = {
id,
database: null,