[SIEM] Beta badge on overview page (#38161) (#38193)

* add beta badge to overview header

* update test

* updates snapshot
This commit is contained in:
Michael Marcialis 2019-06-06 13:21:46 -04:00 committed by GitHub
parent ee463870ec
commit 58df103f38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 18 deletions

View file

@ -2,6 +2,8 @@
exports[`rendering renders correctly 1`] = `
<Component
badgeLabel="Beta"
badgeTooltip="My test tooltip."
subtitle="My Test Subtitle"
title="My Test Title"
>

View file

@ -13,7 +13,12 @@ import { HeaderPage } from './index';
describe('rendering', () => {
test('renders correctly', () => {
const wrapper = shallow(
<HeaderPage subtitle="My Test Subtitle" title="My Test Title">
<HeaderPage
badgeLabel="Beta"
badgeTooltip="My test tooltip."
subtitle="My Test Subtitle"
title="My Test Title"
>
<p>{'My test supplement.'}</p>
</HeaderPage>
);

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';
import React from 'react';
import { pure } from 'recompose';
import styled from 'styled-components';
@ -18,25 +18,41 @@ const Header = styled.header`
`;
export interface HeaderPageProps {
badgeLabel?: string;
badgeTooltip?: string;
children?: React.ReactNode;
subtitle?: string | React.ReactNode;
title: string | React.ReactNode;
}
export const HeaderPage = pure<HeaderPageProps>(({ children, subtitle, title }) => (
<Header>
<EuiFlexGroup alignItems="center">
<EuiFlexItem>
<EuiTitle size="l">
<h1 data-test-subj="page_headline_title">{title}</h1>
</EuiTitle>
export const HeaderPage = pure<HeaderPageProps>(
({ badgeLabel, badgeTooltip, children, subtitle, title }) => (
<Header>
<EuiFlexGroup alignItems="center">
<EuiFlexItem>
<EuiTitle size="l">
<h1 data-test-subj="page_headline_title">
{title}
{badgeLabel && (
<>
{' '}
<EuiBetaBadge
label={badgeLabel}
tooltipContent={badgeTooltip}
tooltipPosition="bottom"
/>
</>
)}
</h1>
</EuiTitle>
<EuiText color="subdued" size="s">
{subtitle}
</EuiText>
</EuiFlexItem>
<EuiText color="subdued" size="s">
{subtitle}
</EuiText>
</EuiFlexItem>
{children && <EuiFlexItem grow={false}>{children}</EuiFlexItem>}
</EuiFlexGroup>
</Header>
));
{children && <EuiFlexItem grow={false}>{children}</EuiFlexItem>}
</EuiFlexGroup>
</Header>
)
);

View file

@ -31,7 +31,12 @@ export const OverviewComponent = pure(() => {
return (
<>
<HeaderPage subtitle={i18n.PAGE_SUBTITLE} title={i18n.PAGE_TITLE} />
<HeaderPage
badgeLabel={i18n.PAGE_BADGE_LABEL}
badgeTooltip={i18n.PAGE_BADGE_TOOLTIP}
subtitle={i18n.PAGE_SUBTITLE}
title={i18n.PAGE_TITLE}
/>
<WithSource sourceId="default">
{({ indicesExist }) =>

View file

@ -14,6 +14,15 @@ export const PAGE_SUBTITLE = i18n.translate('xpack.siem.overview.pageSubtitle',
defaultMessage: 'Security Information & Event Management with the Elastic Stack',
});
export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.overview.pageBadgeLabel', {
defaultMessage: 'Beta',
});
export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.overview.pageBadgeTooltip', {
defaultMessage:
'SIEM is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.',
});
export const EMPTY_TITLE = i18n.translate('xpack.siem.overview.emptyTitle', {
defaultMessage: 'It looks like you dont have any indices relevant to the SIEM application',
});