Skip to content

: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.

feat(vision): polish scanner overview actions and enable toggle (#63069)

Kim Svatos Dugan61a7e3b1138c
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
index 01b50583413f..ad01ceef13e0 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScanner.tsx
@@ -4,7 +4,6 @@ import { LemonBanner, LemonButton, LemonSwitch } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { dayjs } from 'lib/dayjs'
-import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonCollapse } from 'lib/lemon-ui/LemonCollapse'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
@@ -39,7 +38,27 @@ export function ReplayScannerSceneComponent(): JSX.Element {
useAttachedLogic(scannerLogic, replayScannerSceneLogic)
const { scanner, scannerLoading, togglingEnabled } = useValues(scannerLogic)
- const { deleteScanner, toggleEnabled } = useActions(scannerLogic)
+ const { toggleEnabled } = useActions(scannerLogic)
+
+ const handleToggleEnabledClick = (): void => {
+ if (!scanner) {
+ return
+ }
+ LemonDialog.open({
+ title: scanner.enabled ? 'Disable scanner?' : 'Enable scanner?',
+ description: scanner.enabled
+ ? 'This will stop the scanner from analyzing new session recordings. Are you sure?'
+ : 'The scanner will begin analyzing new session recordings that match its triggers',
+ primaryButton: {
+ children: scanner.enabled ? 'Disable' : 'Enable',
+ status: scanner.enabled ? 'danger' : 'default',
+ onClick: () => toggleEnabled(),
+ },
+ secondaryButton: {
+ children: 'Cancel',
+ },
+ })
+ }
if (scannerLoading || !scanner) {
return (
@@ -57,24 +76,7 @@ export function ReplayScannerSceneComponent(): JSX.Element {
resourceType={{ type: 'replay_vision' }}
actions={
<>
- <div className="flex items-center gap-2">
- <AccessControlAction
- resourceType={AccessControlResourceType.SessionRecording}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonSwitch
- checked={scanner.enabled}
- onChange={() => toggleEnabled()}
- disabled={togglingEnabled}
- size="small"
- data-attr="vision-scanner-toggle-enabled"
- data-ph-capture-attribute-scanner-type={scanner.scanner_type}
- />
- </AccessControlAction>
- <span className={scanner.enabled ? 'text-success' : 'text-muted'}>
- {scanner.enabled ? 'Enabled' : 'Disabled'}
- </span>
- </div>
+ <ReplayVisionFeedbackButton />
<AccessControlAction
resourceType={AccessControlResourceType.SessionRecording}
minAccessLevel={AccessControlLevel.Editor}
@@ -89,38 +91,30 @@ export function ReplayScannerSceneComponent(): JSX.Element {
Edit scanner
</LemonButton>
</AccessControlAction>
- <ReplayVisionFeedbackButton />
- <More
- size="small"
- overlay={
- <LemonButton
- status="danger"
- fullWidth
- onClick={() =>
- LemonDialog.open({
- title: `Delete "${scanner.name || 'Untitled scanner'}"?`,
- description: 'This cannot be undone.',
- primaryButton: {
- children: 'Delete',
- status: 'danger',
- onClick: () => deleteScanner(),
- },
- secondaryButton: { children: 'Cancel' },
- })
- }
- data-attr="vision-scanner-delete"
- data-ph-capture-attribute-scanner-type={scanner.scanner_type}
- >
- Delete
- </LemonButton>
- }
- />
</>
}
/>
<QuotaBanner />
+ <div className="w-full max-w-xs">
+ <AccessControlAction
+ resourceType={AccessControlResourceType.SessionRecording}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonSwitch
+ checked={scanner.enabled}
+ onChange={handleToggleEnabledClick}
+ loading={togglingEnabled}
+ label="Enable scanner"
+ bordered
+ fullWidth
+ data-attr="vision-scanner-toggle-enabled"
+ data-ph-capture-attribute-scanner-type={scanner.scanner_type}
+ />
+ </AccessControlAction>
+ </div>
+
<ScannerOverview scannerId={scannerId} />
<div className="flex flex-col gap-2">
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
index 023f07beaf9b..10ac045e7ead 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
@@ -248,7 +248,9 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
onClick={() => loadObservations()}
loading={observationsLoading}
data-attr="vision-observations-refresh"
- />
+ >
+ Refresh
+ </LemonButton>
</Tooltip>
</div>
{observationStats.total > 0 && (