From 2aee3bb3be8be1b2d71961540788d9d14b44269f Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Thu, 1 Nov 2018 09:05:57 -0700 Subject: [PATCH] [Rollups] Mark beta in rollup index pattern creation (#24805) (#24957) * Add beta UI tags to rollup index pattern creation * Add test, update snapshots * Address feedback, adjust copy, and localize rollup index pattern creation --- .../create_index_pattern_wizard.test.js.snap | 8 +++ .../create_index_pattern_wizard.test.js | 1 + .../__snapshots__/header.test.js.snap | 69 +++++++++++++++++++ .../header/__tests__/header.test.js | 14 ++++ .../components/header/header.js | 8 +++ .../create_index_pattern_wizard.js | 1 + .../components/create_button/create_button.js | 18 ++++- .../index_pattern_creation_config.js | 8 ++- .../components/rollup_prompt/rollup_prompt.js | 26 ++++--- .../rollup_index_pattern_creation_config.js | 41 +++++++++-- 10 files changed, 176 insertions(+), 18 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/__snapshots__/create_index_pattern_wizard.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/__snapshots__/create_index_pattern_wizard.test.js.snap index 3365c6f722304..d7378e58d42bf 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/__snapshots__/create_index_pattern_wizard.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/__snapshots__/create_index_pattern_wizard.test.js.snap @@ -4,6 +4,7 @@ exports[`CreateIndexPatternWizard defaults to the loading state 1`] = `
'default', getIndexPatternName: () => 'name', + getIsBeta: () => false, checkIndicesForErrors: () => false, getShowSystemIndices: () => false, renderPrompt: () => {}, diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__tests__/__snapshots__/header.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__tests__/__snapshots__/header.test.js.snap index 8f2ecf83d5890..bbd77a50f0406 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__tests__/__snapshots__/header.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__tests__/__snapshots__/header.test.js.snap @@ -1,5 +1,74 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Header should render a different name, prompt, and beta tag if provided 1`] = ` +
+ +

+ + + + + +

+
+ + + +

+ + + +

+
+
+
+ + +
+ Test prompt +
+
+ +
+`; + exports[`Header should render normally 1`] = `
{ expect(component).toMatchSnapshot(); }); + + it('should render a different name, prompt, and beta tag if provided', () => { + const component = shallow( +
{}} + prompt={
Test prompt
} + indexPatternName="test index pattern" + isBeta={true} + /> + ); + + expect(component).toMatchSnapshot(); + }); }); diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js index 57407bf7a2233..cefd6141e63f5 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js @@ -20,6 +20,7 @@ import React, { Fragment } from 'react'; import { + EuiBetaBadge, EuiSpacer, EuiTitle, EuiFlexGroup, @@ -37,6 +38,7 @@ export const Header = ({ showSystemIndices, isIncludingSystemIndices, onChangeIncludingSystemIndices, + isBeta, }) => (
@@ -48,6 +50,12 @@ export const Header = ({ indexPatternName }} /> + { isBeta ? ( + + {' '} + + + ) : null } diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/create_index_pattern_wizard.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/create_index_pattern_wizard.js index 4ab7df7d2dea3..dc0568b85e00e 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/create_index_pattern_wizard.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/create_index_pattern_wizard.js @@ -115,6 +115,7 @@ export class CreateIndexPatternWizard extends Component { isIncludingSystemIndices={isIncludingSystemIndices} onChangeIncludingSystemIndices={this.onChangeIncludingSystemIndices} indexPatternName={this.indexPatternCreationType.getIndexPatternName()} + isBeta={this.indexPatternCreationType.getIsBeta()} /> ); } diff --git a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js index 176ba0da03229..5e20bf6f60dfd 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js @@ -17,10 +17,12 @@ * under the License. */ -import React, { Component } from 'react'; +import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; +import { euiColorAccent } from '@elastic/eui/dist/eui_theme_k6_light.json'; import { + EuiBadge, EuiButton, EuiPopover, EuiContextMenuPanel, @@ -28,6 +30,7 @@ import { EuiDescriptionList, EuiDescriptionListTitle, EuiDescriptionListDescription, + rgbToHex, } from '@elastic/eui'; export class CreateButton extends Component { @@ -58,6 +61,13 @@ export class CreateButton extends Component { }); } + renderBetaBadge = () => { + const color = rgbToHex(euiColorAccent); + return ( + Beta + ); + }; + render() { const { options, children } = this.props; const { isPopoverOpen } = this.state; @@ -113,6 +123,12 @@ export class CreateButton extends Component { {option.text} + { option.isBeta ? ( + + {' '} + {this.renderBetaBadge()} + + ) : null } {option.description} diff --git a/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js b/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js index 6f4877b13bddc..68f5200e142cc 100644 --- a/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js +++ b/src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js @@ -26,7 +26,7 @@ const indexPatternButtonText = i18n.translate('common.ui.management.editIndexPat { defaultMessage: 'Standard index pattern' }); const indexPatternButtonDescription = i18n.translate('common.ui.management.editIndexPattern.createIndex.defaultButtonDescription', - { defaultMessage: 'Can perform full aggregations against any data' }); + { defaultMessage: 'Perform full aggregations against any data' }); export class IndexPatternCreationConfig { static key = 'default'; @@ -36,11 +36,13 @@ export class IndexPatternCreationConfig { name = indexPatternTypeName, showSystemIndices = true, httpClient = null, + isBeta = false, }) { this.type = type; this.name = name; this.showSystemIndices = showSystemIndices; this.httpClient = httpClient; + this.isBeta = isBeta; } async getIndexPatternCreationOption(urlHandler) { @@ -62,6 +64,10 @@ export class IndexPatternCreationConfig { return this.name; } + getIsBeta = () => { + return this.isBeta; + } + getShowSystemIndices = () => { return this.showSystemIndices; } diff --git a/x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js b/x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js index 823535fa30088..82402a033b906 100644 --- a/x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js +++ b/x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js @@ -12,13 +12,21 @@ import { export const RollupPrompt = () => ( + color="warning" + iconType="help" + title="Beta feature" + > +

+ Kibana's support for rollup index patterns is in beta. You might encounter + issues using these patterns in saved searches, visualizations, and dashboards. + They are not supported in advanced features, such as Visual Builder, Timelion, + and Machine Learning. +

+

+ You can match a rollup index pattern against one rollup index and zero or + more regular indices. A rollup index pattern has limited metrics, fields, + intervals, and aggregations. A rollup index is limited to indices that have + one job configuration, or multiple jobs with compatible configurations. +

+
); diff --git a/x-pack/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js b/x-pack/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js index b7cb7eecb5c87..c987b773ca4c9 100644 --- a/x-pack/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js +++ b/x-pack/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js @@ -9,6 +9,25 @@ import { IndexPatternCreationConfig } from 'ui/management/index_pattern_creation import { RollupPrompt } from './components/rollup_prompt'; import { setHttpClient, getRollupIndices } from '../services/api'; +import { i18n } from '@kbn/i18n'; + +const rollupIndexPatternTypeName = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.defaultTypeName', + { defaultMessage: 'rollup index pattern' }); + +const rollupIndexPatternButtonText = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.defaultButtonText', + { defaultMessage: 'Rollup index pattern' }); + +const rollupIndexPatternButtonDescription = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.defaultButtonDescription', + { defaultMessage: 'Perform limited aggregations against summarized data' }); + +const rollupIndexPatternNoMatchError = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.noMatchError', + { defaultMessage: 'Rollup index pattern error: must match one rollup index' }); + +const rollupIndexPatternTooManyMatchesError = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.tooManyMatchesError', + { defaultMessage: 'Rollup index pattern error: can only match one rollup index' }); + +const rollupIndexPatternIndexLabel = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.indexLabel', + { defaultMessage: 'Rollup' }); export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig { static key = 'rollup'; @@ -16,8 +35,9 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig constructor(options) { super({ type: 'rollup', - name: 'rollup index pattern', + name: rollupIndexPatternTypeName, showSystemIndices: false, + isBeta: true, ...options, }); @@ -37,9 +57,10 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig async getIndexPatternCreationOption(urlHandler) { await this.settingUp; return this.rollupIndices && this.rollupIndices.length ? { - text: `Rollup index pattern`, - description: `Can perform limited aggregations against summarized data`, + text: rollupIndexPatternButtonText, + description: rollupIndexPatternButtonDescription, testSubj: `createRollupIndexPatternButton`, + isBeta: this.isBeta, onClick: () => { urlHandler('/management/kibana/index?type=rollup'); }, @@ -53,7 +74,7 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig getIndexTags(indexName) { return this.isRollupIndex(indexName) ? [{ key: this.type, - name: 'Rollup', + name: rollupIndexPatternIndexLabel, }] : []; } @@ -67,16 +88,22 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig const rollupIndices = indices.filter(index => this.isRollupIndex(index.name)); if(!rollupIndices.length) { - return ['Rollup index error: must match one rollup index']; + return [rollupIndexPatternNoMatchError]; } else if(rollupIndices.length > 1) { - return ['Rollup index error: can only match one rollup index']; + return [rollupIndexPatternTooManyMatchesError]; } const rollupIndexName = rollupIndices[0].name; const error = this.rollupIndicesCapabilities[rollupIndexName].error; if(error) { - return [`Rollup index error: ${error}`]; + const errorMessage = i18n.translate('xpack.rollupJobs.editRollupIndexPattern.createIndex.uncaughtError', { + defaultMessage: 'Rollup index pattern error: {error}', + values: { + error + } + }); + return [errorMessage]; } this.rollupIndex = rollupIndexName;