Skip to content

Commit

Permalink
Merge branch 'master' into fix/export-distinct-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhpillai authored Jul 27, 2024
2 parents f136e59 + 01a8986 commit 13477bb
Show file tree
Hide file tree
Showing 287 changed files with 11,979 additions and 7,255 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
remove-issue-stale-when-updated: true
days-before-pr-stale: 7
days-before-pr-close: 7
stale-pr-message: "This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the `stale` label – otherwise this will be closed in another week."
stale-pr-message: "This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the `stale` label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the `waiting` label."
close-pr-message: "This PR was closed due to lack of activity. Feel free to reopen if it's still relevant."
stale-pr-label: stale
remove-pr-stale-when-updated: true
Expand Down
8 changes: 0 additions & 8 deletions bin/start-frontend-https

This file was deleted.

12 changes: 0 additions & 12 deletions bin/start-https

This file was deleted.

1 change: 1 addition & 0 deletions ee/clickhouse/materialized_columns/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get_materialized_columns(
WHERE database = %(database)s
AND table = %(table)s
AND comment LIKE '%%column_materializer::%%'
AND comment not LIKE '%%column_materializer::elements_chain::%%'
""",
{"database": CLICKHOUSE_DATABASE, "table": table},
)
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.
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.
26 changes: 17 additions & 9 deletions frontend/src/layout/navigation-3000/sidebars/dataManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'

import { navigation3000Logic } from '~/layout/navigation-3000/navigationLogic'
import { ActionType, EventDefinition, PropertyDefinition, ReplayTabs } from '~/types'
import { ActionType, EventDefinition, FilterLogicalOperator, PropertyDefinition, ReplayTabs } from '~/types'

import { BasicListItem, SidebarCategory } from '../types'
import type { dataManagementSidebarLogicType } from './dataManagementType'
Expand Down Expand Up @@ -118,14 +118,22 @@ export const dataManagementSidebarLogic = kea<dataManagementSidebarLogicType>([
{
label: 'View recordings',
to: urls.replay(ReplayTabs.Recent, {
events: [
{
id: eventDefinition.name,
type: 'events',
order: 0,
name: eventDefinition.name,
},
],
filter_group: {
type: FilterLogicalOperator.And,
values: [
{
type: FilterLogicalOperator.And,
values: [
{
id: eventDefinition.name,
type: 'events',
order: 0,
name: eventDefinition.name,
},
],
},
],
},
}),
},
],
Expand Down
17 changes: 15 additions & 2 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ class ApiRequest {
return this.errorTracking(teamId).addPathComponent(fingerprint)
}

public errorTrackingMerge(fingerprint: ErrorTrackingGroup['fingerprint']): ApiRequest {
return this.errorTrackingGroup(fingerprint).addPathComponent('merge')
}

// # Warehouse
public dataWarehouseTables(teamId?: TeamType['id']): ApiRequest {
return this.projectsDetail(teamId).addPathComponent('warehouse_tables')
Expand Down Expand Up @@ -1626,8 +1630,8 @@ const api = {
},

hogFunctions: {
async list(): Promise<PaginatedResponse<HogFunctionType>> {
return await new ApiRequest().hogFunctions().get()
async list(params?: { filters?: any }): Promise<PaginatedResponse<HogFunctionType>> {
return await new ApiRequest().hogFunctions().withQueryString(params).get()
},
async get(id: HogFunctionType['id']): Promise<HogFunctionType> {
return await new ApiRequest().hogFunction(id).get()
Expand Down Expand Up @@ -1720,6 +1724,15 @@ const api = {
): Promise<ErrorTrackingGroup> {
return await new ApiRequest().errorTrackingGroup(fingerprint).update({ data })
},

async merge(
primaryFingerprint: ErrorTrackingGroup['fingerprint'],
mergingFingerprints: ErrorTrackingGroup['fingerprint'][]
): Promise<{ content: string }> {
return await new ApiRequest()
.errorTrackingMerge(primaryFingerprint)
.create({ data: { merging_fingerprints: mergingFingerprints } })
},
},

recordings: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const addToDashboardModalLogic = kea<addToDashboardModalLogicType>([
key(keyForInsightLogicProps('new')),
path((key) => ['lib', 'components', 'AddToDashboard', 'saveToDashboardModalLogic', key]),
connect((props: InsightLogicProps) => ({
values: [insightLogic(props), ['queryBasedInsight', 'legacyInsight']],
values: [insightLogic(props), ['queryBasedInsight']],
actions: [
insightLogic(props),
['updateInsight', 'updateInsightSuccess', 'updateInsightFailure'],
Expand Down Expand Up @@ -101,7 +101,9 @@ export const addToDashboardModalLogic = kea<addToDashboardModalLogicType>([
// TODO be able to update not by patching `dashboards` against insight
// either patch dashboard_tiles on the insight or add a dashboard_tiles API
actions.updateInsight(
{ ...values.legacyInsight, dashboards: [...(values.legacyInsight.dashboards || []), dashboardId] },
{
dashboards: [...(values.queryBasedInsight.dashboards || []), dashboardId],
},
() => {
actions.reportSavedInsightToDashboard()
dashboardsModel.actions.tileAddedToDashboard(dashboardId)
Expand All @@ -117,9 +119,8 @@ export const addToDashboardModalLogic = kea<addToDashboardModalLogicType>([
removeFromDashboard: async ({ dashboardId }): Promise<void> => {
actions.updateInsight(
{
...values.legacyInsight,
dashboards: (values.legacyInsight.dashboards || []).filter((d) => d !== dashboardId),
dashboard_tiles: (values.legacyInsight.dashboard_tiles || []).filter(
dashboards: (values.queryBasedInsight.dashboards || []).filter((d) => d !== dashboardId),
dashboard_tiles: (values.queryBasedInsight.dashboard_tiles || []).filter(
(dt) => dt.dashboard_id !== dashboardId
),
},
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib/components/Cards/InsightCard/InsightCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const displayMap: Record<
className: 'bar',
element: ActionsHorizontalBar,
},
ActionsStackedBar: {
className: 'bar',
element: ActionsLineGraph,
},
ActionsTable: {
className: 'table',
element: DashboardInsightsTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const makeTextTile = (body: string, color: InsightColor | null = null): Dashboar

layouts: {},
color,
last_refresh: null,
next_allowed_client_refresh: null,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function CategoryPill({
type={isActive ? 'primary' : canInteract ? 'option' : 'muted'}
data-attr={`taxonomic-tab-${groupType}`}
onClick={canInteract ? onClick : undefined}
weight="normal"
aria-disabled
disabledReason={!canInteract ? 'No results' : null}
className="font-normal"
>
{group?.render ? (
group?.name
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ChartDisplayCategory, ChartDisplayType, Region, SSOProvider } from '../
export const DISPLAY_TYPES_TO_CATEGORIES: Record<ChartDisplayType, ChartDisplayCategory> = {
[ChartDisplayType.ActionsLineGraph]: ChartDisplayCategory.TimeSeries,
[ChartDisplayType.ActionsBar]: ChartDisplayCategory.TimeSeries,
[ChartDisplayType.ActionsStackedBar]: ChartDisplayCategory.TimeSeries,
[ChartDisplayType.ActionsAreaGraph]: ChartDisplayCategory.TimeSeries,
[ChartDisplayType.ActionsLineGraphCumulative]: ChartDisplayCategory.CumulativeTimeSeries,
[ChartDisplayType.BoldNumber]: ChartDisplayCategory.TotalValue,
Expand Down
9 changes: 1 addition & 8 deletions frontend/src/lib/lemon-ui/LemonButton/LemonButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
--lemon-button-height: 2.3125rem;
--lemon-button-gap: 0.5rem;
--lemon-button-icon-opacity: 0.8;
--lemon-button-profile-picture-opacity: 0.9; // Profile pictures must be more prominent than icons
--lemon-button-color: var(--text-3000);

// column-gap: 4px;
Expand Down Expand Up @@ -119,14 +118,9 @@
font-size: var(--lemon-button-icon-size);
transition: color 200ms ease;

> * {
.LemonIcon {
opacity: var(--lemon-button-icon-opacity);
}

> .ProfilePicture,
> .Lettermark {
opacity: var(--lemon-button-profile-picture-opacity);
}
}
}

Expand All @@ -139,7 +133,6 @@
&:hover:not([aria-disabled='true']),
&:not([aria-disabled='true']):active {
--lemon-button-icon-opacity: 0.75;
--lemon-button-profile-picture-opacity: 1;
}

&.LemonButton--full-width {
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/lib/lemon-ui/LemonButton/LemonButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, { useContext } from 'react'

import { LemonDropdown, LemonDropdownProps } from '../LemonDropdown'
import { Link } from '../Link'
import { PopoverReferenceContext } from '../Popover'
import { PopoverOverlayContext, PopoverReferenceContext } from '../Popover'
import { Spinner } from '../Spinner/Spinner'
import { Tooltip, TooltipProps } from '../Tooltip'

Expand Down Expand Up @@ -139,6 +139,7 @@ export const LemonButton: React.FunctionComponent<LemonButtonProps & React.RefAt
ref
): JSX.Element => {
const [popoverVisibility, popoverPlacement] = useContext(PopoverReferenceContext) || [false, null]
const [, parentPopoverLevel] = useContext(PopoverOverlayContext)
const within3000PageHeader = useContext(WithinPageHeaderContext)

if (!active && popoverVisibility) {
Expand Down Expand Up @@ -169,8 +170,8 @@ export const LemonButton: React.FunctionComponent<LemonButtonProps & React.RefAt
icon = <Spinner textColored />
disabled = true // Cannot interact with a loading button
}
if (within3000PageHeader) {
size = 'small'
if (within3000PageHeader && parentPopoverLevel === -1) {
size = 'small' // Ensure that buttons in the page header are small (but NOT inside dropdowns!)
}

let tooltipContent: TooltipProps['title']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export function LemonInputSelect({
onMouseEnter={() => setSelectedIndex(index)}
>
<span className="flex-1 flex items-center justify-between gap-1">
{option.labelComponent ?? option.label}
<span className="ph-no-capture">{option.labelComponent ?? option.label}</span>
{isHighlighted ? (
<span>
<KeyboardShortcut enter />{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@

.LemonButton {
--lemon-button-icon-opacity: 1;
--lemon-button-profile-picture-opacity: 1;
}
}

Expand Down
26 changes: 23 additions & 3 deletions frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,37 @@ export type LemonTagType =
| 'none'
| 'breakdown'

export interface LemonTagProps extends React.HTMLAttributes<HTMLDivElement> {
export interface LemonTagProps {
type?: LemonTagType
children: React.ReactNode
size?: 'small' | 'medium'
weight?: 'normal'
icon?: JSX.Element
closable?: boolean
onClose?: () => void
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
popover?: LemonButtonDropdown
className?: string
disabledReason?: string | null
title?: string
'data-attr'?: string
}

export const LemonTag: React.FunctionComponent<LemonTagProps & React.RefAttributes<HTMLDivElement>> = forwardRef(
function LemonTag(
{ type = 'default', children, className, size = 'medium', weight, icon, closable, onClose, popover, ...props },
{
type = 'default',
children,
className,
size = 'medium',
weight,
icon,
closable,
onClose,
popover,
disabledReason,
...props
},
ref
): JSX.Element {
return (
Expand All @@ -42,11 +59,14 @@ export const LemonTag: React.FunctionComponent<LemonTagProps & React.RefAttribut
className={clsx(
'LemonTag',
`LemonTag--size-${size}`,
!!props.onClick && 'cursor-pointer',
disabledReason ? 'cursor-not-allowed' : props.onClick ? 'cursor-pointer' : undefined,
`LemonTag--${type}`,
weight && `LemonTag--${weight}`,
className
)}
role={props.onClick ? 'button' : undefined}
title={disabledReason || undefined}
aria-disabled={disabledReason ? true : undefined}
{...props}
>
{icon && <span className="LemonTag__icon">{icon}</span>}
Expand Down
14 changes: 12 additions & 2 deletions frontend/src/lib/monaco/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (loader) {
export interface CodeEditorProps extends Omit<EditorProps, 'loading' | 'theme'> {
queryKey?: string
autocompleteContext?: string
onPressCmdEnter?: (value: string) => void
onPressCmdEnter?: (value: string, selectionType: 'selection' | 'full') => void
autoFocus?: boolean
sourceQuery?: AnyDataNode
globals?: Record<string, any>
Expand Down Expand Up @@ -257,7 +257,17 @@ export function CodeEditor({
id: 'saveAndRunPostHog',
label: 'Save and run query',
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
run: () => onPressCmdEnter(editor.getValue()),
run: () => {
const selection = editor.getSelection()
const model = editor.getModel()
if (selection && model) {
const highlightedText = model.getValueInRange(selection)
onPressCmdEnter(highlightedText, 'selection')
return
}

onPressCmdEnter(editor.getValue(), 'full')
},
})
)
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportTeamSettingChange: (name: string, value: any) => ({ name, value }),
reportActivationSideBarTaskClicked: (key: string) => ({ key }),
reportBillingUpgradeClicked: (plan: string) => ({ plan }),
reportBillingDowngradeClicked: (plan: string) => ({ plan }),
reportRoleCreated: (role: string) => ({ role }),
reportResourceAccessLevelUpdated: (resourceType: Resource, roleName: string, accessLevel: AccessLevel) => ({
resourceType,
Expand Down Expand Up @@ -1179,6 +1180,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
plan,
})
},
reportBillingDowngradeClicked: ({ plan }) => {
posthog.capture('billing downgrade button clicked', {
plan,
})
},
reportRoleCreated: ({ role }) => {
posthog.capture('new role created', {
role,
Expand Down
20 changes: 2 additions & 18 deletions frontend/src/models/dashboardsModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,10 @@ export const dashboardsModel = kea<dashboardsModelType>([
// can provide extra dashboard ids if not all listeners will choose to respond to this action
// not providing a dashboard id is a signal that only listeners in the item.dashboards array should respond
// specifying `number` not `Pick<DashboardType, 'id'> because kea typegen couldn't figure out the import in `savedInsightsLogic`
// if an update is made against an insight it will hold last_refresh, color, and filters_hash in dashboard context
updateDashboardInsight: (
insight: InsightModel,
extraDashboardIds?: number[],
updateTileOnDashboards?: [number]
) => ({
// if an update is made against an insight it will hold color in dashboard context
updateDashboardInsight: (insight: InsightModel, extraDashboardIds?: number[]) => ({
insight,
extraDashboardIds,
updateTileOnDashboards,
}),
// a side effect on this action exists in dashboardLogic so that individual refresh statuses can be bubbled up
// to dashboard items in dashboards
updateDashboardRefreshStatus: (
shortId: string | undefined | null,
refreshing: boolean | null,
last_refresh: string | null
) => ({
shortId,
refreshing,
last_refresh,
}),
pinDashboard: (id: number, source: DashboardEventSource) => ({ id, source }),
unpinDashboard: (id: number, source: DashboardEventSource) => ({ id, source }),
Expand Down
Loading

0 comments on commit 13477bb

Please sign in to comment.