Skip to content

Commit

Permalink
Merge branch 'master' into fix/backfill-runs
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-landing-page--dark.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-landing-page--light.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-landing-page-iff-legacy-sources--dark.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-landing-page-iff-legacy-sources--light.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-overview-page--dark.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-overview-page--light.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-transformations-page--dark.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-transformations-page--light.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-transformations-page-empty--dark.png
#	frontend/__snapshots__/scenes-app-pipeline--pipeline-transformations-page-empty--light.png
  • Loading branch information
benjackwhite committed Jul 23, 2024
2 parents e3314f6 + 5dd0781 commit 9687c28
Show file tree
Hide file tree
Showing 77 changed files with 792 additions and 1,371 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/src/lib/components/Playlist/Playlist.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

.SessionRecordingPlaylistHeightWrapper {
// NOTE: Somewhat random way to offset the various headers and tabs above the playlist
height: calc(100vh - 15rem);
min-height: 41rem;
height: calc(100vh - 14rem);
min-height: 25rem;
}

.SessionRecordingPreview {
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export const FEATURE_FLAGS = {
REPLAY_SIMILAR_RECORDINGS: 'session-replay-similar-recordings', // owner: #team-replay
SAVED_NOT_PINNED: 'saved-not-pinned', // owner: #team-replay
NEW_EXPERIMENTS_UI: 'new-experiments-ui', // owner: @jurajmajerik #team-feature-success
SESSION_REPLAY_FILTER_ORDERING: 'session-replay-filter-ordering', // owner: #team-replay
REPLAY_ERROR_CLUSTERING: 'session-replay-error-clustering', // owner: #team-replay
AUDIT_LOGS_ACCESS: 'audit-logs-access', // owner: #team-growth
SUBSCRIBE_FROM_PAYGATE: 'subscribe-from-paygate', // owner: #team-growth
Expand All @@ -202,7 +201,6 @@ export const FEATURE_FLAGS = {
HOG: 'hog', // owner: @mariusandra
HOG_FUNCTIONS: 'hog-functions', // owner: #team-cdp
PERSONLESS_EVENTS_NOT_SUPPORTED: 'personless-events-not-supported', // owner: @raquelmsmith
SESSION_REPLAY_UNIVERSAL_FILTERS: 'session-replay-universal-filters', // owner: #team-replay
ALERTS: 'alerts', // owner: github.com/nikitaevg
ERROR_TRACKING: 'error-tracking', // owner: #team-replay
SETTINGS_BOUNCE_RATE_PAGE_VIEW_MODE: 'settings-bounce-rate-page-view-mode', // owner: @robbie-c
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/queries/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ limit 100`,
},
}

const HogQLForDataWarehouse: HogQLQuery = {
kind: NodeKind.HogQLQuery,
query: `select toDate(timestamp) as timestamp, event as event
from events
limit 100`,
explain: true,
}

const DataWarehouse: DataVisualizationNode = {
kind: NodeKind.DataVisualizationNode,
source: HogQLForDataWarehouse,
}

const HogQLTable: DataTableNode = {
kind: NodeKind.DataTableNode,
full: true,
Expand Down Expand Up @@ -344,6 +357,7 @@ export const examples: Record<string, Node> = {
DataVisualization,
Hog,
Hoggonacci,
DataWarehouse,
}

export const stringifiedExamples: Record<string, string> = Object.fromEntries(
Expand Down
29 changes: 16 additions & 13 deletions frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { LemonDivider } from '@posthog/lemon-ui'
import { BindLogic, useValues } from 'kea'
import { router } from 'kea-router'
import { AnimationType } from 'lib/animations/animations'
import { Animation } from 'lib/components/Animation/Animation'
import { useCallback, useState } from 'react'
import { DatabaseTableTreeWithItems } from 'scenes/data-warehouse/external/DataWarehouseTables'
import { insightLogic } from 'scenes/insights/insightLogic'
import { HogQLBoldNumber } from 'scenes/insights/views/BoldNumber/BoldNumber'
import { urls } from 'scenes/urls'

import { insightVizDataCollectionId, insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'
import { AnyResponseType, DataVisualizationNode, HogQLQuery, NodeKind } from '~/queries/schema'
Expand Down Expand Up @@ -123,19 +125,6 @@ function InternalDataTableVisualization(props: DataTableVisualizationProps): JSX
{!readOnly && showEditingUI && (
<>
<HogQLQueryEditor query={query.source} setQuery={setQuerySource} embedded />
{sourceFeatures.has(QueryFeature.dateRangePicker) && (
<div className="flex gap-4 items-center flex-wrap">
<DateRange
key="date-range"
query={query.source}
setQuery={(query) => {
if (query.kind === NodeKind.HogQLQuery) {
setQuerySource(query)
}
}}
/>
</div>
)}
</>
)}
{!readOnly && showResultControls && (
Expand All @@ -147,6 +136,20 @@ function InternalDataTableVisualization(props: DataTableVisualizationProps): JSX
<ElapsedTime />
</div>
<div className="flex gap-4 items-center">
{sourceFeatures.has(QueryFeature.dateRangePicker) &&
!router.values.location.pathname.includes(urls.dataWarehouse()) && ( // decouple this component from insights tab and datawarehouse scene
<div className="flex gap-4 items-center flex-wrap">
<DateRange
key="date-range"
query={query.source}
setQuery={(query) => {
if (query.kind === NodeKind.HogQLQuery) {
setQuerySource(query)
}
}}
/>
</div>
)}
<TableDisplay />
</div>
</div>
Expand Down
24 changes: 6 additions & 18 deletions frontend/src/queries/nodes/HogQLQuery/HogQLQueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,29 +223,17 @@ export function HogQLQueryEditor(props: HogQLQueryEditorProps): JSX.Element {
: ''
}
data-attr="hogql-query-editor-save-as-view"
>
Save as view
</LemonButton>
)}
<LemonButtonWithDropdown
className="ml-2"
icon={<IconInfo />}
type="secondary"
size="small"
dropdown={{
overlay: (
tooltip={
<div>
Save a query as a view that can be referenced in another query. This is
useful for modeling data and organizing large queries into readable chunks.{' '}
<Link to="https://posthog.com/docs/data-warehouse">More Info</Link>{' '}
</div>
),
placement: 'right-start',
fallbackPlacements: ['left-start'],
actionable: true,
closeParentPopoverOnClickInside: true,
}}
/>
}
>
Save as view
</LemonButton>
)}
</>
)}
</div>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@
"normalize_url": {
"type": "boolean"
},
"property": {
"type": "string"
},
"type": {
"anyOf": [
{
Expand All @@ -432,12 +435,9 @@
"type": "null"
}
]
},
"value": {
"type": "string"
}
},
"required": ["value"],
"required": ["property"],
"type": "object"
},
"BreakdownAttributionType": {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ export type MultipleBreakdownType = Extract<BreakdownType, 'person' | 'event' |

export interface Breakdown {
type?: MultipleBreakdownType | null
value: string
property: string
normalize_url?: boolean
group_type_index?: integer | null
histogram_bin_count?: integer // trends breakdown histogram bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { router } from 'kea-router'
import { PageHeader } from 'lib/components/PageHeader'
import { insightDataLogic } from 'scenes/insights/insightDataLogic'
import { insightLogic } from 'scenes/insights/insightLogic'
import { InsightSaveButton } from 'scenes/insights/InsightSaveButton'
import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -42,29 +41,29 @@ export const humanFriendlyDataWarehouseTabName = (tab: DataWarehouseTab): string
export function DataWarehouseExternalScene(): JSX.Element {
const { currentTab } = useValues(dataWarehouseSceneLogic)

const { insightProps, insightChanged, insightSaving, hasDashboardItemId } = useValues(
const { insightProps, insightSaving } = useValues(
insightLogic({
dashboardItemId: 'new',
cachedInsight: null,
})
)

const { saveInsight, saveAs } = useActions(insightDataLogic(insightProps))
const { saveAs } = useActions(insightDataLogic(insightProps))

return (
<div>
<PageHeader
buttons={
<>
{currentTab === DataWarehouseTab.Explore && (
<InsightSaveButton
saveAs={saveAs}
saveInsight={saveInsight}
isSaved={hasDashboardItemId}
addingToDashboard={false}
insightSaving={insightSaving}
insightChanged={insightChanged}
/>
<LemonButton
type="primary"
data-attr="save-exploration"
onClick={() => saveAs(true)}
loading={insightSaving}
>
Save as insight
</LemonButton>
)}

<LemonButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { actions, afterMount, beforeUnmount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import api, { ApiMethodOptions, PaginatedResponse } from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import posthog from 'posthog-js'
Expand Down Expand Up @@ -138,24 +139,24 @@ export const dataWarehouseSettingsLogic = kea<dataWarehouseSettingsLogicType>([
},
],
}),
listeners(({ actions, values, cache }) => ({
deleteSelfManagedTable: async ({ tableId }) => {
await api.dataWarehouseTables.delete(tableId)
actions.loadDatabase()
},
loadSourcesSuccess: () => {
urlToAction(({ cache, actions }) => ({
'/data-warehouse/managed-sources': () => {
clearTimeout(cache.refreshTimeout)

cache.refreshTimeout = setTimeout(() => {
actions.loadSources(null)
}, REFRESH_INTERVAL)
},
loadSourcesFailure: () => {
clearTimeout(cache.refreshTimeout)

cache.refreshTimeout = setTimeout(() => {
actions.loadSources(null)
}, REFRESH_INTERVAL)
'*': () => {
if (cache.refreshTimeout && router.values.location.pathname !== '/data-warehouse/managed-sources') {
clearTimeout(cache.refreshTimeout)
}
},
})),
listeners(({ actions, values, cache }) => ({
deleteSelfManagedTable: async ({ tableId }) => {
await api.dataWarehouseTables.delete(tableId)
actions.loadDatabase()
},
deleteSource: async ({ source }) => {
await api.externalDataSources.delete(source.id)
Expand Down Expand Up @@ -214,4 +215,7 @@ export const dataWarehouseSettingsLogic = kea<dataWarehouseSettingsLogicType>([
afterMount(({ actions }) => {
actions.loadSources(null)
}),
beforeUnmount(({ cache }) => {
clearTimeout(cache.refreshTimeout)
}),
])
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export const dataWarehouseSourcesTableSyncMethodModalLogic = kea<dataWarehouseSo
props({ schema: {} } as DataWarehouseSourcesTableSyncMethodModalLogicProps),
key((props) => props.schema.id),
connect(() => ({
actions: [dataWarehouseSettingsLogic, ['updateSchema', 'updateSchemaSuccess', 'updateSchemaFailure']],
actions: [
dataWarehouseSettingsLogic,
['updateSchema', 'updateSchemaSuccess', 'updateSchemaFailure', 'loadSources'],
],
})),
actions({
openSyncMethodModal: (schema: ExternalDataSourceSchema) => ({ schema }),
Expand Down Expand Up @@ -59,6 +62,7 @@ export const dataWarehouseSourcesTableSyncMethodModalLogic = kea<dataWarehouseSo
}),
listeners(({ actions }) => ({
updateSchemaSuccess: () => {
actions.loadSources(null)
actions.resetSchemaIncrementalFields()
actions.closeSyncMethodModal()
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/funnels/funnelDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
if (!isTimeToConvertFunnel && Array.isArray(results)) {
if (isBreakdownFunnelResults(results)) {
const breakdownProperty = breakdownFilter?.breakdowns
? breakdownFilter?.breakdowns.map((b) => b.value).join('::')
? breakdownFilter?.breakdowns.map((b) => b.property).join('::')
: breakdownFilter?.breakdown ?? undefined
return aggregateBreakdownResult(results, breakdownProperty).sort((a, b) => a.order - b.order)
}
Expand Down
28 changes: 9 additions & 19 deletions frontend/src/scenes/groups/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NotFound } from 'lib/components/NotFound'
import { PageHeader } from 'lib/components/PageHeader'
import { PropertiesTable } from 'lib/components/PropertiesTable'
import { TZLabel } from 'lib/components/TZLabel'
import { isEventFilter } from 'lib/components/UniversalFilters/utils'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
Expand All @@ -17,6 +18,7 @@ import { NotebookSelectButton } from 'scenes/notebooks/NotebookSelectButton/Note
import { RelatedFeatureFlags } from 'scenes/persons/RelatedFeatureFlags'
import { SceneExport } from 'scenes/sceneTypes'
import { SessionRecordingsPlaylist } from 'scenes/session-recordings/playlist/SessionRecordingsPlaylist'
import { filtersFromUniversalFilterGroups } from 'scenes/session-recordings/utils'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'

Expand Down Expand Up @@ -154,7 +156,7 @@ export function Group(): JSX.Element {
<SessionRecordingsPlaylist
logicKey="groups-recordings"
updateSearchParams
universalFilters={{
filters={{
duration: [
{
type: PropertyFilterType.Recording,
Expand Down Expand Up @@ -184,24 +186,12 @@ export function Group(): JSX.Element {
],
},
}}
advancedFilters={{
events: [
{
type: 'events',
order: 0,
name: 'All events',
properties: [
{
key: `$group_${groupTypeIndex} = '${groupKey}'`,
type: 'hogql',
},
],
},
],
}}
onFiltersChange={(_, legacyFilters) => {
const stillHasGroupFilter = legacyFilters.events?.some((event) => {
return event.properties.some(
onFiltersChange={(filters) => {
const eventFilters =
filtersFromUniversalFilterGroups(filters).filter(isEventFilter)

const stillHasGroupFilter = eventFilters?.some((event) => {
return event.properties?.some(
(prop: Record<string, any>) =>
prop.key === `$group_${groupTypeIndex} = '${groupKey}'`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export function TaxonomicBreakdownFilter({
const tags = breakdownArray.map((breakdown) =>
typeof breakdown === 'object' ? (
<EditableBreakdownTag
key={breakdown.value}
breakdown={breakdown.value}
key={breakdown.property}
breakdown={breakdown.property}
breakdownType={breakdown.type ?? 'event'}
isTrends={isTrends}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
(s) => [s.breakdownFilter, s.breakdown, s.breakdownType],
({ breakdowns }, breakdown, breakdownType) =>
breakdowns?.find(
(savedBreakdown) => savedBreakdown.value === breakdown && savedBreakdown.type === breakdownType
(savedBreakdown) => savedBreakdown.property === breakdown && savedBreakdown.type === breakdownType
),
],
histogramBinsUsed: [
Expand Down Expand Up @@ -147,7 +147,7 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
? filterToTaxonomicFilterType(
multipleBreakdown?.type,
multipleBreakdown?.group_type_index,
multipleBreakdown?.value
multipleBreakdown?.property
)
: breakdownFilterToTaxonomicFilterType(breakdownFilter)

Expand Down
Loading

0 comments on commit 9687c28

Please sign in to comment.