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

[Unified Integrations] Clean up empty states, tutorial links and routing to prefer unified integrations #114911

Merged
merged 36 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
177f3d0
Completely remove Beats card
Oct 13, 2021
040a728
Added `category` for easily adding integration links and checking for…
Oct 13, 2021
3ea65dc
Example of simplified use in Security
Oct 13, 2021
03e8113
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
171f889
fix links and titles to cards
snide Oct 14, 2021
ac836c4
empty state card updates. change add data to add integrations
snide Oct 14, 2021
28c1fa3
analytics copy
snide Oct 14, 2021
6384a1a
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
7abd79f
feedback
snide Oct 14, 2021
9336c01
more link and test cleanup
snide Oct 14, 2021
20066a8
clean up the tutorial views and hide notices and tabs
snide Oct 14, 2021
3133485
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
d237571
jest
snide Oct 15, 2021
e061a7a
point to obs APM agents
snide Oct 15, 2021
b85ec15
i18n and other test fixes
snide Oct 15, 2021
013cf67
remove tests no longer needed
snide Oct 15, 2021
877d4ec
more consistant copy
snide Oct 15, 2021
cc0aecc
Merge remote-tracking branch 'upstream/master' into integrations/upda…
joshdover Oct 15, 2021
c58a8fa
fix jest tests mock
snide Oct 15, 2021
273552a
address feedback
snide Oct 15, 2021
1a34739
feedback
snide Oct 15, 2021
bd68272
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 18, 2021
961b599
remove data tutorial tests since tabs no longer exist
snide Oct 18, 2021
8b5b576
remove directory notice components
snide Oct 18, 2021
73d0e09
i18n fixes
snide Oct 18, 2021
c219990
a11 hack
snide Oct 18, 2021
a3a7125
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
9142b85
screenreader rather than hack
snide Oct 18, 2021
c99e038
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
54d9fb6
fix fleet/integrations link
snide Oct 18, 2021
9b052f0
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
f56b0e8
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 18, 2021
02d7b81
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 18, 2021
86294f5
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 18, 2021
6d3f49c
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 19, 2021
1f59fe3
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 19, 2021
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
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export function CollapsibleNav({
iconType="plusInCircleFilled"
>
{i18n.translate('core.ui.primaryNav.addData', {
defaultMessage: 'Add data',
defaultMessage: 'Add integrations',
})}
Comment on lines 364 to 366
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove from the translation files (x-pack/plugins/translations/translations) all the keys/entries that have a change in their default message, for them to be picked for re-translation.

Please double check in case I missed any, but from core's owned files:

core.ui.primaryNav.addData
home.tryButtonLabel
home.letsStartTitle
home.addData.sectionTitle
home.tutorial.addDataToKibanaTitle

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is news to me. I thought this happened automatically?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New keys are automatically collected. Keys that were already present in the translation files always required to be removed to be picked again. Unless I'm wrong here cc @Bamieh for confirmation.

Copy link
Member

@Bamieh Bamieh Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CI is failing the only requirement is to run this locally:

node script/i18n_check --fix

Retranslations and all these details are automatically handled by our scripts so devs dont have to worry about this.

The long answer is that the --fix removes it from the translation file if there is a difference in the passed values keys.

When we're about to send the labels to the translators we take the fresh messages from the source code and send the diff of the added/changed labels. Translators send us the new strings back and we integrate it back into the translations file.

</EuiButton>
</EuiCollapsibleNavGroup>
Expand Down

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
Expand Up @@ -27,7 +27,9 @@ beforeEach(() => {
jest.clearAllMocks();
});

const applicationStartMock = {} as unknown as ApplicationStart;
const applicationStartMock = {
capabilities: { navLinks: { integrations: true } },
} as unknown as ApplicationStart;

const addBasePathMock = jest.fn((path: string) => (path ? path : 'path'));

Expand Down
152 changes: 77 additions & 75 deletions src/plugins/home/public/application/components/add_data/add_data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { METRIC_TYPE } from '@kbn/analytics';
import { ApplicationStart } from 'kibana/public';
import { createAppNavigationHandler } from '../app_navigation_handler';
// @ts-expect-error untyped component
import { Synopsis } from '../synopsis';
import { getServices } from '../../kibana_services';
import { RedirectAppLinks } from '../../../../../kibana_react/public';

Expand All @@ -35,87 +33,91 @@ interface Props {

export const AddData: FC<Props> = ({ addBasePath, application, isDarkMode }) => {
const { trackUiMetric } = getServices();
const canAccessIntegrations = application.capabilities.navLinks.integrations;
if (canAccessIntegrations) {
Comment on lines +36 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is more of a hack than a proper usage of capabilities, OTOH this is way easier to access this info that way than any alternative, so I guess this is fine-ish.

return (
<>
<section className="homDataAdd" aria-labelledby="homDataAdd__title">
<EuiFlexGroup alignItems="flexEnd">
<EuiFlexItem>
<EuiTitle size="s">
<h2 id="homDataAdd__title">
<FormattedMessage
id="home.addData.sectionTitle"
defaultMessage="Get started by adding integrations"
/>
</h2>
</EuiTitle>

return (
<>
<section className="homDataAdd" aria-labelledby="homDataAdd__title">
<EuiFlexGroup alignItems="flexEnd">
<EuiFlexItem>
<EuiTitle size="s">
<h2 id="homDataAdd__title">
<FormattedMessage
id="home.addData.sectionTitle"
defaultMessage="Get started by adding your data"
/>
</h2>
</EuiTitle>
<EuiSpacer />

<EuiSpacer />
<EuiText>
snide marked this conversation as resolved.
Show resolved Hide resolved
<p>
<FormattedMessage
id="home.addData.text"
defaultMessage="To start working with your data, use one of our many ingest options. Collect data from an app or service, or upload a file. If you're not ready to use your own data, add a sample data set."
/>
</p>
</EuiText>

<EuiText>
<p>
<FormattedMessage
id="home.addData.text"
defaultMessage="To start working with your data, use one of our many ingest options. Collect data from an app or service, or upload a file. If you're not ready to use your own data, add a sample data set."
/>
</p>
</EuiText>
<EuiSpacer />

<EuiSpacer />
<EuiFlexGroup gutterSize="m" responsive={false} wrap>
<EuiFlexItem grow={false}>
<RedirectAppLinks application={application}>
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
<EuiButton
data-test-subj="homeAddData"
fill
href={addBasePath('/app/integrations/browse')}
iconType="plusInCircle"
onClick={(event: MouseEvent) => {
trackUiMetric(METRIC_TYPE.CLICK, 'home_tutorial_directory');
createAppNavigationHandler('/app/integrations/browse')(event);
}}
>
<FormattedMessage
id="home.addData.addDataButtonLabel"
defaultMessage="Add integrations"
/>
</EuiButton>
</RedirectAppLinks>
</EuiFlexItem>

<EuiFlexGroup gutterSize="m" responsive={false} wrap>
<EuiFlexItem grow={false}>
<RedirectAppLinks application={application}>
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
<EuiButton
data-test-subj="homeAddData"
fill
href={addBasePath('/app/home#/tutorial_directory')}
iconType="plusInCircle"
onClick={(event: MouseEvent) => {
trackUiMetric(METRIC_TYPE.CLICK, 'home_tutorial_directory');
createAppNavigationHandler('/app/home#/tutorial_directory')(event);
}}
<EuiFlexItem grow={false}>
<EuiButtonEmpty
data-test-subj="addSampleData"
href={addBasePath('#/tutorial_directory/sampleData')}
iconType="documents"
>
<FormattedMessage
id="home.addData.addDataButtonLabel"
defaultMessage="Add your data"
id="home.addData.sampleDataButtonLabel"
defaultMessage="Try sample data"
/>
</EuiButton>
</RedirectAppLinks>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButtonEmpty
data-test-subj="addSampleData"
href={addBasePath('#/tutorial_directory/sampleData')}
iconType="documents"
>
<FormattedMessage
id="home.addData.sampleDataButtonLabel"
defaultMessage="Try sample data"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>

<EuiFlexItem>
<EuiImage
alt="Illustration of Elastic data integrations"
className="homDataAdd__illustration"
src={
addBasePath('/plugins/kibanaReact/assets/') +
(isDarkMode
? 'illustration_integrations_darkmode.svg'
: 'illustration_integrations_lightmode.svg')
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</section>
<EuiFlexItem>
<EuiImage
alt="Illustration of Elastic data integrations"
className="homDataAdd__illustration"
src={
addBasePath('/plugins/kibanaReact/assets/') +
(isDarkMode
? 'illustration_integrations_darkmode.svg'
: 'illustration_integrations_lightmode.svg')
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</section>

<EuiHorizontalRule margin="xxl" />
</>
);
<EuiHorizontalRule margin="xxl" />
</>
);
} else {
return null;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
image={cardGraphicURL}
textAlign="left"
title={
<FormattedMessage id="home.letsStartTitle" defaultMessage="Start by adding your data" />
<FormattedMessage id="home.letsStartTitle" defaultMessage="Start by adding integrations" />
}
description={
<FormattedMessage
Expand All @@ -51,7 +51,7 @@ export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
footer={
<footer>
<EuiButton fill className="homWelcome__footerAction" onClick={onConfirm}>
<FormattedMessage id="home.tryButtonLabel" defaultMessage="Add data" />
<FormattedMessage id="home.tryButtonLabel" defaultMessage="Add integrations" />
</EuiButton>
<EuiButtonEmpty
className="homWelcome__footerAction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { EuiFlexItem, EuiFlexGrid, EuiFlexGroup, EuiSpacer } from '@elastic/eui';
import { EuiFlexItem, EuiFlexGrid, EuiFlexGroup } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { Synopsis } from './synopsis';
Expand All @@ -33,34 +33,6 @@ class TutorialDirectoryUi extends React.Component {
const extraTabs = getServices().addDataService.getAddDataTabs();

this.tabs = [
{
id: ALL_TAB_ID,
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.allTitle',
defaultMessage: 'All',
}),
},
{
id: 'logging',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.loggingTitle',
defaultMessage: 'Logs',
}),
},
{
id: 'metrics',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.metricsTitle',
defaultMessage: 'Metrics',
}),
},
{
id: 'security',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.securitySolutionTitle',
defaultMessage: 'Security',
}),
},
{
id: SAMPLE_DATA_TAB_ID,
name: this.props.intl.formatMessage({
Expand Down Expand Up @@ -88,7 +60,6 @@ class TutorialDirectoryUi extends React.Component {
this.state = {
selectedTabId: openTab,
tutorialCards: [],
notices: getServices().tutorialService.getDirectoryNotices(),
};
}

Expand Down Expand Up @@ -216,19 +187,6 @@ class TutorialDirectoryUi extends React.Component {
);
};

renderNotices = () => {
const notices = getServices().tutorialService.getDirectoryNotices();
return notices.length ? (
<EuiFlexGroup direction="column" gutterSize="none">
{notices.map((DirectoryNotice, index) => (
<EuiFlexItem key={index}>
<DirectoryNotice />
</EuiFlexItem>
))}
</EuiFlexGroup>
) : null;
};

renderHeaderLinks = () => {
const headerLinks = getServices().tutorialService.getDirectoryHeaderLinks();
return headerLinks.length ? (
Expand All @@ -245,26 +203,22 @@ class TutorialDirectoryUi extends React.Component {
render() {
const headerLinks = this.renderHeaderLinks();
const tabs = this.getTabs();
const notices = this.renderNotices();

return (
<KibanaPageTemplate
restrictWidth={1200}
template="empty"
pageHeader={{
pageTitle: (
<FormattedMessage id="home.tutorial.addDataToKibanaTitle" defaultMessage="Add data" />
<FormattedMessage
id="home.tutorial.addDataToKibanaTitle"
defaultMessage="Alternative ways to add data"
/>
),
tabs,
rightSideItems: headerLinks ? [headerLinks] : [],
}}
>
{notices && (
<>
{notices}
<EuiSpacer size="s" />
</>
)}
{this.renderTabContent()}
</KibanaPageTemplate>
);
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/home/public/application/components/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export class Welcome extends React.Component<Props> {
};

private redirecToAddData() {
const path = this.services.addBasePath('#/tutorial_directory');
window.location.href = path;
this.services.application.navigateToApp('integrations', { path: '/browse' });
}

private onSampleDataDecline = () => {
Expand Down
1 change: 0 additions & 1 deletion src/plugins/home/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type {
FeatureCatalogueSolution,
Environment,
TutorialVariables,
TutorialDirectoryNoticeComponent,
TutorialDirectoryHeaderLinkComponent,
TutorialModuleNoticeComponent,
} from './services';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/home/public/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export { TutorialService } from './tutorials';
export type {
TutorialVariables,
TutorialServiceSetup,
TutorialDirectoryNoticeComponent,
TutorialDirectoryHeaderLinkComponent,
TutorialModuleNoticeComponent,
} from './tutorials';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/home/public/services/tutorials/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export { TutorialService } from './tutorial_service';
export type {
TutorialVariables,
TutorialServiceSetup,
TutorialDirectoryNoticeComponent,
TutorialDirectoryHeaderLinkComponent,
TutorialModuleNoticeComponent,
} from './tutorial_service';
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const createMock = (): jest.Mocked<PublicMethodsOf<TutorialService>> => {
const service = {
setup: jest.fn(),
getVariables: jest.fn(() => ({})),
getDirectoryNotices: jest.fn(() => []),
getDirectoryHeaderLinks: jest.fn(() => []),
getModuleNotices: jest.fn(() => []),
getCustomStatusCheck: jest.fn(),
Expand Down
Loading