Update label to handle new field shapes

pull/2416/head
Andrew Watkins 2017-11-28 12:46:01 -05:00
parent f80a6d8f03
commit 1a1a74a1d2
1 changed files with 5 additions and 7 deletions

View File

@ -110,11 +110,9 @@ function getRolesForUser(roles, user) {
}
export const buildDefaultYLabel = queryConfig => {
return queryConfig.rawText
? ''
: `${queryConfig.measurement}.${_.get(
queryConfig,
['fields', '0', 'field'],
''
)}`
const {measurement, fields} = queryConfig
const fieldAlias = `${_.get(fields, ['0', 'alias'], '')}`
const field = `${_.get(fields, ['0', 'value'], '')}`
return `${measurement}.${fieldAlias || field}`
}