diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index b834a23336229..66868ac5021d4 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -2136,11 +2136,11 @@ const api = { return response }, - async loadPaginatedResults( + async loadPaginatedResults>( url: string | null, maxIterations: number = PAGINATION_DEFAULT_MAX_PAGES - ): Promise { - let results: any[] = [] + ): Promise { + let results: T[] = [] for (let i = 0; i <= maxIterations; ++i) { if (!url) { break diff --git a/frontend/src/scenes/actions/ActionEdit.tsx b/frontend/src/scenes/actions/ActionEdit.tsx index 64f0a61f59c2f..6c335555c7e22 100644 --- a/frontend/src/scenes/actions/ActionEdit.tsx +++ b/frontend/src/scenes/actions/ActionEdit.tsx @@ -1,5 +1,5 @@ import { IconInfo, IconPlus, IconWarning } from '@posthog/icons' -import { LemonTextArea } from '@posthog/lemon-ui' +import { LemonCheckbox, LemonTextArea } from '@posthog/lemon-ui' import { useActions, useValues } from 'kea' import { Form } from 'kea-forms' import { combineUrl, router } from 'kea-router' @@ -8,7 +8,6 @@ import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags' import { PageHeader } from 'lib/components/PageHeader' import { IconPlayCircle } from 'lib/lemon-ui/icons' import { LemonButton } from 'lib/lemon-ui/LemonButton' -import { LemonCheckbox } from 'lib/lemon-ui/LemonCheckbox' import { LemonField } from 'lib/lemon-ui/LemonField' import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel' import { Link } from 'lib/lemon-ui/Link' @@ -170,28 +169,15 @@ export function ActionEdit({ action: loadedAction, id }: ActionEditLogicProps):

Match groups

-
+

Your action will be triggered whenever any of your match groups are received. -

- - {({ onChange }) => ( -
- onChange([...(action.steps || []), { isNew: uuid() }])} - size="small" - type="secondary" - > - Add another match group - -
- )} -
+

{({ value: stepsValue, onChange }) => ( -
+
{stepsValue.map((step: ActionStepType, index: number) => { const identifier = String(JSON.stringify(step)) return ( @@ -229,87 +215,82 @@ export function ActionEdit({ action: loadedAction, id }: ActionEditLogicProps): })}
-
} onClick={() => { onChange([...(action.steps || []), { isNew: uuid() }]) }} + center + className="w-full h-full border-dashed border" > - -
+ Add match group +
)}
-
- - {({ value, onChange }) => ( -
- - Post to webhook when this action is triggered. - {action.bytecode_error ? ( - - ) : null} - - } - /> -
- - {slackEnabled ? 'Configure' : 'Enable'} webhooks in project settings. - -
-
- )} -
- {!action.bytecode_error && action.post_to_slack && ( - <> - - {({ value, onChange }) => ( + + {({ value, onChange }) => ( +
+ - Message format - - - - See documentation on how to format webhook messages. - - + Post to webhook when this action is triggered. + {action.bytecode_error ? ( + + ) : null} - )} - + } + /> +
+ + {slackEnabled ? 'Configure' : 'Enable'} webhooks in project settings. + +
+
+ )} +
+
+ {action.post_to_slack && ( + <> + {!action.bytecode_error && action.post_to_slack && ( + <> + + {({ value, onChange }) => ( + <> + Slack message format + + + + See documentation on how to format webhook messages. + + + + )} + + + )} )}
-
- {id ? deleteButton() : cancelButton()} - - Save - -
) diff --git a/frontend/src/scenes/actions/ActionStep.tsx b/frontend/src/scenes/actions/ActionStep.tsx index 7a1fe6a00b3dd..f79af4d6bb81a 100644 --- a/frontend/src/scenes/actions/ActionStep.tsx +++ b/frontend/src/scenes/actions/ActionStep.tsx @@ -35,7 +35,7 @@ export function ActionStep({ step, actionId, isOnlyStep, index, identifier, onDe } return ( -
+
{index > 0 && !(index % 2 === 0) && (
@@ -162,7 +162,7 @@ function Option({ return (
-
+
{label} {extra_options}
diff --git a/frontend/src/scenes/billing/ExportsUnsubscribeTable/exportsUnsubscribeTableLogic.tsx b/frontend/src/scenes/billing/ExportsUnsubscribeTable/exportsUnsubscribeTableLogic.tsx index abe8190f905a4..a3acb3089b9b9 100644 --- a/frontend/src/scenes/billing/ExportsUnsubscribeTable/exportsUnsubscribeTableLogic.tsx +++ b/frontend/src/scenes/billing/ExportsUnsubscribeTable/exportsUnsubscribeTableLogic.tsx @@ -54,7 +54,9 @@ export const exportsUnsubscribeTableLogic = kea, { loadBatchExportConfigs: async () => { - const res = await api.loadPaginatedResults(`api/organizations/@current/batch_exports`) + const res = await api.loadPaginatedResults( + `api/organizations/@current/batch_exports` + ) return Object.fromEntries( res .filter((batchExportConfig) => !batchExportConfig.paused) diff --git a/frontend/src/scenes/pipeline/destinationsLogic.tsx b/frontend/src/scenes/pipeline/destinationsLogic.tsx index b06f51684f0db..ceff6e79956c9 100644 --- a/frontend/src/scenes/pipeline/destinationsLogic.tsx +++ b/frontend/src/scenes/pipeline/destinationsLogic.tsx @@ -32,7 +32,7 @@ export const pipelineDestinationsLogic = kea([ {} as Record, { loadPlugins: async () => { - const results: PluginType[] = await api.loadPaginatedResults( + const results = await api.loadPaginatedResults( `api/organizations/@current/pipeline_destinations` ) const plugins: Record = {} @@ -48,7 +48,7 @@ export const pipelineDestinationsLogic = kea([ { loadPluginConfigs: async () => { const pluginConfigs: Record = {} - const results = await api.loadPaginatedResults( + const results = await api.loadPaginatedResults( `api/projects/${values.currentTeamId}/pipeline_destination_configs` ) @@ -85,7 +85,7 @@ export const pipelineDestinationsLogic = kea([ {} as Record, { loadBatchExports: async () => { - const results: BatchExportConfiguration[] = await api.loadPaginatedResults( + const results = await api.loadPaginatedResults( `api/projects/${values.currentTeamId}/batch_exports` ) return Object.fromEntries(results.map((batchExport) => [batchExport.id, batchExport])) diff --git a/frontend/src/scenes/pipeline/transformationsLogic.tsx b/frontend/src/scenes/pipeline/transformationsLogic.tsx index 9ded667fe38e4..9425a5fa0dd31 100644 --- a/frontend/src/scenes/pipeline/transformationsLogic.tsx +++ b/frontend/src/scenes/pipeline/transformationsLogic.tsx @@ -30,7 +30,7 @@ export const pipelineTransformationsLogic = kea, { loadPlugins: async () => { - const results: PluginType[] = await api.loadPaginatedResults( + const results = await api.loadPaginatedResults( `api/organizations/@current/pipeline_transformations` ) const plugins: Record = {} @@ -53,7 +53,7 @@ export const pipelineTransformationsLogic = kea, { loadPluginConfigs: async () => { - const res: PluginConfigTypeNew[] = await api.loadPaginatedResults( + const res = await api.loadPaginatedResults( `api/projects/${values.currentTeamId}/pipeline_transformation_configs` ) diff --git a/frontend/src/scenes/plugins/pluginsLogic.ts b/frontend/src/scenes/plugins/pluginsLogic.ts index 5ade3a9101dfb..e4ce68b032669 100644 --- a/frontend/src/scenes/plugins/pluginsLogic.ts +++ b/frontend/src/scenes/plugins/pluginsLogic.ts @@ -79,7 +79,7 @@ export const pluginsLogic = kea([ {} as Record, { loadPlugins: async () => { - const results: PluginType[] = await api.loadPaginatedResults('api/organizations/@current/plugins') + const results = await api.loadPaginatedResults('api/organizations/@current/plugins') const plugins: Record = {} for (const plugin of results) { plugins[plugin.id] = plugin @@ -137,7 +137,7 @@ export const pluginsLogic = kea([ { loadPluginConfigs: async () => { const pluginConfigs: Record = {} - const results: PluginConfigType[] = await api.loadPaginatedResults('api/plugin_config') + const results = await api.loadPaginatedResults('api/plugin_config') for (const pluginConfig of results) { pluginConfigs[pluginConfig.plugin] = { ...pluginConfig } diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.ts b/frontend/src/scenes/web-analytics/webAnalyticsLogic.ts index dce246290d219..b97a031a2fe4a 100644 --- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.ts +++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.ts @@ -25,6 +25,8 @@ import { InsightLogicProps, InsightType, IntervalType, + PluginConfigTypeNew, + PluginType, PropertyDefinition, PropertyFilterType, PropertyOperator, @@ -1169,8 +1171,8 @@ export const webAnalyticsLogic = kea([ event_names: ['$pageview'], properties: ['$geoip_country_code'], }), - api.loadPaginatedResults('api/organizations/@current/plugins'), - api.loadPaginatedResults('api/plugin_config'), + api.loadPaginatedResults('api/organizations/@current/plugins'), + api.loadPaginatedResults('api/plugin_config'), ]) const hasNonStaleCountryCodeDefinition = @@ -1185,7 +1187,7 @@ export const webAnalyticsLogic = kea([ const geoIpPlugin = pluginsResponse.status === 'fulfilled' && - pluginsResponse.value.find((plugin) => GEOIP_PLUGIN_URLS.includes(plugin.url)) + pluginsResponse.value.find((plugin) => plugin.url && GEOIP_PLUGIN_URLS.includes(plugin.url)) const geoIpPluginId = geoIpPlugin ? geoIpPlugin.id : undefined const geoIpPluginConfig =