Skip to content

Commit c571c22

Browse files
authored
fix: some missing events on notebooks (#4097)
1 parent cf43f4c commit c571c22

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/flows/components/FlowsIndex.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Libraries
2-
import React, {useState, useContext, useRef} from 'react'
2+
import React, {useState, useContext, useRef, useEffect} from 'react'
33

44
// Components
55
import {
@@ -18,6 +18,7 @@ import ResourceSortDropdown from 'src/shared/components/resource_sort_dropdown/R
1818
import {SortTypes} from 'src/shared/utils/sort'
1919
import PresetFlows from 'src/flows/components/PresetFlows'
2020
import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
21+
import {event} from 'src/cloud/utils/reporting'
2122

2223
// Utils
2324
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
@@ -106,13 +107,29 @@ const FlowsIndex = () => {
106107
}
107108

108109
const setSort = (sortKey, sortDirection, sortType) => {
110+
if (
111+
sortKey === sortOptions.sortKey &&
112+
sortDirection === sortOptions.sortDirection
113+
) {
114+
return
115+
}
116+
117+
event('Notebook List Sort Change', {
118+
key: sortKey,
119+
direction: sortDirection,
120+
})
121+
109122
setSortOptions({
110123
sortKey,
111124
sortType,
112125
sortDirection,
113126
})
114127
}
115128

129+
useEffect(() => {
130+
event('Notebook List Page Visited')
131+
}, [])
132+
116133
return (
117134
<Page
118135
titleTag={pageTitleSuffixer([PROJECT_NAME_PLURAL])}

src/flows/components/header/MenuButton.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const MenuButton: FC<Props> = ({handleResetShare}) => {
7171
}
7272

7373
const handleDownloadAsPNG = () => {
74+
event('full notebook png download')
7475
const canvas = document.getElementById(flow.id)
7576
import('html2canvas').then((module: any) =>
7677
module.default(canvas as HTMLDivElement, canvasOptions).then(result => {
@@ -80,6 +81,7 @@ const MenuButton: FC<Props> = ({handleResetShare}) => {
8081
}
8182

8283
const handleDownloadAsPDF = () => {
84+
event('full notebook pdf download')
8385
const canvas = document.getElementById(flow.id)
8486
import('html2canvas').then((module: any) =>
8587
module.default(canvas as HTMLDivElement, canvasOptions).then(result => {
@@ -217,6 +219,9 @@ const MenuButton: FC<Props> = ({handleResetShare}) => {
217219
triggerRef={triggerRef}
218220
enableDefaultStyles={false}
219221
style={{minWidth: 209}}
222+
onShow={() => {
223+
event('Notebook main menu opened')
224+
}}
220225
showEvent={PopoverInteraction.Click}
221226
hideEvent={PopoverInteraction.Click}
222227
contents={onHide => (

0 commit comments

Comments
 (0)