Skip to content

Commit

Permalink
Merge branch 'master' into tom/add-stripe-account
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert09 committed Sep 2, 2024
2 parents 93575ed + b67e96d commit a0af7ec
Show file tree
Hide file tree
Showing 79 changed files with 2,142 additions and 264 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import './ErrorBoundary.scss'

import { ErrorBoundary as SentryErrorBoundary, getCurrentHub } from '@sentry/react'
import { useActions } from 'kea'
import type { Primitive } from '@sentry/types'
import { useActions, useValues } from 'kea'
import { supportLogic } from 'lib/components/Support/supportLogic'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { teamLogic } from 'scenes/teamLogic'

export function ErrorBoundary({ children }: { children?: React.ReactNode }): JSX.Element {
interface ErrorBoundaryProps {
children?: React.ReactNode
tags?: Record<string, Primitive>
}

export function ErrorBoundary({ children, tags = {} }: ErrorBoundaryProps): JSX.Element {
const isSentryInitialized = !!getCurrentHub().getClient()
const { currentTeamId } = useValues(teamLogic)
const { openSupportForm } = useActions(supportLogic)

return (
<SentryErrorBoundary
beforeCapture={(scope) => {
if (currentTeamId !== undefined) {
scope.setTag('team_id', currentTeamId)
}
scope.setTags(tags)
}}
fallback={({ error, eventId }) => (
<div className="ErrorBoundary">
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function InsightCardInternal(
style={{ ...(divProps?.style ?? {}), ...(theme?.boxStyle ?? {}) }}
ref={ref}
>
<ErrorBoundary>
<ErrorBoundary tags={{ feature: 'insight' }}>
<BindLogic logic={insightLogic} props={insightLogicProps}>
<InsightMeta
insight={insight}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/components/DatabaseTableTree/TreeRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function TreeRow({ item }: TreeRowProps): JSX.Element {
size="xsmall"
fullWidth
icon={item.icon ? <>{item.icon}</> : null}
className="font-mono"
>
<span className="flex-1 flex justify-between">
<span className="truncate">{item.name}</span>
Expand All @@ -50,6 +51,7 @@ export function TreeTableRow({ item, onClick, selected }: TreeTableRowProps): JS
<li>
<LemonButton
size="xsmall"
className="font-mono"
fullWidth
onClick={_onClick}
active={selected}
Expand Down Expand Up @@ -84,6 +86,7 @@ export function TreeFolderRow({ item, depth, onClick, selectedRow, dropdownOverl
<li className="overflow-hidden">
<LemonButton
size="small"
className="font-mono"
fullWidth
onClick={_onClick}
sideAction={
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/PropertyFilters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ export function propertyFilterTypeToPropertyDefinitionType(
? PropertyDefinitionType.Session
: filterType === PropertyFilterType.Recording
? PropertyDefinitionType.Session
: filterType === PropertyFilterType.LogEntry
? PropertyDefinitionType.LogEntry
: PropertyDefinitionType.Event
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
searchPlaceholder: 'actions',
type: TaxonomicFilterGroupType.Actions,
logic: actionsModel,
value: 'actions',
value: 'actionsSorted',
getName: (action: ActionType) => action.name || '',
getValue: (action: ActionType) => action.id,
getPopoverHeader: () => 'Action',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export const FEATURE_FLAGS = {
WEB_ANALYTICS_REPLAY: 'web-analytics-replay', // owner: @robbie-c
BATCH_EXPORTS_POSTHOG_HTTP: 'posthog-http-batch-exports',
EXPERIMENT_MAKE_DECISION: 'experiment-make-decision', // owner: @jurajmajerik #team-feature-success
WEB_ANALYTICS_CONVERSION_GOALS: 'web-analytics-conversion-goals', // owner: @robbie-c
WEB_ANALYTICS_LAST_CLICK: 'web-analytics-last-click', // owner: @robbie-c
} as const
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/lemon-ui/LemonButton/LemonButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
outline: none;
transition: var(--lemon-button-transition);

.font-normal {
.font-normal,
&.font-normal {
font-family: var(--font-sans);
}

Expand Down
16 changes: 16 additions & 0 deletions frontend/src/lib/taxonomy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,11 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = {
description: <span>Whether the session was a bounce.</span>,
examples: ['true', 'false'],
},
$last_external_click_url: {
label: 'Last external click URL',
description: <span>The last external URL clicked in this session</span>,
examples: ['https://example.com/interesting-article?parameter=true'],
},
},
groups: {
$group_key: {
Expand Down Expand Up @@ -1155,6 +1160,17 @@ export const CORE_FILTER_DEFINITIONS_BY_GROUP = {
description: 'URL a user visited during their session',
},
},
log_entries: {
level: {
label: 'Console log level',
description: 'Level of the ',
examples: ['info', 'warn', 'error'],
},
message: {
label: 'Console log message',
description: 'The contents of the log message',
},
},
} satisfies Partial<Record<TaxonomicFilterGroupType, Record<string, CoreFilterDefinition>>>

CORE_FILTER_DEFINITIONS_BY_GROUP.numerical_event_properties = CORE_FILTER_DEFINITIONS_BY_GROUP.event_properties
Expand Down
24 changes: 23 additions & 1 deletion frontend/src/models/actionsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const actionsModel = kea<actionsModelType>([
connect({
values: [teamLogic, ['currentTeam']],
}),
loaders(({ props, values }) => ({
loaders(({ props, values, actions }) => ({
actions: {
__default: [] as ActionType[],
loadActions: async () => {
Expand All @@ -31,6 +31,22 @@ export const actionsModel = kea<actionsModelType>([
},
updateAction: (action: ActionType) => (values.actions || []).map((a) => (action.id === a.id ? action : a)),
},
pin: {
pinAction: async (action: ActionType) => {
const response = await api.actions.update(action.id, {
name: action.name,
pinned_at: new Date().toISOString(),
})
actions.updateAction(response)
},
unpinAction: async (action: ActionType) => {
const response = await api.actions.update(action.id, {
name: action.name,
pinned_at: null,
})
actions.updateAction(response)
},
},
})),
selectors(({ selectors }) => ({
actionsGrouped: [
Expand All @@ -51,6 +67,12 @@ export const actionsModel = kea<actionsModelType>([
(actions): Partial<Record<string | number, ActionType>> =>
Object.fromEntries(actions.map((action) => [action.id, action])),
],
actionsSorted: [
(s) => [s.actions],
(actions: ActionType[]): ActionType[] => {
return actions.sort((a, b) => (b.pinned_at ? 1 : 0) - (a.pinned_at ? 1 : 0))
},
],
})),
events(({ values, actions }) => ({
afterMount: () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/propertyDefinitionsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const localOptions: Record<string, PropValue[]> = {
{ id: 0, name: 'web' },
{ id: 1, name: 'mobile' },
],
'session/console_log_level': [
'log_entry/level': [
{ id: 0, name: 'info' },
{ id: 1, name: 'warn' },
{ id: 2, name: 'error' },
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/queries/nodes/DataTable/queryFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
isHogQLQuery,
isPersonsNode,
isSessionAttributionExplorerQuery,
isWebGoalsQuery,
isWebOverviewQuery,
isWebStatsTableQuery,
isWebTopClicksQuery,
Expand Down Expand Up @@ -58,7 +59,12 @@ export function getQueryFeatures(query: Node): Set<QueryFeature> {
}
}

if (isWebOverviewQuery(query) || isWebTopClicksQuery(query) || isWebStatsTableQuery(query)) {
if (
isWebOverviewQuery(query) ||
isWebTopClicksQuery(query) ||
isWebStatsTableQuery(query) ||
isWebGoalsQuery(query)
) {
features.add(QueryFeature.columnsInResponse)
features.add(QueryFeature.resultIsArrayOfArrays)
features.add(QueryFeature.hideLoadNextButton)
Expand Down
39 changes: 21 additions & 18 deletions frontend/src/queries/nodes/InsightViz/InsightViz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'

import { ErrorBoundary } from '~/layout/ErrorBoundary'
import { InsightVizNode } from '~/queries/schema'
import { QueryContext } from '~/queries/types'
import { isFunnelsQuery } from '~/queries/utils'
Expand Down Expand Up @@ -93,25 +94,27 @@ export function InsightViz({ uniqueKey, query, setQuery, context, readOnly, embe
)

return (
<BindLogic logic={insightLogic} props={insightProps}>
<BindLogic logic={dataNodeLogic} props={dataNodeLogicProps}>
<BindLogic logic={insightVizDataLogic} props={insightProps}>
<div
className={
!isEmbedded
? clsx('InsightViz', {
'InsightViz--horizontal': isFunnels || isHorizontalAlways,
})
: 'InsightCard__viz'
}
>
{!readOnly && (
<EditorFilters query={query.source} showing={showingFilters} embedded={isEmbedded} />
)}
{!isEmbedded ? <div className="flex-1 h-full overflow-auto">{display}</div> : display}
</div>
<ErrorBoundary tags={{ feature: 'InsightViz' }}>
<BindLogic logic={insightLogic} props={insightProps}>
<BindLogic logic={dataNodeLogic} props={dataNodeLogicProps}>
<BindLogic logic={insightVizDataLogic} props={insightProps}>
<div
className={
!isEmbedded
? clsx('InsightViz', {
'InsightViz--horizontal': isFunnels || isHorizontalAlways,
})
: 'InsightCard__viz'
}
>
{!readOnly && (
<EditorFilters query={query.source} showing={showingFilters} embedded={isEmbedded} />
)}
{!isEmbedded ? <div className="flex-1 h-full overflow-auto">{display}</div> : display}
</div>
</BindLogic>
</BindLogic>
</BindLogic>
</BindLogic>
</ErrorBoundary>
)
}
Loading

0 comments on commit a0af7ec

Please sign in to comment.