Skip to content

Commit

Permalink
Merge branch 'master' into fix/encryption-env-hobby
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 8, 2024
2 parents 3eb8cec + 97ac130 commit 97bad3f
Show file tree
Hide file tree
Showing 21 changed files with 173 additions and 166 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.
2 changes: 1 addition & 1 deletion frontend/src/layout/navigation-3000/navigationLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
identifier: Scene.Activity,
label: 'Activity',
icon: <IconLive />,
to: featureFlags[FEATURE_FLAGS.LIVE_EVENTS] ? urls.activity() : urls.events(),
to: urls.activity(),
},
]
: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,9 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>([
},
{
icon: IconLive,
display: 'Go to Events explorer',
display: 'Go to Activity',
executor: () => {
push(urls.events())
push(urls.activity())
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export const FEATURE_FLAGS = {
HEATMAPS_UI: 'heatmaps-ui', // owner: @benjackwhite
THEME: 'theme', // owner: @aprilfools
PROXY_AS_A_SERVICE: 'proxy-as-a-service', // owner: #team-infrastructure
LIVE_EVENTS: 'live-events', // owner: @zach or @jams
SETTINGS_PERSONS_JOIN_MODE: 'settings-persons-join-mode', // owner: @robbie-c
SETTINGS_PERSONS_ON_EVENTS_HIDDEN: 'settings-persons-on-events-hidden', // owner: @Twixes
HOG: 'hog', // owner: @mariusandra
Expand Down Expand Up @@ -220,6 +219,7 @@ export const FEATURE_FLAGS = {
BIGQUERY_DWH: 'bigquery-dwh', // owner: @Gilbert09 #team-data-warehouse
REPLAY_DEFAULT_SORT_ORDER_EXPERIMENT: 'replay-order-by-experiment', // owner: #team-replay
ENVIRONMENTS: 'environments', // owner: @Twixes #team-product-analytics
LEGACY_ACTION_WEBHOOKS: 'legacy-action-webhooks', // owner: @mariusandra #team-cdp
} as const
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]

Expand Down
32 changes: 0 additions & 32 deletions frontend/src/queries/nodes/DataNode/AutoLoad.tsx

This file was deleted.

15 changes: 4 additions & 11 deletions frontend/src/queries/nodes/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import clsx from 'clsx'
import { BindLogic, useValues } from 'kea'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { TaxonomicPopover } from 'lib/components/TaxonomicPopover/TaxonomicPopover'
import { FEATURE_FLAGS } from 'lib/constants'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { LemonTable, LemonTableColumn } from 'lib/lemon-ui/LemonTable'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useCallback, useState } from 'react'
import { EventDetails } from 'scenes/activity/explore/EventDetails'
import { InsightEmptyState, InsightErrorState } from 'scenes/insights/EmptyStates'
import { PersonDeleteModal } from 'scenes/persons/PersonDeleteModal'

import { AutoLoad } from '~/queries/nodes/DataNode/AutoLoad'
import { dataNodeLogic, DataNodeLogicProps } from '~/queries/nodes/DataNode/dataNodeLogic'
import { DateRange } from '~/queries/nodes/DataNode/DateRange'
import { ElapsedTime } from '~/queries/nodes/DataNode/ElapsedTime'
Expand Down Expand Up @@ -113,7 +110,6 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }
responseLoading,
responseError,
queryCancelled,
canLoadNewData,
nextDataLoading,
newDataLoading,
highlightedRows,
Expand All @@ -122,15 +118,14 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }

const dataTableLogicProps: DataTableLogicProps = {
query,
vizKey: vizKey,
dataKey: dataKey,
vizKey,
dataKey,
dataNodeLogicKey: dataNodeLogicProps.key,
context,
}
const { dataTableRows, columnsInQuery, columnsInResponse, queryWithDefaults, canSort, sourceFeatures } = useValues(
dataTableLogic(dataTableLogicProps)
)
const { featureFlags } = useValues(featureFlagLogic)

const {
showActions,
Expand Down Expand Up @@ -387,7 +382,7 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }
const setQuerySource = useCallback(
(source: EventsNode | EventsQuery | PersonsNode | ActorsQuery | HogQLQuery | SessionAttributionExplorerQuery) =>
setQuery?.({ ...query, source }),
[setQuery]
[setQuery, query]
)

const firstRowLeft = [
Expand Down Expand Up @@ -443,10 +438,8 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }
) : null,
].filter((x) => !!x)

const isAutoReloadAvailable = !featureFlags[FEATURE_FLAGS.LIVE_EVENTS]
const secondRowLeft = [
showReload ? <Reload key="reload" /> : null,
showReload && canLoadNewData && isAutoReloadAvailable ? <AutoLoad key="auto-load" /> : null,
showElapsedTime ? <ElapsedTime key="elapsed-time" showTimings={showTimings} /> : null,
].filter((x) => !!x)

Expand All @@ -457,7 +450,7 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }
) : null,
showExport ? <DataTableExport key="data-table-export" query={query} setQuery={setQuery} /> : null,
showExport && showOpenEditorButton ? (
<DataTableOpenEditor key="data-table-export" query={query} setQuery={setQuery} />
<DataTableOpenEditor key="data-table-open-editor" query={query} setQuery={setQuery} />
) : null,
].filter((x) => !!x)

Expand Down
128 changes: 66 additions & 62 deletions frontend/src/scenes/actions/ActionEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { router } from 'kea-router'
import { EditableField } from 'lib/components/EditableField/EditableField'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
import { PageHeader } from 'lib/components/PageHeader'
import { FEATURE_FLAGS } from 'lib/constants'
import { IconPlayCircle } from 'lib/lemon-ui/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'
import { Link } from 'lib/lemon-ui/Link'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { ActionHogFunctions } from 'scenes/actions/ActionHogFunctions'
import { pipelineAccessLogic } from 'scenes/pipeline/pipelineAccessLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'

Expand All @@ -31,8 +34,15 @@ export function ActionEdit({ action: loadedAction, id }: ActionEditLogicProps):
const { submitAction, deleteAction, migrateToHogFunction } = useActions(logic)
const { currentTeam } = useValues(teamLogic)
const { tags } = useValues(tagsModel)
const { canEnableNewDestinations: hasDataPipelinesAddon } = useValues(pipelineAccessLogic)
const { featureFlags } = useValues(featureFlagLogic)

const slackEnabled = currentTeam?.slack_incoming_webhook
const showWebhookDelivery =
(!hasDataPipelinesAddon && slackEnabled) ||
action.post_to_slack ||
featureFlags[FEATURE_FLAGS.LEGACY_ACTION_WEBHOOKS]
const showActionMigrationBanner = hasDataPipelinesAddon && action.post_to_slack

const deleteButton = (): JSX.Element => (
<LemonButton
Expand Down Expand Up @@ -208,42 +218,44 @@ export function ActionEdit({ action: loadedAction, id }: ActionEditLogicProps):
</LemonField>
</div>

{action.post_to_slack ? (
{showWebhookDelivery ? (
<div className="my-4 space-y-2">
<h2 className="subtitle">Webhook delivery</h2>

<LemonBanner
type="error"
action={{
children: 'Upgrade to new version',
onClick: () =>
LemonDialog.open({
title: 'Upgrade webhook',
width: '30rem',
description:
'This will create a new Destination in the upgraded system. The action will have its webhook disabled. There will be slight difference in the placeholder tags, so double check that everything works as expected.',
secondaryButton: {
type: 'secondary',
children: 'Cancel',
},
primaryButton: {
type: 'primary',
onClick: () => migrateToHogFunction(),
children: 'Upgrade',
},
}),
disabledReason: hasCohortFilters
? 'Can not upgrade because action has a cohort filter.'
: migrationLoading
? 'Loading...'
: actionChanged
? 'Please save the action first'
: undefined,
}}
>
Action Webhooks have been replaced by the new and improved <b>Pipeline Destinations</b>.{' '}
{!hasCohortFilters && !actionChanged ? 'Click to upgrade.' : ''}
</LemonBanner>
{showActionMigrationBanner ? (
<LemonBanner
type="error"
action={{
children: 'Upgrade to new version',
onClick: () =>
LemonDialog.open({
title: 'Upgrade webhook',
width: '30rem',
description:
'This will create a new Destination in the upgraded system. The action will have its webhook disabled. There will be slight difference in the placeholder tags, so double check that everything works as expected.',
secondaryButton: {
type: 'secondary',
children: 'Cancel',
},
primaryButton: {
type: 'primary',
onClick: () => migrateToHogFunction(),
children: 'Upgrade',
},
}),
disabledReason: hasCohortFilters
? 'Can not upgrade because action has a cohort filter.'
: migrationLoading
? 'Loading...'
: actionChanged
? 'Please save the action first'
: undefined,
}}
>
Action Webhooks have been replaced by the new and improved <b>Pipeline Destinations</b>.{' '}
{!hasCohortFilters && !actionChanged ? 'Click to upgrade.' : ''}
</LemonBanner>
) : null}

<LemonField name="post_to_slack">
{({ value, onChange }) => (
Expand All @@ -267,40 +279,32 @@ export function ActionEdit({ action: loadedAction, id }: ActionEditLogicProps):
)}
</LemonField>
{action.post_to_slack && (
<>
{action.post_to_slack && (
<LemonField name="slack_message_format">
{({ value, onChange }) => (
<>
<LemonField name="slack_message_format">
{({ value, onChange }) => (
<>
<LemonLabel showOptional>Slack message format</LemonLabel>
<LemonTextArea
placeholder="Default: [action.name] triggered by [person]"
value={value}
onChange={onChange}
disabled={!slackEnabled || !action.post_to_slack}
data-attr="edit-slack-message-format"
maxLength={
1200 /** Must be same as in posthog/models/action/action.py */
}
/>
<small>
<Link
to="https://posthog.com/docs/webhooks#message-formatting"
target="_blank"
>
See documentation on how to format webhook messages.
</Link>
</small>
</>
)}
</LemonField>
<LemonLabel showOptional>Slack message format</LemonLabel>
<LemonTextArea
placeholder="Default: [action.name] triggered by [person]"
value={value}
onChange={onChange}
disabled={!slackEnabled || !action.post_to_slack}
data-attr="edit-slack-message-format"
maxLength={1200 /** Must be same as in posthog/models/action/action.py */}
/>
<small>
<Link
to="https://posthog.com/docs/webhooks#message-formatting"
target="_blank"
>
See documentation on how to format webhook messages.
</Link>
</small>
</>
)}
</>
</LemonField>
)}
</div>
) : undefined}
) : null}
</Form>
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/scenes/actions/actionEditLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ export const actionEditLogic = kea<actionEditLogicType>([
},
})),

beforeUnload(({ actions, values }) => ({
enabled: () => values.actionChanged,
beforeUnload((logic) => ({
enabled: () => (logic.isMounted() ? logic.values.actionChanged : false),
message: 'Leave action?\nChanges you made will be discarded.',
onConfirm: () => {
actions.resetAction()
logic.actions.resetAction()
},
})),
])
Loading

0 comments on commit 97bad3f

Please sign in to comment.