fix(fluxWizard): use existing fluxString helper
parent
4cc56eee33
commit
4c73908078
|
@ -6,11 +6,8 @@ import {TimeRange, Source} from 'src/types'
|
||||||
import {CancelBox} from 'src/types/promises'
|
import {CancelBox} from 'src/types/promises'
|
||||||
import {parseResponse} from 'src/shared/parsing/flux/response'
|
import {parseResponse} from 'src/shared/parsing/flux/response'
|
||||||
import {BuilderTagsType} from '../types'
|
import {BuilderTagsType} from '../types'
|
||||||
import {
|
import {formatTimeRangeArguments, tagToFlux} from '../util/generateFlux'
|
||||||
fluxString,
|
import fluxString from 'src/flux/helpers/fluxString'
|
||||||
formatTimeRangeArguments,
|
|
||||||
tagToFlux,
|
|
||||||
} from '../util/generateFlux'
|
|
||||||
|
|
||||||
const DEFAULT_TIME_RANGE: TimeRange = {lower: 'now() - 30d', lowerFlux: '-30d'}
|
const DEFAULT_TIME_RANGE: TimeRange = {lower: 'now() - 30d', lowerFlux: '-30d'}
|
||||||
const DEFAULT_LIMIT = 200
|
const DEFAULT_LIMIT = 200
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import fluxString from 'src/flux/helpers/fluxString'
|
||||||
import {TimeRange} from 'src/types'
|
import {TimeRange} from 'src/types'
|
||||||
import {BuilderTagsType, QueryBuilderState} from '../types'
|
import {BuilderTagsType, QueryBuilderState} from '../types'
|
||||||
import {AGG_WINDOW_AUTO, FUNCTIONS} from './constants'
|
import {AGG_WINDOW_AUTO, FUNCTIONS} from './constants'
|
||||||
|
@ -14,9 +15,6 @@ export function tagToFlux(tag: BuilderTagsType) {
|
||||||
.map(value => `r["${fluxString(tag.tagKey)}"] == "${fluxString(value)}"`)
|
.map(value => `r["${fluxString(tag.tagKey)}"] == "${fluxString(value)}"`)
|
||||||
.join(' or ')
|
.join(' or ')
|
||||||
}
|
}
|
||||||
export function fluxString(s: string = '') {
|
|
||||||
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
||||||
}
|
|
||||||
|
|
||||||
export function buildQuery(state: QueryBuilderState): string | undefined {
|
export function buildQuery(state: QueryBuilderState): string | undefined {
|
||||||
const bucket = state.buckets.selectedBucket
|
const bucket = state.buckets.selectedBucket
|
||||||
|
|
Loading…
Reference in New Issue