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

[Rollups] Mark beta in rollup index pattern creation #24805

Merged
merged 5 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exports[`CreateIndexPatternWizard defaults to the loading state 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
Expand All @@ -16,6 +17,7 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
Expand All @@ -36,6 +38,7 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
Expand All @@ -51,6 +54,7 @@ exports[`CreateIndexPatternWizard renders the empty state when there are no indi
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
Expand All @@ -65,6 +69,7 @@ exports[`CreateIndexPatternWizard renders time field step when step is set to 2
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
Expand All @@ -79,6 +84,7 @@ exports[`CreateIndexPatternWizard renders time field step when step is set to 2
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
Expand All @@ -92,6 +98,7 @@ exports[`CreateIndexPatternWizard shows system indices even if there are no othe
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={true}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
Expand All @@ -112,6 +119,7 @@ exports[`CreateIndexPatternWizard shows system indices even if there are no othe
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CreateIndexPatternWizard } from '../create_index_pattern_wizard';
const mockIndexPatternCreationType = {
getIndexPatternType: () => 'default',
getIndexPatternName: () => 'name',
getIsBeta: () => false,
checkIndicesForErrors: () => false,
getShowSystemIndices: () => false,
renderPrompt: () => {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Header should render a different name, prompt, and beta tag if provided 1`] = `
<div>
<EuiSpacer
size="m"
/>
<EuiTitle
size="m"
>
<h1>
<FormattedMessage
defaultMessage="Create {indexPatternName}"
id="kbn.management.createIndexPatternHeader"
values={
Object {
"indexPatternName": "test index pattern",
}
}
/>
<React.Fragment>

<EuiBetaBadge
label="Beta"
tooltipPosition="top"
/>
</React.Fragment>
</h1>
</EuiTitle>
<EuiFlexGroup
alignItems="flexEnd"
component="div"
direction="row"
gutterSize="l"
justifyContent="spaceBetween"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<EuiText
grow={true}
>
<p>
<EuiTextColor
color="subdued"
component="span"
>
<FormattedMessage
defaultMessage="Kibana uses index patterns to retrieve data from Elasticsearch indices for things like visualizations."
id="kbn.management.createIndexPatternLabel"
values={Object {}}
/>
</EuiTextColor>
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
<React.Fragment>
<EuiSpacer
size="s"
/>
<div>
Test prompt
</div>
</React.Fragment>
<EuiSpacer
size="m"
/>
</div>
`;

exports[`Header should render normally 1`] = `
<div>
<EuiSpacer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,18 @@ describe('Header', () => {

expect(component).toMatchSnapshot();
});

it('should render a different name, prompt, and beta tag if provided', () => {
const component = shallow(
<Header
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={() => {}}
prompt={<div>Test prompt</div>}
indexPatternName="test index pattern"
isBeta={true}
/>
);

expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import React, { Fragment } from 'react';

import {
EuiBetaBadge,
EuiSpacer,
EuiTitle,
EuiFlexGroup,
Expand All @@ -37,6 +38,7 @@ export const Header = ({
showSystemIndices,
isIncludingSystemIndices,
onChangeIncludingSystemIndices,
isBeta,
}) => (
<div>
<EuiSpacer size="m"/>
Expand All @@ -49,6 +51,12 @@ export const Header = ({
indexPatternName
}}
/>
{ isBeta ? (
<Fragment>
{' '}
<EuiBetaBadge label="Beta" />
</Fragment>
) : null }
</h1>
</EuiTitle>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="flexEnd">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class CreateIndexPatternWizard extends Component {
isIncludingSystemIndices={isIncludingSystemIndices}
onChangeIncludingSystemIndices={this.onChangeIncludingSystemIndices}
indexPatternName={this.indexPatternCreationType.getIndexPatternName()}
isBeta={this.indexPatternCreationType.getIsBeta()}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
* under the License.
*/

import React, { Component } from 'react';
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import * as euiVars from '@elastic/eui/dist/eui_theme_k6_light.json';

import {
EuiBadge,
EuiButton,
EuiPopover,
EuiContextMenuPanel,
EuiContextMenuItem,
EuiDescriptionList,
EuiDescriptionListTitle,
EuiDescriptionListDescription,
rgbToHex,
} from '@elastic/eui';

export class CreateButton extends Component {
Expand Down Expand Up @@ -58,6 +61,13 @@ export class CreateButton extends Component {
});
}

renderBetaIcon = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be named renderBetaBadge for consistency?

const color = rgbToHex(euiVars.euiColorAccent);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use named imports, we can simplify this code a bit:

import { euiColorAccent }from '@elastic/eui/dist/eui_theme_k6_light.json';

const color = rgbToHex(euiColorAccent);

return (
<EuiBadge color={color}>Beta</EuiBadge>
);
};

render() {
const { options, children } = this.props;
const { isPopoverOpen } = this.state;
Expand Down Expand Up @@ -113,6 +123,12 @@ export class CreateButton extends Component {
<EuiDescriptionList style={{ whiteSpace: 'nowrap' }}>
<EuiDescriptionListTitle>
{option.text}
{ option.beta ? (
<Fragment>
{' '}
{this.renderBetaIcon()}
</Fragment>
) : null }
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{option.description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ export class IndexPatternCreationConfig {
name = indexPatternTypeName,
showSystemIndices = true,
httpClient = null,
beta = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be isBeta to reflect its boolean nature? It will also be consistent with the getIsBeta getter.

}) {
this.type = type;
this.name = name;
this.showSystemIndices = showSystemIndices;
this.httpClient = httpClient;
this.beta = beta;
}

async getIndexPatternCreationOption(urlHandler) {
Expand All @@ -61,6 +63,10 @@ export class IndexPatternCreationConfig {
return this.name;
}

getIsBeta = () => {
return this.beta;
}

getShowSystemIndices = () => {
return this.showSystemIndices;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ import {

export const RollupPrompt = () => (
<EuiCallOut
size="s"
title={
`Rollup index patterns can match against one rollup index and zero or more
color="warning"
iconType="help"
title="Beta feature"
>
<p>
Kibana support for rollup index patterns is in beta. You may encounter issues using
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gchaps Could you please review the two paragraphs here? Thanks!

them in saved searches, visualizations, and dashboards. They are not supported
in advanced features such as Visual Builder, Timelion, and Machine Learning.
</p>
<p>
Rollup index patterns can match against one rollup index and zero or more
regular indices. They will have limited metrics, fields, intervals and aggregations
available based on the rollup index job configuration. The rollup index is
limited to those that have one job configuration, or multiple jobs
with the same configuration.`
}
/>
with compatible configurations.
</p>
</EuiCallOut>
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig
type: 'rollup',
name: 'rollup index pattern',
showSystemIndices: false,
beta: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same suggestion about isBeta here.

...options,
});

Expand All @@ -40,6 +41,7 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig
text: `Rollup index pattern`,
description: `Can perform limited aggregations against summarized data`,
testSubj: `createRollupIndexPatternButton`,
beta: this.beta,
Copy link
Contributor

Choose a reason for hiding this comment

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

And here.

onClick: () => {
urlHandler('/management/kibana/index?type=rollup');
},
Expand Down