[Rollups] Add attributes for tracking doc links clicks (#186612)

Closes https://github.com/elastic/kibana/issues/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.
This commit is contained in:
Elena Stoeva 2024-06-21 16:05:44 +01:00 committed by GitHub
parent 7129eea6d5
commit d16d402d81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View file

@ -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"
@ -30,6 +36,7 @@ export const DeprecationCallout = () => {
<EuiLink
href={documentationLinks.elasticsearch.rollupMigratingToDownsampling}
target="_blank"
data-test-subj={`${linksTestSubjPrefix}-rollupDeprecationCalloutMigrationGuideLink`}
>
{i18n.translate('xpack.rollupJobs.deprecationCallout.migrationGuideLink', {
defaultMessage: 'migration guide',
@ -37,7 +44,11 @@ export const DeprecationCallout = () => {
</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',
})}

View file

@ -557,7 +557,7 @@ export class JobCreateUi extends Component {
<EuiSpacer size="l" />
<DeprecationCallout />
<DeprecationCallout linksTestSubjPrefix="createForm" />
<EuiSpacer size="l" />

View file

@ -41,6 +41,7 @@ export const DeprecatedPrompt = () => {
target="_blank"
fill
iconType="help"
data-test-subj="rollupDeprecatedPromptDocsLink"
>
<FormattedMessage
id="xpack.rollupJobs.deprecatedPrompt.downsamplingDocsButtonLabel"

View file

@ -173,7 +173,7 @@ export class JobListUi extends Component {
<EuiSpacer size="l" />
<DeprecationCallout />
<DeprecationCallout linksTestSubjPrefix="listView" />
<EuiSpacer size="l" />