Skip to content
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/opt in welcome screen #42110

Merged
merged 43 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8914b61
refactor opt_in_message
Bamieh Jul 23, 2019
cb0b2b5
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Jul 23, 2019
0f2261b
welcome optin card
Bamieh Jul 27, 2019
84737d0
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Jul 27, 2019
d1e7794
finish optin in welcome screen
Bamieh Jul 28, 2019
d7f7a07
add steps
Bamieh Jul 28, 2019
25b4577
disable current step
Bamieh Jul 28, 2019
11d9e82
remove checkbox option
Bamieh Jul 28, 2019
a3338db
add metrics
Bamieh Jul 28, 2019
2812b0f
fix typescript checks
Bamieh Jul 28, 2019
76b17dd
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Jul 28, 2019
5135a14
hide in oss
Bamieh Jul 29, 2019
d2bdffa
update snapshots
Bamieh Jul 29, 2019
d69c996
only require TelemetryOptInProvider if telemetry is enabled
Bamieh Jul 29, 2019
150e7f1
pass telemetry description from service
Bamieh Jul 29, 2019
9a7808f
remove x-pack import
Bamieh Jul 29, 2019
f9b3603
remove x-pack import
Bamieh Jul 29, 2019
06ae6e9
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Jul 31, 2019
1e318eb
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Jul 31, 2019
62e571f
update image
Bamieh Aug 14, 2019
595542f
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 15, 2019
1f20375
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 16, 2019
77e72ae
update per design feedback
Bamieh Aug 16, 2019
0f69d1e
update props
Bamieh Aug 16, 2019
e6bec27
fix in oss
Bamieh Aug 16, 2019
96d6d3c
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 16, 2019
caab68e
await before moving to next screen
Bamieh Aug 16, 2019
0f46f9c
utlize bannerId in telemtry provider
Bamieh Aug 18, 2019
002ae63
keep export in 1 line
Bamieh Aug 18, 2019
0b5a066
ts-ignore banner import
Bamieh Aug 18, 2019
5e06a17
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 18, 2019
a89e88c
add test
Bamieh Aug 18, 2019
2bef45f
update tests
Bamieh Aug 18, 2019
f58b239
update translations
Bamieh Aug 18, 2019
c492da3
update home tests
Bamieh Aug 18, 2019
6560d26
remove extra license header
Bamieh Aug 19, 2019
30c3802
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 21, 2019
aa7adc1
Merge branch 'master' of github.com:elastic/kibana into telemetry/opt…
Bamieh Aug 26, 2019
be9bd46
showTelemetryOptIn -> shouldShowTelemetryOptIn
Bamieh Aug 26, 2019
81bb8b6
remote extra EuiTexts
Bamieh Aug 26, 2019
645b86d
Merge branch 'telemetry/opt_in_welcome_screen' of github.com:elastic/…
Bamieh Aug 26, 2019
2bff852
update jest snapshot
Bamieh Aug 26, 2019
927c708
unencrypted telemetry example
Bamieh Aug 26, 2019
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

.homWelcome {
@include kibanaFullScreenGraphics;
@include kibanaFullScreenGraphics($euiZLevel6);
}

.homWelcome__header {
Expand Down
8 changes: 8 additions & 0 deletions src/legacy/core_plugins/kibana/public/home/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export class Home extends Component {
<Welcome
onSkip={this.skipWelcome}
urlBasePath={this.props.urlBasePath}
showTelemetryOptIn={this.props.showTelemetryOptIn}
fetchTelemetry={this.props.fetchTelemetry}
setOptIn={this.props.setOptIn}
getTelemetryBannerId={this.props.getTelemetryBannerId}
/>
);
}
Expand All @@ -247,6 +251,10 @@ export class Home extends Component {

Home.propTypes = {
addBasePath: PropTypes.func.isRequired,
fetchTelemetry: PropTypes.func.isRequired,
getTelemetryBannerId: PropTypes.func.isRequired,
setOptIn: PropTypes.func.isRequired,
showTelemetryOptIn: PropTypes.bool.isRequired,
Bamieh marked this conversation as resolved.
Show resolved Hide resolved
directories: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
Expand Down
24 changes: 6 additions & 18 deletions src/legacy/core_plugins/kibana/public/home/components/home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,14 @@
* under the License.
*/

import './home.test.mocks';
Bamieh marked this conversation as resolved.
Show resolved Hide resolved

import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { Home } from './home';
import { FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';

jest.mock(
'ui/chrome',
() => ({
getBasePath: jest.fn(() => 'path'),
getInjected: jest.fn(() => ''),
}),
{ virtual: true }
);

jest.mock(
'ui/capabilities',
() => ({
catalogue: {},
management: {},
navLinks: {}
})
);

describe('home', () => {
let defaultProps;

Expand All @@ -50,6 +34,10 @@ describe('home', () => {
apmUiEnabled: true,
mlEnabled: true,
kibanaVersion: '99.2.1',
fetchTelemetry: jest.fn(),
getTelemetryBannerId: jest.fn(),
setOptIn: jest.fn(),
showTelemetryOptIn: false,
addBasePath(url) {
return `base_path/${url}`;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { notificationServiceMock } from '../../../../../../core/public/mocks';

jest.doMock('ui/new_platform', () => {
return {
npSetup: {
core: {
notifications: notificationServiceMock.createSetupContract(),
},
},
};
});

jest.doMock(
'ui/chrome',
() => ({
getBasePath: jest.fn(() => 'path'),
getInjected: jest.fn(() => ''),
}),
{ virtual: true }
);

jest.doMock('ui/capabilities', () => ({
catalogue: {},
management: {},
navLinks: {},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ import {
} from 'react-router-dom';
import { getTutorial } from '../load_tutorials';
import { replaceTemplateStrings } from './tutorial/replace_template_strings';
import { telemetryOptInProvider, showTelemetryOptIn } from '../kibana_services';
import chrome from 'ui/chrome';

export function HomeApp({
directories,
}) {

export function HomeApp({ directories }) {
const isCloudEnabled = chrome.getInjected('isCloudEnabled', false);
const apmUiEnabled = chrome.getInjected('apmUiEnabled', true);
const mlEnabled = chrome.getInjected('mlEnabled', false);
Expand Down Expand Up @@ -94,6 +92,10 @@ export function HomeApp({
find={savedObjectsClient.find}
localStorage={localStorage}
urlBasePath={chrome.getBasePath()}
showTelemetryOptIn={showTelemetryOptIn}
setOptIn={telemetryOptInProvider.setOptIn}
fetchTelemetry={telemetryOptInProvider.fetchExample}
getTelemetryBannerId={telemetryOptInProvider.getBannerId}
/>
</Route>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* The UI and related logic for the welcome screen that *should* show only
* when it is enabled (the default) and there is no Kibana-consumed data
* in Elasticsearch.
*/

import React from 'react';
import {
// @ts-ignore
EuiCard,
EuiButton,
EuiButtonEmpty,
} from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n/react';

interface Props {
urlBasePath: string;
onDecline: () => void;
onConfirm: () => void;
}

export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
return (
<EuiCard
image={`${urlBasePath}/plugins/kibana/assets/illo_dashboard.png`}
textAlign="left"
title={<FormattedMessage id="kbn.home.letsStartTitle" defaultMessage="Let's get started" />}
description={
<FormattedMessage
id="kbn.home.letsStartDescription"
defaultMessage="We noticed that you don't have any data in your cluster.
You can try our sample data and dashboards or jump in with your own data."
/>
}
footer={
<footer>
<EuiButton fill className="homWelcome__footerAction" onClick={onConfirm}>
<FormattedMessage id="kbn.home.tryButtonLabel" defaultMessage="Try our sample data" />
</EuiButton>
<EuiButtonEmpty
className="homWelcome__footerAction"
onClick={onDecline}
data-test-subj="skipWelcomeScreen"
>
<FormattedMessage id="kbn.home.exploreButtonLabel" defaultMessage="Explore on my own" />
</EuiButtonEmpty>
</footer>
}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { renderTelemetryOptInCard, Props } from './telemetry_opt_in_card';

export const TelemetryOptInCard = (props: Props) => {
return renderTelemetryOptInCard(props);
};
Loading