diff --git a/ui/src/data_explorer/reducers/queryConfigs.js b/ui/src/data_explorer/reducers/queryConfigs.js index 84dbbffd82..5db58324b9 100644 --- a/ui/src/data_explorer/reducers/queryConfigs.js +++ b/ui/src/data_explorer/reducers/queryConfigs.js @@ -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, diff --git a/ui/src/kapacitor/reducers/queryConfigs.js b/ui/src/kapacitor/reducers/queryConfigs.js index cdc652c273..5ef770e2e7 100644 --- a/ui/src/kapacitor/reducers/queryConfigs.js +++ b/ui/src/kapacitor/reducers/queryConfigs.js @@ -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, diff --git a/ui/src/utils/queryTransitions.js b/ui/src/utils/queryTransitions.js index ce0d1c12cb..dc694684cc 100644 --- a/ui/src/utils/queryTransitions.js +++ b/ui/src/utils/queryTransitions.js @@ -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) {