Skip to content

Commit

Permalink
Merge branch 'master' into quick-start-reverse-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield authored Mar 15, 2024
2 parents c547f3a + 5209274 commit eca6df1
Show file tree
Hide file tree
Showing 44 changed files with 759 additions and 592 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/invites.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Invite Signup', () => {

cy.location('pathname').should('contain', '/settings/organization')
cy.get('[id="invites"]').should('exist')
cy.contains('Pending Invites').should('exist')
cy.contains('Pending invites').should('exist')

// Test invite creation flow
cy.get('[data-attr=invite-teammate-button]').click()
Expand Down Expand Up @@ -102,15 +102,15 @@ describe('Invite Signup', () => {

// Change membership level
cy.contains('[data-attr=org-members-table] tr', user).within(() => {
cy.get('[data-attr=membership-level]').last().should('contain', 'member')
cy.get('[data-attr=membership-level]').last().should('contain', 'Member')
cy.get('[data-attr=more-button]').last().click()
})

// more menu is not within the row
cy.get('[data-test-level=8]').click()

cy.contains('[data-attr=org-members-table] tr', user).within(() => {
cy.get('[data-attr=membership-level]').last().should('contain', 'admin')
cy.get('[data-attr=membership-level]').last().should('contain', 'Admin')
})

// Delete member
Expand Down
2 changes: 1 addition & 1 deletion ee/api/dashboard_collaborator.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DashboardCollaboratorViewSet(
mixins.DestroyModelMixin,
viewsets.GenericViewSet,
):
scope_object = "INTERNAL"
scope_object = "dashboard"
permission_classes = [CanEditDashboardCollaborator]
pagination_class = None
queryset = DashboardPrivilege.objects.select_related("dashboard").filter(user__is_active=True)
Expand Down
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.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ import { ActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'
import { ActivityScope, InsightShortId } from '~/types'

export const teamActivityResponseJson: ActivityLogItem[] = [
{
user: {
first_name: 'sdavasdadadsadas',
last_name: '',
email: '[email protected]',
},
unread: false,
is_staff: false,
is_system: false,
activity: 'updated',
item_id: '1',
scope: ActivityScope.TEAM,
detail: {
name: 'Default Project',
type: undefined,
merge: null,
changes: [
{
type: ActivityScope.TEAM,
after: { poe_v2_enabled: true },
field: 'extra_settings',
action: 'created',
before: null,
},
],
trigger: null,
short_id: null,
},
created_at: '2024-02-08T19:23:53.530402Z',
},
{
user: {
first_name: 'sdavasdadadsadas',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,18 @@ function DefinitionView({ group }: { group: TaxonomicFilterGroup }): JSX.Element
onChange={(value) => setLocalDefinition({ id_field: value })}
/>

<label className="definition-popover-edit-form-label" htmlFor="ID Field">
<label className="definition-popover-edit-form-label" htmlFor="Distinct Id Field">
<span className="label-text">Distinct ID field</span>
</label>
<LemonSelect
value={
'distinct_id_field' in localDefinition ? localDefinition.distinct_id_field : undefined
}
options={columnOptions}
onChange={(value) => setLocalDefinition({ distinct_id_field: value })}
/>

<label className="definition-popover-edit-form-label" htmlFor="Timestamp Field">
<span className="label-text">Timestamp field</span>
</label>
<LemonSelect
Expand All @@ -313,7 +324,9 @@ function DefinitionView({ group }: { group: TaxonomicFilterGroup }): JSX.Element
'id_field' in localDefinition &&
localDefinition.id_field &&
'timestamp_field' in localDefinition &&
localDefinition.timestamp_field
localDefinition.timestamp_field &&
'distinct_id_field' in localDefinition &&
localDefinition.distinct_id_field
? null
: 'Field mappings must be specified'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'
import { useEffect, useState } from 'react'

import { AnyDataNode } from '~/queries/schema'
import { AnyDataNode, DatabaseSchemaQueryResponseField } from '~/queries/schema'

export interface TaxonomicPopoverProps<ValueType extends TaxonomicFilterValue = TaxonomicFilterValue>
extends Omit<LemonButtonProps, 'children' | 'onClick' | 'sideIcon' | 'sideAction'> {
Expand All @@ -19,6 +19,7 @@ export interface TaxonomicPopoverProps<ValueType extends TaxonomicFilterValue =
placeholder?: React.ReactNode
placeholderClass?: string
dropdownMatchSelectWidth?: boolean
schemaColumns?: DatabaseSchemaQueryResponseField[]
allowClear?: boolean
style?: React.CSSProperties
excludedProperties?: { [key in TaxonomicFilterGroupType]?: TaxonomicFilterValue[] }
Expand Down Expand Up @@ -49,6 +50,7 @@ export function TaxonomicPopover<ValueType extends TaxonomicFilterValue = Taxono
allowClear = false,
excludedProperties,
metadataSource,
schemaColumns,
...buttonPropsRest
}: TaxonomicPopoverProps<ValueType>): JSX.Element {
const [localValue, setLocalValue] = useState<ValueType>(value || ('' as ValueType))
Expand Down Expand Up @@ -85,6 +87,7 @@ export function TaxonomicPopover<ValueType extends TaxonomicFilterValue = Taxono
}}
taxonomicGroupTypes={groupTypes ?? [groupType]}
eventNames={eventNames}
schemaColumns={schemaColumns}
metadataSource={metadataSource}
excludedProperties={excludedProperties}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const legacyEntityToNode = (
custom_name: entity.custom_name || undefined,
id_field: 'id_field' in entity ? entity.id_field : undefined,
timestamp_field: 'timestamp_field' in entity ? entity.timestamp_field : undefined,
distinct_id_field: 'distinct_id_field' in entity ? entity.distinct_id_field : undefined,
table_name: 'table_name' in entity ? entity.table_name : undefined,
}

Expand All @@ -103,6 +104,7 @@ export const legacyEntityToNode = (
...shared,
id_field: entity.id_field || undefined,
timestamp_field: entity.timestamp_field || undefined,
distinct_id_field: entity.distinct_id_field || undefined,
table_name: entity.table_name || undefined,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export const seriesNodeToFilter = (
math_group_type_index: node.math_group_type_index,
properties: node.properties as any, // TODO,
...(isDataWarehouseNode(node)
? { table_name: node.table_name, id_field: node.id_field, timestamp_field: node.timestamp_field }
? {
table_name: node.table_name,
id_field: node.id_field,
timestamp_field: node.timestamp_field,
distinct_id_field: node.distinct_id_field,
}
: {}),
})
return entity
Expand Down
32 changes: 30 additions & 2 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,34 @@
"required": ["kind", "source"],
"type": "object"
},
"DataWarehouseEventsModifier": {
"additionalProperties": false,
"properties": {
"distinct_id_field": {
"type": "string"
},
"id_field": {
"type": "string"
},
"table_name": {
"type": "string"
},
"timestamp_field": {
"type": "string"
}
},
"required": ["table_name", "timestamp_field", "distinct_id_field", "id_field"],
"type": "object"
},
"DataWarehouseNode": {
"additionalProperties": false,
"properties": {
"custom_name": {
"type": "string"
},
"distinct_id_field": {
"type": "string"
},
"fixedProperties": {
"description": "Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)",
"items": {
Expand Down Expand Up @@ -837,7 +859,7 @@
"type": "string"
}
},
"required": ["id", "id_field", "kind", "table_name", "timestamp_field"],
"required": ["distinct_id_field", "id", "id_field", "kind", "table_name", "timestamp_field"],
"type": "object"
},
"DataWarehousePropertyFilter": {
Expand Down Expand Up @@ -1960,7 +1982,7 @@
"additionalProperties": false,
"properties": {
"average_conversion_time": {
"type": "number"
"type": ["number", "null"]
},
"bins": {
"items": {
Expand Down Expand Up @@ -2526,6 +2548,12 @@
"additionalProperties": false,
"description": "HogQL Query Options are automatically set per team. However, they can be overriden in the query.",
"properties": {
"dataWarehouseEventsModifiers": {
"items": {
"$ref": "#/definitions/DataWarehouseEventsModifier"
},
"type": "array"
},
"inCohortVia": {
"enum": ["auto", "leftjoin", "subquery", "leftjoin_conjoined"],
"type": "string"
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ export interface HogQLQueryModifiers {
personsArgMaxVersion?: 'auto' | 'v1' | 'v2'
inCohortVia?: 'auto' | 'leftjoin' | 'subquery' | 'leftjoin_conjoined'
materializationMode?: 'auto' | 'legacy_null_as_string' | 'legacy_null_as_null' | 'disabled'
dataWarehouseEventsModifiers?: DataWarehouseEventsModifier[]
}

export interface DataWarehouseEventsModifier {
table_name: string
timestamp_field: string
distinct_id_field: string
id_field: string
}

export interface HogQLQueryResponse {
Expand Down Expand Up @@ -376,6 +384,7 @@ export interface DataWarehouseNode extends EntityNode {
id_field: string
table_name: string
timestamp_field: string
distinct_id_field: string
}

export interface ActionsNode extends EntityNode {
Expand Down Expand Up @@ -713,7 +722,7 @@ type BinNumber = number
export type FunnelStepsResults = Record<string, any>[]
export type FunnelStepsBreakdownResults = Record<string, any>[][]
export type FunnelTimeToConvertResults = {
average_conversion_time: number
average_conversion_time: number | null
bins: [BinNumber, BinNumber][]
}
export type FunnelTrendsResults = Record<string, any>[]
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/data-warehouse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface DataWarehouseTableBaseType {
// used for selecting in trends series
id_field?: string
timestamp_field?: string
distinct_id_field?: string
}

export interface DataWarehousePostHogTableType extends DataWarehouseTableBaseType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ export function ActionFilterRow({
const { setNodeRef, attributes, transform, transition, listeners, isDragging } = useSortable({ id: filter.uuid })

const propertyFiltersVisible = typeof filter.order === 'number' ? entityFilterVisible[filter.order] : false
const mathDisabledReason =
filter.type === EntityTypes.DATA_WAREHOUSE ? 'Data Warehouse Series only supports total counts' : ''

let name: string | null | undefined, value: PropertyFilterValue
const {
Expand Down Expand Up @@ -239,6 +237,7 @@ export function ActionFilterRow({
name: item?.name ?? '',
id_field: item?.id_field,
timestamp_field: item?.timestamp_field,
distinct_id_field: item?.distinct_id_field,
table_name: item?.name,
index,
})
Expand Down Expand Up @@ -375,7 +374,6 @@ export function ActionFilterRow({
index={index}
onMathSelect={onMathSelect}
disabled={readOnly}
disabledReason={mathDisabledReason}
style={{ maxWidth: '100%', width: 'initial' }}
mathAvailability={mathAvailability}
/>
Expand All @@ -385,9 +383,15 @@ export function ActionFilterRow({
<TaxonomicStringPopover
groupType={TaxonomicFilterGroupType.NumericalEventProperties}
groupTypes={[
TaxonomicFilterGroupType.DataWarehouseProperties,
TaxonomicFilterGroupType.NumericalEventProperties,
TaxonomicFilterGroupType.Sessions,
]}
schemaColumns={
filter.type == TaxonomicFilterGroupType.DataWarehouse && filter.name
? externalTablesMap[filter.name]?.columns
: []
}
value={mathProperty}
onChange={(currentValue) => onMathPropertySelect(index, currentValue)}
eventNames={name ? [name] : []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type LocalFilter = ActionFilter & {
uuid: string
id_field?: string
timestamp_field?: string
distinct_id_field?: string
table_name?: string
}

Expand Down Expand Up @@ -74,7 +75,16 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
path((key) => ['scenes', 'insights', 'ActionFilter', 'entityFilterLogic', key]),
connect((props: EntityFilterProps) => ({
logic: [eventUsageLogic],
actions: [insightDataLogic({ dashboardItemId: props.typeKey as InsightShortId }), ['loadData']],
actions: [
insightDataLogic({
dashboardItemId: props.typeKey as InsightShortId,
// this can be mounted in replay filters
// in which case there's not really an insightDataLogic to mount
// disable attempts to load data that will never work
doNotLoad: props.typeKey === 'session-recordings',
}),
['loadData'],
],
})),
actions({
selectFilter: (filter: EntityFilter | ActionFilter | null) => ({ filter }),
Expand All @@ -95,6 +105,7 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
index: number
id_field?: string
timestamp_field?: string
distinct_id_field?: string
table_name?: string
}
) => ({
Expand Down Expand Up @@ -187,7 +198,17 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
hideModal: () => {
actions.selectFilter(null)
},
updateFilter: async ({ type, index, name, id, custom_name, id_field, timestamp_field, table_name }) => {
updateFilter: async ({
type,
index,
name,
id,
custom_name,
id_field,
timestamp_field,
distinct_id_field,
table_name,
}) => {
actions.setFilters(
values.localFilters.map((filter, i) => {
if (i === index) {
Expand All @@ -201,11 +222,16 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
id_field: typeof id_field === 'undefined' ? filter.id_field : id_field,
timestamp_field:
typeof timestamp_field === 'undefined' ? filter.timestamp_field : timestamp_field,
distinct_id_field:
typeof distinct_id_field === 'undefined'
? filter.distinct_id_field
: distinct_id_field,
table_name: typeof table_name === 'undefined' ? filter.table_name : table_name,
}
} else {
delete filter.id_field
delete filter.timestamp_field
delete filter.distinct_id_field
delete filter.table_name
return {
...filter,
Expand Down
Loading

0 comments on commit eca6df1

Please sign in to comment.