Skip to content

Commit

Permalink
Telemetry usage collection welcome screen (#53084)
Browse files Browse the repository at this point in the history
* Changes text dynamically based on the value of optIn in kibana.yml
  • Loading branch information
TinaHeiligers authored Dec 18, 2019
1 parent 13c2ed4 commit b34852a
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 45 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions src/legacy/core_plugins/kibana/public/home/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ export class Home extends Component {
getServices().getInjected('disableWelcomeScreen') ||
props.localStorage.getItem(KEY_ENABLE_WELCOME) === 'false'
);
const showTelemetryDisclaimer = getServices().getInjected(
'telemetryNotifyUserAboutOptInDefault'
);

const currentOptInStatus = this.props.getOptInStatus();
this.state = {
// If welcome is enabled, we wait for loading to complete
// before rendering. This prevents an annoying flickering
Expand All @@ -63,7 +60,7 @@ export class Home extends Component {
isLoading: isWelcomeEnabled,
isNewKibanaInstance: false,
isWelcomeEnabled,
showTelemetryDisclaimer,
currentOptInStatus,
};
}

Expand Down Expand Up @@ -222,14 +219,13 @@ export class Home extends Component {
renderLoading() {
return '';
}

renderWelcome() {
return (
<Welcome
onSkip={this.skipWelcome}
urlBasePath={this.props.urlBasePath}
showTelemetryDisclaimer={this.state.showTelemetryDisclaimer}
onOptInSeen={this.props.onOptInSeen}
currentOptInStatus={this.state.currentOptInStatus}
/>
);
}
Expand Down Expand Up @@ -269,4 +265,5 @@ Home.propTypes = {
urlBasePath: PropTypes.string.isRequired,
mlEnabled: PropTypes.bool.isRequired,
onOptInSeen: PropTypes.func.isRequired,
getOptInStatus: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ describe('home', () => {
setItem: sinon.mock(),
},
urlBasePath: 'goober',
onOptInSeen() {
return false;
},
getOptInStatus: jest.fn(),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ import { getTutorial } from '../load_tutorials';
import { replaceTemplateStrings } from './tutorial/replace_template_strings';
import { getServices } from '../kibana_services';
import { npSetup } from 'ui/new_platform';

export function HomeApp({ directories }) {
const {
getInjected,
savedObjectsClient,
getBasePath,
addBasePath,
telemetryOptInProvider: { setOptInNoticeSeen },
telemetryOptInProvider: { setOptInNoticeSeen, getOptIn },
} = getServices();
const { cloud } = npSetup.plugins;
const isCloudEnabled = !!(cloud && cloud.isCloudEnabled);
Expand Down Expand Up @@ -87,6 +86,7 @@ export function HomeApp({ directories }) {
localStorage={localStorage}
urlBasePath={getBasePath()}
onOptInSeen={setOptInNoticeSeen}
getOptInStatus={getOptIn}
/>
</Route>
<Route path="/home">
Expand Down
Loading

0 comments on commit b34852a

Please sign in to comment.