:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import type { LogsMetricRuleSeed } from './metricRuleSeed'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface logsMetricRuleQuickCreateLogicValues {
seed: LogsMetricRuleSeed | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface logsMetricRuleQuickCreateLogicActions {
closeQuickCreateModal: () => {
value: true
}
openWithSeed: (seed: LogsMetricRuleSeed) => {
seed: LogsMetricRuleSeed
}
}
export type logsMetricRuleQuickCreateLogicType = MakeLogicType<
logsMetricRuleQuickCreateLogicValues,
logsMetricRuleQuickCreateLogicActions
>
/**
* Open/close state for the metric rule modal launched from a log row in the viewer. Separate from
* logsMetricRulesSectionLogic so the viewer does not mount the settings section (and its rules
* fetch) until a modal actually opens.
*/
export const logsMetricRuleQuickCreateLogic = kea<logsMetricRuleQuickCreateLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsMetricRules', 'logsMetricRuleQuickCreateLogic']),
actions({
openWithSeed: (seed: LogsMetricRuleSeed) => ({ seed }),
closeQuickCreateModal: true,
}),
reducers({
seed: [
null as LogsMetricRuleSeed | null,
{
openWithSeed: (_, { seed }) => seed,
closeQuickCreateModal: () => null,
},
],
}),
])