: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 { useActions, useValues } from 'kea'
import { LemonSwitch } from '@posthog/lemon-ui'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { dataQualityGateLogic } from '../dataQualityGateLogic'
export function DataQualityGateToggle(): JSX.Element | null {
const { gateConfig, gateReadable, gateSaving } = useValues(dataQualityGateLogic)
const { setGateEnabled } = useActions(dataQualityGateLogic)
if (!gateReadable || !gateConfig) {
return null
}
return (
<LemonSwitch
bordered
checked={gateConfig.gate_materialization_on_checks}
onChange={setGateEnabled}
loading={gateSaving}
disabledReason={getAccessControlDisabledReason(
AccessControlResourceType.WarehouseObjects,
AccessControlLevel.Editor
)}
label="Block materialization on failing checks"
data-attr="data-quality-gate-toggle"
/>
)
}