-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Telemetry] Remove telemetry splash page and add conditional messaging #50189
Changes from 4 commits
30b339a
774bd42
ce837aa
ddf7260
b69142c
46b9f5c
440a373
9188ce8
a76794f
6faff3e
fe98b93
b84c88f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
|
||
import React from 'react'; | ||
import { | ||
EuiLink, | ||
EuiTextColor, | ||
EuiTitle, | ||
EuiSpacer, | ||
EuiFlexGroup, | ||
|
@@ -37,29 +39,17 @@ import { FormattedMessage } from '@kbn/i18n/react'; | |
import { getServices } from '../kibana_services'; | ||
|
||
import { SampleDataCard } from './sample_data'; | ||
import { TelemetryOptInCard } from './telemetry_opt_in'; | ||
|
||
interface Props { | ||
urlBasePath: string; | ||
onSkip: () => {}; | ||
fetchTelemetry: () => Promise<any[]>; | ||
setOptIn: (enabled: boolean) => Promise<boolean>; | ||
getTelemetryBannerId: () => string; | ||
shouldShowTelemetryOptIn: boolean; | ||
} | ||
|
||
interface State { | ||
step: number; | ||
} | ||
|
||
/** | ||
* Shows a full-screen welcome page that gives helpful quick links to beginners. | ||
*/ | ||
export class Welcome extends React.PureComponent<Props, State> { | ||
export class Welcome extends React.Component<Props> { | ||
private services = getServices(); | ||
public readonly state: State = { | ||
step: 0, | ||
}; | ||
|
||
private hideOnEsc = (e: KeyboardEvent) => { | ||
if (e.key === 'Escape') { | ||
|
@@ -72,32 +62,18 @@ export class Welcome extends React.PureComponent<Props, State> { | |
window.location.href = path; | ||
} | ||
|
||
private async handleTelemetrySelection(confirm: boolean) { | ||
const metricName = `telemetryOptIn${confirm ? 'Confirm' : 'Decline'}`; | ||
this.services.trackUiMetric(this.services.METRIC_TYPE.CLICK, metricName); | ||
await this.props.setOptIn(confirm); | ||
const bannerId = this.props.getTelemetryBannerId(); | ||
this.services.banners.remove(bannerId); | ||
this.setState(() => ({ step: 1 })); | ||
} | ||
|
||
private onSampleDataDecline = () => { | ||
this.services.trackUiMetric(this.services.METRIC_TYPE.CLICK, 'sampleDataDecline'); | ||
this.props.onSkip(); | ||
}; | ||
|
||
private onSampleDataConfirm = () => { | ||
this.services.trackUiMetric(this.services.METRIC_TYPE.CLICK, 'sampleDataConfirm'); | ||
this.redirecToSampleData(); | ||
}; | ||
|
||
componentDidMount() { | ||
this.services.trackUiMetric(this.services.METRIC_TYPE.LOADED, 'welcomeScreenMount'); | ||
if (this.props.shouldShowTelemetryOptIn) { | ||
this.services.trackUiMetric( | ||
this.services.METRIC_TYPE.COUNT, | ||
'welcomeScreenWithTelemetryOptIn' | ||
); | ||
} | ||
document.addEventListener('keydown', this.hideOnEsc); | ||
} | ||
|
||
|
@@ -106,8 +82,7 @@ export class Welcome extends React.PureComponent<Props, State> { | |
} | ||
|
||
render() { | ||
const { urlBasePath, shouldShowTelemetryOptIn, fetchTelemetry } = this.props; | ||
const { step } = this.state; | ||
const { urlBasePath } = this.props; | ||
|
||
return ( | ||
<EuiPortal> | ||
|
@@ -137,21 +112,34 @@ export class Welcome extends React.PureComponent<Props, State> { | |
<div className="homWelcome__content homWelcome-body"> | ||
<EuiFlexGroup gutterSize="l"> | ||
<EuiFlexItem> | ||
{shouldShowTelemetryOptIn && step === 0 && ( | ||
<TelemetryOptInCard | ||
urlBasePath={urlBasePath} | ||
fetchTelemetry={fetchTelemetry} | ||
onConfirm={this.handleTelemetrySelection.bind(this, true)} | ||
onDecline={this.handleTelemetrySelection.bind(this, false)} | ||
<SampleDataCard | ||
urlBasePath={urlBasePath} | ||
onConfirm={this.onSampleDataConfirm} | ||
onDecline={this.onSampleDataDecline} | ||
/> | ||
<EuiSpacer size="s" /> | ||
<EuiTextColor className="euiText--small" color="subdued"> | ||
<FormattedMessage | ||
id="kbn.home.dataManagementDisclaimerPrivacy" | ||
defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our " | ||
/> | ||
)} | ||
{(!shouldShowTelemetryOptIn || step === 1) && ( | ||
<SampleDataCard | ||
urlBasePath={urlBasePath} | ||
onConfirm={this.onSampleDataConfirm} | ||
onDecline={this.onSampleDataDecline} | ||
<EuiLink href="#"> | ||
<FormattedMessage | ||
id="kbn.home.dataManagementDisclaimerPrivacyLink" | ||
defaultMessage="Privacy Policy." | ||
/> | ||
</EuiLink> | ||
<FormattedMessage | ||
id="kbn.home.dataManagementDisableCollection" | ||
defaultMessage=" To disable collection, " | ||
/> | ||
)} | ||
<EuiLink href="#"> | ||
<FormattedMessage | ||
id="kbn.home.dataManagementDisableCollectionLink" | ||
defaultMessage="click here." | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clicking here just causes the page to refresh and ends up in the same place. 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with the privacy policy link, which seems like it should go to https://www.elastic.co/legal/telemetry-privacy-statement , but perhaps we're waiting for updated links ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, these are just placeholders for now, thanks for calling it out! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added links! |
||
</EuiLink> | ||
</EuiTextColor> | ||
<EuiSpacer size="xs" /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is a bit hectic, but I couldn't find a better mechanism for embedding links into a formatted message. Would love to know if folks have a better alternative as this is super noisy.