Skip to content

Commit 98acc41

Browse files
authored
feat: add showRecordingColumn option to data table, activate for surveys (#41502)
1 parent 258102b commit 98acc41

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

frontend/src/queries/nodes/DataTable/DataTable.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useCallback, useState } from 'react'
77
import { PreAggregatedBadge } from 'lib/components/PreAggregatedBadge'
88
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
99
import { TaxonomicPopover } from 'lib/components/TaxonomicPopover/TaxonomicPopover'
10+
import ViewRecordingButton from 'lib/components/ViewRecordingButton/ViewRecordingButton'
1011
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
1112
import { LemonButton } from 'lib/lemon-ui/LemonButton'
1213
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
@@ -195,6 +196,7 @@ export function DataTable({
195196

196197
const {
197198
showActions,
199+
showRecordingColumn,
198200
showDateRange,
199201
showTestAccountFilters,
200202
showSearch,
@@ -219,6 +221,8 @@ export function DataTable({
219221

220222
const eventActionsColumnShown =
221223
showActions && sourceFeatures.has(QueryFeature.eventActionsColumn) && columnsInResponse?.includes('*')
224+
const recordingColumnShown =
225+
showRecordingColumn && sourceFeatures.has(QueryFeature.eventActionsColumn) && columnsInResponse?.includes('*')
222226
const allColumns = sourceFeatures.has(QueryFeature.columnsInResponse)
223227
? (columnsInResponse ?? columnsInQuery)
224228
: columnsInQuery
@@ -561,6 +565,35 @@ export function DataTable({
561565
</>
562566
) : undefined,
563567
})),
568+
...(recordingColumnShown
569+
? [
570+
{
571+
dataIndex: '__recording' as any,
572+
title: '',
573+
render: function RenderRecording(_: any, { label, result }: DataTableRow) {
574+
if (label) {
575+
return { props: { colSpan: 0 } }
576+
}
577+
if (result && columnsInResponse?.includes('*')) {
578+
const event = result[columnsInResponse.indexOf('*')]
579+
return (
580+
<ViewRecordingButton
581+
sessionId={event?.properties?.$session_id}
582+
recordingStatus={event?.properties?.$recording_status}
583+
timestamp={event?.timestamp}
584+
inModal
585+
size="xsmall"
586+
type="secondary"
587+
/>
588+
)
589+
}
590+
return null
591+
},
592+
width: 100,
593+
align: 'center' as const,
594+
},
595+
]
596+
: []),
564597
...(eventActionsColumnShown
565598
? [
566599
{

frontend/src/queries/nodes/DataTable/dataTableLogic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export const dataTableLogic = kea<dataTableLogicType>([
239239
? context.showOpenEditorButton
240240
: (query.showOpenEditorButton ?? true),
241241
showResultsTable: query.showResultsTable ?? true,
242+
showRecordingColumn: query.showRecordingColumn ?? false,
242243
}),
243244
}
244245
},

frontend/src/queries/schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,6 +9721,10 @@
97219721
],
97229722
"description": "Include a property filter above the table"
97239723
},
9724+
"showRecordingColumn": {
9725+
"description": "Show a recording column for events with session recordings",
9726+
"type": "boolean"
9727+
},
97249728
"showReload": {
97259729
"description": "Show a reload button",
97269730
"type": "boolean"
@@ -25477,6 +25481,10 @@
2547725481
],
2547825482
"description": "Include a property filter above the table"
2547925483
},
25484+
"showRecordingColumn": {
25485+
"description": "Show a recording column for events with session recordings",
25486+
"type": "boolean"
25487+
},
2548025488
"showReload": {
2548125489
"description": "Show a reload button",
2548225490
"type": "boolean"

frontend/src/queries/schema/schema-general.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,8 @@ interface DataTableNodeViewProps {
10451045
showHogQLEditor?: boolean
10461046
/** Show the kebab menu at the end of the row */
10471047
showActions?: boolean
1048+
/** Show a recording column for events with session recordings */
1049+
showRecordingColumn?: boolean
10481050
/** Show date range selector */
10491051
showDateRange?: boolean
10501052
/** Show the export button */

frontend/src/scenes/surveys/surveyLogic.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ export const surveyLogic = kea<surveyLogicType>([
14791479
propertiesViaUrl: true,
14801480
showExport: true,
14811481
showReload: true,
1482+
showRecordingColumn: true,
14821483
showEventFilter: false,
14831484
showPropertyFilter: false,
14841485
showTimings: false,

0 commit comments

Comments
 (0)