Add checks for null retention policies in meta queries

pull/1182/head
Chris Goller 2017-04-04 17:42:30 -05:00
parent e166aed46c
commit e3c07e1797
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import AJAX from 'utils/ajax' import AJAX from 'utils/ajax'
import _ from 'lodash'
import {buildInfluxUrl, proxy} from 'utils/queryUrlGenerator' import {buildInfluxUrl, proxy} from 'utils/queryUrlGenerator'
export const showDatabases = async (source) => { export const showDatabases = async (source) => {
@ -36,14 +37,15 @@ export function showMeasurements(source, db) {
} }
export function showTagKeys({source, database, retentionPolicy, measurement}) { export function showTagKeys({source, database, retentionPolicy, measurement}) {
const query = `SHOW TAG KEYS FROM "${retentionPolicy}"."${measurement}"` const rp = _.toString(retentionPolicy)
const query = `SHOW TAG KEYS FROM "${rp}"."${measurement}"`
return proxy({source, db: database, rp: retentionPolicy, query}) return proxy({source, db: database, rp: retentionPolicy, query})
} }
export function showTagValues({source, database, retentionPolicy, measurement, tagKeys}) { export function showTagValues({source, database, retentionPolicy, measurement, tagKeys}) {
const keys = tagKeys.sort().map((k) => `"${k}"`).join(', ') const keys = tagKeys.sort().map((k) => `"${k}"`).join(', ')
const query = `SHOW TAG VALUES FROM "${retentionPolicy}"."${measurement}" WITH KEY IN (${keys})` const rp = _.toString(retentionPolicy)
const query = `SHOW TAG VALUES FROM "${rp}"."${measurement}" WITH KEY IN (${keys})`
return proxy({source, db: database, rp: retentionPolicy, query}) return proxy({source, db: database, rp: retentionPolicy, query})
} }