File tree Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export type CreateIndexFormProps = {
3939 namespace : string ;
4040 fields : Field [ ] ;
4141 serverVersion : string ;
42- currentTab : Tab ;
42+ currentTab : Tab | null ;
4343 onSelectFieldNameClick : ( idx : number , name : string ) => void ;
4444 onSelectFieldTypeClick : ( idx : number , fType : string ) => void ;
4545 onAddFieldClick : ( ) => void ; // Plus icon.
@@ -85,7 +85,7 @@ function CreateIndexForm({
8585 className = { createIndexModalFieldsStyles }
8686 data-testid = "create-index-form"
8787 >
88- { showIndexesGuidanceVariant ? (
88+ { showIndexesGuidanceVariant && ! ! currentTab ? (
8989 < RadioBoxGroup
9090 aria-labelledby = "index-flows"
9191 data-testid = "create-index-form-flows"
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ type CreateIndexModalProps = React.ComponentProps<typeof CreateIndexForm> & {
3434 isVisible : boolean ;
3535 namespace : string ;
3636 error : string | null ;
37- currentTab : Tab ;
37+ currentTab : Tab | null ;
3838 onErrorBannerCloseClick : ( ) => void ;
3939 onCreateIndexClick : ( ) => void ;
4040 onCancelCreateIndexClick : ( ) => void ;
@@ -83,6 +83,10 @@ function CreateIndexModal({
8383 const enableInIndexesGuidanceExp = usePreference ( 'enableIndexesGuidanceExp' ) ;
8484 const showIndexesGuidanceVariant =
8585 usePreference ( 'showIndexesGuidanceVariant' ) && enableInIndexesGuidanceExp ;
86+ if ( showIndexesGuidanceVariant && ! currentTab ) {
87+ // If user is in the variant and there has not been a currentTab set, default it to IndexFlow
88+ props . onTabClick ( 'IndexFlow' ) ;
89+ }
8690
8791 useFireExperimentViewed ( {
8892 testName : TestName . earlyJourneyIndexesGuidance ,
Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ export type State = {
295295 options : Options ;
296296
297297 // current tab that user is on (Query Flow or Index Flow)
298- currentTab : Tab ;
298+ currentTab : Tab | null ;
299299} ;
300300
301301export const INITIAL_STATE : State = {
@@ -304,7 +304,7 @@ export const INITIAL_STATE: State = {
304304 error : null ,
305305 fields : INITIAL_FIELDS_STATE ,
306306 options : INITIAL_OPTIONS_STATE ,
307- currentTab : 'IndexFlow' ,
307+ currentTab : null ,
308308} ;
309309
310310function getInitialState ( ) : State {
@@ -365,7 +365,17 @@ export const createIndexFormSubmitted = (): IndexesThunkAction<
365365 void ,
366366 ErrorEncounteredAction | CreateIndexFormSubmittedAction
367367> => {
368- return ( dispatch , getState ) => {
368+ return ( dispatch , getState , { track } ) => {
369+ const currentTab = getState ( ) . createIndex . currentTab ;
370+ track ( 'Create Index Button Clicked' , {
371+ context : 'Create Index Modal' ,
372+ flow : ! currentTab
373+ ? undefined
374+ : currentTab === 'IndexFlow'
375+ ? 'Start with Index'
376+ : 'Start with Query' ,
377+ } ) ;
378+
369379 // Check for field errors.
370380 if (
371381 getState ( ) . createIndex . fields . some (
Original file line number Diff line number Diff line change @@ -2678,6 +2678,14 @@ type ExperimentViewedEvent = CommonEvent<{
26782678 payload : { test_name : string } ;
26792679} > ;
26802680
2681+ type CreateIndexButtonClickedEvent = CommonEvent < {
2682+ name : 'Create Index Button Clicked' ;
2683+ payload : {
2684+ flow : 'Start with Query' | 'Start with Index' | undefined ;
2685+ context : string ;
2686+ } ;
2687+ } > ;
2688+
26812689export type TelemetryEvent =
26822690 | AggregationCanceledEvent
26832691 | AggregationCopiedEvent
@@ -2799,4 +2807,5 @@ export type TelemetryEvent =
27992807 | FirstInputDelayEvent
28002808 | CumulativeLayoutShiftEvent
28012809 | TimeToFirstByteEvent
2802- | ExperimentViewedEvent ;
2810+ | ExperimentViewedEvent
2811+ | CreateIndexButtonClickedEvent ;
You can’t perform that action at this time.
0 commit comments