From 29a986beb502d27cbcee02fb368de2ad56b7f926 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Wed, 18 Apr 2018 13:00:37 -0700 Subject: [PATCH 01/47] Rollup index pattern creation as xpack plugin Co-authored-by: CJ Cenizal --- src/core_plugins/kibana/mappings.json | 6 + src/core_plugins/kibana/public/kibana.js | 1 + .../components/header/header.js | 44 ++++-- .../components/header/header.js | 19 ++- .../components/indices_list/indices_list.js | 8 + .../status_message/status_message.js | 4 +- .../step_index_pattern/step_index_pattern.js | 34 ++-- .../components/header/header.js | 8 +- .../step_time_field/step_time_field.js | 14 +- .../create_index_pattern_wizard.js | 16 +- .../create_index_pattern_wizard/index.js | 8 +- .../lib/get_indices.js | 22 ++- .../edit_index_pattern.html | 19 ++- .../edit_index_pattern/edit_index_pattern.js | 5 + .../components/table/table.js | 37 +++-- .../indexed_fields_table.js | 4 +- .../management/sections/indices/index.html | 53 +------ .../management/sections/indices/index.js | 81 +++++++++- .../management/sections/indices/index.less | 24 +++ .../components/create_button/create_button.js | 126 +++++++++++++++ .../components/create_button/index.js | 20 +++ .../components/header/header.js | 29 ++++ .../components/header/index.js | 20 +++ .../components/list/index.js | 20 +++ .../components/list/list.js | 56 +++++++ .../indices/index_pattern_list/index.js | 20 +++ .../index_pattern_list/index_pattern_list.js | 45 ++++++ .../service/index_patterns_service.js | 2 +- .../public/index_patterns/_index_pattern.js | 4 +- .../public/index_patterns/fields_fetcher.js | 5 +- .../index_patterns_api_client.js | 15 +- src/ui/public/management/index.js | 34 +--- .../index_pattern_creation/index.js | 23 +++ .../index_pattern_creation.js | 56 +++++++ .../index_pattern_creation_config.js | 94 +++++++++++ .../index_pattern_creation_config_registry.js | 26 ++++ .../index_pattern_creation/register.js | 23 +++ .../public/management/index_pattern_list.js | 52 +++++++ src/ui/public/management/sections_register.js | 44 ++++++ src/ui/ui_exports/ui_export_types/index.js | 1 + .../ui_export_types/ui_app_extensions.js | 1 + x-pack/index.js | 2 + .../plugins/rollup/common/constants/index.js | 7 + .../plugins/rollup/common/constants/plugin.js | 9 ++ x-pack/plugins/rollup/index.js | 29 ++++ .../components/rollup_prompt/index.js | 7 + .../components/rollup_prompt/rollup_prompt.js | 24 +++ .../public/index_pattern_creation/index.js | 7 + .../public/index_pattern_creation/register.js | 10 ++ .../rollup_index_pattern_creation_config.js | 122 +++++++++++++++ .../rollup/public/index_pattern_list/index.js | 7 + .../public/index_pattern_list/register.js | 49 ++++++ x-pack/plugins/rollup/public/services/api.js | 17 ++ .../server/client/elasticsearch_rollup.js | 30 ++++ .../call_with_request_factory.js | 24 +++ .../lib/call_with_request_factory/index.js | 7 + .../check_license/__tests__/check_license.js | 146 ++++++++++++++++++ .../server/lib/check_license/check_license.js | 58 +++++++ .../rollup/server/lib/check_license/index.js | 7 + .../__tests__/wrap_custom_error.js | 21 +++ .../error_wrappers/__tests__/wrap_es_error.js | 39 +++++ .../__tests__/wrap_unknown_error.js | 19 +++ .../rollup/server/lib/error_wrappers/index.js | 9 ++ .../lib/error_wrappers/wrap_custom_error.js | 18 +++ .../lib/error_wrappers/wrap_es_error.js | 30 ++++ .../lib/error_wrappers/wrap_unknown_error.js | 17 ++ .../__tests__/is_es_error_factory.js | 48 ++++++ .../server/lib/is_es_error_factory/index.js | 7 + .../is_es_error_factory.js | 18 +++ .../rollup/server/lib/map_capabilities.js | 51 ++++++ .../lib/register_license_checker/index.js | 7 + .../register_license_checker.js | 21 +++ .../plugins/rollup/server/routes/api/index.js | 8 + .../server/routes/api/index_patterns.js | 89 +++++++++++ .../rollup/server/routes/api/indices.js | 35 +++++ 75 files changed, 1962 insertions(+), 160 deletions(-) create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index.less create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/index.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/header/header.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/header/index.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/index.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/list/list.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index.js create mode 100644 src/core_plugins/kibana/public/management/sections/indices/index_pattern_list/index_pattern_list.js create mode 100644 src/ui/public/management/index_pattern_creation/index.js create mode 100644 src/ui/public/management/index_pattern_creation/index_pattern_creation.js create mode 100644 src/ui/public/management/index_pattern_creation/index_pattern_creation_config.js create mode 100644 src/ui/public/management/index_pattern_creation/index_pattern_creation_config_registry.js create mode 100644 src/ui/public/management/index_pattern_creation/register.js create mode 100644 src/ui/public/management/index_pattern_list.js create mode 100644 src/ui/public/management/sections_register.js create mode 100644 x-pack/plugins/rollup/common/constants/index.js create mode 100644 x-pack/plugins/rollup/common/constants/plugin.js create mode 100644 x-pack/plugins/rollup/index.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/index.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_creation/components/rollup_prompt/rollup_prompt.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_creation/index.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_creation/register.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_creation/rollup_index_pattern_creation_config.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_list/index.js create mode 100644 x-pack/plugins/rollup/public/index_pattern_list/register.js create mode 100644 x-pack/plugins/rollup/public/services/api.js create mode 100644 x-pack/plugins/rollup/server/client/elasticsearch_rollup.js create mode 100644 x-pack/plugins/rollup/server/lib/call_with_request_factory/call_with_request_factory.js create mode 100644 x-pack/plugins/rollup/server/lib/call_with_request_factory/index.js create mode 100644 x-pack/plugins/rollup/server/lib/check_license/__tests__/check_license.js create mode 100644 x-pack/plugins/rollup/server/lib/check_license/check_license.js create mode 100644 x-pack/plugins/rollup/server/lib/check_license/index.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/__tests__/wrap_custom_error.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/__tests__/wrap_es_error.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/__tests__/wrap_unknown_error.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/index.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/wrap_custom_error.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/wrap_es_error.js create mode 100644 x-pack/plugins/rollup/server/lib/error_wrappers/wrap_unknown_error.js create mode 100644 x-pack/plugins/rollup/server/lib/is_es_error_factory/__tests__/is_es_error_factory.js create mode 100644 x-pack/plugins/rollup/server/lib/is_es_error_factory/index.js create mode 100644 x-pack/plugins/rollup/server/lib/is_es_error_factory/is_es_error_factory.js create mode 100644 x-pack/plugins/rollup/server/lib/map_capabilities.js create mode 100644 x-pack/plugins/rollup/server/lib/register_license_checker/index.js create mode 100644 x-pack/plugins/rollup/server/lib/register_license_checker/register_license_checker.js create mode 100644 x-pack/plugins/rollup/server/routes/api/index.js create mode 100644 x-pack/plugins/rollup/server/routes/api/index_patterns.js create mode 100644 x-pack/plugins/rollup/server/routes/api/indices.js diff --git a/src/core_plugins/kibana/mappings.json b/src/core_plugins/kibana/mappings.json index 471cee57da565..c65fd5377f1ec 100644 --- a/src/core_plugins/kibana/mappings.json +++ b/src/core_plugins/kibana/mappings.json @@ -21,6 +21,12 @@ }, "title": { "type": "text" + }, + "type": { + "type": "keyword" + }, + "typeMeta": { + "type": "keyword" } } }, diff --git a/src/core_plugins/kibana/public/kibana.js b/src/core_plugins/kibana/public/kibana.js index 7daafbf6411a9..ed88791241d13 100644 --- a/src/core_plugins/kibana/public/kibana.js +++ b/src/core_plugins/kibana/public/kibana.js @@ -37,6 +37,7 @@ import 'uiExports/fieldFormatEditors'; import 'uiExports/navbarExtensions'; import 'uiExports/contextMenuActions'; import 'uiExports/managementSections'; +import 'uiExports/indexManagement'; import 'uiExports/devTools'; import 'uiExports/docViews'; import 'uiExports/embeddableFactories'; 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 c6c749d400bab..c29acc22f6ac4 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 @@ -17,7 +17,7 @@ * under the License. */ -import React from 'react'; +import React, { Fragment } from 'react'; import { EuiSpacer, @@ -32,6 +32,9 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; export const Header = ({ + prompt, + indexPatternName, + showSystemIndices, isIncludingSystemIndices, onChangeIncludingSystemIndices, }) => ( @@ -41,7 +44,10 @@ export const Header = ({

@@ -58,18 +64,30 @@ export const Header = ({

- - } - id="checkboxShowSystemIndices" - checked={isIncludingSystemIndices} - onChange={onChangeIncludingSystemIndices} - /> - + { + showSystemIndices ? ( + + } + id="checkboxShowSystemIndices" + checked={isIncludingSystemIndices} + onChange={onChangeIncludingSystemIndices} + /> + + ) : '' + } + { + prompt ? ( + + + {prompt} + + ) : '' + } ); diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js index aab39f8851ef7..0c1262964c298 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/header/header.js @@ -40,6 +40,7 @@ export const HeaderComponent = ({ onQueryChanged, goToNextStep, isNextStepDisabled, + allowWildcards, intl, ...rest }) => ( @@ -67,13 +68,17 @@ export const HeaderComponent = ({ error={errors} helpText={
-

- * }} - /> -

+ { + allowWildcards ? ( +

+ * }} + /> +

+ ) : '' + }

{this.highlightIndexName(index.name, queryWithoutWildcard)} + + {index.tags.map(tag => { + return ( + {tag.name} + ); + })} + ); }); diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.js index a403925f24dd1..772d7ec900ec1 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.js @@ -35,6 +35,7 @@ export const StatusMessage = ({ }, isIncludingSystemIndices, query, + showSystemIndicies, }) => { let statusIcon; let statusMessage; @@ -58,7 +59,7 @@ export const StatusMessage = ({ ); } - else if (!isIncludingSystemIndices) { + else if (!isIncludingSystemIndices && showSystemIndicies) { statusMessage = ( { - const { esService } = this.props; + const { esService, indexPatternCreationType } = this.props; const { existingIndexPatterns } = this.state; if (existingIndexPatterns.includes(query)) { @@ -104,7 +109,7 @@ export class StepIndexPatternComponent extends Component { this.setState({ isLoadingIndices: true, indexPatternExists: false }); if (query.endsWith('*')) { - const exactMatchedIndices = await ensureMinimumTime(getIndices(esService, query, MAX_SEARCH_SIZE)); + const exactMatchedIndices = await ensureMinimumTime(getIndices(esService, indexPatternCreationType, query, MAX_SEARCH_SIZE)); // If the search changed, discard this state if (query !== this.lastQuery) { return; @@ -117,8 +122,8 @@ export class StepIndexPatternComponent extends Component { partialMatchedIndices, exactMatchedIndices, ] = await ensureMinimumTime([ - getIndices(esService, `${query}*`, MAX_SEARCH_SIZE), - getIndices(esService, query, MAX_SEARCH_SIZE), + getIndices(esService, indexPatternCreationType, `${query}*`, MAX_SEARCH_SIZE), + getIndices(esService, indexPatternCreationType, query, MAX_SEARCH_SIZE), ]); // If the search changed, discard this state @@ -134,11 +139,11 @@ export class StepIndexPatternComponent extends Component { } onQueryChanged = e => { - const { appendedWildcard } = this.state; + const { appendedWildcard, allowWildcards } = this.state; const { target } = e; let query = target.value; - if (query.length === 1 && canAppendWildcard(query)) { + if (query.length === 1 && allowWildcards && canAppendWildcard(query)) { query += '*'; this.setState({ appendedWildcard: true }); setTimeout(() => target.setSelectionRange(1, 1)); @@ -167,6 +172,7 @@ export class StepIndexPatternComponent extends Component { } renderStatusMessage(matchedIndices) { + const { indexPatternCreationType } = this.props; const { query, isLoadingIndices, indexPatternExists, isIncludingSystemIndices } = this.state; if (isLoadingIndices || indexPatternExists) { @@ -176,6 +182,7 @@ export class StepIndexPatternComponent extends Component { return ( @@ -230,12 +237,13 @@ export class StepIndexPatternComponent extends Component { } renderHeader({ exactMatchedIndices: indices }) { - const { goToNextStep, intl } = this.props; - const { query, showingIndexPatternQueryErrors, indexPatternExists } = this.state; + const { goToNextStep, indexPatternCreationType, intl } = this.props; + const { query, showingIndexPatternQueryErrors, indexPatternExists, indexPatternName, allowWildcards } = this.state; let containsErrors = false; const errors = []; - const characterList = ILLEGAL_CHARACTERS.slice(0, ILLEGAL_CHARACTERS.length - 1).join(', '); + const characterList = this.ILLEGAL_CHARACTERS.slice(0, this.ILLEGAL_CHARACTERS.length - 1).join(', '); + const checkIndices = indexPatternCreationType.checkIndicesForErrors(indices); if (!query || !query.length || query === '.' || query === '..') { // This is an error scenario but do not report an error @@ -245,12 +253,15 @@ export class StepIndexPatternComponent extends Component { const errorMessage = intl.formatMessage( { id: 'kbn.management.createIndexPattern.step.invalidCharactersErrorMessage', - defaultMessage: 'An index pattern cannot contain spaces or the characters: {characterList}' + defaultMessage: 'A ${indexPatternName} cannot contain spaces or the characters: {characterList}' }, - { characterList }); + { characterList, indexPatternName }); errors.push(errorMessage); containsErrors = true; + } else if(checkIndices) { + errors.push(...checkIndices); + containsErrors = true; } const isInputInvalid = showingIndexPatternQueryErrors && containsErrors && errors.length > 0; @@ -266,6 +277,7 @@ export class StepIndexPatternComponent extends Component { onQueryChanged={this.onQueryChanged} goToNextStep={goToNextStep} isNextStepDisabled={isNextStepDisabled} + allowWildcards={allowWildcards} /> ); } diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/header/header.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/header/header.js index 1ccaf90f66484..67e8053eb6bbd 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/header/header.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/header/header.js @@ -29,6 +29,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; export const Header = ({ indexPattern, + indexPatternName, }) => (

@@ -43,8 +44,11 @@ export const Header = ({ {indexPattern} }} + defaultMessage="You've defined {indexPattern} as your {indexPatternName}. Now you can specify some settings before we create it." + values={{ + indexPattern: {indexPattern}, + indexPatternName, + }} />
diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js index b514e571166d1..a94c5c0f926b4 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js @@ -43,6 +43,7 @@ export class StepTimeFieldComponent extends Component { indexPatternsService: PropTypes.object.isRequired, goToPreviousStep: PropTypes.func.isRequired, createIndexPattern: PropTypes.func.isRequired, + indexPatternCreationType: PropTypes.object.isRequired, } constructor(props) { @@ -56,6 +57,8 @@ export class StepTimeFieldComponent extends Component { isFetchingTimeFields: false, isCreating: false, indexPatternId: '', + indexPatternType: props.indexPatternCreationType.getIndexPatternType(), + indexPatternName: props.indexPatternCreationType.getIndexPatternName(), }; } @@ -65,9 +68,10 @@ export class StepTimeFieldComponent extends Component { fetchTimeFields = async () => { const { indexPatternsService, indexPattern } = this.props; + const { indexPatternType } = this.state; this.setState({ isFetchingTimeFields: true }); - const fields = await ensureMinimumTime(indexPatternsService.fieldsFetcher.fetchForWildcard(indexPattern)); + const fields = await ensureMinimumTime(indexPatternsService.fieldsFetcher.fetchForWildcard(indexPattern, indexPatternType)); const timeFields = extractTimeFields(fields); this.setState({ timeFields, isFetchingTimeFields: false }); @@ -113,6 +117,7 @@ export class StepTimeFieldComponent extends Component { indexPatternId, isCreating, isFetchingTimeFields, + indexPatternName, } = this.state; if (isCreating) { @@ -156,8 +161,11 @@ export class StepTimeFieldComponent extends Component { return ( -
- +
+ { this.setState({ allIndices: [], isInitiallyLoadingIndices: true }); const { services } = this.props; - const allIndices = await ensureMinimumTime(getIndices(services.es, `*`, MAX_SEARCH_SIZE)); + const allIndices = await ensureMinimumTime(getIndices(services.es, this.indexPatternCreationType, `*`, MAX_SEARCH_SIZE)); // this.setState({ allIndices, isInitiallyLoadingIndices: false }); } @@ -74,6 +78,7 @@ export class CreateIndexPatternWizard extends Component { id: indexPatternId, title: indexPattern, timeFieldName, + ...this.indexPatternCreationType.getIndexPatternMappings() }); const createdId = await emptyPattern.create(); @@ -105,8 +110,11 @@ export class CreateIndexPatternWizard extends Component { return (
); } @@ -138,6 +146,7 @@ export class CreateIndexPatternWizard extends Component { isIncludingSystemIndices={isIncludingSystemIndices} esService={services.es} savedObjectsClient={services.savedObjectsClient} + indexPatternCreationType={this.indexPatternCreationType} goToNextStep={this.goToTimeFieldStep} /> ); @@ -151,6 +160,7 @@ export class CreateIndexPatternWizard extends Component { indexPatternsService={services.indexPatterns} goToPreviousStep={this.goToIndexPatternStep} createIndexPattern={this.createIndexPattern} + indexPatternCreationType={this.indexPatternCreationType} /> ); } diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/index.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/index.js index 2b5c3987af420..ced5b1c69b83e 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/index.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/index.js @@ -21,6 +21,8 @@ import { SavedObjectsClientProvider } from 'ui/saved_objects'; import uiRoutes from 'ui/routes'; import angularTemplate from './angular_template.html'; import 'ui/index_patterns'; +import { documentationLinks } from 'ui/documentation_links'; +import { IndexPatternCreationFactory } from 'ui/management/index_pattern_creation'; import { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } from './render'; @@ -29,13 +31,17 @@ uiRoutes.when('/management/kibana/index', { controller: function ($scope, $injector) { // Wait for the directives to execute const kbnUrl = $injector.get('kbnUrl'); + const Private = $injector.get('Private'); $scope.$$postDigest(() => { const $routeParams = $injector.get('$routeParams'); + const indexPatternCreationProvider = Private(IndexPatternCreationFactory)($routeParams.type); + const indexPatternCreationType = indexPatternCreationProvider.getType(); const services = { config: $injector.get('config'), es: $injector.get('es'), indexPatterns: $injector.get('indexPatterns'), - savedObjectsClient: $injector.get('Private')(SavedObjectsClientProvider), + savedObjectsClient: Private(SavedObjectsClientProvider), + indexPatternCreationType, changeUrl: url => { $scope.$evalAsync(() => kbnUrl.changePath(url)); }, diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/lib/get_indices.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/lib/get_indices.js index 7638daf1c5720..45a34efa314e6 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/lib/get_indices.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/lib/get_indices.js @@ -19,7 +19,7 @@ import { get, sortBy } from 'lodash'; -export async function getIndices(es, rawPattern, limit) { +export async function getIndices(es, indexPatternCreationType, rawPattern, limit) { const pattern = rawPattern.trim(); // Searching for `*:` fails for CCS environments. The search request @@ -57,7 +57,8 @@ export async function getIndices(es, rawPattern, limit) { size: limit, } } - } + }, + ...indexPatternCreationType.getIndexPatternCreationQuery(), } }; @@ -67,11 +68,18 @@ export async function getIndices(es, rawPattern, limit) { return []; } - return sortBy(response.aggregations.indices.buckets.map(bucket => { - return { - name: bucket.key - }; - }), 'name'); + return sortBy( + response.aggregations.indices.buckets.map(bucket => { + return bucket.key; + }) + .map((index) => { + return { + name: index, + tags: indexPatternCreationType.getIndexTags(index) + }; + }) + , 'name' + ); } catch (err) { const type = get(err, 'body.error.caused_by.type'); diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.html b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.html index 9e8d982090177..9b42d52159206 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.html +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/edit_index_pattern.html @@ -15,15 +15,22 @@ delete="removePattern()" > -

- - - +

+ + + + + +   + + + {{tag.name}}

+

, @@ -184,11 +186,14 @@ uiModules.get('apps/management') $scope, $location, $route, config, indexPatterns, Private, AppState, docTitle, confirmModal) { const $state = $scope.state = new AppState(); const { fieldWildcardMatcher } = Private(FieldWildcardProvider); + const indexPatternListProvider = Private(IndexPatternListFactory)(); $scope.fieldWildcardMatcher = fieldWildcardMatcher; $scope.editSectionsProvider = Private(IndicesEditSectionsProvider); $scope.kbnUrl = Private(KbnUrlProvider); $scope.indexPattern = $route.current.locals.indexPattern; + $scope.indexPattern.tags = indexPatternListProvider.getIndexPatternTags($scope.indexPattern); + $scope.getFieldInfo = indexPatternListProvider.getFieldInfo; docTitle.change($scope.indexPattern.title); const otherPatterns = _.filter($route.current.locals.indexPatterns, pattern => { diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js index 628e42e9e9653..72ca608040c3f 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js @@ -39,13 +39,19 @@ export class TableComponent extends PureComponent { return value ? : ; } - renderFieldName(name, isTimeField) { + renderFieldName(name, field) { + const { indexPattern } = this.props; const { intl } = this.props; - const label = intl.formatMessage({ + + const infoLabel = intl.formatMessage({ + id: 'kbn.management.editIndexPattern.fields.table.additionalInfo', + defaultMessage: 'Additional field information' + }); + const timeLabel = intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.primaryTimeAria', defaultMessage: 'Primary time field' }); - const content = intl.formatMessage({ + const timeContent = intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.primaryTimeTooltip', defaultMessage: 'This field represents the time that events occurred.' }); @@ -53,17 +59,28 @@ export class TableComponent extends PureComponent { return ( {name} - {isTimeField ? ( + {field.info && field.info.length ? ( + +   +

{info}
)} + /> + + ) : null} + {indexPattern.timeFieldName === name ? (   - ) : ''} + ) : null} ); } @@ -98,7 +115,7 @@ export class TableComponent extends PureComponent { } render() { - const { indexPattern, items, editField, intl } = this.props; + const { items, editField, intl } = this.props; const pagination = { initialPageSize: 10, @@ -111,8 +128,8 @@ export class TableComponent extends PureComponent { name: intl.formatMessage({ id: 'kbn.management.editIndexPattern.fields.table.nameHeader', defaultMessage: 'Name' }), dataType: 'string', sortable: true, - render: (value) => { - return this.renderFieldName(value, indexPattern.timeFieldName === value); + render: (value, field) => { + return this.renderFieldName(value, field); }, width: '38%', 'data-test-subj': 'indexedFieldName', diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js index 646abf6798756..607e7fa66242c 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js @@ -36,6 +36,7 @@ export class IndexedFieldsTable extends Component { indexedFieldTypeFilter: PropTypes.string, helpers: PropTypes.shape({ redirectToRoute: PropTypes.func.isRequired, + getFieldInfo: PropTypes.func, }), fieldWildcardMatcher: PropTypes.func.isRequired, } @@ -57,7 +58,7 @@ export class IndexedFieldsTable extends Component { } mapFields(fields) { - const { indexPattern, fieldWildcardMatcher } = this.props; + const { indexPattern, fieldWildcardMatcher, helpers } = this.props; const sourceFilters = indexPattern.sourceFilters && indexPattern.sourceFilters.map(f => f.value); const fieldWildcardMatch = fieldWildcardMatcher(sourceFilters || []); @@ -70,6 +71,7 @@ export class IndexedFieldsTable extends Component { indexPattern: field.indexPattern, format: getFieldFormat(indexPattern, field.name), excluded: fieldWildcardMatch ? fieldWildcardMatch(field.name) : false, + info: helpers.getFieldInfo && helpers.getFieldInfo(indexPattern, field.name), }; }) || []; } diff --git a/src/core_plugins/kibana/public/management/sections/indices/index.html b/src/core_plugins/kibana/public/management/sections/indices/index.html index 26dee3efa77b8..bf7577e2379b1 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index.html +++ b/src/core_plugins/kibana/public/management/sections/indices/index.html @@ -1,53 +1,6 @@ -
-