Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ const IndexFlowSection = ({
setIsCodeEquivalentToggleChecked(value);
track('Code Equivalent Toggled', {
context: 'Create Index Modal',
toggled: value === true ? 'On' : 'Off',
});
}}
checked={isCodeEquivalentToggleChecked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ const MDBCodeViewer = ({
collectionName,
indexNameTypeMap,
dataTestId,
onCopy,
}: {
dbName: string;
collectionName: string;
indexNameTypeMap: Record<string, string | number>;
dataTestId?: string;
onCopy?: () => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do want this copy tracked for the index flow section? Right now we're only doing it for the query flow section.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait you're right let me check

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked with analyst and she wanted both in and i realized i had the naming switched anyway so i fixed that. while i was there i added another event that was requested (index strategy documentation clicked)

}) => {
const track = useTelemetry();
const GeneratedCode = generateCode({
Expand All @@ -72,7 +74,15 @@ const MDBCodeViewer = ({

return (
<div className={containerStyles}>
<Code data-testid={dataTestId || 'mdb-code-viewer'} language="javascript">
<Code
data-testid={dataTestId || 'mdb-code-viewer'}
language="javascript"
onCopy={() => {
if (onCopy) {
onCopy();
}
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onCopy={() => {
if (onCopy) {
onCopy();
}
}}
onCopy={onCopy}

>
{GeneratedCode}
</Code>
<span className={programmingLanguageLinkStyles}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ const QueryFlowSection = ({
dbName={dbName}
collectionName={collectionName}
indexNameTypeMap={indexSuggestions}
onCopy={() => {
track('Input Index Copied', {
context: 'Create Index Modal',
});
}}
/>
</div>
</>
Expand Down
9 changes: 9 additions & 0 deletions packages/compass-telemetry/src/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2817,6 +2817,7 @@ type CreateIndexCodeEquivalentToggled = CommonEvent<{
name: 'Code Equivalent Toggled';
payload: {
context: CreateIndexModalContext;
toggled: 'On' | 'Off';
};
}>;

Expand Down Expand Up @@ -2848,6 +2849,13 @@ type CreateIndexCoveredQueriesLearnMoreClicked = CommonEvent<{
};
}>;

type CreateIndexInputIndexCopied = CommonEvent<{
name: 'Input Index Copied';
payload: {
context: CreateIndexModalContext;
};
}>;

export type TelemetryEvent =
| AggregationCanceledEvent
| AggregationCopiedEvent
Expand Down Expand Up @@ -2989,4 +2997,5 @@ export type TelemetryEvent =
| CreateIndexProgrammingLanguageLinkClicked
| CreateIndexQueryTabClicked
| CreateIndexSuggestedIndexButtonClicked
| CreateIndexInputIndexCopied
| UUIDEncounteredEvent;
Loading