From f73143c27ed0aced050edf2813287afac9f4f33c Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 13 Jul 2018 06:39:29 -0700 Subject: [PATCH] Re-enable the indexPattern:placeholder setting. Change its value to be an empty string. (#20685) --- .../create_index_pattern_wizard/__tests__/render.test.js | 6 ++++++ .../__tests__/step_index_pattern.test.js | 7 +++++++ .../components/step_index_pattern/step_index_pattern.js | 6 +++++- src/core_plugins/kibana/ui_setting_defaults.js | 4 ++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/render.test.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/render.test.js index 687732c20e0e5..16da9009f5d5f 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/render.test.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/__tests__/render.test.js @@ -22,6 +22,12 @@ const unmountComponentAtNode = jest.fn(); jest.doMock('react-dom', () => ({ render, unmountComponentAtNode })); +jest.mock('ui/chrome', () => ({ + getUiSettingsClient: () => ({ + get: () => '', + }), +})); + const { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } = require('../render'); describe('CreateIndexPatternWizardRender', () => { diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/__tests__/step_index_pattern.test.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/__tests__/step_index_pattern.test.js index 32756b90182b4..f434f88c25497 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/__tests__/step_index_pattern.test.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/__tests__/step_index_pattern.test.js @@ -24,6 +24,13 @@ import { StepIndexPattern } from '../step_index_pattern'; jest.mock('../../../lib/ensure_minimum_time', () => ({ ensureMinimumTime: async (promises) => Array.isArray(promises) ? await Promise.all(promises) : await promises })); + +jest.mock('ui/chrome', () => ({ + getUiSettingsClient: () => ({ + get: () => '', + }), +})); + jest.mock('../../../lib/get_indices', () => ({ getIndices: (service, query) => { if (query.startsWith('e')) { diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js index 6acd867e8fd6d..cae0a1c8f4736 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.js @@ -38,6 +38,10 @@ import { EuiCallOut, } from '@elastic/eui'; +import chrome from 'ui/chrome'; + +const uiSettings = chrome.getUiSettingsClient(); + export class StepIndexPattern extends Component { static propTypes = { allIndices: PropTypes.array.isRequired, @@ -49,7 +53,7 @@ export class StepIndexPattern extends Component { } static defaultProps = { - initialQuery: '', + initialQuery: uiSettings.get('indexPattern:placeholder'), } constructor(props) { diff --git a/src/core_plugins/kibana/ui_setting_defaults.js b/src/core_plugins/kibana/ui_setting_defaults.js index bda11e544be04..29d2b0d0c686f 100644 --- a/src/core_plugins/kibana/ui_setting_defaults.js +++ b/src/core_plugins/kibana/ui_setting_defaults.js @@ -487,8 +487,8 @@ export function getUiSettingDefaults() { }, 'indexPattern:placeholder': { name: 'Index pattern placeholder', - value: 'logstash-*', - description: `The placeholder for the field "Index name or pattern" in the "Settings > Indices" tab.`, + value: '', + description: `The placeholder for the "Index pattern name" field in "Management > Index Patterns > Create Index Pattern".`, }, 'context:defaultSize': { name: 'Context size',