Skip to content

Commit

Permalink
include global properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Sep 4, 2024
1 parent b2bede5 commit 7a3a4bd
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
PipelineTab,
PropertyFilterType,
PropertyGroupFilter,
PropertyGroupFilterValue,
} from '~/types'

import { EmailTemplate } from './email-templater/emailTemplaterLogic'
Expand Down Expand Up @@ -448,10 +449,14 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
sparklineQuery: [
(s) => [s.configuration],
(configuration): TrendsQuery => {
const properties: PropertyGroupFilter = {
const seriesProperties: PropertyGroupFilterValue = {
type: FilterLogicalOperator.Or,
values: [],
}
const properties: PropertyGroupFilter = {
type: FilterLogicalOperator.And,
values: [seriesProperties],
}
for (const event of configuration.filters?.events ?? []) {
const eventProperties: AnyPropertyFilter[] = [...(event.properties ?? [])]
if (event.id) {
Expand All @@ -466,7 +471,7 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
key: 'true',
})
}
properties.values.push({
seriesProperties.values.push({
type: FilterLogicalOperator.And,
values: eventProperties,
})
Expand All @@ -479,11 +484,21 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
key: hogql`matchesAction(${parseInt(action.id)})`,
})
}
properties.values.push({
seriesProperties.values.push({
type: FilterLogicalOperator.And,
values: actionProperties,
})
}
if ((configuration.filters?.properties?.length ?? 0) > 0) {
const globalProperties: PropertyGroupFilterValue = {
type: FilterLogicalOperator.And,
values: [],
}
for (const property of configuration.filters?.properties ?? []) {
globalProperties.values.push(property as AnyPropertyFilter)
}
properties.values.push(globalProperties)
}

return {
kind: NodeKind.TrendsQuery,
Expand Down

0 comments on commit 7a3a4bd

Please sign in to comment.