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