Skip to content

Commit

Permalink
[Rollups] Add attributes for tracking doc links clicks (#186612)
Browse files Browse the repository at this point in the history
Closes #186610

## Summary

This PR adds `data-test-subj` attributes to the doc links in the Rollup
deprecation warning callout and the deprecation empty callout so that
clicks on these links can be tracked on Fullstory. The links on the
deprecation callout have test subjects with a prefix depending on
whether they are on the list view page or the create form page so that
we can differentiate the clicks from the different pages.
  • Loading branch information
ElenaStoeva committed Jun 21, 2024
1 parent 7129eea commit d16d402
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ import { i18n } from '@kbn/i18n';
import React from 'react';
import { documentationLinks } from '../../../services/documentation_links';

interface DeprecationCalloutProps {
/** The prefix to be applied at the test subjects for the doc links.
* Used for clicks tracking in Fullstory. */
linksTestSubjPrefix: string;
}

/*
A component for displaying a deprecation warning.
*/
export const DeprecationCallout = () => {
export const DeprecationCallout = ({ linksTestSubjPrefix }: DeprecationCalloutProps) => {
return (
<EuiCallOut
title="Deprecated in 8.11.0"
Expand All @@ -30,14 +36,19 @@ export const DeprecationCallout = () => {
<EuiLink
href={documentationLinks.elasticsearch.rollupMigratingToDownsampling}
target="_blank"
data-test-subj={`${linksTestSubjPrefix}-rollupDeprecationCalloutMigrationGuideLink`}
>
{i18n.translate('xpack.rollupJobs.deprecationCallout.migrationGuideLink', {
defaultMessage: 'migration guide',
})}
</EuiLink>
),
downsamplingLink: (
<EuiLink href={documentationLinks.fleet.datastreamsDownsampling} target="_blank">
<EuiLink
href={documentationLinks.fleet.datastreamsDownsampling}
target="_blank"
data-test-subj={`${linksTestSubjPrefix}-rollupDeprecationCalloutDownsamplingDocLink`}
>
{i18n.translate('xpack.rollupJobs.deprecationCallout.downsamplingLink', {
defaultMessage: 'downsampling',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export class JobCreateUi extends Component {

<EuiSpacer size="l" />

<DeprecationCallout />
<DeprecationCallout linksTestSubjPrefix="createForm" />

<EuiSpacer size="l" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const DeprecatedPrompt = () => {
target="_blank"
fill
iconType="help"
data-test-subj="rollupDeprecatedPromptDocsLink"
>
<FormattedMessage
id="xpack.rollupJobs.deprecatedPrompt.downsamplingDocsButtonLabel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class JobListUi extends Component {

<EuiSpacer size="l" />

<DeprecationCallout />
<DeprecationCallout linksTestSubjPrefix="listView" />

<EuiSpacer size="l" />

Expand Down

0 comments on commit d16d402

Please sign in to comment.