From 799cd988f31f162623087189721e1893d74d24d7 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Mon, 18 Nov 2024 16:01:46 -0800 Subject: [PATCH] Show event properties UI when joined to events table --- .../ActionFilterRow/ActionFilterRow.tsx | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx index 15586e766a3..f4b5df34a83 100644 --- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx +++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx @@ -381,6 +381,29 @@ export function ActionFilterRow({ ].filter(Boolean) : [] + const eventsTableLazyJoinName = + filter.type === TaxonomicFilterGroupType.DataWarehouse && + filter.name && + Object.values(dataWarehouseTablesMap[filter.name]?.fields || {}).find( + (field) => field.type === 'lazy_table' && field.table === 'events' + )?.name + + const localTaxonomicGroupTypes = + filter.type == TaxonomicFilterGroupType.DataWarehouse + ? [ + TaxonomicFilterGroupType.DataWarehouseProperties, + eventsTableLazyJoinName ? TaxonomicFilterGroupType.EventProperties : undefined, + TaxonomicFilterGroupType.HogQLExpression, + ] + : propertiesTaxonomicGroupTypes + + const schemaColumns = + filter.type == TaxonomicFilterGroupType.DataWarehouse && filter.name + ? Object.values(dataWarehouseTablesMap[filter.name]?.fields ?? []).filter( + (field) => field.name !== eventsTableLazyJoinName + ) + : [] + return (
  • onMathPropertySelect(index, currentValue, groupType) @@ -605,14 +621,7 @@ export function ActionFilterRow({ } : undefined } - taxonomicGroupTypes={ - filter.type == TaxonomicFilterGroupType.DataWarehouse - ? [ - TaxonomicFilterGroupType.DataWarehouseProperties, - TaxonomicFilterGroupType.HogQLExpression, - ] - : propertiesTaxonomicGroupTypes - } + taxonomicGroupTypes={localTaxonomicGroupTypes} eventNames={ filter.type === TaxonomicFilterGroupType.Events && filter.id ? [String(filter.id)] @@ -620,11 +629,7 @@ export function ActionFilterRow({ ? getEventNamesForAction(parseInt(String(filter.id)), actions) : [] } - schemaColumns={ - filter.type == TaxonomicFilterGroupType.DataWarehouse && filter.name - ? Object.values(dataWarehouseTablesMap[filter.name]?.fields ?? []) - : [] - } + schemaColumns={schemaColumns} /> )}