: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 { IconPause, IconPlay, IconTrash } from '@posthog/icons'
import { LemonButton, LemonDialog } from '@posthog/lemon-ui'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { autoresearchLogic } from './autoresearchLogic'
import { AutoresearchPipelineApi } from './generated/api.schemas'
export function ModelCardMenu({ pipeline }: { pipeline: AutoresearchPipelineApi }): JSX.Element {
const { mutatingPipelineIds } = useValues(autoresearchLogic)
const { deletePipeline, pausePipeline, resumePipeline } = useActions(autoresearchLogic)
const mutating = !!mutatingPipelineIds[pipeline.id]
return (
<More
size="xsmall"
data-attr="autoresearch-model-more"
overlay={
<>
{pipeline.status === 'running' && (
<LemonButton
fullWidth
icon={<IconPause />}
loading={mutating}
disabledReason={mutating ? 'Another change is still saving' : undefined}
onClick={() => pausePipeline(pipeline)}
>
Pause scheduled scoring
</LemonButton>
)}
{pipeline.status === 'paused' && (
<LemonButton
fullWidth
icon={<IconPlay />}
loading={mutating}
disabledReason={mutating ? 'Another change is still saving' : undefined}
onClick={() => resumePipeline(pipeline)}
>
Resume scheduled scoring
</LemonButton>
)}
<LemonButton
fullWidth
icon={<IconTrash />}
status="danger"
loading={mutating}
disabledReason={
mutating
? 'Another change is still saving'
: pipeline.live_training_run || pipeline.status === 'bootstrapping'
? 'Wait for the training run to finish'
: undefined
}
onClick={() => {
LemonDialog.open({
title: `Delete "${pipeline.name}"?`,
description: pipeline.write_person_property
? 'The model, its training runs, and prediction metadata will be removed. Emitted autoresearch_prediction events stay in the events stream. The prediction person property is removed from the people this model scored.'
: 'The model, its training runs, and prediction metadata will be removed. Emitted autoresearch_prediction events stay in the events stream.',
primaryButton: {
children: 'Delete',
status: 'danger',
onClick: () => deletePipeline(pipeline.id, pipeline.name),
},
secondaryButton: { children: 'Cancel' },
})
}}
>
Delete model
</LemonButton>
</>
}
/>
)
}