@@ -6,6 +6,7 @@ import cx from 'classnames'
6
6
import { EuiButtonIcon , EuiText , EuiToolTip } from '@elastic/eui'
7
7
import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api'
8
8
import MonacoEditor , { monaco } from 'react-monaco-editor'
9
+ import { useParams } from 'react-router-dom'
9
10
10
11
import {
11
12
Theme ,
@@ -34,6 +35,7 @@ import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
34
35
import { IEditorMount , ISnippetController } from 'uiSrc/pages/workbench/interfaces'
35
36
import { CommandExecutionUI } from 'uiSrc/slices/interfaces'
36
37
import { darkTheme , lightTheme } from 'uiSrc/constants/monaco/cypher'
38
+ import { sendEventTelemetry , TelemetryEvent } from 'uiSrc/telemetry'
37
39
38
40
import { workbenchResultsSelector } from 'uiSrc/slices/workbench/wb-results'
39
41
import DedicatedEditor from 'uiSrc/components/query/DedicatedEditor/DedicatedEditor'
@@ -77,6 +79,8 @@ const Query = (props: Props) => {
77
79
const { theme } = useContext ( ThemeContext )
78
80
const monacoObjects = useRef < Nullable < IEditorMount > > ( null )
79
81
82
+ const { instanceId = '' } = useParams < { instanceId : string } > ( )
83
+
80
84
let disposeCompletionItemProvider = ( ) => { }
81
85
let disposeSignatureHelpProvider = ( ) => { }
82
86
@@ -125,7 +129,7 @@ const Query = (props: Props) => {
125
129
const triggerUpdateCursorPosition = ( editor : monacoEditor . editor . IStandaloneCodeEditor ) => {
126
130
const position = editor . getPosition ( )
127
131
isDedicatedEditorOpenRef . current = false
128
- editor . trigger ( 'mouse' , '_moveTo' , { position : { lineNumber : 1 , column : 1 } } )
132
+ editor . trigger ( 'mouse' , '_moveTo' , { position : { lineNumber : 1 , column : 1 } } )
129
133
editor . trigger ( 'mouse' , '_moveTo' , { position } )
130
134
editor . focus ( )
131
135
}
@@ -137,6 +141,13 @@ const Query = (props: Props) => {
137
141
setIsDedicatedEditorOpen ( true )
138
142
editor . updateOptions ( { readOnly : true } )
139
143
hideSyntaxWidget ( editor )
144
+ sendEventTelemetry ( {
145
+ event : TelemetryEvent . WORKBENCH_NON_REDIS_EDITOR_OPENED ,
146
+ eventData : {
147
+ databaseId : instanceId ,
148
+ lang : syntaxCommand . current . lang ,
149
+ }
150
+ } )
140
151
}
141
152
142
153
const onChange = ( value : string = '' ) => {
@@ -305,6 +316,14 @@ const Query = (props: Props) => {
305
316
306
317
editor . updateOptions ( { readOnly : false } )
307
318
triggerUpdateCursorPosition ( editor )
319
+
320
+ sendEventTelemetry ( {
321
+ event : TelemetryEvent . WORKBENCH_NON_REDIS_EDITOR_CANCELLED ,
322
+ eventData : {
323
+ databaseId : instanceId ,
324
+ lang : syntaxCommand . current . lang ,
325
+ }
326
+ } )
308
327
}
309
328
310
329
const updateArgFromDedicatedEditor = ( value : string = '' ) => {
@@ -333,6 +352,13 @@ const Query = (props: Props) => {
333
352
] )
334
353
setIsDedicatedEditorOpen ( false )
335
354
triggerUpdateCursorPosition ( editor )
355
+ sendEventTelemetry ( {
356
+ event : TelemetryEvent . WORKBENCH_NON_REDIS_EDITOR_SAVED ,
357
+ eventData : {
358
+ databaseId : instanceId ,
359
+ lang : syntaxCommand . current . lang ,
360
+ }
361
+ } )
336
362
}
337
363
338
364
const editorDidMount = (
0 commit comments