0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00

Add minor tweaks

This commit is contained in:
Robbie Coomber 2024-11-22 16:56:35 +00:00
parent 53150254b8
commit cb04d8831a
7 changed files with 13 additions and 54 deletions

View File

@ -8,7 +8,7 @@ from typing import Literal, Optional, TypedDict, Union, cast
from pydantic import BaseModel, Field, RootModel from pydantic import BaseModel, Field, RootModel
from ee.hogai.taxonomy import CORE_FILTER_DEFINITIONS_BY_GROUP from ee.hogai.taxonomy import CORE_FILTER_DEFINITIONS_BY_GROUP
from posthog.hogql.database.schema.channel_type import POSSIBLE_CHANNEL_TYPES from posthog.hogql.database.schema.channel_type import DEFAULT_CHANNEL_TYPES
from posthog.hogql_queries.ai.actors_property_taxonomy_query_runner import ActorsPropertyTaxonomyQueryRunner from posthog.hogql_queries.ai.actors_property_taxonomy_query_runner import ActorsPropertyTaxonomyQueryRunner
from posthog.hogql_queries.ai.event_taxonomy_query_runner import EventTaxonomyQueryRunner from posthog.hogql_queries.ai.event_taxonomy_query_runner import EventTaxonomyQueryRunner
from posthog.hogql_queries.query_runner import ExecutionMode from posthog.hogql_queries.query_runner import ExecutionMode
@ -353,7 +353,7 @@ class TaxonomyAgentToolkit(ABC):
sample_values: list[str | int | float] sample_values: list[str | int | float]
if property_name == "$channel_type": if property_name == "$channel_type":
sample_values = cast(list[str | int | float], POSSIBLE_CHANNEL_TYPES.copy()) sample_values = cast(list[str | int | float], DEFAULT_CHANNEL_TYPES.copy())
sample_count = len(sample_values) sample_count = len(sample_values)
is_str = True is_str = True
elif ( elif (

View File

@ -1,5 +1,3 @@
import './styles.scss'
import { import {
closestCenter, closestCenter,
CollisionDetection, CollisionDetection,

View File

@ -1,21 +0,0 @@
.VerticalNestedDNDContainer {
box-sizing: initial;
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
background: var(--bg-light);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.VerticalNestedDNDItem {
box-sizing: initial;
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
background: var(--bg-light);
border: 1px solid var(--border);
border-radius: var(--radius);
}

View File

@ -138,7 +138,9 @@ export function CustomChannelTypes(): JSX.Element {
Object.values(DefaultChannelTypes).forEach((channelType) => { Object.values(DefaultChannelTypes).forEach((channelType) => {
optionsSet.add(channelType) optionsSet.add(channelType)
}) })
return Array.from(optionsSet).map((channelType) => ({ label: channelType, key: channelType })) return Array.from(optionsSet)
.filter(Boolean)
.map((channelType) => ({ label: channelType, key: channelType }))
}, [customChannelTypeRules]) }, [customChannelTypeRules])
return ( return (

View File

@ -8,6 +8,7 @@ from posthog.schema import (
CustomChannelRule, CustomChannelRule,
CustomChannelOperator, CustomChannelOperator,
CustomChannelField, CustomChannelField,
DefaultChannelTypes,
) )
@ -288,23 +289,4 @@ multiIf(
return builtin_rules return builtin_rules
POSSIBLE_CHANNEL_TYPES = [ DEFAULT_CHANNEL_TYPES = [entry.value for entry in DefaultChannelTypes]
"Cross Network",
"Paid Search",
"Paid Social",
"Paid Video",
"Paid Shopping",
"Paid Unknown",
"Direct",
"Organic Search",
"Organic Social",
"Organic Video",
"Organic Shopping",
"Push",
"SMS",
"Audio",
"Email",
"Referral",
"Affiliate",
"Unknown",
]

View File

@ -20,6 +20,7 @@ from posthog.hogql.database.models import (
from posthog.hogql.database.schema.channel_type import ( from posthog.hogql.database.schema.channel_type import (
create_channel_type_expr, create_channel_type_expr,
ChannelTypeExprs, ChannelTypeExprs,
DEFAULT_CHANNEL_TYPES,
) )
from posthog.hogql.database.schema.util.where_clause_extractor import SessionMinTimestampWhereClauseExtractorV1 from posthog.hogql.database.schema.util.where_clause_extractor import SessionMinTimestampWhereClauseExtractorV1
from posthog.hogql.errors import ResolutionError from posthog.hogql.errors import ResolutionError
@ -29,7 +30,7 @@ from posthog.models.sessions.sql import (
SELECT_SESSION_PROP_STRING_VALUES_SQL, SELECT_SESSION_PROP_STRING_VALUES_SQL,
) )
from posthog.queries.insight import insight_sync_execute from posthog.queries.insight import insight_sync_execute
from posthog.schema import BounceRatePageViewMode, DefaultChannelTypes from posthog.schema import BounceRatePageViewMode
if TYPE_CHECKING: if TYPE_CHECKING:
from posthog.models.team import Team from posthog.models.team import Team
@ -410,9 +411,7 @@ def get_lazy_session_table_values_v1(key: str, search_term: Optional[str], team:
if key == "$channel_type": if key == "$channel_type":
return [ return [
[entry.value] [entry] for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower()
for entry in DefaultChannelTypes
if not search_term or search_term.lower() in entry.value.lower()
] ]
field_definition = LAZY_SESSIONS_FIELDS.get(key) field_definition = LAZY_SESSIONS_FIELDS.get(key)

View File

@ -20,6 +20,7 @@ from posthog.hogql.database.models import (
from posthog.hogql.database.schema.channel_type import ( from posthog.hogql.database.schema.channel_type import (
create_channel_type_expr, create_channel_type_expr,
ChannelTypeExprs, ChannelTypeExprs,
DEFAULT_CHANNEL_TYPES,
) )
from posthog.hogql.database.schema.sessions_v1 import null_if_empty from posthog.hogql.database.schema.sessions_v1 import null_if_empty
from posthog.hogql.database.schema.util.where_clause_extractor import SessionMinTimestampWhereClauseExtractorV2 from posthog.hogql.database.schema.util.where_clause_extractor import SessionMinTimestampWhereClauseExtractorV2
@ -31,7 +32,7 @@ from posthog.models.raw_sessions.sql import (
RAW_SELECT_SESSION_PROP_STRING_VALUES_SQL_WITH_FILTER, RAW_SELECT_SESSION_PROP_STRING_VALUES_SQL_WITH_FILTER,
) )
from posthog.queries.insight import insight_sync_execute from posthog.queries.insight import insight_sync_execute
from posthog.schema import BounceRatePageViewMode, CustomChannelRule, DefaultChannelTypes from posthog.schema import BounceRatePageViewMode, CustomChannelRule
if TYPE_CHECKING: if TYPE_CHECKING:
from posthog.models.team import Team from posthog.models.team import Team
@ -502,9 +503,7 @@ def get_lazy_session_table_values_v2(key: str, search_term: Optional[str], team:
else: else:
custom_channel_types = [] custom_channel_types = []
default_channel_types = [ default_channel_types = [
entry.value entry for entry in DEFAULT_CHANNEL_TYPES if not search_term or search_term.lower() in entry.value.lower()
for entry in DefaultChannelTypes
if not search_term or search_term.lower() in entry.value.lower()
] ]
# merge the list, keep the order, and remove duplicates # merge the list, keep the order, and remove duplicates
return [[name] for name in list(dict.fromkeys(custom_channel_types + default_channel_types))] return [[name] for name in list(dict.fromkeys(custom_channel_types + default_channel_types))]