Prevent fill from being added to kapacitor query string
parent
c5bb9fd25a
commit
d4ac98b1d4
|
@ -101,7 +101,9 @@ const queryConfigs = (state = {}, action) => {
|
||||||
|
|
||||||
case 'DE_APPLY_FUNCS_TO_FIELD': {
|
case 'DE_APPLY_FUNCS_TO_FIELD': {
|
||||||
const {queryId, fieldFunc} = action.payload
|
const {queryId, fieldFunc} = action.payload
|
||||||
const nextQueryConfig = applyFuncsToField(state[queryId], fieldFunc, true)
|
const nextQueryConfig = applyFuncsToField(state[queryId], fieldFunc, {
|
||||||
|
preventAutoGroupBy: true,
|
||||||
|
})
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
[queryId]: nextQueryConfig,
|
[queryId]: nextQueryConfig,
|
||||||
|
|
|
@ -105,9 +105,10 @@ const queryConfigs = (state = {}, action) => {
|
||||||
|
|
||||||
case 'KAPA_APPLY_FUNCS_TO_FIELD': {
|
case 'KAPA_APPLY_FUNCS_TO_FIELD': {
|
||||||
const {queryId, fieldFunc} = action.payload
|
const {queryId, fieldFunc} = action.payload
|
||||||
// this 3rd arg (isKapacitorRule) makes sure 'auto' is not added as
|
const nextQueryConfig = applyFuncsToField(state[queryId], fieldFunc, {
|
||||||
// default group by in Kapacitor rule
|
preventAutoGroupBy: true,
|
||||||
const nextQueryConfig = applyFuncsToField(state[queryId], fieldFunc, true)
|
isKapacitorRule: true,
|
||||||
|
})
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
[queryId]: nextQueryConfig,
|
[queryId]: nextQueryConfig,
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function toggleTagAcceptance(query) {
|
||||||
export function applyFuncsToField(
|
export function applyFuncsToField(
|
||||||
query,
|
query,
|
||||||
{field, funcs},
|
{field, funcs},
|
||||||
preventAutoGroupBy = false
|
{preventAutoGroupBy = false, isKapacitorRule = false}
|
||||||
) {
|
) {
|
||||||
const shouldRemoveFuncs = funcs.length === 0
|
const shouldRemoveFuncs = funcs.length === 0
|
||||||
const nextFields = query.fields.map(f => {
|
const nextFields = query.fields.map(f => {
|
||||||
|
@ -130,13 +130,16 @@ export function applyFuncsToField(
|
||||||
time: shouldRemoveFuncs ? null : defaultGroupBy,
|
time: shouldRemoveFuncs ? null : defaultGroupBy,
|
||||||
})
|
})
|
||||||
|
|
||||||
const nextFill = NULL_STRING
|
const nextQuery = {...query, fields: nextFields, groupBy: nextGroupBy}
|
||||||
|
|
||||||
return Object.assign({}, query, {
|
// fill is not valid for kapacitor query configs since there is no actual
|
||||||
fields: nextFields,
|
// query and all alert rules create stream-based tasks currently
|
||||||
groupBy: nextGroupBy,
|
if (!isKapacitorRule) {
|
||||||
fill: nextFill,
|
const nextFill = NULL_STRING
|
||||||
})
|
Object.assign(nextQuery, {fill: nextFill})
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateRawQuery(query, rawText) {
|
export function updateRawQuery(query, rawText) {
|
||||||
|
|
Loading…
Reference in New Issue