From f7181a95dc42db2145769cf4df858c834f8c795b Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Mon, 18 May 2020 22:25:20 -0500 Subject: [PATCH] Index pattern management to Kibana platform (#65026) * index pattern management to kibana platform --- src/core/MIGRATION.md | 1 + .../kibana/public/management/index.js | 1 - .../angular_template.html | 5 - .../components/header/header.tsx | 110 ---- .../create_index_pattern_wizard/index.js | 58 -- .../create_index_pattern_wizard/render.js | 45 -- .../render.test.js | 63 -- .../edit_index_pattern/create_edit_field.html | 5 - .../edit_index_pattern.html | 12 - .../edit_index_pattern/index.js | 177 ------ .../header/__snapshots__/header.test.tsx.snap | 44 -- .../sections/index_patterns/index.html | 5 - .../sections/index_patterns/index.js | 173 ------ .../index_pattern_table.tsx | 154 ----- .../sections/index_patterns/list.html | 5 - .../server/lib/__tests__/relationships.js | 12 +- src/legacy/ui/public/_index.scss | 2 - src/legacy/ui/public/field_editor/_index.scss | 2 - .../editors/url/icons/index.js | 26 - .../field_format_editor/register.ts | 43 -- .../field_format_editor/samples/_index.scss | 1 - .../ui/ui_exports/ui_export_defaults.js | 4 +- .../ensure_default_index_pattern.tsx | 6 +- .../index_patterns/index_pattern.ts | 2 +- .../server/saved_objects/index_patterns.ts | 4 +- .../components/fetch_error/fetch_error.tsx | 2 +- .../__snapshots__/add_data.test.js.snap | 8 +- .../public/application/components/add_data.js | 2 +- .../index_pattern_management/kibana.json | 2 +- .../public/assets}/icons/LICENSE.txt | 0 .../public/assets}/icons/cv.png | Bin .../public/assets}/icons/de.png | Bin .../public/assets}/icons/go.png | Bin .../public/assets}/icons/ne.png | Bin .../public/assets}/icons/ni.png | Bin .../public/assets}/icons/stop.png | Bin .../public/assets}/icons/us.png | Bin .../__snapshots__/utils.test.ts.snap | 20 + .../public/components/breadcrumbs.ts} | 29 +- .../create_button/create_button.tsx | 15 +- .../public/components}/create_button/index.ts | 0 .../create_index_pattern_prompt/index.tsx | 18 +- .../CREATE_INDEX_PATTERN.md | 0 .../create_index_pattern_wizard.test.tsx.snap | 47 +- .../__snapshots__/empty_state.test.tsx.snap | 12 +- .../empty_state/empty_state.test.tsx | 0 .../components/empty_state/empty_state.tsx | 12 +- .../components/empty_state/index.ts | 0 .../header/__snapshots__/header.test.tsx.snap | 36 +- .../components/header/header.test.tsx | 3 + .../components/header/header.tsx | 118 ++++ .../components/header/index.ts | 0 .../__snapshots__/loading_state.test.tsx.snap | 2 +- .../components/loading_state/index.ts | 0 .../loading_state/loading_state.test.tsx | 0 .../loading_state/loading_state.tsx | 2 +- .../step_index_pattern.test.tsx.snap | 0 .../header/__snapshots__/header.test.tsx.snap | 20 +- .../components/header/header.test.tsx | 0 .../components/header/header.tsx | 12 +- .../components/header/index.ts | 0 .../__snapshots__/indices_list.test.tsx.snap | 10 +- .../components/indices_list/index.ts | 0 .../indices_list/indices_list.test.tsx | 0 .../components/indices_list/indices_list.tsx | 2 +- .../loading_indices.test.tsx.snap | 4 +- .../components/loading_indices/index.ts | 0 .../loading_indices/loading_indices.test.tsx | 0 .../loading_indices/loading_indices.tsx | 4 +- .../status_message.test.tsx.snap | 20 +- .../components/status_message/index.ts | 0 .../status_message/status_message.test.tsx | 0 .../status_message/status_message.tsx | 20 +- .../components/step_index_pattern/index.ts | 0 .../step_index_pattern.test.tsx | 8 +- .../step_index_pattern/step_index_pattern.tsx | 12 +- .../step_time_field.test.tsx.snap | 8 +- .../action_buttons/action_buttons.tsx | 4 +- .../components/action_buttons/index.ts | 0 .../advanced_options.test.tsx.snap | 8 +- .../advanced_options.test.tsx | 0 .../advanced_options/advanced_options.tsx | 10 +- .../components/advanced_options/index.ts | 0 .../header/__snapshots__/header.test.tsx.snap | 4 +- .../components/header/header.test.tsx | 0 .../components/header/header.tsx | 4 +- .../components/header/index.ts | 0 .../__snapshots__/time_field.test.tsx.snap | 24 +- .../components/time_field/index.ts | 0 .../components/time_field/time_field.scss} | 3 +- .../components/time_field/time_field.test.tsx | 0 .../components/time_field/time_field.tsx | 16 +- .../components/step_time_field/index.ts | 0 .../step_time_field/step_time_field.test.tsx | 7 +- .../step_time_field/step_time_field.tsx | 10 +- .../constants/index.ts | 0 .../create_index_pattern_wizard.test.tsx | 56 +- .../create_index_pattern_wizard.tsx | 123 ++-- .../create_index_pattern_wizard/index.ts | 20 + .../lib/can_append_wildcard.test.ts | 0 .../lib/can_append_wildcard.ts | 0 .../lib/contains_illegal_characters.ts | 0 .../lib/contains_invalid_characters.test.ts | 0 .../lib/ensure_minimum_time.test.ts | 0 .../lib/ensure_minimum_time.ts | 0 .../lib/extract_time_fields.test.ts | 0 .../lib/extract_time_fields.ts | 13 +- .../lib/get_indices.test.ts | 4 +- .../lib/get_indices.ts | 4 +- .../lib/get_matched_indices.test.ts | 0 .../lib/get_matched_indices.ts | 0 .../create_index_pattern_wizard/lib/index.ts | 0 .../create_index_pattern_wizard/types.ts | 0 .../edit_index_pattern/constants.ts | 0 .../create_edit_field/create_edit_field.tsx | 87 +-- .../create_edit_field_container.tsx | 95 +++ .../create_edit_field/index.ts | 21 + .../edit_index_pattern/edit_index_pattern.tsx | 185 +++--- .../edit_index_pattern_container.tsx | 73 +++ .../edit_index_pattern_state_container.ts | 2 +- .../components/edit_index_pattern/index.tsx | 23 + .../edit_index_pattern/index_header/index.ts | 0 .../index_header/index_header.tsx | 36 +- .../indexed_fields_table.test.tsx.snap | 0 .../table/__snapshots__/table.test.tsx.snap | 0 .../components/table/index.ts | 0 .../components/table/table.test.tsx | 2 +- .../components/table/table.tsx | 68 +- .../indexed_fields_table/index.ts | 0 .../indexed_fields_table.test.tsx | 2 +- .../indexed_fields_table.tsx | 3 +- .../lib/get_field_format.test.ts | 2 +- .../lib/get_field_format.ts | 2 +- .../indexed_fields_table/lib/index.ts | 0 .../indexed_fields_table/types.ts | 2 +- .../scripted_field_table.test.tsx.snap | 20 +- .../__snapshots__/call_outs.test.tsx.snap | 6 +- .../components/call_outs/call_outs.test.tsx | 0 .../components/call_outs/call_outs.tsx | 6 +- .../components/call_outs/index.ts | 0 .../confirmation_modal.test.tsx.snap | 0 .../confirmation_modal.test.tsx | 0 .../confirmation_modal/confirmation_modal.tsx | 15 +- .../components/confirmation_modal/index.ts | 0 .../header/__snapshots__/header.test.tsx.snap | 49 ++ .../components/header/header.test.tsx | 12 +- .../components/header/header.tsx | 22 +- .../components/header/index.ts | 0 .../scripted_fields_table/components/index.ts | 0 .../table/__snapshots__/table.test.tsx.snap | 0 .../components/table/index.ts | 0 .../components/table/table.test.tsx | 2 +- .../components/table/table.tsx | 54 +- .../scripted_fields_table/index.ts | 0 .../scripted_field_table.test.tsx | 28 +- .../scripted_fields_table.tsx | 23 +- .../scripted_fields_table/types.ts | 0 .../source_filters_table.test.tsx.snap | 0 .../__snapshots__/add_filter.test.tsx.snap | 4 +- .../components/add_filter/add_filter.test.tsx | 0 .../components/add_filter/add_filter.tsx | 13 +- .../components/add_filter/index.ts | 0 .../confirmation_modal.test.tsx.snap | 6 +- .../confirmation_modal.test.tsx | 0 .../confirmation_modal/confirmation_modal.tsx | 6 +- .../components/confirmation_modal/index.ts | 0 .../header/__snapshots__/header.test.tsx.snap | 6 +- .../components/header/header.test.tsx | 0 .../components/header/header.tsx | 6 +- .../components/header/index.ts | 0 .../source_filters_table/components/index.ts | 0 .../table/__snapshots__/table.test.tsx.snap | 2 +- .../components/table/index.ts | 0 .../components/table/table.test.tsx | 2 +- .../components/table/table.tsx | 49 +- .../source_filters_table/index.ts | 0 .../source_filters_table.test.tsx | 2 +- .../source_filters_table.tsx | 2 +- .../source_filters_table/types.ts | 0 .../edit_index_pattern/tabs/index.ts | 0 .../edit_index_pattern/tabs/tabs.tsx | 31 +- .../edit_index_pattern/tabs/utils.ts | 30 +- .../__snapshots__/field_editor.test.tsx.snap | 229 +++---- .../field_format_editor.test.tsx.snap | 0 .../bytes/__snapshots__/bytes.test.tsx.snap | 4 +- .../editors/bytes/bytes.test.tsx | 1 - .../editors/bytes/bytes.ts | 0 .../editors/bytes/index.ts | 0 .../color/__snapshots__/color.test.tsx.snap | 30 +- .../editors/color/color.test.tsx | 5 +- .../editors/color/color.tsx | 20 +- .../editors/color/index.ts | 0 .../date/__snapshots__/date.test.tsx.snap | 4 +- .../editors/date/date.test.tsx | 1 - .../field_format_editor/editors/date/date.tsx | 4 +- .../field_format_editor/editors/date/index.ts | 0 .../__snapshots__/date_nanos.test.tsx.snap | 4 +- .../editors/date_nanos/date_nanos.test.tsx | 3 +- .../editors/date_nanos/date_nanos.tsx | 4 +- .../editors/date_nanos/index.ts | 0 .../__snapshots__/default.test.tsx.snap | 0 .../editors/default/default.test.tsx | 3 - .../editors/default/default.tsx | 4 +- .../editors/default/index.ts | 0 .../__snapshots__/duration.test.tsx.snap | 10 +- .../editors/duration/duration.test.tsx | 2 - .../editors/duration/duration.tsx | 8 +- .../editors/duration/index.tsx | 0 .../field_format_editor/editors/index.ts | 31 + .../number/__snapshots__/number.test.tsx.snap | 4 +- .../editors/number/index.ts | 0 .../editors/number/number.test.tsx | 1 - .../editors/number/number.tsx | 4 +- .../__snapshots__/percent.test.tsx.snap | 4 +- .../editors/percent/index.ts | 0 .../editors/percent/percent.test.tsx | 3 +- .../editors/percent/percent.tsx | 0 .../__snapshots__/static_lookup.test.tsx.snap | 16 +- .../editors/static_lookup/index.ts | 0 .../static_lookup/static_lookup.test.tsx | 6 +- .../editors/static_lookup/static_lookup.tsx | 19 +- .../string/__snapshots__/string.test.tsx.snap | 2 +- .../editors/string/index.ts | 0 .../editors/string/string.test.tsx | 1 - .../editors/string/string.tsx | 2 +- .../__snapshots__/truncate.test.tsx.snap | 2 +- .../editors/truncate/index.ts | 0 .../editors/truncate/sample.ts | 0 .../editors/truncate/truncate.test.tsx | 3 - .../editors/truncate/truncate.tsx | 2 +- .../label_template_flyout.test.tsx.snap | 10 +- .../url/__snapshots__/url.test.tsx.snap | 44 +- .../url_template_flyout.test.tsx.snap | 12 +- .../field_format_editor/editors/url/index.ts | 0 .../url/label_template_flyout.test.tsx | 0 .../editors/url/label_template_flyout.tsx | 26 +- .../editors/url/url.test.tsx | 8 - .../field_format_editor/editors/url/url.tsx | 25 +- .../editors/url/url_template_flyout.test.tsx | 0 .../editors/url/url_template_flyout.tsx | 18 +- .../field_format_editor.test.tsx | 1 + .../field_format_editor.tsx | 4 +- .../components/field_format_editor/index.ts | 1 + .../__snapshots__/samples.test.tsx.snap | 2 +- .../field_format_editor/samples/index.ts | 0 .../field_format_editor/samples/samples.scss} | 0 .../samples/samples.test.tsx | 0 .../field_format_editor/samples/samples.tsx | 8 +- .../disabled_call_out.test.tsx.snap | 4 +- .../warning_call_out.test.tsx.snap | 10 +- .../disabled_call_out.test.tsx | 0 .../scripting_call_outs/disabled_call_out.tsx | 4 +- .../components/scripting_call_outs/index.ts | 0 .../warning_call_out.test.tsx | 2 +- .../scripting_call_outs/warning_call_out.tsx | 10 +- .../__snapshots__/help_flyout.test.tsx.snap | 40 +- .../scripting_help/help_flyout.test.tsx | 19 +- .../components/scripting_help/help_flyout.tsx | 16 +- .../components/scripting_help/index.ts | 0 .../scripting_help/scripting_syntax.tsx | 46 +- .../scripting_help/test_script.scss} | 0 .../components/scripting_help/test_script.tsx | 43 +- .../field_editor/constants/index.ts | 2 +- .../field_editor/field_editor.test.tsx | 53 +- .../components}/field_editor/field_editor.tsx | 169 ++--- .../public/components}/field_editor/index.ts | 0 .../components}/field_editor/lib/index.ts | 0 .../field_editor/lib/validate_script.ts | 9 +- .../public/components}/field_editor/types.ts | 2 +- .../public/components/index.ts | 27 + .../components/index_pattern_table/index.ts} | 2 +- .../index_pattern_table.tsx | 207 +++++++ .../public/components/types.ts | 32 + .../public/components/utils.test.ts | 51 ++ .../public/components/utils.ts | 69 +++ .../index_pattern_management/public/index.ts | 6 +- .../public/management_app/index.tsx} | 2 +- .../mount_management_section.tsx | 143 +++++ .../index_pattern_management/public/mocks.ts | 21 +- .../index_pattern_management/public/plugin.ts | 67 +- .../public/scripting_languages/index.ts | 13 +- .../public/service/creation/config.ts | 8 +- .../public/service/creation/index.ts | 2 +- .../public/service/creation/manager.ts | 84 +-- .../field_format_editors.ts | 43 ++ .../service/field_format_editors}/index.ts | 2 +- .../public/service/index.ts | 2 +- .../index_pattern_management_service.ts | 41 +- .../public/service/list/config.ts | 20 +- .../public/service/list/manager.ts | 72 +-- .../url/kbn_url_storage.test.ts | 36 +- .../state_management/url/kbn_url_storage.ts | 8 +- .../saved_objects_table.test.tsx.snap | 4 +- .../__snapshots__/relationships.test.tsx.snap | 4 +- .../__snapshots__/table.test.tsx.snap | 8 +- .../components/relationships.test.tsx | 8 +- .../objects_table/components/table.test.tsx | 8 +- .../saved_objects_table.test.tsx | 4 +- .../objects_table/saved_objects_table.tsx | 2 +- .../apis/saved_objects_management/find.ts | 5 +- .../saved_objects_management/relationships.ts | 10 +- .../_index_pattern_create_delete.js | 2 +- test/functional/page_objects/settings_page.ts | 4 +- .../guidance_panel/guidance_panel.tsx | 2 +- .../components/no_index_pattern_callout.js | 2 +- .../results_links/results_links.tsx | 4 +- .../rollup_index_pattern_creation_config.js | 2 +- ...ndex_patterns_missing_prompt.test.tsx.snap | 2 +- .../index_patterns_missing_prompt.tsx | 2 +- .../translations/translations/ja-JP.json | 584 +++++++++--------- .../translations/translations/zh-CN.json | 584 +++++++++--------- .../index_patterns_security.ts | 8 +- .../feature_controls/index_patterns_spaces.ts | 8 +- 313 files changed, 3134 insertions(+), 2822 deletions(-) delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/angular_template.html delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.tsx delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/index.js delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.js delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field.html delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.html delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.html delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.js delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index_pattern_table.tsx delete mode 100644 src/legacy/core_plugins/kibana/public/management/sections/index_patterns/list.html delete mode 100644 src/legacy/ui/public/field_editor/_index.scss delete mode 100644 src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/icons/index.js delete mode 100644 src/legacy/ui/public/field_editor/components/field_format_editor/register.ts delete mode 100644 src/legacy/ui/public/field_editor/components/field_format_editor/samples/_index.scss rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/LICENSE.txt (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/cv.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/de.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/go.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/ne.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/ni.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/stop.png (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/editors/url => plugins/index_pattern_management/public/assets}/icons/us.png (100%) create mode 100644 src/plugins/index_pattern_management/public/components/__snapshots__/utils.test.ts.snap rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns/breadcrumbs.js => plugins/index_pattern_management/public/components/breadcrumbs.ts} (62%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_button/create_button.tsx (88%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_button/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_prompt/index.tsx (84%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap (94%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap (75%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/empty_state/empty_state.tsx (82%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/empty_state/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap (71%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/header/header.test.tsx (95%) create mode 100644 src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap (88%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/loading_state/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/loading_state/loading_state.tsx (94%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx (87%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap (97%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/indices_list.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/indices_list.tsx (98%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx (91%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap (80%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx (83%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/__snapshots__/step_time_field.test.tsx.snap (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx (91%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap (81%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap (83%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx (92%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap (84%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.css => plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.scss} (84%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx (87%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx (98%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx (94%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/constants/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx (73%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/create_index_pattern_wizard.tsx (68%) create mode 100644 src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/can_append_wildcard.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/can_append_wildcard.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/contains_illegal_characters.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/ensure_minimum_time.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/extract_time_fields.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/extract_time_fields.ts (80%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/get_indices.test.ts (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/get_indices.ts (93%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/get_matched_indices.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/get_matched_indices.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/lib/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/create_index_pattern_wizard/types.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/constants.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/create_edit_field/create_edit_field.tsx (52%) create mode 100644 src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field_container.tsx create mode 100644 src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/index.ts rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/edit_index_pattern.tsx (51%) create mode 100644 src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_container.tsx rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/edit_index_pattern_state_container.ts (97%) create mode 100644 src/plugins/index_pattern_management/public/components/edit_index_pattern/index.tsx rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/index_header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/index_header/index_header.tsx (78%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/__snapshots__/indexed_fields_table.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/components/table/__snapshots__/table.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/components/table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/components/table/table.test.tsx (97%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/components/table/table.tsx (78%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx (97%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx (98%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts (92%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/lib/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/indexed_fields_table/types.ts (92%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap (82%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/call_outs/__snapshots__/call_outs.test.tsx.snap (78%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx (87%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/call_outs/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx (83%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.ts (100%) create mode 100644 src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx (71%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/header/header.tsx (72%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/table/__snapshots__/table.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx (97%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/components/table/table.tsx (68%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx (89%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx (88%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/scripted_fields_table/types.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap (88%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/add_filter/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap (72%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/confirmation_modal/confirmation_modal.tsx (89%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/header/header.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/header/header.tsx (90%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/header/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap (95%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/table/table.test.tsx (99%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/components/table/table.tsx (85%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/source_filters_table.test.tsx (98%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/source_filters_table.tsx (98%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/source_filters_table/types.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/tabs/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/tabs/tabs.tsx (92%) rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns => plugins/index_pattern_management/public/components}/edit_index_pattern/tabs/utils.ts (82%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/__snapshots__/field_editor.test.tsx.snap (72%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/__snapshots__/field_format_editor.test.tsx.snap (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap (92%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/bytes/bytes.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/bytes/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/color/__snapshots__/color.test.tsx.snap (87%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/color/color.test.tsx (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/color/color.tsx (90%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/color/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date/date.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date/date.tsx (95%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.tsx (95%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/date_nanos/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/default/__snapshots__/default.test.tsx.snap (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/default/default.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/default/default.tsx (96%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/default/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/duration/duration.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/duration/duration.tsx (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/duration/index.tsx (100%) create mode 100644 src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/index.ts rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap (92%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/number/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/number/number.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/number/number.tsx (95%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap (92%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/percent/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/percent/percent.test.tsx (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/percent/percent.tsx (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/static_lookup/__snapshots__/static_lookup.test.tsx.snap (88%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/static_lookup/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.tsx (88%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/string/__snapshots__/string.test.tsx.snap (96%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/string/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/string/string.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/string/string.tsx (97%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap (96%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/truncate/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/truncate/sample.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/truncate/truncate.tsx (97%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap (90%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap (89%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap (88%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx (80%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/url.test.tsx (94%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/url.tsx (88%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx (84%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/field_format_editor.test.tsx (98%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/field_format_editor.tsx (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/index.ts (96%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap (96%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/samples/index.ts (100%) rename src/{legacy/ui/public/field_editor/components/field_format_editor/samples/_samples.scss => plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.scss} (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/samples/samples.test.tsx (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/field_format_editor/samples/samples.tsx (90%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap (87%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap (82%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/disabled_call_out.test.tsx (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/disabled_call_out.tsx (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/warning_call_out.test.tsx (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_call_outs/warning_call_out.tsx (88%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/__snapshots__/help_flyout.test.tsx.snap (59%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/help_flyout.test.tsx (77%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/help_flyout.tsx (85%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/scripting_syntax.tsx (79%) rename src/{legacy/ui/public/field_editor/components/scripting_help/_test_script.scss => plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.scss} (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/components/scripting_help/test_script.tsx (85%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/constants/index.ts (93%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/field_editor.test.tsx (84%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/field_editor.tsx (81%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/lib/index.ts (100%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/lib/validate_script.ts (95%) rename src/{legacy/ui/public => plugins/index_pattern_management/public/components}/field_editor/types.ts (97%) create mode 100644 src/plugins/index_pattern_management/public/components/index.ts rename src/{legacy/core_plugins/kibana/public/management/sections/index.js => plugins/index_pattern_management/public/components/index_pattern_table/index.ts} (92%) create mode 100644 src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx create mode 100644 src/plugins/index_pattern_management/public/components/types.ts create mode 100644 src/plugins/index_pattern_management/public/components/utils.test.ts create mode 100644 src/plugins/index_pattern_management/public/components/utils.ts rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index.js => plugins/index_pattern_management/public/management_app/index.tsx} (92%) create mode 100644 src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx rename src/{legacy/ui => plugins/index_pattern_management}/public/scripting_languages/index.ts (80%) create mode 100644 src/plugins/index_pattern_management/public/service/field_format_editors/field_format_editors.ts rename src/{legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field => plugins/index_pattern_management/public/service/field_format_editors}/index.ts (92%) diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index 02d46b1583b59..ce2d652257e1f 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1240,6 +1240,7 @@ import { npStart: { plugins } } from 'ui/new_platform'; | `ui/filter_manager` | `plugins.data.filter` | -- | | `ui/index_patterns` | `plugins.data.indexPatterns` | | `import 'ui/management'` | `plugins.management.sections` | | +| `import 'ui/registry/field_format_editors'` | `plugins.indexPatternManagement.fieldFormatEditors` | | | `ui/registry/field_formats` | `plugins.data.fieldFormats` | | | `ui/registry/feature_catalogue` | `plugins.home.featureCatalogue.register` | Must add `home` as a dependency in your kibana.json. | | `ui/registry/vis_types` | `plugins.visualizations` | -- | diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index 2cba9fab7be22..ff253629a4825 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -21,7 +21,6 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { FormattedMessage } from '@kbn/i18n/react'; -import './sections'; import uiRoutes from 'ui/routes'; import { I18nContext } from 'ui/i18n'; import { uiModules } from 'ui/modules'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/angular_template.html b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/angular_template.html deleted file mode 100644 index a2bc83db904a4..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/angular_template.html +++ /dev/null @@ -1,5 +0,0 @@ - -
-
-
-
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.tsx deleted file mode 100644 index 928c1ef2b6299..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.tsx +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React, { Fragment } from 'react'; - -import { - EuiBetaBadge, - EuiSpacer, - EuiTitle, - EuiFlexGroup, - EuiFlexItem, - EuiText, - EuiTextColor, - EuiSwitch, -} from '@elastic/eui'; - -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; - -export const Header = ({ - prompt, - indexPatternName, - showSystemIndices = false, - isIncludingSystemIndices, - onChangeIncludingSystemIndices, - isBeta = false, -}: { - prompt?: React.ReactNode; - indexPatternName: string; - showSystemIndices?: boolean; - isIncludingSystemIndices: boolean; - onChangeIncludingSystemIndices: () => void; - isBeta?: boolean; -}) => ( -
- -

- - {isBeta ? ( - - {' '} - - - ) : null} -

-
- - - -

- - - -

-
-
- {showSystemIndices ? ( - - - } - id="checkboxShowSystemIndices" - checked={isIncludingSystemIndices} - onChange={onChangeIncludingSystemIndices} - /> - - ) : null} -
- {prompt ? ( - - - {prompt} - - ) : null} - -
-); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/index.js deleted file mode 100644 index 2762a4f6e8726..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import uiRoutes from 'ui/routes'; -import angularTemplate from './angular_template.html'; -import { npStart } from 'ui/new_platform'; -import { getCreateBreadcrumbs } from '../breadcrumbs'; - -import { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } from './render'; - -uiRoutes.when('/management/kibana/index_pattern', { - template: angularTemplate, - k7Breadcrumbs: getCreateBreadcrumbs, - controller: function($scope, $injector) { - // Wait for the directives to execute - const kbnUrl = $injector.get('kbnUrl'); - $scope.$$postDigest(() => { - const $routeParams = $injector.get('$routeParams'); - const indexPatternCreationType = npStart.plugins.indexPatternManagement.creation.getType( - $routeParams.type - ); - const services = { - uiSettings: npStart.core.uiSettings, - es: npStart.plugins.data.search.__LEGACY.esClient, - indexPatterns: npStart.plugins.data.indexPatterns, - savedObjectsClient: npStart.core.savedObjects.client, - indexPatternCreationType, - changeUrl: url => { - $scope.$evalAsync(() => kbnUrl.changePath(url)); - }, - openConfirm: npStart.core.overlays.openConfirm, - prependBasePath: npStart.core.http.basePath.prepend, - }; - - const initialQuery = $routeParams.id ? decodeURIComponent($routeParams.id) : undefined; - - renderCreateIndexPatternWizard(initialQuery, services); - }); - - $scope.$on('$destroy', destroyCreateIndexPatternWizard); - }, -}); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.js deleted file mode 100644 index d09ad3f63f0a2..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { CreateIndexPatternWizard } from './create_index_pattern_wizard'; - -import { I18nContext } from 'ui/i18n'; - -const CREATE_INDEX_PATTERN_DOM_ELEMENT_ID = 'createIndexPatternReact'; - -export function renderCreateIndexPatternWizard(initialQuery, services) { - const node = document.getElementById(CREATE_INDEX_PATTERN_DOM_ELEMENT_ID); - if (!node) { - return; - } - - render( - - - , - node - ); -} - -export function destroyCreateIndexPatternWizard() { - const node = document.getElementById(CREATE_INDEX_PATTERN_DOM_ELEMENT_ID); - node && unmountComponentAtNode(node); -} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js deleted file mode 100644 index 1b9dafb6daf23..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const render = jest.fn(); -const unmountComponentAtNode = jest.fn(); - -jest.doMock('react-dom', () => ({ render, unmountComponentAtNode })); - -jest.mock('ui/chrome', () => ({ - getUiSettingsClient: () => ({ - get: () => '', - }), - addBasePath: () => {}, -})); - -jest.mock('ui/i18n', () => ({ - I18nContext: () => {}, -})); - -const { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } = require('./render'); - -describe('CreateIndexPatternWizardRender', () => { - beforeEach(() => { - jest.spyOn(document, 'getElementById').mockImplementation(() => ({})); - render.mockClear(); - unmountComponentAtNode.mockClear(); - }); - - it('should call render', () => { - renderCreateIndexPatternWizard('', { - es: {}, - indexPatterns: {}, - savedObjectsClient: {}, - config: {}, - changeUrl: () => {}, - indexPatternCreationType: {}, - openConfirm: jest.fn(), - }); - - expect(render.mock.calls.length).toBe(1); - }); - - it('should call unmountComponentAtNode', () => { - destroyCreateIndexPatternWizard(); - expect(unmountComponentAtNode.mock.calls.length).toBe(1); - }); -}); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field.html b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field.html deleted file mode 100644 index 2decaf423183e..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field.html +++ /dev/null @@ -1,5 +0,0 @@ - -
-
-
-
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.html b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.html deleted file mode 100644 index 0bf7c7f0bdfbe..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.html +++ /dev/null @@ -1,12 +0,0 @@ - -
-
-
-
-
-
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js deleted file mode 100644 index ab1fa546e5ea8..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React from 'react'; -import { HashRouter } from 'react-router-dom'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { RegistryFieldFormatEditorsProvider } from 'ui/registry/field_format_editors'; -import uiRoutes from 'ui/routes'; -import { uiModules } from 'ui/modules'; -import { I18nContext } from 'ui/i18n'; -import { npStart } from 'ui/new_platform'; -import template from './edit_index_pattern.html'; -import createEditFieldtemplate from './create_edit_field.html'; -import { - getEditBreadcrumbs, - getEditFieldBreadcrumbs, - getCreateFieldBreadcrumbs, -} from '../breadcrumbs'; -import { EditIndexPattern } from './edit_index_pattern'; -import { CreateEditField } from './create_edit_field'; - -const REACT_EDIT_INDEX_PATTERN_DOM_ELEMENT_ID = 'reactEditIndexPattern'; - -function destroyEditIndexPattern() { - const node = document.getElementById(REACT_EDIT_INDEX_PATTERN_DOM_ELEMENT_ID); - node && unmountComponentAtNode(node); -} - -function renderEditIndexPattern($scope, config, $route) { - $scope.$$postDigest(() => { - const node = document.getElementById(REACT_EDIT_INDEX_PATTERN_DOM_ELEMENT_ID); - if (!node) { - return; - } - - render( - - - - - , - node - ); - }); -} - -uiRoutes.when('/management/kibana/index_patterns/:indexPatternId', { - template, - k7Breadcrumbs: getEditBreadcrumbs, - resolve: { - indexPattern: function($route, Promise, redirectWhenMissing) { - const { indexPatterns } = npStart.plugins.data; - return Promise.resolve(indexPatterns.get($route.current.params.indexPatternId)).catch( - redirectWhenMissing('/management/kibana/index_patterns') - ); - }, - }, -}); - -uiModules - .get('apps/management') - .controller('managementIndexPatternsEdit', function($scope, $route, config) { - $scope.$on('$destroy', () => { - destroyEditIndexPattern(); - }); - - renderEditIndexPattern($scope, config, $route); - }); - -// routes for create edit field. Will be removed after migartion all component to react. -const REACT_FIELD_EDITOR_ID = 'reactFieldEditor'; -const renderCreateEditField = ($scope, $route, getConfig, fieldFormatEditors) => { - $scope.$$postDigest(() => { - const node = document.getElementById(REACT_FIELD_EDITOR_ID); - if (!node) { - return; - } - - render( - - - npStart.core.http, - notifications: npStart.core.notifications, - docTitle: npStart.core.chrome.docTitle, - docLinksScriptedFields: npStart.core.docLinks.links.scriptedFields, - }} - /> - - , - node - ); - }); -}; - -const destroyCreateEditField = () => { - const node = document.getElementById(REACT_FIELD_EDITOR_ID); - node && unmountComponentAtNode(node); -}; - -uiRoutes - .when('/management/kibana/index_patterns/:indexPatternId/field/:fieldName*', { - mode: 'edit', - k7Breadcrumbs: getEditFieldBreadcrumbs, - }) - .when('/management/kibana/index_patterns/:indexPatternId/create-field/', { - mode: 'create', - k7Breadcrumbs: getCreateFieldBreadcrumbs, - }) - .defaults(/management\/kibana\/index_patterns\/[^\/]+\/(field|create-field)(\/|$)/, { - template: createEditFieldtemplate, - mapBreadcrumbs($route, breadcrumbs) { - const { indexPattern } = $route.current.locals; - return breadcrumbs.map(crumb => { - if (crumb.id !== indexPattern.id) { - return crumb; - } - - return { - ...crumb, - display: indexPattern.title, - }; - }); - }, - resolve: { - indexPattern: function($route, Promise, redirectWhenMissing) { - const { indexPatterns } = npStart.plugins.data; - return Promise.resolve(indexPatterns.get($route.current.params.indexPatternId)).catch( - redirectWhenMissing('/management/kibana/index_patterns') - ); - }, - }, - controllerAs: 'fieldSettings', - controller: function FieldEditorPageController($scope, $route, Private, config) { - const getConfig = (...args) => config.get(...args); - const fieldFormatEditors = Private(RegistryFieldFormatEditorsProvider); - - renderCreateEditField($scope, $route, getConfig, fieldFormatEditors); - - $scope.$on('$destroy', () => { - destroyCreateEditField(); - }); - }, - }); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap deleted file mode 100644 index 2e694b6363117..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap +++ /dev/null @@ -1,44 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Header should render normally 1`] = ` - - - -

- -

-
- -

- -

-
-
- - - - - -
-`; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.html b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.html deleted file mode 100644 index 1af0fc2c33782..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.html +++ /dev/null @@ -1,5 +0,0 @@ -
-
-
-
-
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.js deleted file mode 100644 index 24bc4ba8fba5b..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { management } from 'ui/management'; -import { ManagementSectionId } from '../../../../../../../plugins/management/public'; -import './create_index_pattern_wizard'; -import './edit_index_pattern'; -import uiRoutes from 'ui/routes'; -import { uiModules } from 'ui/modules'; -import indexTemplate from './index.html'; -import indexPatternListTemplate from './list.html'; -import { IndexPatternTable } from './index_pattern_table'; -import { npStart } from 'ui/new_platform'; -import { i18n } from '@kbn/i18n'; -import { I18nContext } from 'ui/i18n'; -import { UICapabilitiesProvider } from 'ui/capabilities/react'; -import { getListBreadcrumbs } from './breadcrumbs'; - -import React from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; - -const INDEX_PATTERN_LIST_DOM_ELEMENT_ID = 'indexPatternListReact'; - -export function updateIndexPatternList(indexPatterns, kbnUrl, indexPatternCreationOptions) { - const node = document.getElementById(INDEX_PATTERN_LIST_DOM_ELEMENT_ID); - if (!node) { - return; - } - - render( - - - - - , - node - ); -} - -export const destroyIndexPatternList = () => { - const node = document.getElementById(INDEX_PATTERN_LIST_DOM_ELEMENT_ID); - node && unmountComponentAtNode(node); -}; - -const indexPatternsResolutions = { - indexPatterns: function() { - const savedObjectsClient = npStart.core.savedObjects.client; - - return savedObjectsClient - .find({ - type: 'index-pattern', - fields: ['title', 'type'], - perPage: 10000, - }) - .then(response => response.savedObjects); - }, -}; - -// add a dependency to all of the subsection routes -uiRoutes.defaults(/management\/kibana\/(index_patterns|index_pattern)/, { - resolve: indexPatternsResolutions, - requireUICapability: 'management.kibana.index_patterns', - badge: uiCapabilities => { - if (uiCapabilities.indexPatterns.save) { - return undefined; - } - - return { - text: i18n.translate('kbn.management.indexPatterns.badge.readOnly.text', { - defaultMessage: 'Read only', - }), - tooltip: i18n.translate('kbn.management.indexPatterns.badge.readOnly.tooltip', { - defaultMessage: 'Unable to save index patterns', - }), - iconType: 'glasses', - }; - }, -}); - -uiRoutes.when('/management/kibana/index_patterns', { - template: indexPatternListTemplate, - k7Breadcrumbs: getListBreadcrumbs, -}); - -// wrapper directive, which sets some global stuff up like the left nav -uiModules - .get('apps/management') - .directive('kbnManagementIndexPatterns', function($route, config, kbnUrl) { - return { - restrict: 'E', - transclude: true, - template: indexTemplate, - link: async function($scope) { - const indexPatternCreationOptions = await npStart.plugins.indexPatternManagement.creation.getIndexPatternCreationOptions( - url => { - $scope.$evalAsync(() => kbnUrl.change(url)); - } - ); - - const renderList = () => { - $scope.indexPatternList = - $route.current.locals.indexPatterns - .map(pattern => { - const id = pattern.id; - const title = pattern.get('title'); - const isDefault = $scope.defaultIndex === id; - const tags = npStart.plugins.indexPatternManagement.list.getIndexPatternTags( - pattern, - isDefault - ); - - return { - id, - title, - url: kbnUrl.eval('#/management/kibana/index_patterns/{{id}}', { id: id }), - active: $scope.editingId === id, - default: isDefault, - tags, - //the prepending of 0 at the default pattern takes care of prioritization - //so the sorting will but the default index on top - //or on bottom of a the table - sort: `${isDefault ? '0' : '1'}${title}`, - }; - }) - .sort((a, b) => { - if (a.sort < b.sort) { - return -1; - } else if (a.sort > b.sort) { - return 1; - } else { - return 0; - } - }) || []; - - updateIndexPatternList($scope.indexPatternList, kbnUrl, indexPatternCreationOptions); - }; - - $scope.$on('$destroy', destroyIndexPatternList); - $scope.editingId = $route.current.params.indexPatternId; - $scope.$watch('defaultIndex', () => renderList()); - config.bindToScope($scope, 'defaultIndex'); - $scope.$apply(); - }, - }; - }); - -management.getSection(ManagementSectionId.Kibana).register('index_patterns', { - display: i18n.translate('kbn.management.indexPattern.sectionsHeader', { - defaultMessage: 'Index Patterns', - }), - order: 0, - url: '#/management/kibana/index_patterns/', -}); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index_pattern_table.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index_pattern_table.tsx deleted file mode 100644 index f254a6bc22a0d..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index_pattern_table.tsx +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - EuiBadge, - EuiButtonEmpty, - EuiButtonIcon, - EuiFlexGroup, - EuiFlexItem, - // @ts-ignore - EuiInMemoryTable, - EuiPanel, - EuiSpacer, - EuiText, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import React from 'react'; -import { CreateButton } from '../create_button'; -import { CreateIndexPatternPrompt } from '../create_index_pattern_prompt'; -import { IndexPattern, IndexPatternCreationOption } from '../types'; - -const columns = [ - { - field: 'title', - name: 'Pattern', - render: ( - name: string, - index: { - id: string; - tags?: Array<{ - key: string; - name: string; - }>; - } - ) => ( - - {name} - {index.tags && - index.tags.map(({ key: tagKey, name: tagName }) => ( - - {tagName} - - ))} - - ), - dataType: 'string' as const, - sortable: ({ sort }: { sort: string }) => sort, - }, -]; - -const pagination = { - initialPageSize: 10, - pageSizeOptions: [5, 10, 25, 50], -}; - -const sorting = { - sort: { - field: 'title', - direction: 'asc' as const, - }, -}; - -const search = { - box: { - incremental: true, - schema: { - fields: { title: { type: 'string' } }, - }, - }, -}; - -interface Props { - indexPatterns: IndexPattern[]; - indexPatternCreationOptions: IndexPatternCreationOption[]; -} - -interface State { - showFlyout: boolean; -} - -export class IndexPatternTable extends React.Component { - public readonly state = { - showFlyout: this.props.indexPatterns.length === 0, - }; - - public render() { - return ( - - {this.state.showFlyout && ( - this.setState({ showFlyout: false })} /> - )} - - - - - -

- -

-
-
- - this.setState({ showFlyout: true })} - aria-label="Help" - /> - -
-
- - - - - -
- - -
- ); - } -} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/list.html b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/list.html deleted file mode 100644 index 928fb75384be1..0000000000000 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/list.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js index e5d43fec4e59c..64676b1bce75c 100644 --- a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js +++ b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js @@ -65,11 +65,11 @@ const savedObjectsManagement = getManagementaMock({ return obj.attributes.title; }, getEditUrl(obj) { - return `/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`; + return `/management/kibana/indexPatterns/patterns/${encodeURIComponent(obj.id)}`; }, getInAppUrl(obj) { return { - path: `/app/kibana#/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`, + path: `/app/kibana#/management/kibana/indexPatterns/patterns/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'management.kibana.index_patterns', }; }, @@ -323,9 +323,9 @@ describe('findRelationships', () => { meta: { icon: 'indexPatternApp', title: 'My Index Pattern', - editUrl: '/management/kibana/index_patterns/1', + editUrl: '/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/app/kibana#/management/kibana/index_patterns/1', + path: '/app/kibana#/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, @@ -437,9 +437,9 @@ describe('findRelationships', () => { meta: { icon: 'indexPatternApp', title: 'My Index Pattern', - editUrl: '/management/kibana/index_patterns/1', + editUrl: '/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/app/kibana#/management/kibana/index_patterns/1', + path: '/app/kibana#/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, diff --git a/src/legacy/ui/public/_index.scss b/src/legacy/ui/public/_index.scss index 15a70e0ef7f5a..d258ef190a100 100644 --- a/src/legacy/ui/public/_index.scss +++ b/src/legacy/ui/public/_index.scss @@ -11,5 +11,3 @@ @import './accessibility/index'; @import './directives/index'; @import './error_url_overflow/index'; -@import './field_editor/index'; -@import '../../../plugins/management/public/components/index'; diff --git a/src/legacy/ui/public/field_editor/_index.scss b/src/legacy/ui/public/field_editor/_index.scss deleted file mode 100644 index 39f69c013d428..0000000000000 --- a/src/legacy/ui/public/field_editor/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import './components/field_format_editor/samples/index'; -@import './components/scripting_help/test_script'; diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/icons/index.js b/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/icons/index.js deleted file mode 100644 index 2dc9a1835f582..0000000000000 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/icons/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/go.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/stop.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/de.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/ne.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/us.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/ni.png'; -import '!!file-loader?name=[path][name].[ext]!ui/field_editor/components/field_format_editor/editors/url/icons/cv.png'; diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/register.ts b/src/legacy/ui/public/field_editor/components/field_format_editor/register.ts deleted file mode 100644 index 3062a3ba8ac14..0000000000000 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/register.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { RegistryFieldFormatEditorsProvider } from 'ui/registry/field_format_editors'; -import { BytesFormatEditor } from './editors/bytes'; -import { ColorFormatEditor } from './editors/color'; -import { DateFormatEditor } from './editors/date'; -import { DateNanosFormatEditor } from './editors/date_nanos'; -import { DurationFormatEditor } from './editors/duration'; -import { NumberFormatEditor } from './editors/number'; -import { PercentFormatEditor } from './editors/percent'; -import { StaticLookupFormatEditor } from './editors/static_lookup'; -import { StringFormatEditor } from './editors/string'; -import { TruncateFormatEditor } from './editors/truncate'; -import { UrlFormatEditor } from './editors/url/url'; - -RegistryFieldFormatEditorsProvider.register(() => BytesFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => ColorFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => DateFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => DateNanosFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => DurationFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => NumberFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => PercentFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => StaticLookupFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => StringFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => TruncateFormatEditor); -RegistryFieldFormatEditorsProvider.register(() => UrlFormatEditor); diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/_index.scss b/src/legacy/ui/public/field_editor/components/field_format_editor/samples/_index.scss deleted file mode 100644 index 7a50cd118bfb2..0000000000000 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import './samples'; diff --git a/src/legacy/ui/ui_exports/ui_export_defaults.js b/src/legacy/ui/ui_exports/ui_export_defaults.js index 35e1f8b7d2127..1341777bc0991 100644 --- a/src/legacy/ui/ui_exports/ui_export_defaults.js +++ b/src/legacy/ui/ui_exports/ui_export_defaults.js @@ -43,7 +43,5 @@ export const UI_EXPORT_DEFAULTS = { }, })), - appExtensions: { - fieldFormatEditors: ['ui/field_editor/components/field_format_editor/register'], - }, + appExtensions: {}, }; diff --git a/src/plugins/data/public/index_patterns/index_patterns/ensure_default_index_pattern.tsx b/src/plugins/data/public/index_patterns/index_patterns/ensure_default_index_pattern.tsx index 2a6ef13f66dda..9115e523f5302 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/ensure_default_index_pattern.tsx +++ b/src/plugins/data/public/index_patterns/index_patterns/ensure_default_index_pattern.tsx @@ -61,7 +61,7 @@ export const createEnsureDefaultIndexPattern = (core: CoreStart) => { core.uiSettings.set('defaultIndex', defaultId); } else { const canManageIndexPatterns = core.application.capabilities.management.kibana.index_patterns; - const redirectTarget = canManageIndexPatterns ? 'management' : 'home'; + const redirectTarget = canManageIndexPatterns ? '/management/kibana/indexPatterns' : '/home'; if (timeoutId) { clearTimeout(timeoutId); @@ -88,11 +88,11 @@ export const createEnsureDefaultIndexPattern = (core: CoreStart) => { timeoutId = undefined; }, 15000); - if (redirectTarget === 'home') { + if (redirectTarget === '/home') { core.application.navigateToApp('home'); } else { window.location.href = core.http.basePath.prepend( - `/app/kibana#/management/kibana/index_pattern?bannerMessage=${bannerMessage}` + `/app/kibana#/management/kibana/indexPatterns?bannerMessage=${bannerMessage}` ); } diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts index ecbfceac14b66..3780557db50d3 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts @@ -174,7 +174,7 @@ export class IndexPattern implements IIndexPattern { private updateFromElasticSearch(response: any, forceFieldRefresh: boolean = false) { if (!response.found) { - throw new SavedObjectNotFound(type, this.id, '#/management/kibana/index_pattern'); + throw new SavedObjectNotFound(type, this.id, '#/management/kibana/indexPatterns'); } _.forOwn(this.mapping, (fieldMapping: FieldMappingSpec, name: string | undefined) => { diff --git a/src/plugins/data/server/saved_objects/index_patterns.ts b/src/plugins/data/server/saved_objects/index_patterns.ts index 497dbb7d6f630..a212d7f88e4eb 100644 --- a/src/plugins/data/server/saved_objects/index_patterns.ts +++ b/src/plugins/data/server/saved_objects/index_patterns.ts @@ -32,11 +32,11 @@ export const indexPatternSavedObjectType: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`; + return `/management/kibana/indexPatterns/patterns/${encodeURIComponent(obj.id)}`; }, getInAppUrl(obj) { return { - path: `/app/kibana#/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`, + path: `/app/kibana#/management/kibana/indexPatterns/patterns/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'management.kibana.index_patterns', }; }, diff --git a/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx b/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx index 0bae2456f743c..880a493983adf 100644 --- a/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx +++ b/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx @@ -42,7 +42,7 @@ const DiscoverFetchError = ({ fetchError }: Props) => { const { chrome } = getServices(); const mangagementUrlObj = chrome.navLinks.get('kibana:stack_management'); const managementUrl = mangagementUrlObj ? mangagementUrlObj.url : ''; - const url = `${managementUrl}/kibana/index_patterns`; + const url = `${managementUrl}/kibana/indexPatterns`; body = (

diff --git a/src/plugins/home/public/application/components/__snapshots__/add_data.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/add_data.test.js.snap index dea33022fa429..924de9bbd0994 100644 --- a/src/plugins/home/public/application/components/__snapshots__/add_data.test.js.snap +++ b/src/plugins/home/public/application/components/__snapshots__/add_data.test.js.snap @@ -277,7 +277,7 @@ exports[`apmUiEnabled 1`] = ` /> { void; }>; - uiCapabilities: UICapabilities; } -class CreateButtonComponent extends Component { +export class CreateButton extends Component { public state = { isPopoverOpen: false, }; public render() { - const { options, children, uiCapabilities } = this.props; + const { options, children } = this.props; const { isPopoverOpen } = this.state; if (!options || !options.length) { return null; } - if (!uiCapabilities.indexPatterns.save) { - return null; - } - if (options.length === 1) { return ( { return ( ); }; } - -export const CreateButton = injectUICapabilities(CreateButtonComponent); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_button/index.ts b/src/plugins/index_pattern_management/public/components/create_button/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_button/index.ts rename to src/plugins/index_pattern_management/public/components/create_button/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_prompt/index.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_prompt/index.tsx similarity index 84% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_prompt/index.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_prompt/index.tsx index 174b3af930550..ab3b90177bcfd 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_prompt/index.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_prompt/index.tsx @@ -37,7 +37,7 @@ export const CreateIndexPatternPrompt = ({ onClose }: { onClose: () => void }) =

@@ -47,7 +47,7 @@ export const CreateIndexPatternPrompt = ({ onClose }: { onClose: () => void }) =

@@ -57,7 +57,7 @@ export const CreateIndexPatternPrompt = ({ onClose }: { onClose: () => void }) =

@@ -66,38 +66,38 @@ export const CreateIndexPatternPrompt = ({ onClose }: { onClose: () => void }) = diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap similarity index 94% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap index 9763cd9f638fd..9a390f84ef5dc 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap @@ -1,9 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CreateIndexPatternWizard defaults to the loading state 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders index pattern step when there are indices 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = ` - +
-
+ `; exports[`CreateIndexPatternWizard renders time field step when step is set to 2 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard renders when there are no indices but there are remote clusters 1`] = ` - +
- + `; exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = ` - +
- + `; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap similarity index 75% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap index 3ecab05a8459b..4ebb5db05753b 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap @@ -7,7 +7,7 @@ exports[`EmptyState should render normally 1`] = ` title={ } @@ -15,7 +15,7 @@ exports[`EmptyState should render normally 1`] = `

, @@ -32,7 +32,7 @@ exports[`EmptyState should render normally 1`] = ` > , @@ -41,7 +41,7 @@ exports[`EmptyState should render normally 1`] = ` > , @@ -57,7 +57,7 @@ exports[`EmptyState should render normally 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/empty_state.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.tsx similarity index 82% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/empty_state.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.tsx index 3ee5d1a0e96f1..43c3bf79026fe 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/empty_state.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.tsx @@ -36,20 +36,20 @@ export const EmptyState = ({ color="warning" title={ } >

@@ -57,7 +57,7 @@ export const EmptyState = ({ learnHowLink: ( @@ -65,7 +65,7 @@ export const EmptyState = ({ getStartedLink: ( @@ -81,7 +81,7 @@ export const EmptyState = ({ color="warning" > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/empty_state/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap similarity index 71% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap index a6b22ebf32a43..bdfdd2e7ad0a6 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap @@ -4,15 +4,7 @@ exports[`Header should render a different name, prompt, and beta tag if provided

- + Create test index pattern @@ -59,15 +51,7 @@ exports[`Header should render normally 1`] = `

- + Create test index pattern

@@ -104,15 +88,7 @@ exports[`Header should render without including system indices 1`] = `

- + Create test index pattern

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx index 06b8b38e2d8bc..d70746dd930e4 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx @@ -29,6 +29,7 @@ describe('Header', () => { indexPatternName={indexPatternName} isIncludingSystemIndices={true} onChangeIncludingSystemIndices={() => {}} + changeTitle={() => {}} /> ); @@ -41,6 +42,7 @@ describe('Header', () => { indexPatternName={indexPatternName} isIncludingSystemIndices={false} onChangeIncludingSystemIndices={() => {}} + changeTitle={() => {}} /> ); @@ -55,6 +57,7 @@ describe('Header', () => { prompt={
Test prompt
} indexPatternName={indexPatternName} isBeta={true} + changeTitle={() => {}} /> ); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx new file mode 100644 index 0000000000000..1be33e3edc3bc --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx @@ -0,0 +1,118 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { Fragment } from 'react'; + +import { + EuiBetaBadge, + EuiSpacer, + EuiTitle, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiTextColor, + EuiSwitch, +} from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +export const Header = ({ + prompt, + indexPatternName, + showSystemIndices = false, + isIncludingSystemIndices, + onChangeIncludingSystemIndices, + isBeta = false, + changeTitle, +}: { + prompt?: React.ReactNode; + indexPatternName: string; + showSystemIndices?: boolean; + isIncludingSystemIndices: boolean; + onChangeIncludingSystemIndices: () => void; + isBeta?: boolean; + changeTitle: (title: string) => void; +}) => { + const createIndexPatternHeader = i18n.translate( + 'indexPatternManagement.createIndexPatternHeader', + { + defaultMessage: 'Create {indexPatternName}', + values: { indexPatternName }, + } + ); + + changeTitle(createIndexPatternHeader); + + return ( +
+ +

+ {createIndexPatternHeader} + {isBeta ? ( + + {' '} + + + ) : null} +

+
+ + + +

+ + + +

+
+
+ {showSystemIndices ? ( + + + } + id="checkboxShowSystemIndices" + checked={isIncludingSystemIndices} + onChange={onChangeIncludingSystemIndices} + /> + + ) : null} +
+ {prompt ? ( + + + {prompt} + + ) : null} + +
+ ); +}; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/header/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap similarity index 88% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap index 3adc497a639c4..1e6ac56d437e1 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap @@ -22,7 +22,7 @@ exports[`LoadingState should render normally 1`] = ` >

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/loading_state.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx similarity index 94% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/loading_state.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx index e9b68033090cf..26653adfd14a6 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/loading_state/loading_state.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx @@ -29,7 +29,7 @@ export const LoadingState = () => (

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap index f2fb17cdb0d60..3021292953ff5 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap @@ -8,7 +8,7 @@ exports[`Header should mark the input as invalid 1`] = `

@@ -42,7 +42,7 @@ exports[`Header should mark the input as invalid 1`] = `

@@ -55,7 +55,7 @@ exports[`Header should mark the input as invalid 1`] = `

@@ -71,7 +71,7 @@ exports[`Header should mark the input as invalid 1`] = ` label={ } @@ -99,7 +99,7 @@ exports[`Header should mark the input as invalid 1`] = ` > @@ -116,7 +116,7 @@ exports[`Header should render normally 1`] = `

@@ -146,7 +146,7 @@ exports[`Header should render normally 1`] = `

@@ -159,7 +159,7 @@ exports[`Header should render normally 1`] = `

@@ -175,7 +175,7 @@ exports[`Header should render normally 1`] = ` label={ } @@ -203,7 +203,7 @@ exports[`Header should render normally 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx similarity index 87% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx index f9d86d5d9d53d..9ce72aeeea6e3 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx @@ -57,7 +57,7 @@ export const Header: React.FC = ({

@@ -69,7 +69,7 @@ export const Header: React.FC = ({ } @@ -79,14 +79,14 @@ export const Header: React.FC = ({

* }} />

{characterList} }} /> @@ -97,7 +97,7 @@ export const Header: React.FC = ({ = ({ data-test-subj="createIndexPatternGoToStep2Button" > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap similarity index 97% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap index a759b3b3e9881..598de4d90e893 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap @@ -44,7 +44,7 @@ exports[`IndicesList should change pages 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap index d8b4253de78bb..9d67ca913d415 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap @@ -21,7 +21,7 @@ exports[`LoadingIndices should render normally 1`] = ` > @@ -39,7 +39,7 @@ exports[`LoadingIndices should render normally 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx similarity index 91% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx index 2f91f961b6c18..16e8d1a9f3e98 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx @@ -33,7 +33,7 @@ export const LoadingIndices = ({ ...rest }) => ( @@ -42,7 +42,7 @@ export const LoadingIndices = ({ ...rest }) => ( diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap similarity index 80% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap index eb99424cb12a8..4a063f1430d1c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap @@ -15,13 +15,13 @@ exports[`StatusMessage should render with exact matches 1`] = `   , @@ -55,14 +55,14 @@ exports[`StatusMessage should render with no partial matches 1`] = ` @@ -149,7 +149,7 @@ exports[`StatusMessage should show that no indices exist 1`] = ` @@ -168,7 +168,7 @@ exports[`StatusMessage should show that system indices exist 1`] = ` diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx similarity index 83% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx index ad7f58fa4e879..ccdd1833ea9bf 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx @@ -55,7 +55,7 @@ export const StatusMessage: React.FC = ({ statusMessage = ( {allIndicesLength} indices }} /> @@ -65,7 +65,7 @@ export const StatusMessage: React.FC = ({ statusMessage = ( @@ -75,7 +75,7 @@ export const StatusMessage: React.FC = ({ statusMessage = ( @@ -88,13 +88,13 @@ export const StatusMessage: React.FC = ({   @@ -102,7 +102,7 @@ export const StatusMessage: React.FC = ({ strongIndices: ( @@ -118,7 +118,7 @@ export const StatusMessage: React.FC = ({ statusMessage = ( = ({ strongIndices: ( @@ -142,14 +142,14 @@ export const StatusMessage: React.FC = ({ statusMessage = ( diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx index 40471b95d774c..68afd64ae848c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx @@ -21,10 +21,10 @@ import React from 'react'; import { StepIndexPattern } from '../step_index_pattern'; import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; import { Header } from './components/header'; -import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public'; -import { coreMock } from '../../../../../../../../../../core/public/mocks'; -import { dataPluginMock } from '../../../../../../../../../../plugins/data/public/mocks'; -import { SavedObjectsFindResponsePublic } from '../../../../../../../../../../core/public'; +import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; +import { coreMock } from '../../../../../../../core/public/mocks'; +import { dataPluginMock } from '../../../../../../../plugins/data/public/mocks'; +import { SavedObjectsFindResponsePublic } from 'src/core/public'; jest.mock('../../lib/ensure_minimum_time', () => ({ ensureMinimumTime: async (promises: Array>) => diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx index d8f677b7f6089..5c8fa92d355a3 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx @@ -25,8 +25,8 @@ import { indexPatterns, DataPublicPluginStart, IndexPatternAttributes, -} from '../../../../../../../../../../plugins/data/public'; -import { SavedObjectsClient, IUiSettingsClient } from '../../../../../../../../../../core/public'; +} from '../../../../../../../plugins/data/public'; +import { SavedObjectsClientContract, IUiSettingsClient } from '../../../../../../../core/public'; import { MAX_SEARCH_SIZE } from '../../constants'; import { getIndices, @@ -39,14 +39,14 @@ import { LoadingIndices } from './components/loading_indices'; import { StatusMessage } from './components/status_message'; import { IndicesList } from './components/indices_list'; import { Header } from './components/header'; -import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public'; +import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; import { MatchedIndex } from '../../types'; interface StepIndexPatternProps { allIndices: MatchedIndex[]; isIncludingSystemIndices: boolean; esService: DataPublicPluginStart['search']['__LEGACY']['esClient']; - savedObjectsClient: SavedObjectsClient; + savedObjectsClient: SavedObjectsClientContract; indexPatternCreationType: IndexPatternCreationConfig; goToNextStep: (query: string) => void; initialQuery?: string; @@ -237,7 +237,7 @@ export class StepIndexPattern extends Component @@ -270,7 +270,7 @@ export class StepIndexPattern extends Component } @@ -60,7 +60,7 @@ exports[`StepTimeField should render "Custom index pattern ID already exists" wh

@@ -92,7 +92,7 @@ exports[`StepTimeField should render a loading state when creating the index pat @@ -269,7 +269,7 @@ exports[`StepTimeField should render any error message 1`] = ` title={ } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx similarity index 91% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx index 342876712eb28..d7c55f2573a17 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx @@ -36,7 +36,7 @@ export const ActionButtons = ({ @@ -49,7 +49,7 @@ export const ActionButtons = ({ onClick={createIndexPattern} > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap similarity index 81% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap index 02ceed3454a00..d1b10fb532020 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap @@ -8,7 +8,7 @@ exports[`AdvancedOptions should hide if not showing 1`] = ` > @@ -26,7 +26,7 @@ exports[`AdvancedOptions should render normally 1`] = ` > @@ -43,14 +43,14 @@ exports[`AdvancedOptions should render normally 1`] = ` helpText={ } label={ } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx index fd2c1db1eacd7..b8f34095743ba 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx @@ -44,12 +44,12 @@ export const AdvancedOptions: React.FC = ({ > {isVisible ? ( ) : ( )} @@ -60,13 +60,13 @@ export const AdvancedOptions: React.FC = ({ } helpText={ @@ -78,7 +78,7 @@ export const AdvancedOptions: React.FC = ({ value={indexPatternId} onChange={onChangeIndexPatternId} placeholder={i18n.translate( - 'kbn.management.createIndexPattern.stepTime.options.patternPlaceholder', + 'indexPatternManagement.createIndexPattern.stepTime.options.patternPlaceholder', { defaultMessage: 'custom-index-pattern-id', } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap similarity index 83% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap index 5c53558286b0d..63008ec5b52e7 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap @@ -8,7 +8,7 @@ exports[`Header should render normally 1`] = `

@@ -21,7 +21,7 @@ exports[`Header should render normally 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx index 5c2f184e8038b..22e245f7ac137 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx @@ -33,7 +33,7 @@ export const Header: React.FC = ({ indexPattern, indexPatternName }

@@ -41,7 +41,7 @@ export const Header: React.FC = ({ indexPattern, indexPatternName } {indexPattern}
, diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/header/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap similarity index 84% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap index e997cb80a2a14..7d056433f55df 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap @@ -13,14 +13,14 @@ exports[`TimeField should render a loading state 1`] = `

@@ -38,7 +38,7 @@ exports[`TimeField should render a loading state 1`] = ` @@ -84,14 +84,14 @@ exports[`TimeField should render a selected time field 1`] = `

@@ -109,7 +109,7 @@ exports[`TimeField should render a selected time field 1`] = ` @@ -123,7 +123,7 @@ exports[`TimeField should render a selected time field 1`] = ` > @@ -165,14 +165,14 @@ exports[`TimeField should render normally 1`] = `

@@ -190,7 +190,7 @@ exports[`TimeField should render normally 1`] = ` @@ -204,7 +204,7 @@ exports[`TimeField should render normally 1`] = ` > @@ -239,7 +239,7 @@ exports[`TimeField should render something if hiding time field 1`] = `

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.css b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.scss similarity index 84% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.css rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.scss index d0a2652d7e045..5bd60e8b76afc 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.css +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.scss @@ -1,6 +1,7 @@ /** * 1. Bring the line-height down or else this link expands its container when it becomes visible. */ - .timeFieldRefreshButton { + +.timeFieldRefreshButton { line-height: 1 !important; /* 1 */ } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx similarity index 87% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx index 876a3b79a8812..b4ed37118966b 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx @@ -17,9 +17,9 @@ * under the License. */ -import React from 'react'; +import './time_field.scss'; -import './time_field.css'; +import React from 'react'; import { EuiForm, @@ -60,7 +60,7 @@ export const TimeField: React.FC = ({ @@ -71,7 +71,7 @@ export const TimeField: React.FC = ({ ) : ( @@ -83,13 +83,13 @@ export const TimeField: React.FC = ({

@@ -103,7 +103,7 @@ export const TimeField: React.FC = ({ options={[ { text: i18n.translate( - 'kbn.management.createIndexPattern.stepTime.field.loadingDropDown', + 'indexPatternManagement.createIndexPattern.stepTime.field.loadingDropDown', { defaultMessage: 'Loading…', } @@ -129,7 +129,7 @@ export const TimeField: React.FC = ({

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx similarity index 98% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx index b23b1e3ad9051..939b0d006b4aa 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx @@ -19,8 +19,8 @@ import React from 'react'; import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; -import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public'; -import { IFieldType } from '../../../../../../../../../../plugins/data/public'; +import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; +import { IFieldType } from '../../../../../../../plugins/data/public'; import { StepTimeField } from '../step_time_field'; @@ -32,9 +32,6 @@ jest.mock('./../../lib', () => ({ extractTimeFields: require.requireActual('./../../lib').extractTimeFields, ensureMinimumTime: async (fields: IFieldType) => Promise.resolve(fields), })); -jest.mock('ui/chrome', () => ({ - addBasePath: () => {}, -})); const mockIndexPatternCreationType = new IndexPatternCreationConfig({ type: 'default', diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx similarity index 94% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx index a58bf10c9dab8..d22b503937290 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx @@ -34,8 +34,8 @@ import { Header } from './components/header'; import { TimeField } from './components/time_field'; import { AdvancedOptions } from './components/advanced_options'; import { ActionButtons } from './components/action_buttons'; -import { IndexPatternCreationConfig } from '../../../../../../../../../../plugins/index_pattern_management/public'; -import { DataPublicPluginStart } from '../../../../../../../../../../plugins/data/public'; +import { IndexPatternCreationConfig } from '../../../..'; +import { DataPublicPluginStart } from '../../../../../../data/public'; interface StepTimeFieldProps { indexPattern: string; @@ -157,7 +157,7 @@ export class StepTimeField extends Component ) : ( @@ -187,7 +187,7 @@ export class StepTimeField extends Component @@ -218,7 +218,7 @@ export class StepTimeField extends Component } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/constants/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/constants/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/constants/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/constants/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx similarity index 73% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx index 36d251e4f41a6..f526aa35c2afe 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx @@ -20,12 +20,15 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { CreateIndexPatternWizard } from './create_index_pattern_wizard'; -import { coreMock } from '../../../../../../../../core/public/mocks'; -import { dataPluginMock } from '../../../../../../../../plugins/data/public/mocks'; -import { IndexPatternCreationConfig } from '../../../../../../../../plugins/index_pattern_management/public'; -import { IndexPattern } from '../../../../../../../../plugins/data/public'; -import { SavedObjectsClient } from '../../../../../../../../core/public'; +import { + CreateIndexPatternWizard, + CreateIndexPatternWizardProps, +} from './create_index_pattern_wizard'; +import { coreMock } from '../../../../../core/public/mocks'; +import { dataPluginMock } from '../../../../../plugins/data/public/mocks'; +import { IndexPattern } from '../../../../../plugins/data/public'; +import { SavedObjectsClient } from '../../../../../core/public'; +import { IndexPatternCreationConfig } from '../../service/creation'; jest.mock('./components/step_index_pattern', () => ({ StepIndexPattern: 'StepIndexPattern' })); jest.mock('./components/step_time_field', () => ({ StepTimeField: 'StepTimeField' })); @@ -37,33 +40,42 @@ jest.mock('./lib/get_indices', () => ({ return [{ name: 'kibana' }]; }, })); -jest.mock('ui/chrome', () => ({ - addBasePath: () => {}, -})); -const { savedObjects, overlays, uiSettings } = coreMock.createStart(); +const { savedObjects, overlays, uiSettings, chrome, http } = coreMock.createStart(); const { indexPatterns, search } = dataPluginMock.createStartContract(); + const mockIndexPatternCreationType = new IndexPatternCreationConfig({ type: 'default', name: 'name', }); -const initialQuery = ''; -const services = { +const services = ({ + indexPatternCreation: { + getType: jest.fn(() => mockIndexPatternCreationType), + }, es: search.__LEGACY.esClient, indexPatterns, savedObjectsClient: savedObjects.client as SavedObjectsClient, uiSettings, changeUrl: jest.fn(), openConfirm: overlays.openConfirm, - indexPatternCreationType: mockIndexPatternCreationType, - prependBasePath: jest.fn(x => x), + setBreadcrumbs: jest.fn(), + docTitle: chrome.docTitle, + prependBasePath: http.basePath.prepend, +} as unknown) as CreateIndexPatternWizardProps['services']; + +const routeComponentPropsMock = { + history: { + push: jest.fn(), + } as any, + location: {} as any, + match: {} as any, }; describe('CreateIndexPatternWizard', () => { test(`defaults to the loading state`, () => { const component = shallow( - + ); expect(component).toMatchSnapshot(); @@ -71,7 +83,7 @@ describe('CreateIndexPatternWizard', () => { test('renders the empty state when there are no indices', async () => { const component = shallow( - + ); component.setState({ @@ -86,7 +98,7 @@ describe('CreateIndexPatternWizard', () => { test('renders when there are no indices but there are remote clusters', async () => { const component = shallow( - + ); component.setState({ @@ -101,7 +113,7 @@ describe('CreateIndexPatternWizard', () => { test('shows system indices even if there are no other indices if the include system indices is toggled', async () => { const component = shallow( - + ); component.setState({ @@ -116,7 +128,7 @@ describe('CreateIndexPatternWizard', () => { test('renders index pattern step when there are indices', async () => { const component = shallow( - + ); component.setState({ @@ -130,7 +142,7 @@ describe('CreateIndexPatternWizard', () => { test('renders time field step when step is set to 2', async () => { const component = shallow( - + ); component.setState({ @@ -159,7 +171,7 @@ describe('CreateIndexPatternWizard', () => { }; const component = shallow( - + ); component.setState({ indexPattern: 'foo' }); @@ -167,6 +179,6 @@ describe('CreateIndexPatternWizard', () => { expect(services.uiSettings.get).toBeCalled(); expect(create).toBeCalled(); expect(clear).toBeCalledWith('id'); - expect(services.changeUrl).toBeCalledWith(`/management/kibana/index_patterns/id`); + expect(routeComponentPropsMock.history.push).toBeCalledWith(`/patterns/id`); }); }); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx similarity index 68% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.tsx rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx index a1a263fe88923..62bf47546e103 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/create_index_pattern_wizard.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx @@ -19,38 +19,42 @@ import React, { ReactElement, Component } from 'react'; -import { EuiGlobalToastList, EuiGlobalToastListToast } from '@elastic/eui'; +import { EuiGlobalToastList, EuiGlobalToastListToast, EuiPanel } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; +import { + SavedObjectsClientContract, + IUiSettingsClient, + OverlayStart, + ChromeDocTitle, + IBasePath, +} from 'src/core/public'; +import { DataPublicPluginStart } from 'src/plugins/data/public'; +import { ManagementAppMountParams } from '../../../../management/public'; import { StepIndexPattern } from './components/step_index_pattern'; import { StepTimeField } from './components/step_time_field'; import { Header } from './components/header'; import { LoadingState } from './components/loading_state'; import { EmptyState } from './components/empty_state'; +import { getCreateBreadcrumbs } from '../breadcrumbs'; import { MAX_SEARCH_SIZE } from './constants'; import { ensureMinimumTime, getIndices } from './lib'; -import { - SavedObjectsClient, - IUiSettingsClient, - OverlayStart, - IBasePath, -} from '../../../../../../../../core/public'; -import { DataPublicPluginStart } from '../../../../../../../../plugins/data/public'; -import { IndexPatternCreationConfig } from '../../../../../../../../plugins/index_pattern_management/public'; +import { IndexPatternCreationConfig, IndexPatternManagementStart } from '../..'; import { MatchedIndex } from './types'; -interface CreateIndexPatternWizardProps { - initialQuery: string; +export interface CreateIndexPatternWizardProps extends RouteComponentProps { services: { - indexPatternCreationType: IndexPatternCreationConfig; + indexPatternCreation: IndexPatternManagementStart['creation']; es: DataPublicPluginStart['search']['__LEGACY']['esClient']; indexPatterns: DataPublicPluginStart['indexPatterns']; - savedObjectsClient: SavedObjectsClient; + savedObjectsClient: SavedObjectsClientContract; uiSettings: IUiSettingsClient; - changeUrl: (url: string) => void; openConfirm: OverlayStart['openConfirm']; + setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; + docTitle: ChromeDocTitle; prependBasePath: IBasePath['prepend']; }; } @@ -63,21 +67,35 @@ interface CreateIndexPatternWizardState { isInitiallyLoadingIndices: boolean; isIncludingSystemIndices: boolean; toasts: EuiGlobalToastListToast[]; + indexPatternCreationType: IndexPatternCreationConfig; } export class CreateIndexPatternWizard extends Component< CreateIndexPatternWizardProps, CreateIndexPatternWizardState > { - state = { - step: 1, - indexPattern: '', - allIndices: [], - remoteClustersExist: false, - isInitiallyLoadingIndices: true, - isIncludingSystemIndices: false, - toasts: [], - }; + constructor(props: CreateIndexPatternWizardProps) { + super(props); + const { + services: { indexPatternCreation, setBreadcrumbs }, + location, + } = props; + + setBreadcrumbs(getCreateBreadcrumbs()); + + const type = new URLSearchParams(location.search).get('type') || undefined; + + this.state = { + step: 1, + indexPattern: '', + allIndices: [], + remoteClustersExist: false, + isInitiallyLoadingIndices: true, + isIncludingSystemIndices: false, + toasts: [], + indexPatternCreationType: indexPatternCreation.getType(type), + }; + } async UNSAFE_componentWillMount() { this.fetchData(); @@ -116,14 +134,14 @@ export class CreateIndexPatternWizard extends Component< const indicesFailMsg = ( ); const clustersFailMsg = ( ); @@ -131,7 +149,7 @@ export class CreateIndexPatternWizard extends Component< // query local and remote indices, updating state independently ensureMinimumTime( this.catchAndWarn( - getIndices(services.es, services.indexPatternCreationType, `*`, MAX_SEARCH_SIZE), + getIndices(services.es, this.state.indexPatternCreationType, `*`, MAX_SEARCH_SIZE), [], indicesFailMsg ) @@ -142,7 +160,7 @@ export class CreateIndexPatternWizard extends Component< this.catchAndWarn( // if we get an error from remote cluster query, supply fallback value that allows user entry. // ['a'] is fallback value - getIndices(services.es, services.indexPatternCreationType, `*:*`, 1), + getIndices(services.es, this.state.indexPatternCreationType, `*:*`, 1), ['a'], clustersFailMsg ).then((remoteIndices: string[] | MatchedIndex[]) => @@ -151,7 +169,7 @@ export class CreateIndexPatternWizard extends Component< }; createIndexPattern = async (timeFieldName: string | undefined, indexPatternId: string) => { - const { services } = this.props; + const { services, history } = this.props; const { indexPattern } = this.state; const emptyPattern = await services.indexPatterns.make(); @@ -160,24 +178,30 @@ export class CreateIndexPatternWizard extends Component< id: indexPatternId, title: indexPattern, timeFieldName, - ...services.indexPatternCreationType.getIndexPatternMappings(), + ...this.state.indexPatternCreationType.getIndexPatternMappings(), }); const createdId = await emptyPattern.create(); if (!createdId) { - const confirmMessage = i18n.translate('kbn.management.indexPattern.titleExistsLabel', { - values: { title: emptyPattern.title }, - defaultMessage: "An index pattern with the title '{title}' already exists.", - }); + const confirmMessage = i18n.translate( + 'indexPatternManagement.indexPattern.titleExistsLabel', + { + values: { title: emptyPattern.title }, + defaultMessage: "An index pattern with the title '{title}' already exists.", + } + ); const isConfirmed = await services.openConfirm(confirmMessage, { - confirmButtonText: i18n.translate('kbn.management.indexPattern.goToPatternButtonLabel', { - defaultMessage: 'Go to existing pattern', - }), + confirmButtonText: i18n.translate( + 'indexPatternManagement.indexPattern.goToPatternButtonLabel', + { + defaultMessage: 'Go to existing pattern', + } + ), }); if (isConfirmed) { - return services.changeUrl(`/management/kibana/index_patterns/${indexPatternId}`); + return history.push(`/patterns/${indexPatternId}`); } else { return false; } @@ -188,7 +212,7 @@ export class CreateIndexPatternWizard extends Component< } services.indexPatterns.clearCache(createdId); - services.changeUrl(`/management/kibana/index_patterns/${createdId}`); + history.push(`/patterns/${createdId}`); }; goToTimeFieldStep = (indexPattern: string) => { @@ -211,12 +235,13 @@ export class CreateIndexPatternWizard extends Component< return (
); } @@ -246,7 +271,9 @@ export class CreateIndexPatternWizard extends Component< } if (step === 1) { - const { services, initialQuery } = this.props; + const { services, location } = this.props; + const initialQuery = new URLSearchParams(location.search).get('id') || undefined; + return ( @@ -269,7 +296,7 @@ export class CreateIndexPatternWizard extends Component< indexPatternsService={services.indexPatterns} goToPreviousStep={this.goToIndexPatternStep} createIndexPattern={this.createIndexPattern} - indexPatternCreationType={services.indexPatternCreationType} + indexPatternCreationType={this.state.indexPatternCreationType} /> ); } @@ -288,7 +315,7 @@ export class CreateIndexPatternWizard extends Component< const content = this.renderContent(); return ( - +
{header} {content} @@ -300,7 +327,9 @@ export class CreateIndexPatternWizard extends Component< }} toastLifeTimeMs={6000} /> - + ); } } + +export const CreateIndexPatternWizardWithRouter = withRouter(CreateIndexPatternWizard); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts new file mode 100644 index 0000000000000..893021141aa24 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts @@ -0,0 +1,20 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { CreateIndexPatternWizardWithRouter } from './create_index_pattern_wizard'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/can_append_wildcard.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/can_append_wildcard.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.test.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/can_append_wildcard.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/can_append_wildcard.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/contains_illegal_characters.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_illegal_characters.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/contains_illegal_characters.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_illegal_characters.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/ensure_minimum_time.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/ensure_minimum_time.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/extract_time_fields.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/extract_time_fields.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/extract_time_fields.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts similarity index 80% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/extract_time_fields.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts index 0b95ec0a120da..809c9f77b2832 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/extract_time_fields.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts @@ -18,13 +18,16 @@ */ import { i18n } from '@kbn/i18n'; -import { IFieldType } from '../../../../../../../../../plugins/data/public'; +import { IFieldType } from '../../../../../../plugins/data/public'; export function extractTimeFields(fields: IFieldType[]) { const dateFields = fields.filter(field => field.type === 'date'); - const label = i18n.translate('kbn.management.createIndexPattern.stepTime.noTimeFieldsLabel', { - defaultMessage: "The indices which match this index pattern don't contain any time fields.", - }); + const label = i18n.translate( + 'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldsLabel', + { + defaultMessage: "The indices which match this index pattern don't contain any time fields.", + } + ); if (dateFields.length === 0) { return [ @@ -40,7 +43,7 @@ export function extractTimeFields(fields: IFieldType[]) { fieldName: '', }; const noTimeFieldLabel = i18n.translate( - 'kbn.management.createIndexPattern.stepTime.noTimeFieldOptionLabel', + 'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldOptionLabel', { defaultMessage: "I don't want to use the Time Filter", } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts index b1500f8303b66..1c67fea9fa352 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts @@ -18,9 +18,9 @@ */ import { getIndices } from './get_indices'; -import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public'; +import { IndexPatternCreationConfig } from '../../../../../index_pattern_management/public'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search/legacy'; +import { LegacyApiCaller } from '../../../../../data/public/search/legacy'; export const successfulResponse = { hits: { diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts similarity index 93% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts index 3b1b7a3b52a5b..9f75dc39a654c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts @@ -18,8 +18,8 @@ */ import { get, sortBy } from 'lodash'; -import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public'; -import { DataPublicPluginStart } from '../../../../../../../../../plugins/data/public'; +import { IndexPatternCreationConfig } from '../../../../../index_pattern_management/public'; +import { DataPublicPluginStart } from '../../../../../data/public'; import { MatchedIndex } from '../types'; export async function getIndices( diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_matched_indices.test.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_matched_indices.test.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.test.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_matched_indices.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_matched_indices.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/index.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/types.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/types.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/types.ts rename to src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/types.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/constants.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/constants.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/constants.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/constants.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx similarity index 52% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx index 3b865f7d5e1ea..fb5c27774f506 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx @@ -18,34 +18,36 @@ */ import React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -// @ts-ignore -import { FieldEditor } from 'ui/field_editor'; -import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { HttpStart, DocLinksStart } from 'src/core/public'; -import { IndexPattern, DataPublicPluginStart } from 'src/plugins/data/public'; +import { ChromeDocTitle, NotificationsStart, IUiSettingsClient } from 'src/core/public'; +import { IndexPattern, DataPublicPluginStart } from '../../../../../../plugins/data/public'; import { IndexHeader } from '../index_header'; -import { ChromeDocTitle, NotificationsStart } from '../../../../../../../../../core/public'; import { TAB_SCRIPTED_FIELDS, TAB_INDEXED_FIELDS } from '../constants'; +import { FieldEditor } from '../../field_editor'; + interface CreateEditFieldProps extends RouteComponentProps { indexPattern: IndexPattern; mode?: string; fieldName?: string; fieldFormatEditors: any; - getConfig: (name: string) => any; services: { - dataStart: DataPublicPluginStart; - notifications: NotificationsStart; + uiSettings: IUiSettingsClient; docTitle: ChromeDocTitle; - getHttpStart: () => HttpStart; + http: HttpStart; docLinksScriptedFields: DocLinksStart['links']['scriptedFields']; + SearchBar: DataPublicPluginStart['ui']['SearchBar']; + toasts: NotificationsStart['toasts']; + fieldFormats: DataPublicPluginStart['fieldFormats']; + indexPatterns: DataPublicPluginStart['indexPatterns']; }; } const newFieldPlaceholder = i18n.translate( - 'kbn.management.editIndexPattern.scripted.newFieldPlaceholder', + 'indexPatternManagement.editIndexPattern.scripted.newFieldPlaceholder', { defaultMessage: 'New Scripted Field', } @@ -57,14 +59,13 @@ export const CreateEditField = withRouter( mode, fieldName, fieldFormatEditors, - getConfig, services, history, }: CreateEditFieldProps) => { const field = mode === 'edit' && fieldName ? indexPattern.fields.getByName(fieldName) - : services.dataStart.indexPatterns.createField( + : services.indexPatterns.createField( indexPattern, { scripted: true, @@ -73,15 +74,18 @@ export const CreateEditField = withRouter( false ); - const url = `/management/kibana/index_patterns/${indexPattern.id}`; + const url = `/patterns/${indexPattern.id}`; if (mode === 'edit' && !field) { - const message = i18n.translate('kbn.management.editIndexPattern.scripted.noFieldLabel', { - defaultMessage: - "'{indexPatternTitle}' index pattern doesn't have a scripted field called '{fieldName}'", - values: { indexPatternTitle: indexPattern.title, fieldName }, - }); - services.notifications.toasts.addWarning(message); + const message = i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.noFieldLabel', + { + defaultMessage: + "'{indexPatternTitle}' index pattern doesn't have a scripted field called '{fieldName}'", + values: { indexPatternTitle: indexPattern.title, fieldName }, + } + ); + services.toasts.addWarning(message); history.push(url); } @@ -95,24 +99,33 @@ export const CreateEditField = withRouter( if (field) { return ( - - - - - - - - + + + + + + + + + + ); } else { return <>; diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field_container.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field_container.tsx new file mode 100644 index 0000000000000..70851b712d756 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field_container.tsx @@ -0,0 +1,95 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { useEffect, useState } from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; + +import { + HttpStart, + DocLinksStart, + ChromeDocTitle, + NotificationsStart, + IUiSettingsClient, +} from 'src/core/public'; + +import { IndexPattern, DataPublicPluginStart } from '../../../../../../plugins/data/public'; +import { ManagementAppMountParams } from '../../../../../management/public'; +import { getEditFieldBreadcrumbs, getCreateFieldBreadcrumbs } from '../../breadcrumbs'; +import { CreateEditField } from './create_edit_field'; + +export interface CreateEditFieldContainerProps + extends RouteComponentProps<{ id: string; fieldName: string }> { + getIndexPattern: (id: string) => Promise; + fieldFormatEditors: any; + getConfig: IUiSettingsClient; + services: { + uiSettings: IUiSettingsClient; + notifications: NotificationsStart; + docTitle: ChromeDocTitle; + http: HttpStart; + docLinksScriptedFields: DocLinksStart['links']['scriptedFields']; + SearchBar: DataPublicPluginStart['ui']['SearchBar']; + toasts: NotificationsStart['toasts']; + fieldFormats: DataPublicPluginStart['fieldFormats']; + indexPatterns: DataPublicPluginStart['indexPatterns']; + setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; + }; +} + +const CreateEditFieldCont: React.FC = ({ ...props }) => { + const [indexPattern, setIndexPattern] = useState(); + + useEffect(() => { + props.getIndexPattern(props.match.params.id).then((ip: IndexPattern) => { + setIndexPattern(ip); + if (ip) { + props.services.setBreadcrumbs( + props.match.params.fieldName + ? getEditFieldBreadcrumbs(ip, props.match.params.fieldName) + : getCreateFieldBreadcrumbs(ip) + ); + } + }); + }, [props.match.params.id, props.getIndexPattern, props]); + + if (indexPattern) { + return ( + + ); + } else { + return <>; + } +}; + +export const CreateEditFieldContainer = withRouter(CreateEditFieldCont); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/index.ts new file mode 100644 index 0000000000000..84dce3b0f8301 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { CreateEditField } from './create_edit_field'; +export { CreateEditFieldContainer } from './create_edit_field_container'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx similarity index 51% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx index e869ac84c2db2..f1c020cc409e0 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx @@ -29,69 +29,75 @@ import { EuiLink, EuiIcon, EuiCallOut, + EuiPanel, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { IndexPattern, IndexPatternField } from '../../../../../../../../plugins/data/public'; import { ChromeDocTitle, NotificationsStart, OverlayStart, -} from '../../../../../../../../core/public'; -import { IndexPatternManagementStart } from '../../../../../../../../plugins/index_pattern_management/public'; + IUiSettingsClient, + SavedObjectsClientContract, +} from 'src/core/public'; +import { IndexPattern, IndexPatternField } from '../../../../../plugins/data/public'; +import { IndexPatternManagementStart } from '../..'; import { Tabs } from './tabs'; import { IndexHeader } from './index_header'; +import { IndexPatternTableItem } from '../types'; +import { getIndexPatterns } from '../utils'; interface EditIndexPatternProps extends RouteComponentProps { indexPattern: IndexPattern; - indexPatterns: IndexPattern[]; - config: Record; + config: IUiSettingsClient; services: { notifications: NotificationsStart; docTitle: ChromeDocTitle; overlays: OverlayStart; + savedObjectsClient: SavedObjectsClientContract; indexPatternManagement: IndexPatternManagementStart; + painlessDocLink: string; }; } const mappingAPILink = i18n.translate( - 'kbn.management.editIndexPattern.timeFilterLabel.mappingAPILink', + 'indexPatternManagement.editIndexPattern.timeFilterLabel.mappingAPILink', { defaultMessage: 'Mapping API', } ); const mappingConflictHeader = i18n.translate( - 'kbn.management.editIndexPattern.mappingConflictHeader', + 'indexPatternManagement.editIndexPattern.mappingConflictHeader', { defaultMessage: 'Mapping conflict', } ); -const confirmMessage = i18n.translate('kbn.management.editIndexPattern.refreshLabel', { +const confirmMessage = i18n.translate('indexPatternManagement.editIndexPattern.refreshLabel', { defaultMessage: 'This action resets the popularity counter of each field.', }); const confirmModalOptionsRefresh = { - confirmButtonText: i18n.translate('kbn.management.editIndexPattern.refreshButton', { + confirmButtonText: i18n.translate('indexPatternManagement.editIndexPattern.refreshButton', { defaultMessage: 'Refresh', }), - title: i18n.translate('kbn.management.editIndexPattern.refreshHeader', { + title: i18n.translate('indexPatternManagement.editIndexPattern.refreshHeader', { defaultMessage: 'Refresh field list?', }), }; const confirmModalOptionsDelete = { - confirmButtonText: i18n.translate('kbn.management.editIndexPattern.deleteButton', { + confirmButtonText: i18n.translate('indexPatternManagement.editIndexPattern.deleteButton', { defaultMessage: 'Delete', }), - title: i18n.translate('kbn.management.editIndexPattern.deleteHeader', { + title: i18n.translate('indexPatternManagement.editIndexPattern.deleteHeader', { defaultMessage: 'Delete index pattern?', }), }; export const EditIndexPattern = withRouter( - ({ indexPattern, indexPatterns, config, services, history, location }: EditIndexPatternProps) => { + ({ indexPattern, config, services, history, location }: EditIndexPatternProps) => { const [fields, setFields] = useState(indexPattern.getNonScriptedFields()); const [conflictedFields, setConflictedFields] = useState( indexPattern.fields.filter(field => field.type === 'conflict') @@ -102,7 +108,7 @@ export const EditIndexPattern = withRouter( useEffect(() => { setFields(indexPattern.getNonScriptedFields()); setConflictedFields(indexPattern.fields.filter(field => field.type === 'conflict')); - }, [indexPattern, indexPattern.fields]); + }, [indexPattern]); useEffect(() => { const indexPatternTags = @@ -129,9 +135,14 @@ export const EditIndexPattern = withRouter( }); }; - const removePattern = () => { - function doRemove() { + const removePatternClick = () => { + async function doRemove() { if (indexPattern.id === defaultIndex) { + const indexPatterns: IndexPatternTableItem[] = await getIndexPatterns( + services.savedObjectsClient, + config.get('defaultIndex'), + services.indexPatternManagement + ); config.remove('defaultIndex'); const otherPatterns = filter(indexPatterns, pattern => { return pattern.id !== indexPattern.id; @@ -143,7 +154,7 @@ export const EditIndexPattern = withRouter( } Promise.resolve(indexPattern.destroy()).then(function() { - history.push('/management/kibana/index_patterns'); + history.push(''); }); } @@ -154,13 +165,16 @@ export const EditIndexPattern = withRouter( }); }; - const timeFilterHeader = i18n.translate('kbn.management.editIndexPattern.timeFilterHeader', { - defaultMessage: "Time Filter field name: '{timeFieldName}'", - values: { timeFieldName: indexPattern.timeFieldName }, - }); + const timeFilterHeader = i18n.translate( + 'indexPatternManagement.editIndexPattern.timeFilterHeader', + { + defaultMessage: "Time Filter field name: '{timeFieldName}'", + values: { timeFieldName: indexPattern.timeFieldName }, + } + ); const mappingConflictLabel = i18n.translate( - 'kbn.management.editIndexPattern.mappingConflictLabel', + 'indexPatternManagement.editIndexPattern.mappingConflictLabel', { defaultMessage: '{conflictFieldsLength, plural, one {A field is} other {# fields are}} defined as several types (string, integer, etc) across the indices that match this pattern. You may still be able to use these conflict fields in parts of Kibana, but they will be unavailable for functions that require Kibana to know their type. Correcting this issue will require reindexing your data.', @@ -168,71 +182,80 @@ export const EditIndexPattern = withRouter( } ); + const headingAriaLabel = i18n.translate('indexPatternManagement.editIndexPattern.detailsAria', { + defaultMessage: 'Index pattern details', + }); + services.docTitle.change(indexPattern.title); const showTagsSection = Boolean(indexPattern.timeFieldName || (tags && tags.length > 0)); return ( - - - - - {showTagsSection && ( - - {Boolean(indexPattern.timeFieldName) && ( - - {timeFilterHeader} - + +
+ + + + + {showTagsSection && ( + + {Boolean(indexPattern.timeFieldName) && ( + + {timeFilterHeader} + + )} + {tags.map((tag: any) => ( + + {tag.name} + + ))} + + )} + + +

+ {indexPattern.title} }} + />{' '} + + {mappingAPILink} + + +

+ + {conflictedFields.length > 0 && ( + +

{mappingConflictLabel}

+
)} - {tags.map((tag: any) => ( - - {tag.name} - - ))} - - )} - - -

- {indexPattern.title} }} - />{' '} - - {mappingAPILink} - - -

-
- {conflictedFields.length > 0 && ( - -

{mappingConflictLabel}

-
- )} - - - - - + + + + + +
+ ); } ); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_container.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_container.tsx new file mode 100644 index 0000000000000..2f02765cd0596 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_container.tsx @@ -0,0 +1,73 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { useEffect, useState } from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; +import { + ChromeDocTitle, + NotificationsStart, + OverlayStart, + IUiSettingsClient, + SavedObjectsClientContract, +} from 'src/core/public'; +import { IndexPattern } from '../../../../../plugins/data/public'; +import { ManagementAppMountParams } from '../../../../management/public'; +import { IndexPatternManagementStart } from '../..'; +import { getEditBreadcrumbs } from '../breadcrumbs'; + +import { EditIndexPattern } from '../edit_index_pattern'; + +interface EditIndexPatternContainerProps extends RouteComponentProps<{ id: string }> { + getIndexPattern: (id: string) => Promise; + config: IUiSettingsClient; + services: { + notifications: NotificationsStart; + docTitle: ChromeDocTitle; + overlays: OverlayStart; + savedObjectsClient: SavedObjectsClientContract; + setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; + indexPatternManagement: IndexPatternManagementStart; + painlessDocLink: string; + }; +} + +const EditIndexPatternCont: React.FC = ({ ...props }) => { + const [indexPattern, setIndexPattern] = useState(); + + useEffect(() => { + props.getIndexPattern(props.match.params.id).then((ip: IndexPattern) => { + setIndexPattern(ip); + props.services.setBreadcrumbs(getEditBreadcrumbs(ip)); + }); + }, [props.match.params.id, props.getIndexPattern, props]); + + if (indexPattern) { + return ( + + ); + } else { + return <>; + } +}; + +export const EditIndexPatternContainer = withRouter(EditIndexPatternCont); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern_state_container.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_state_container.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern_state_container.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_state_container.ts index 5723a596f95d5..f99a5b072b423 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern_state_container.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern_state_container.ts @@ -22,7 +22,7 @@ import { createStateContainer, syncState, createKbnUrlStateStorage, -} from '../../../../../../../../plugins/kibana_utils/public'; +} from '../../../../../plugins/kibana_utils/public'; interface IEditIndexPatternState { tab: string; diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/index.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/index.tsx new file mode 100644 index 0000000000000..288ce115a7803 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/index.tsx @@ -0,0 +1,23 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { EditIndexPattern } from './edit_index_pattern'; +export { EditIndexPatternContainer } from './edit_index_pattern_container'; +export { CreateEditField } from './create_edit_field'; +export { CreateEditFieldContainer } from './create_edit_field/create_edit_field_container'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index_header/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/index_header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index_header/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/index_header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index_header/index_header.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/index_header/index_header.tsx similarity index 78% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index_header/index_header.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/index_header/index_header.tsx index a06671ef6a470..4cf43d63d5839 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index_header/index_header.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/index_header/index_header.tsx @@ -27,37 +27,43 @@ import { EuiTitle, EuiButtonIcon, } from '@elastic/eui'; -import { IIndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from 'src/plugins/data/public'; interface IndexHeaderProps { indexPattern: IIndexPattern; defaultIndex?: string; setDefault?: () => void; refreshFields?: () => void; - deleteIndexPattern?: () => void; + deleteIndexPatternClick?: () => void; } -const setDefaultAriaLabel = i18n.translate('kbn.management.editIndexPattern.setDefaultAria', { - defaultMessage: 'Set as default index.', -}); +const setDefaultAriaLabel = i18n.translate( + 'indexPatternManagement.editIndexPattern.setDefaultAria', + { + defaultMessage: 'Set as default index.', + } +); -const setDefaultTooltip = i18n.translate('kbn.management.editIndexPattern.setDefaultTooltip', { - defaultMessage: 'Set as default index.', -}); +const setDefaultTooltip = i18n.translate( + 'indexPatternManagement.editIndexPattern.setDefaultTooltip', + { + defaultMessage: 'Set as default index.', + } +); -const refreshAriaLabel = i18n.translate('kbn.management.editIndexPattern.refreshAria', { +const refreshAriaLabel = i18n.translate('indexPatternManagement.editIndexPattern.refreshAria', { defaultMessage: 'Reload field list.', }); -const refreshTooltip = i18n.translate('kbn.management.editIndexPattern.refreshTooltip', { +const refreshTooltip = i18n.translate('indexPatternManagement.editIndexPattern.refreshTooltip', { defaultMessage: 'Refresh field list.', }); -const removeAriaLabel = i18n.translate('kbn.management.editIndexPattern.removeAria', { +const removeAriaLabel = i18n.translate('indexPatternManagement.editIndexPattern.removeAria', { defaultMessage: 'Remove index pattern.', }); -const removeTooltip = i18n.translate('kbn.management.editIndexPattern.removeTooltip', { +const removeTooltip = i18n.translate('indexPatternManagement.editIndexPattern.removeTooltip', { defaultMessage: 'Remove index pattern.', }); @@ -66,7 +72,7 @@ export function IndexHeader({ indexPattern, setDefault, refreshFields, - deleteIndexPattern, + deleteIndexPatternClick, }: IndexHeaderProps) { return ( @@ -114,12 +120,12 @@ export function IndexHeader({ )} - {deleteIndexPattern && ( + {deleteIndexPatternClick && ( ({ diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx similarity index 98% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx index c69063967b1e2..6b1048d3c9d0c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.tsx @@ -23,7 +23,7 @@ import { IndexPatternField, IIndexPattern, IFieldType, -} from '../../../../../../../../../plugins/data/public'; +} from '../../../../../../plugins/data/public'; import { Table } from './components/table'; import { getFieldFormat } from './lib'; import { IndexedFieldItem } from './types'; @@ -108,7 +108,6 @@ export class IndexedFieldsTable extends Component< render() { const { indexPattern } = this.props; - const fields = this.getFilteredFields(this.state, this.props); return ( diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts index fc7477c074ac2..2786df641fdb2 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IIndexPattern } from '../../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from '../../../../../../data/public'; import { getFieldFormat } from './get_field_format'; const indexPattern = ({ diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts index 1d6f267430f07..861017d99962e 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/get_field_format.ts @@ -18,7 +18,7 @@ */ import { get } from 'lodash'; -import { IIndexPattern } from '../../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from '../../../../../../data/public'; export function getFieldFormat(indexPattern?: IIndexPattern, fieldName?: string): string { return indexPattern && fieldName diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/lib/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/lib/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/types.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/types.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts index f27f4608bf5d5..30466bc57bada 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/indexed_fields_table/types.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IFieldType } from '../../../../../../../../../plugins/data/public'; +import { IFieldType } from '../../../../../../plugins/data/public'; export interface IndexedFieldItem extends IFieldType { info: string[]; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap similarity index 82% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap index 202b09ddc6066..c0ecc441e9018 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/__snapshots__/scripted_field_table.test.tsx.snap @@ -3,7 +3,7 @@ exports[`ScriptedFieldsTable should filter based on the lang filter 1`] = `
} @@ -16,7 +16,7 @@ exports[`CallOuts should render normally 1`] = `

, diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx similarity index 87% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx index 8e38b569a32fa..31d1e4e40bcd5 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/call_outs.tsx @@ -37,7 +37,7 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProp } @@ -46,7 +46,7 @@ export const CallOuts = ({ deprecatedLangsInUse, painlessDocLink }: CallOutsProp >

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/call_outs/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/call_outs/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx similarity index 83% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx index 1e82174f863b0..ece706798a55f 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/confirmation_modal.tsx @@ -35,16 +35,19 @@ export const DeleteScritpedFieldConfirmationModal = ({ hideDeleteConfirmationModal, deleteField, }: DeleteScritpedFieldConfirmationModalProps) => { - const title = i18n.translate('kbn.management.editIndexPattern.scripted.deleteFieldLabel', { - defaultMessage: "Delete scripted field '{fieldName}'?", - values: { fieldName: field.name }, - }); + const title = i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.deleteFieldLabel', + { + defaultMessage: "Delete scripted field '{fieldName}'?", + values: { fieldName: field.name }, + } + ); const cancelButtonText = i18n.translate( - 'kbn.management.editIndexPattern.scripted.deleteField.cancelButton', + 'indexPatternManagement.editIndexPattern.scripted.deleteField.cancelButton', { defaultMessage: 'Cancel' } ); const confirmButtonText = i18n.translate( - 'kbn.management.editIndexPattern.scripted.deleteField.deleteButton', + 'indexPatternManagement.editIndexPattern.scripted.deleteField.deleteButton', { defaultMessage: 'Delete' } ); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/confirmation_modal/index.ts diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap new file mode 100644 index 0000000000000..6261ea2c90793 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Header should render normally 1`] = ` +

+
+

+ + Scripted fields + +

+
+

+ + You can use scripted fields in visualizations and display them in your documents. However, you cannot search scripted fields. + +

+
+
+
+ +
+
+`; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx similarity index 71% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx index 19479de8f2aa4..11fdae39aee3c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx @@ -18,13 +18,21 @@ */ import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from 'enzyme'; +import { RouteComponentProps } from 'react-router-dom'; import { Header } from './header'; describe('Header', () => { test('should render normally', () => { - const component = shallow(
); + const component = render( + + ); expect(component).toMatchSnapshot(); }); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx similarity index 72% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx index b8f832dad72af..dc48f61d1aa65 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/header.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx @@ -18,21 +18,22 @@ */ import React from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -interface HeaderProps { - addScriptedFieldUrl: string; +interface HeaderProps extends RouteComponentProps { + indexPatternId: string; } -export const Header = ({ addScriptedFieldUrl }: HeaderProps) => ( +export const Header = withRouter(({ indexPatternId, history }: HeaderProps) => (

@@ -40,7 +41,7 @@ export const Header = ({ addScriptedFieldUrl }: HeaderProps) => (

@@ -49,12 +50,17 @@ export const Header = ({ addScriptedFieldUrl }: HeaderProps) => ( - + { + history.push(`${indexPatternId}/create-field/`); + }} + > -); +)); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/header/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/__snapshots__/table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/__snapshots__/table.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/__snapshots__/table.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/__snapshots__/table.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx similarity index 97% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx index 13b3875f58687..26044f910159a 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.test.tsx @@ -22,7 +22,7 @@ import { shallow } from 'enzyme'; import { Table } from '../table'; import { ScriptedFieldItem } from '../../types'; -import { IIndexPattern } from '../../../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from 'src/plugins/data/public'; const getIndexPatternMock = (mockedFields: any = {}) => ({ ...mockedFields } as IIndexPattern); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.tsx similarity index 68% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.tsx index 14aed11b32203..51ca59ee7b032 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/components/table/table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/table/table.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { EuiInMemoryTable, EuiBasicTableColumn } from '@elastic/eui'; import { ScriptedFieldItem } from '../../types'; -import { IIndexPattern } from '../../../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from '../../../../../../../data/public'; interface TableProps { indexPattern: IIndexPattern; @@ -46,11 +46,11 @@ export class Table extends PureComponent { const columns: Array> = [ { field: 'displayName', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.nameHeader', { + name: i18n.translate('indexPatternManagement.editIndexPattern.scripted.table.nameHeader', { defaultMessage: 'Name', }), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.nameDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.nameDescription', { defaultMessage: 'Name of the field' } ), dataType: 'string', @@ -59,11 +59,11 @@ export class Table extends PureComponent { }, { field: 'lang', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.langHeader', { + name: i18n.translate('indexPatternManagement.editIndexPattern.scripted.table.langHeader', { defaultMessage: 'Lang', }), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.langDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.langDescription', { defaultMessage: 'Language used for the field' } ), dataType: 'string', @@ -72,11 +72,14 @@ export class Table extends PureComponent { }, { field: 'script', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.scriptHeader', { - defaultMessage: 'Script', - }), + name: i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.table.scriptHeader', + { + defaultMessage: 'Script', + } + ), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.scriptDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.scriptDescription', { defaultMessage: 'Script for the field' } ), dataType: 'string', @@ -84,11 +87,14 @@ export class Table extends PureComponent { }, { field: 'name', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.formatHeader', { - defaultMessage: 'Format', - }), + name: i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.table.formatHeader', + { + defaultMessage: 'Format', + } + ), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.formatDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.formatDescription', { defaultMessage: 'Format used for the field' } ), render: this.renderFormatCell, @@ -99,11 +105,14 @@ export class Table extends PureComponent { actions: [ { type: 'icon', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.editHeader', { - defaultMessage: 'Edit', - }), + name: i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.table.editHeader', + { + defaultMessage: 'Edit', + } + ), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.editDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.editDescription', { defaultMessage: 'Edit this field' } ), icon: 'pencil', @@ -111,11 +120,14 @@ export class Table extends PureComponent { }, { type: 'icon', - name: i18n.translate('kbn.management.editIndexPattern.scripted.table.deleteHeader', { - defaultMessage: 'Delete', - }), + name: i18n.translate( + 'indexPatternManagement.editIndexPattern.scripted.table.deleteHeader', + { + defaultMessage: 'Delete', + } + ), description: i18n.translate( - 'kbn.management.editIndexPattern.scripted.table.deleteDescription', + 'indexPatternManagement.editIndexPattern.scripted.table.deleteDescription', { defaultMessage: 'Delete this field' } ), icon: 'trash', diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx similarity index 89% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx index 914d80f9f61d7..80132167b7f58 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_field_table.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { ScriptedFieldsTable } from '../scripted_fields_table'; -import { IIndexPattern } from '../../../../../../../../../plugins/data/common/index_patterns'; +import { IIndexPattern } from '../../../../../../plugins/data/common/index_patterns'; jest.mock('@elastic/eui', () => ({ EuiTitle: 'eui-title', @@ -46,11 +46,6 @@ jest.mock('./components/table', () => ({ }, })); -jest.mock('ui/scripting_languages', () => ({ - getSupportedScriptingLanguages: () => ['painless'], - getDeprecatedScriptingLanguages: () => [], -})); - jest.mock('ui/documentation_links', () => ({ documentationLinks: { scriptedFields: { @@ -80,7 +75,11 @@ describe('ScriptedFieldsTable', () => { test('should render normally', async () => { const component = shallow( - + ); // Allow the componentWillMount code to execute @@ -93,7 +92,11 @@ describe('ScriptedFieldsTable', () => { test('should filter based on the query bar', async () => { const component = shallow( - + ); // Allow the componentWillMount code to execute @@ -117,6 +120,7 @@ describe('ScriptedFieldsTable', () => { { name: 'Bad', lang: 'somethingElse', script: 'z++' }, ], })} + painlessDocLink={'painlessDoc'} helpers={helpers} /> ); @@ -138,6 +142,7 @@ describe('ScriptedFieldsTable', () => { indexPattern={getIndexPatternMock({ getScriptedFields: () => [], })} + painlessDocLink={'painlessDoc'} helpers={helpers} /> ); @@ -152,7 +157,11 @@ describe('ScriptedFieldsTable', () => { test('should show a delete modal', async () => { const component = shallow( - + ); await component.update(); // Fire `componentWillMount()` @@ -172,6 +181,7 @@ describe('ScriptedFieldsTable', () => { removeScriptedField, }} helpers={helpers} + painlessDocLink={'painlessDoc'} /> ); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx similarity index 88% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx index f2c2727c5c0bb..32520eadaf199 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/scripted_fields_table.tsx @@ -18,18 +18,16 @@ */ import React, { Component } from 'react'; +import { EuiSpacer } from '@elastic/eui'; import { getSupportedScriptingLanguages, getDeprecatedScriptingLanguages, -} from 'ui/scripting_languages'; -import { documentationLinks } from 'ui/documentation_links'; - -import { EuiSpacer } from '@elastic/eui'; +} from '../../../scripting_languages'; import { Table, Header, CallOuts, DeleteScritpedFieldConfirmationModal } from './components'; import { ScriptedFieldItem } from './types'; -import { IIndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from '../../../../../../plugins/data/public'; interface ScriptedFieldsTableProps { indexPattern: IIndexPattern; @@ -40,6 +38,7 @@ interface ScriptedFieldsTableProps { getRouteHref?: Function; }; onRemoveField?: () => void; + painlessDocLink: string; } interface ScriptedFieldsTableState { @@ -136,24 +135,16 @@ export class ScriptedFieldsTable extends Component< }; render() { - const { indexPattern } = this.props; + const { indexPattern, painlessDocLink } = this.props; const { fieldToDelete, deprecatedLangsInUse } = this.state; const items = this.getFilteredItems(); return ( <> -

+
- + diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/types.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/types.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/scripted_fields_table/types.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/types.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/__snapshots__/source_filters_table.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap similarity index 88% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap index 879ea555d3300..92998bc3f07e3 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/__snapshots__/add_filter.test.tsx.snap @@ -19,7 +19,7 @@ exports[`AddFilter should ignore strings with just spaces 1`] = ` > @@ -46,7 +46,7 @@ exports[`AddFilter should render normally 1`] = ` > diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/add_filter.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx index d0f397637de33..2a5e29827ccc5 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/add_filter.tsx @@ -27,10 +27,13 @@ interface AddFilterProps { onAddFilter: (filter: string) => void; } -const sourcePlaceholder = i18n.translate('kbn.management.editIndexPattern.sourcePlaceholder', { - defaultMessage: - "source filter, accepts wildcards (e.g., `user*` to filter fields starting with 'user')", -}); +const sourcePlaceholder = i18n.translate( + 'indexPatternManagement.editIndexPattern.sourcePlaceholder', + { + defaultMessage: + "source filter, accepts wildcards (e.g., `user*` to filter fields starting with 'user')", + } +); export const AddFilter = ({ onAddFilter }: AddFilterProps) => { const [filter, setFilter] = useState(''); @@ -53,7 +56,7 @@ export const AddFilter = ({ onAddFilter }: AddFilterProps) => { diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/add_filter/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/add_filter/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap similarity index 72% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap index 62376b498d887..0020adb19983d 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/confirmation_modal/__snapshots__/confirmation_modal.test.tsx.snap @@ -7,14 +7,14 @@ exports[`Header should render normally 1`] = ` cancelButtonText={ } confirmButtonText={ } @@ -24,7 +24,7 @@ exports[`Header should render normally 1`] = ` title={ } buttonColor="danger" confirmButtonText={ } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/confirmation_modal/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap index cde0de79caacd..1f380d68a5af5 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap @@ -8,7 +8,7 @@ exports[`Header should render normally 1`] = `

@@ -17,14 +17,14 @@ exports[`Header should render normally 1`] = `

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/header.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/header.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/header.tsx similarity index 90% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/header.tsx index 7b37f75043dd5..709908a1bb253 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/header.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/header.tsx @@ -27,7 +27,7 @@ export const Header = () => (

@@ -35,7 +35,7 @@ export const Header = () => (

diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/header/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap similarity index 95% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap index c70d0871bb854..cb8abdefec266 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/__snapshots__/table.test.tsx.snap @@ -29,7 +29,7 @@ exports[`Table editing should update the matches dynamically as input value is c diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.test.tsx similarity index 99% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.test.tsx index 4705ecd2d1685..421b5b67c2288 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.test.tsx @@ -22,7 +22,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { Table, TableProps, TableState } from './table'; import { EuiTableFieldDataColumnType, keyCodes } from '@elastic/eui'; -import { IIndexPattern } from '../../../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from 'src/plugins/data/public'; import { SourceFiltersTableFilter } from '../../types'; const indexPattern = {} as IIndexPattern; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx similarity index 85% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx index db2b74bbc9824..04998d9f7dafe 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/components/table/table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/table/table.tsx @@ -30,43 +30,54 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import { IIndexPattern } from 'src/plugins/data/public'; import { SourceFiltersTableFilter } from '../../types'; -import { IIndexPattern } from '../../../../../../../../../../../plugins/data/public'; - -const filterHeader = i18n.translate('kbn.management.editIndexPattern.source.table.filterHeader', { - defaultMessage: 'Filter', -}); +const filterHeader = i18n.translate( + 'indexPatternManagement.editIndexPattern.source.table.filterHeader', + { + defaultMessage: 'Filter', + } +); const filterDescription = i18n.translate( - 'kbn.management.editIndexPattern.source.table.filterDescription', + 'indexPatternManagement.editIndexPattern.source.table.filterDescription', { defaultMessage: 'Filter name' } ); -const matchesHeader = i18n.translate('kbn.management.editIndexPattern.source.table.matchesHeader', { - defaultMessage: 'Matches', -}); +const matchesHeader = i18n.translate( + 'indexPatternManagement.editIndexPattern.source.table.matchesHeader', + { + defaultMessage: 'Matches', + } +); const matchesDescription = i18n.translate( - 'kbn.management.editIndexPattern.source.table.matchesDescription', + 'indexPatternManagement.editIndexPattern.source.table.matchesDescription', { defaultMessage: 'Language used for the field' } ); -const editAria = i18n.translate('kbn.management.editIndexPattern.source.table.editAria', { +const editAria = i18n.translate('indexPatternManagement.editIndexPattern.source.table.editAria', { defaultMessage: 'Edit', }); -const saveAria = i18n.translate('kbn.management.editIndexPattern.source.table.saveAria', { +const saveAria = i18n.translate('indexPatternManagement.editIndexPattern.source.table.saveAria', { defaultMessage: 'Save', }); -const deleteAria = i18n.translate('kbn.management.editIndexPattern.source.table.deleteAria', { - defaultMessage: 'Delete', -}); +const deleteAria = i18n.translate( + 'indexPatternManagement.editIndexPattern.source.table.deleteAria', + { + defaultMessage: 'Delete', + } +); -const cancelAria = i18n.translate('kbn.management.editIndexPattern.source.table.cancelAria', { - defaultMessage: 'Cancel', -}); +const cancelAria = i18n.translate( + 'indexPatternManagement.editIndexPattern.source.table.cancelAria', + { + defaultMessage: 'Cancel', + } +); export interface TableProps { indexPattern: IIndexPattern; @@ -161,7 +172,7 @@ export class Table extends Component { return ( diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.test.tsx similarity index 98% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.test.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.test.tsx index 1b68dd13566d3..fa048af7c7a70 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { SourceFiltersTable } from './source_filters_table'; -import { IIndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from 'src/plugins/data/public'; jest.mock('@elastic/eui', () => ({ EuiButton: 'eui-button', diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.tsx similarity index 98% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.tsx index dcf8ae9e1323f..ccdda3915e979 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/source_filters_table.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/source_filters_table.tsx @@ -22,7 +22,7 @@ import { createSelector } from 'reselect'; import { EuiSpacer } from '@elastic/eui'; import { AddFilter, Table, Header, DeleteFilterConfirmationModal } from './components'; -import { IIndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IIndexPattern } from '../../../../../../plugins/data/public'; import { SourceFiltersTableFilter } from './types'; export interface SourceFiltersTableProps { diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/types.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/types.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/source_filters_table/types.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/types.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/index.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/index.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/index.ts diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/tabs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/tabs.tsx rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx index c727dcd3e3c65..5cf7fd9b2af06 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/tabs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx @@ -30,10 +30,10 @@ import { EuiSelectOption, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { fieldWildcardMatcher } from '../../../../../../../../../plugins/kibana_utils/public'; -import { IndexPatternManagementStart } from '../../../../../../../../../plugins/index_pattern_management/public'; -import { IndexPattern, IndexPatternField } from '../../../../../../../../../plugins/data/public'; -import { META_FIELDS_SETTING } from '../../../../../../../../../plugins/data/common'; +import { fieldWildcardMatcher } from '../../../../../kibana_utils/public'; +import { IndexPatternManagementStart } from '../../../../../index_pattern_management/public'; +import { IndexPattern, IndexPatternField } from '../../../../../data/public'; +import { META_FIELDS_SETTING } from '../../../../../data/common'; import { createEditIndexPatternPageStateContainer } from '../edit_index_pattern_state_container'; import { TAB_INDEXED_FIELDS, TAB_SCRIPTED_FIELDS, TAB_SOURCE_FILTERS } from '../constants'; import { SourceFiltersTable } from '../source_filters_table'; @@ -47,19 +47,26 @@ interface TabsProps extends Pick { fields: IndexPatternField[]; services: { indexPatternManagement: IndexPatternManagementStart; + painlessDocLink: string; }; } -const searchAriaLabel = i18n.translate('kbn.management.editIndexPattern.fields.searchAria', { - defaultMessage: 'Search fields', -}); +const searchAriaLabel = i18n.translate( + 'indexPatternManagement.editIndexPattern.fields.searchAria', + { + defaultMessage: 'Search fields', + } +); -const filterAriaLabel = i18n.translate('kbn.management.editIndexPattern.fields.filterAria', { - defaultMessage: 'Filter field types', -}); +const filterAriaLabel = i18n.translate( + 'indexPatternManagement.editIndexPattern.fields.filterAria', + { + defaultMessage: 'Filter field types', + } +); const filterPlaceholder = i18n.translate( - 'kbn.management.editIndexPattern.fields.filterPlaceholder', + 'indexPatternManagement.editIndexPattern.fields.filterPlaceholder', { defaultMessage: 'Search', } @@ -189,6 +196,7 @@ export function Tabs({ config, indexPattern, fields, services, history, location }, }} onRemoveField={refreshFilters} + painlessDocLink={services.painlessDocLink} /> ); @@ -219,6 +227,7 @@ export function Tabs({ config, indexPattern, fields, services, history, location refreshFilters, scriptedFieldLanguageFilter, services.indexPatternManagement.list.getFieldInfo, + services.painlessDocLink, ] ); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts similarity index 82% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts rename to src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts index 83335a6fabfeb..b9b59142290dc 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts @@ -19,8 +19,8 @@ import { Dictionary, countBy, defaults, unique } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { IndexPattern, IndexPatternField } from '../../../../../../../../../plugins/data/public'; -import { IndexPatternManagementStart } from '../../../../../../../../../plugins/index_pattern_management/public'; +import { IndexPattern, IndexPatternField } from '../../../../../../plugins/data/public'; +import { IndexPatternManagementStart } from '../../../../../../plugins/index_pattern_management/public'; import { TAB_INDEXED_FIELDS, TAB_SCRIPTED_FIELDS, TAB_SOURCE_FILTERS } from '../constants'; function filterByName(items: IndexPatternField[], filter: string) { @@ -56,17 +56,17 @@ function getTitle(type: string, filteredCount: Dictionary, totalCount: D let title = ''; switch (type) { case 'indexed': - title = i18n.translate('kbn.management.editIndexPattern.tabs.fieldsHeader', { + title = i18n.translate('indexPatternManagement.editIndexPattern.tabs.fieldsHeader', { defaultMessage: 'Fields', }); break; case 'scripted': - title = i18n.translate('kbn.management.editIndexPattern.tabs.scriptedHeader', { + title = i18n.translate('indexPatternManagement.editIndexPattern.tabs.scriptedHeader', { defaultMessage: 'Scripted fields', }); break; case 'sourceFilters': - title = i18n.translate('kbn.management.editIndexPattern.tabs.sourceHeader', { + title = i18n.translate('indexPatternManagement.editIndexPattern.tabs.sourceHeader', { defaultMessage: 'Source filters', }); break; @@ -117,16 +117,22 @@ export function getTabs( } export function getPath(field: IndexPatternField) { - return `/management/kibana/index_patterns/${field.indexPattern?.id}/field/${field.name}`; + return `${field.indexPattern?.id}/field/${field.name}`; } -const allTypesDropDown = i18n.translate('kbn.management.editIndexPattern.fields.allTypesDropDown', { - defaultMessage: 'All field types', -}); +const allTypesDropDown = i18n.translate( + 'indexPatternManagement.editIndexPattern.fields.allTypesDropDown', + { + defaultMessage: 'All field types', + } +); -const allLangsDropDown = i18n.translate('kbn.management.editIndexPattern.fields.allLangsDropDown', { - defaultMessage: 'All languages', -}); +const allLangsDropDown = i18n.translate( + 'indexPatternManagement.editIndexPattern.fields.allLangsDropDown', + { + defaultMessage: 'All languages', + } +); export function convertToEuiSelectOption(options: string[], type: string) { const euiOptions = diff --git a/src/legacy/ui/public/field_editor/__snapshots__/field_editor.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap similarity index 72% rename from src/legacy/ui/public/field_editor/__snapshots__/field_editor.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap index dc11bdfefa46b..a7ed4e1c9cafd 100644 --- a/src/legacy/ui/public/field_editor/__snapshots__/field_editor.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/__snapshots__/field_editor.test.tsx.snap @@ -6,7 +6,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = `

@@ -19,31 +19,14 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` isVisible={false} /> } label={ } @@ -168,7 +152,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` error={ } @@ -188,7 +172,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` @@ -205,7 +189,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` > @@ -224,7 +208,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` > @@ -238,7 +222,7 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = ` > @@ -258,7 +242,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = `

} label={ } @@ -435,7 +403,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` @@ -452,7 +420,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` > @@ -471,7 +439,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` > @@ -485,7 +453,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` > @@ -503,7 +471,7 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = ` > @@ -525,7 +493,7 @@ exports[`FieldEditor should show conflict field warning 1`] = `

@@ -538,31 +506,14 @@ exports[`FieldEditor should show conflict field warning 1`] = ` isVisible={false} /> @@ -614,7 +566,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` "mappingConflict": , @@ -690,14 +642,14 @@ exports[`FieldEditor should show conflict field warning 1`] = ` helpText={ } label={ } @@ -731,7 +683,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` error={ } @@ -751,7 +703,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` @@ -768,7 +720,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` > @@ -787,7 +739,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` > @@ -801,7 +753,7 @@ exports[`FieldEditor should show conflict field warning 1`] = ` > @@ -821,7 +773,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `

  testlang , "painlessLink": , @@ -1032,14 +967,14 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` helpText={ } label={ } @@ -1088,7 +1023,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` @@ -1105,7 +1040,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` > @@ -1124,7 +1059,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` > @@ -1138,7 +1073,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` > @@ -1156,7 +1091,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = ` > @@ -1178,7 +1113,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai

@@ -1191,31 +1126,14 @@ exports[`FieldEditor should show multiple type field warning with a table contai isVisible={false} /> @@ -1267,7 +1186,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai "mappingConflict": , @@ -1350,14 +1269,14 @@ exports[`FieldEditor should show multiple type field warning with a table contai title={ } > @@ -1399,14 +1318,14 @@ exports[`FieldEditor should show multiple type field warning with a table contai helpText={ } label={ } @@ -1440,7 +1359,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai error={ } @@ -1460,7 +1379,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai @@ -1477,7 +1396,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai > @@ -1496,7 +1415,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai > @@ -1510,7 +1429,7 @@ exports[`FieldEditor should show multiple type field warning with a table contai > diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/__snapshots__/field_format_editor.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/__snapshots__/field_format_editor.test.tsx.snap similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/__snapshots__/field_format_editor.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/__snapshots__/field_format_editor.test.tsx.snap diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap similarity index 92% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap index bf1682faf9a9d..f3e529a8a1e1b 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/__snapshots__/bytes.test.tsx.snap @@ -16,7 +16,7 @@ exports[`BytesFormatEditor should render normally 1`] = ` >   @@ -30,7 +30,7 @@ exports[`BytesFormatEditor should render normally 1`] = ` label={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx index 40443ec262182..99c3d3d55a8bc 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/bytes/bytes.test.tsx @@ -44,7 +44,6 @@ describe('BytesFormatEditor', () => { it('should render normally', async () => { const component = shallow( , "render": [Function], @@ -18,7 +18,7 @@ exports[`ColorFormatEditor should render multiple colors 1`] = ` "field": "text", "name": , "render": [Function], @@ -27,7 +27,7 @@ exports[`ColorFormatEditor should render multiple colors 1`] = ` "field": "background", "name": , "render": [Function], @@ -35,7 +35,7 @@ exports[`ColorFormatEditor should render multiple colors 1`] = ` Object { "name": , "render": [Function], @@ -89,7 +89,7 @@ exports[`ColorFormatEditor should render multiple colors 1`] = ` > @@ -108,7 +108,7 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] = "field": "range", "name": , "render": [Function], @@ -117,7 +117,7 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] = "field": "text", "name": , "render": [Function], @@ -126,7 +126,7 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] = "field": "background", "name": , "render": [Function], @@ -134,7 +134,7 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] = Object { "name": , "render": [Function], @@ -181,7 +181,7 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] = > @@ -200,7 +200,7 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`] "field": "regex", "name": , "render": [Function], @@ -209,7 +209,7 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`] "field": "text", "name": , "render": [Function], @@ -218,7 +218,7 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`] "field": "background", "name": , "render": [Function], @@ -226,7 +226,7 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`] Object { "name": , "render": [Function], @@ -273,7 +273,7 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`] > diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/color/color.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx similarity index 94% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/color/color.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx index 549831e9c3fb2..f13cb0975c8d2 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/color/color.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx @@ -22,7 +22,7 @@ import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; import { FieldFormat } from 'src/plugins/data/public'; import { ColorFormatEditor } from './color'; -import { fieldFormats } from '../../../../../../../../plugins/data/public'; +import { fieldFormats } from '../../../../../../../../data/public'; const fieldType = 'string'; const format = { @@ -42,7 +42,6 @@ describe('ColorFormatEditor', () => { it('should render string type normally (regex field)', async () => { const component = shallowWithI18nProvider( { it('should render other type normally (range field)', async () => { const component = shallowWithI18nProvider( { it('should render multiple colors', async () => { const component = shallowWithI18nProvider( ), @@ -121,7 +121,7 @@ export class ColorFormatEditor extends DefaultFormatEditor ), @@ -145,7 +145,7 @@ export class ColorFormatEditor extends DefaultFormatEditor ), @@ -169,7 +169,7 @@ export class ColorFormatEditor extends DefaultFormatEditor ), @@ -192,7 +192,7 @@ export class ColorFormatEditor extends DefaultFormatEditor ), @@ -211,15 +211,15 @@ export class ColorFormatEditor extends DefaultFormatEditor { @@ -240,7 +240,7 @@ export class ColorFormatEditor extends DefaultFormatEditor diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/color/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/color/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap similarity index 93% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap index 2d73f775e316c..a4d780c59ca74 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/__snapshots__/date.test.tsx.snap @@ -16,7 +16,7 @@ exports[`DateFormatEditor should render normally 1`] = ` >   @@ -30,7 +30,7 @@ exports[`DateFormatEditor should render normally 1`] = ` label={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/date.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/date.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/date.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/date.test.tsx index 746cb7c7fe302..c3114dacd118d 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/date.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/date.test.tsx @@ -44,7 +44,6 @@ describe('DateFormatEditor', () => { it('should render normally', async () => { const component = shallow( {defaultPattern}, @@ -69,7 +69,7 @@ export class DateFormatEditor extends DefaultFormatEditor   diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap similarity index 93% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap index 1456deaa13e47..8c6397ea3adeb 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/__snapshots__/date_nanos.test.tsx.snap @@ -16,7 +16,7 @@ exports[`DateFormatEditor should render normally 1`] = ` >   @@ -30,7 +30,7 @@ exports[`DateFormatEditor should render normally 1`] = ` label={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx similarity index 94% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx index e6b15c741af4e..bc9a8704e7c7d 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from '../../../../../../../../plugins/data/public'; +import { FieldFormat } from '../../../../../../../../data/public'; import { DateNanosFormatEditor } from './date_nanos'; @@ -46,7 +46,6 @@ describe('DateFormatEditor', () => { it('should render normally', async () => { const component = shallow( {defaultPattern}, @@ -64,7 +64,7 @@ export class DateNanosFormatEditor extends DefaultFormatEditor   diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/date_nanos/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/date_nanos/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/__snapshots__/default.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/__snapshots__/default.test.tsx.snap similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/__snapshots__/default.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/__snapshots__/default.test.tsx.snap diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/default.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/default.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/default.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/default.test.tsx index 3f30af97dc063..6af441b9ba751 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/default.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/default.test.tsx @@ -69,7 +69,6 @@ describe('DefaultFormatEditor', () => { it('should render nothing', async () => { const component = shallow( { it('should call prop onChange()', async () => { const component = shallow( { shallow( { formatParams: { type?: string } & P; onChange: (newParams: Record) => void; onError: FieldFormatEditorProps['onError']; - basePath: string; } export interface FormatEditorState { @@ -86,6 +85,7 @@ export class DefaultFormatEditor

extends PureComponent< FormatEditorProps

, FormatEditorState & S > { + static formatId = 'default'; state = defaultState as FormatEditorState & S; static getDerivedStateFromProps(nextProps: FormatEditorProps<{}>, state: FormatEditorState) { diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/default/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/default/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap similarity index 94% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap index dbebd324b16b6..b606e60949af5 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/__snapshots__/duration.test.tsx.snap @@ -12,7 +12,7 @@ exports[`DurationFormatEditor should render human readable output normally 1`] = label={ } @@ -42,7 +42,7 @@ exports[`DurationFormatEditor should render human readable output normally 1`] = label={ } @@ -124,7 +124,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1 label={ } @@ -154,7 +154,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1 label={ } @@ -189,7 +189,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1 label={ } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/duration.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/duration.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/duration.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/duration.test.tsx index 3ab69d12d8c0e..b181d6fa4466d 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/duration.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/duration.test.tsx @@ -71,7 +71,6 @@ describe('DurationFormatEditor', () => { it('should render human readable output normally', async () => { const component = shallow( { }; const component = shallow( 20 ) { - error = i18n.translate('common.ui.fieldEditor.durationErrorMessage', { + error = i18n.translate('indexPatternManagement.durationErrorMessage', { defaultMessage: 'Decimal places must be between 0 and 20', }); nextProps.onError(error); @@ -101,7 +101,7 @@ export class DurationFormatEditor extends DefaultFormatEditor< } @@ -125,7 +125,7 @@ export class DurationFormatEditor extends DefaultFormatEditor< } @@ -149,7 +149,7 @@ export class DurationFormatEditor extends DefaultFormatEditor< } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/index.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/index.tsx similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/duration/index.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/duration/index.tsx diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/index.ts new file mode 100644 index 0000000000000..6961cbf8d831c --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/index.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export { DefaultFormatEditor } from './default'; + +export { BytesFormatEditor } from './bytes'; +export { ColorFormatEditor } from './color'; +export { DateFormatEditor } from './date'; +export { DateNanosFormatEditor } from './date_nanos'; +export { DurationFormatEditor } from './duration'; +export { NumberFormatEditor } from './number'; +export { PercentFormatEditor } from './percent'; +export { StaticLookupFormatEditor } from './static_lookup'; +export { StringFormatEditor } from './string'; +export { TruncateFormatEditor } from './truncate'; +export { UrlFormatEditor } from './url'; diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap similarity index 92% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap index cf04dd19428e5..42c2323e56979 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/__snapshots__/number.test.tsx.snap @@ -16,7 +16,7 @@ exports[`NumberFormatEditor should render normally 1`] = ` >   @@ -30,7 +30,7 @@ exports[`NumberFormatEditor should render normally 1`] = ` label={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/number.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/number.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/number.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/number.test.tsx index c07c866359305..fddd1d5a8c7c3 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/number/number.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/number/number.test.tsx @@ -44,7 +44,6 @@ describe('NumberFormatEditor', () => { it('should render normally', async () => { const component = shallow( {defaultPattern} }} /> @@ -56,7 +56,7 @@ export class NumberFormatEditor extends DefaultFormatEditor   diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap similarity index 92% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap index 0784a3f5e407d..ac512402b4d41 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/__snapshots__/percent.test.tsx.snap @@ -16,7 +16,7 @@ exports[`PercentFormatEditor should render normally 1`] = ` >   @@ -30,7 +30,7 @@ exports[`PercentFormatEditor should render normally 1`] = ` label={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/percent.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/percent.test.tsx similarity index 94% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/percent.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/percent.test.tsx index ddeb79538cda1..c23e940dadea7 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/percent/percent.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/percent/percent.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from '../../../../../../../../plugins/data/public'; +import { FieldFormat } from '../../../../../../../../data/public'; import { PercentFormatEditor } from './percent'; @@ -44,7 +44,6 @@ describe('PercentFormatEditor', () => { it('should render normally', async () => { const component = shallow( , "render": [Function], @@ -18,7 +18,7 @@ exports[`StaticLookupFormatEditor should render multiple lookup entries and unkn "field": "value", "name": , "render": [Function], @@ -73,7 +73,7 @@ exports[`StaticLookupFormatEditor should render multiple lookup entries and unkn > @@ -89,7 +89,7 @@ exports[`StaticLookupFormatEditor should render multiple lookup entries and unkn label={ } @@ -116,7 +116,7 @@ exports[`StaticLookupFormatEditor should render normally 1`] = ` "field": "key", "name": , "render": [Function], @@ -125,7 +125,7 @@ exports[`StaticLookupFormatEditor should render normally 1`] = ` "field": "value", "name": , "render": [Function], @@ -174,7 +174,7 @@ exports[`StaticLookupFormatEditor should render normally 1`] = ` > @@ -190,7 +190,7 @@ exports[`StaticLookupFormatEditor should render normally 1`] = ` label={ } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/static_lookup/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/static_lookup/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx similarity index 93% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx index 2e2b1c3ae2357..a8356923eb381 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx @@ -18,9 +18,9 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '../../../../../../../../test_utils/public/enzyme_helpers'; +import { shallowWithI18nProvider } from '../../../../../../../../../test_utils/public/enzyme_helpers'; import { StaticLookupFormatEditorFormatParams } from './static_lookup'; -import { FieldFormat } from '../../../../../../../../plugins/data/public'; +import { FieldFormat } from '../../../../../../../../data/public'; import { StaticLookupFormatEditor } from './static_lookup'; @@ -43,7 +43,6 @@ describe('StaticLookupFormatEditor', () => { it('should render normally', async () => { const component = shallowWithI18nProvider( { it('should render multiple lookup entries and unknown key value', async () => { const component = shallowWithI18nProvider( + ), render: (value: number, item: StaticLookupItem) => { return ( @@ -106,7 +109,7 @@ export class StaticLookupFormatEditor extends DefaultFormatEditor< field: 'value', name: ( ), @@ -128,15 +131,15 @@ export class StaticLookupFormatEditor extends DefaultFormatEditor< }, { field: 'actions', - name: i18n.translate('common.ui.fieldEditor.staticLookup.actions', { + name: i18n.translate('indexPatternManagement.staticLookup.actions', { defaultMessage: 'actions', }), actions: [ { - name: i18n.translate('common.ui.fieldEditor.staticLookup.deleteAria', { + name: i18n.translate('indexPatternManagement.staticLookup.deleteAria', { defaultMessage: 'Delete', }), - description: i18n.translate('common.ui.fieldEditor.staticLookup.deleteTitle', { + description: i18n.translate('indexPatternManagement.staticLookup.deleteTitle', { defaultMessage: 'Delete entry', }), onClick: (item: StaticLookupItem) => { @@ -158,7 +161,7 @@ export class StaticLookupFormatEditor extends DefaultFormatEditor< @@ -166,7 +169,7 @@ export class StaticLookupFormatEditor extends DefaultFormatEditor< } @@ -174,7 +177,7 @@ export class StaticLookupFormatEditor extends DefaultFormatEditor< } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/string/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/string/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/string/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/string/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/string/string.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/string/string.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/string/string.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/string/string.test.tsx index d0fa0935b2664..ccaa12222281f 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/string/string.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/string/string.test.tsx @@ -52,7 +52,6 @@ describe('StringFormatEditor', () => { it('should render normally', async () => { const component = shallow( } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap similarity index 96% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap index f646d5b4afca8..2d1ee496d2786 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/__snapshots__/truncate.test.tsx.snap @@ -12,7 +12,7 @@ exports[`TruncateFormatEditor should render normally 1`] = ` label={ } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/sample.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/sample.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/sample.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/sample.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx index bb723386ff777..149b78c85e5da 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/truncate/truncate.test.tsx @@ -50,7 +50,6 @@ describe('TruncateFormatEditor', () => { it('should render normally', async () => { const component = shallow( { it('should fire error, when input is invalid', async () => { const component = shallow( { it('should fire change, when input changed and is valid', async () => { const component = shallow( } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap similarity index 90% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap index f0766df176c0d..69b192a81d097 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/label_template_flyout.test.tsx.snap @@ -11,14 +11,14 @@ exports[`LabelTemplateFlyout should render normally 1`] = `

@@ -36,7 +36,7 @@ exports[`LabelTemplateFlyout should render normally 1`] = ` —  @@ -47,7 +47,7 @@ exports[`LabelTemplateFlyout should render normally 1`] = ` —  @@ -55,7 +55,7 @@ exports[`LabelTemplateFlyout should render normally 1`] = `

diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap similarity index 89% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap index a3418077ad258..aa69b8da6cf60 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url.test.tsx.snap @@ -19,7 +19,7 @@ exports[`UrlFormatEditor should render label template help 1`] = ` label={ } @@ -58,7 +58,7 @@ exports[`UrlFormatEditor should render label template help 1`] = ` > @@ -67,7 +67,7 @@ exports[`UrlFormatEditor should render label template help 1`] = ` label={ } @@ -91,7 +91,7 @@ exports[`UrlFormatEditor should render label template help 1`] = ` > @@ -100,7 +100,7 @@ exports[`UrlFormatEditor should render label template help 1`] = ` label={ } @@ -138,7 +138,7 @@ exports[`UrlFormatEditor should render normally 1`] = ` label={ } @@ -177,7 +177,7 @@ exports[`UrlFormatEditor should render normally 1`] = ` > @@ -186,7 +186,7 @@ exports[`UrlFormatEditor should render normally 1`] = ` label={ } @@ -210,7 +210,7 @@ exports[`UrlFormatEditor should render normally 1`] = ` > @@ -219,7 +219,7 @@ exports[`UrlFormatEditor should render normally 1`] = ` label={ } @@ -257,7 +257,7 @@ exports[`UrlFormatEditor should render url template help 1`] = ` label={ } @@ -296,7 +296,7 @@ exports[`UrlFormatEditor should render url template help 1`] = ` > @@ -305,7 +305,7 @@ exports[`UrlFormatEditor should render url template help 1`] = ` label={ } @@ -329,7 +329,7 @@ exports[`UrlFormatEditor should render url template help 1`] = ` > @@ -338,7 +338,7 @@ exports[`UrlFormatEditor should render url template help 1`] = ` label={ } @@ -376,7 +376,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` label={ } @@ -416,7 +416,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` > @@ -425,7 +425,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` label={ } @@ -449,7 +449,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` > @@ -458,7 +458,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` label={ } @@ -479,7 +479,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` label={ } @@ -500,7 +500,7 @@ exports[`UrlFormatEditor should render width and height fields if image 1`] = ` label={ } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap similarity index 88% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap index fd697a2a4c70a..14e5012e9a554 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/__snapshots__/url_template_flyout.test.tsx.snap @@ -11,14 +11,14 @@ exports[`UrlTemplateFlyout should render normally 1`] = `

@@ -27,7 +27,7 @@ exports[`UrlTemplateFlyout should render normally 1`] = ` "strongUrlTemplate": , @@ -43,7 +43,7 @@ exports[`UrlTemplateFlyout should render normally 1`] = ` —  @@ -54,7 +54,7 @@ exports[`UrlTemplateFlyout should render normally 1`] = ` —  @@ -62,7 +62,7 @@ exports[`UrlTemplateFlyout should render normally 1`] = `

diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx similarity index 80% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx index 1ce7bec579e16..d04ee58f26b0a 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.tsx @@ -35,13 +35,13 @@ const items: LabelTemplateExampleItem[] = [ { input: 1234, urlTemplate: 'http://company.net/profiles?user_id={{value}}', - labelTemplate: i18n.translate('common.ui.fieldEditor.labelTemplate.example.idLabel', { + labelTemplate: i18n.translate('indexPatternManagement.labelTemplate.example.idLabel', { defaultMessage: 'User #{value}', values: { value: '{{value}}' }, }), output: '' + - i18n.translate('common.ui.fieldEditor.labelTemplate.example.output.idLabel', { + i18n.translate('indexPatternManagement.labelTemplate.example.output.idLabel', { defaultMessage: 'User', }) + ' #1234', @@ -49,12 +49,12 @@ const items: LabelTemplateExampleItem[] = [ { input: '/assets/main.css', urlTemplate: 'http://site.com{{rawValue}}', - labelTemplate: i18n.translate('common.ui.fieldEditor.labelTemplate.example.pathLabel', { + labelTemplate: i18n.translate('indexPatternManagement.labelTemplate.example.pathLabel', { defaultMessage: 'View Asset', }), output: '' + - i18n.translate('common.ui.fieldEditor.labelTemplate.example.output.pathLabel', { + i18n.translate('indexPatternManagement.labelTemplate.example.output.pathLabel', { defaultMessage: 'View Asset', }) + '', @@ -68,13 +68,13 @@ export const LabelTemplateFlyout = ({ isVisible = false, onClose = () => {} }) =

{} }) =

  • value — 
  • url — 
  • @@ -108,26 +108,26 @@ export const LabelTemplateFlyout = ({ isVisible = false, onClose = () => {} }) = columns={[ { field: 'input', - name: i18n.translate('common.ui.fieldEditor.labelTemplate.inputHeader', { + name: i18n.translate('indexPatternManagement.labelTemplate.inputHeader', { defaultMessage: 'Input', }), width: '160px', }, { field: 'urlTemplate', - name: i18n.translate('common.ui.fieldEditor.labelTemplate.urlHeader', { + name: i18n.translate('indexPatternManagement.labelTemplate.urlHeader', { defaultMessage: 'URL Template', }), }, { field: 'labelTemplate', - name: i18n.translate('common.ui.fieldEditor.labelTemplate.labelHeader', { + name: i18n.translate('indexPatternManagement.labelTemplate.labelHeader', { defaultMessage: 'Label Template', }), }, { field: 'output', - name: i18n.translate('common.ui.fieldEditor.labelTemplate.outputHeader', { + name: i18n.translate('indexPatternManagement.labelTemplate.outputHeader', { defaultMessage: 'Output', }), render: (value: LabelTemplateExampleItem['output']) => { diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url.test.tsx similarity index 94% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url.test.tsx index 4d09da84edfb6..a1a1655949432 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url.test.tsx @@ -46,10 +46,6 @@ const formatParams = { const onChange = jest.fn(); const onError = jest.fn(); -jest.mock('ui/chrome', () => ({ - getBasePath: () => 'http://localhost/', -})); - describe('UrlFormatEditor', () => { it('should have a formatId', () => { expect(UrlFormatEditor.formatId).toEqual('url'); @@ -58,7 +54,6 @@ describe('UrlFormatEditor', () => { it('should render normally', async () => { const component = shallow( { it('should render url template help', async () => { const component = shallow( { it('should render label template help', async () => { const component = shallow( { it('should render width and height fields if image', async () => { const component = shallow( ) { super(props); - this.iconPattern = `${props.basePath}/bundles/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/icons/{{value}}.png`; + this.iconPattern = `/plugins/indexPatternManagement/assets/icons/{{value}}.png`; + this.state = { ...this.state, sampleInputsByType: { @@ -146,7 +145,7 @@ export class UrlFormatEditor extends DefaultFormatEditor< + } > + } > + } > } @@ -220,9 +219,9 @@ export class UrlFormatEditor extends DefaultFormatEditor< + ) : ( - + ) } checked={!formatParams.openLinkInCurrentTab} @@ -236,14 +235,14 @@ export class UrlFormatEditor extends DefaultFormatEditor< } helpText={ @@ -263,14 +262,14 @@ export class UrlFormatEditor extends DefaultFormatEditor< } helpText={ diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx similarity index 84% rename from src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx index 8194bb731ad14..c1b144b0d9eac 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.tsx @@ -31,13 +31,13 @@ export const UrlTemplateFlyout = ({ isVisible = false, onClose = () => {} }) =>

    {} }) => strongUrlTemplate: ( @@ -58,21 +58,21 @@ export const UrlTemplateFlyout = ({ isVisible = false, onClose = () => {} }) =>

  • value — 
  • rawValue — 
  • @@ -97,20 +97,20 @@ export const UrlTemplateFlyout = ({ isVisible = false, onClose = () => {} }) => columns={[ { field: 'input', - name: i18n.translate('common.ui.fieldEditor.urlTemplate.inputHeader', { + name: i18n.translate('indexPatternManagement.urlTemplate.inputHeader', { defaultMessage: 'Input', }), width: '160px', }, { field: 'template', - name: i18n.translate('common.ui.fieldEditor.urlTemplate.templateHeader', { + name: i18n.translate('indexPatternManagement.urlTemplate.templateHeader', { defaultMessage: 'Template', }), }, { field: 'output', - name: i18n.translate('common.ui.fieldEditor.urlTemplate.outputHeader', { + name: i18n.translate('indexPatternManagement.urlTemplate.outputHeader', { defaultMessage: 'Output', }), }, diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx similarity index 98% rename from src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx index f6e631c8b7ac0..c94d2e2f861dc 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx @@ -37,6 +37,7 @@ const formatEditors = { ip: TestEditor, number: TestEditor, }, + getById: jest.fn(() => TestEditor), }; describe('FieldFormatEditor', () => { diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx similarity index 93% rename from src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx index 2de6dff5d251a..05aeba1ca107b 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/field_format_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx @@ -49,13 +49,13 @@ export class FieldFormatEditor extends PureComponent< constructor(props: FieldFormatEditorProps) { super(props); this.state = { - EditorComponent: props.fieldFormatEditors.byFormatId[props.fieldFormatId], + EditorComponent: props.fieldFormatEditors.getById(props.fieldFormatId), }; } static getDerivedStateFromProps(nextProps: FieldFormatEditorProps) { return { - EditorComponent: nextProps.fieldFormatEditors.byFormatId[nextProps.fieldFormatId] || null, + EditorComponent: nextProps.fieldFormatEditors.getById(nextProps.fieldFormatId) || null, }; } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/index.ts similarity index 96% rename from src/legacy/ui/public/field_editor/components/field_format_editor/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/index.ts index ccfc98b2d5882..83b36274f40e2 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/index.ts +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/index.ts @@ -18,3 +18,4 @@ */ export { FieldFormatEditor } from './field_format_editor'; +export * from './editors'; diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap similarity index 96% rename from src/legacy/ui/public/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap index 2883ffb6bc8a1..ce8c9e70433c8 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/__snapshots__/samples.test.tsx.snap @@ -10,7 +10,7 @@ exports[`FormatEditorSamples should render normally 1`] = ` label={ } diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/samples/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/index.ts diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/_samples.scss b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.scss similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/samples/_samples.scss rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.scss diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/samples.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx similarity index 100% rename from src/legacy/ui/public/field_editor/components/field_format_editor/samples/samples.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx diff --git a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/samples.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.tsx similarity index 90% rename from src/legacy/ui/public/field_editor/components/field_format_editor/samples/samples.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.tsx index d63674bf4d205..f2814664c185d 100644 --- a/src/legacy/ui/public/field_editor/components/field_format_editor/samples/samples.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.tsx @@ -17,6 +17,8 @@ * under the License. */ +import './samples.scss'; + import React, { PureComponent } from 'react'; import { EuiBasicTable, EuiFormRow } from '@elastic/eui'; @@ -41,7 +43,7 @@ export class FormatEditorSamples extends PureComponent const columns = [ { field: 'input', - name: i18n.translate('common.ui.fieldEditor.samples.inputHeader', { + name: i18n.translate('indexPatternManagement.samples.inputHeader', { defaultMessage: 'Input', }), render: (input: {} | string) => { @@ -50,7 +52,7 @@ export class FormatEditorSamples extends PureComponent }, { field: 'output', - name: i18n.translate('common.ui.fieldEditor.samples.outputHeader', { + name: i18n.translate('indexPatternManagement.samples.outputHeader', { defaultMessage: 'Output', }), render: (output: string) => { @@ -72,7 +74,7 @@ export class FormatEditorSamples extends PureComponent return samples.length ? ( + } > diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap similarity index 87% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap index 87e1341b47355..648f68edcbb10 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/disabled_call_out.test.tsx.snap @@ -9,7 +9,7 @@ exports[`ScriptingDisabledCallOut should render normally 1`] = ` } @@ -17,7 +17,7 @@ exports[`ScriptingDisabledCallOut should render normally 1`] = `

    diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap similarity index 82% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap index b331c1e38eb34..c9b5c84939bc6 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap @@ -8,7 +8,7 @@ exports[`ScriptingWarningCallOut should render normally 1`] = ` title={ } @@ -16,7 +16,7 @@ exports[`ScriptingWarningCallOut should render normally 1`] = `

      @@ -37,7 +37,7 @@ exports[`ScriptingWarningCallOut should render normally 1`] = ` >   @@ -52,7 +52,7 @@ exports[`ScriptingWarningCallOut should render normally 1`] = `

    diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/disabled_call_out.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/disabled_call_out.test.tsx similarity index 100% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/disabled_call_out.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/disabled_call_out.test.tsx diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/disabled_call_out.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/disabled_call_out.tsx similarity index 93% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/disabled_call_out.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/disabled_call_out.tsx index 9abca813fe434..0bfec7a54a662 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_call_outs/disabled_call_out.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/disabled_call_out.tsx @@ -29,7 +29,7 @@ export const ScriptingDisabledCallOut = ({ isVisible = false }) => { @@ -39,7 +39,7 @@ export const ScriptingDisabledCallOut = ({ isVisible = false }) => { >

    diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/index.ts diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx similarity index 93% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx index 8568c2c79816b..d659ac83d7b79 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx @@ -22,7 +22,7 @@ import { shallow } from 'enzyme'; import { ScriptingWarningCallOut } from './warning_call_out'; // eslint-disable-next-line -import { docLinksServiceMock } from '../../../../../../core/public/doc_links/doc_links_service.mock'; +import { docLinksServiceMock } from '../../../../../../../core/public/doc_links/doc_links_service.mock'; describe('ScriptingWarningCallOut', () => { const docLinksScriptedFields = docLinksServiceMock.createStartContract().links.scriptedFields; diff --git a/src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx similarity index 88% rename from src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx index 7dac6681fa1ea..fed756f11f08b 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_call_outs/warning_call_out.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx @@ -38,7 +38,7 @@ export const ScriptingWarningCallOut = ({ } @@ -47,13 +47,13 @@ export const ScriptingWarningCallOut = ({ >

      @@ -63,7 +63,7 @@ export const ScriptingWarningCallOut = ({ scriptsInAggregation: (   @@ -75,7 +75,7 @@ export const ScriptingWarningCallOut = ({

    , "data-test-subj": "testTab", "id": "test", @@ -76,10 +94,28 @@ exports[`ScriptingHelpFlyout should render nothing if not visible 1`] = ` }, Object { "content": , "data-test-subj": "testTab", "id": "test", diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.test.tsx similarity index 77% rename from src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.test.tsx index 4106eb7b283ee..fa2d97be60000 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.test.tsx @@ -21,20 +21,26 @@ import React from 'react'; import { shallow } from 'enzyme'; import { HttpStart } from 'src/core/public'; // eslint-disable-next-line -import { docLinksServiceMock } from '../../../../../../core/public/doc_links/doc_links_service.mock'; +import { docLinksServiceMock } from '../../../../../../../core/public/doc_links/doc_links_service.mock'; import { ScriptingHelpFlyout } from './help_flyout'; -import { IndexPattern } from '../../../../../../plugins/data/public'; +import { IndexPattern } from '../../../../../../data/public'; import { ExecuteScript } from '../../types'; +import { coreMock } from '../../../../../../../core/public/mocks'; +import { dataPluginMock } from '../../../../../../../plugins/data/public/mocks'; + jest.mock('./test_script', () => ({ TestScript: () => { return `

    mockTestScript
    `; }, })); +const { uiSettings } = coreMock.createStart(); +const { ui } = dataPluginMock.createStartContract(); + const indexPatternMock = {} as IndexPattern; describe('ScriptingHelpFlyout', () => { @@ -47,9 +53,10 @@ describe('ScriptingHelpFlyout', () => { lang="painless" executeScript={((() => {}) as unknown) as ExecuteScript} onClose={() => {}} - getHttpStart={() => (({} as unknown) as HttpStart)} - // docLinksScriptedFields={docLinksScriptedFields} + http={({} as unknown) as HttpStart} docLinksScriptedFields={{} as typeof docLinksScriptedFields} + uiSettings={uiSettings} + SearchBar={ui.SearchBar} /> ); @@ -64,8 +71,10 @@ describe('ScriptingHelpFlyout', () => { lang="painless" executeScript={((() => {}) as unknown) as ExecuteScript} onClose={() => {}} - getHttpStart={() => (({} as unknown) as HttpStart)} + http={({} as unknown) as HttpStart} docLinksScriptedFields={{} as typeof docLinksScriptedFields} + uiSettings={uiSettings} + SearchBar={ui.SearchBar} /> ); diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.tsx similarity index 85% rename from src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.tsx index 6f51379c796d4..b74d56e1c2878 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_help/help_flyout.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/help_flyout.tsx @@ -18,15 +18,15 @@ */ import React from 'react'; -import { HttpStart, DocLinksStart } from 'src/core/public'; +import { HttpStart, DocLinksStart, IUiSettingsClient } from 'src/core/public'; import { EuiFlyout, EuiFlyoutBody, EuiTabbedContent } from '@elastic/eui'; import { ScriptingSyntax } from './scripting_syntax'; import { TestScript } from './test_script'; -import { IndexPattern } from '../../../../../../plugins/data/public'; import { ExecuteScript } from '../../types'; +import { IndexPattern, DataPublicPluginStart } from '../../../../../../data/public'; interface ScriptingHelpFlyoutProps { indexPattern: IndexPattern; @@ -36,8 +36,10 @@ interface ScriptingHelpFlyoutProps { executeScript: ExecuteScript; isVisible: boolean; onClose: () => void; - getHttpStart: () => HttpStart; + http: HttpStart; docLinksScriptedFields: DocLinksStart['links']['scriptedFields']; + uiSettings: IUiSettingsClient; + SearchBar: DataPublicPluginStart['ui']['SearchBar']; } export const ScriptingHelpFlyout: React.FC = ({ @@ -48,8 +50,10 @@ export const ScriptingHelpFlyout: React.FC = ({ name, script, executeScript, - getHttpStart, + http, docLinksScriptedFields, + uiSettings, + SearchBar, }) => { const tabs = [ { @@ -69,7 +73,9 @@ export const ScriptingHelpFlyout: React.FC = ({ name={name} script={script} executeScript={executeScript} - getHttpStart={getHttpStart} + http={http} + uiSettings={uiSettings} + SearchBar={SearchBar} /> ), }, diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/components/scripting_help/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/index.ts diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/scripting_syntax.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/scripting_syntax.tsx similarity index 79% rename from src/legacy/ui/public/field_editor/components/scripting_help/scripting_syntax.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/scripting_syntax.tsx index 8158c6881acf9..9a78c3695ea7c 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_help/scripting_syntax.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/scripting_syntax.tsx @@ -33,18 +33,18 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps

    - +

    {' '} @@ -56,21 +56,21 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps

      @@ -80,7 +80,7 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps syntax: (   @@ -92,21 +92,21 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps

      @@ -118,26 +118,26 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps

    • @@ -145,21 +145,21 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps

    • + - * / % }} />
    • | & ^ ~ << >> >>>, @@ -168,28 +168,28 @@ export const ScriptingSyntax = ({ docLinksScriptedFields }: ScriptingSyntaxProps
    • && || ! ?: }} />
    • < <= == >= > }} />
    • abs ceil exp floor ln log10 logn max min sqrt pow }} />
    • haversin }} />
    • min, max }} /> diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/_test_script.scss b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.scss similarity index 100% rename from src/legacy/ui/public/field_editor/components/scripting_help/_test_script.scss rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.scss diff --git a/src/legacy/ui/public/field_editor/components/scripting_help/test_script.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx similarity index 85% rename from src/legacy/ui/public/field_editor/components/scripting_help/test_script.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx index 8d3a83a155553..0e324a67bac36 100644 --- a/src/legacy/ui/public/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -17,8 +17,11 @@ * under the License. */ +import './test_script.scss'; + import React, { Component, Fragment } from 'react'; -import { HttpStart } from 'src/core/public'; +import { HttpStart, IUiSettingsClient } from 'src/core/public'; +import { DataPublicPluginStart } from 'src/plugins/data/public'; import { EuiButton, @@ -34,12 +37,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; -const { SearchBar } = npStart.plugins.data.ui; - -const { uiSettings } = npStart.core; - -import { esQuery, IndexPattern, Query } from '../../../../../../plugins/data/public'; +import { esQuery, IndexPattern, Query } from '../../../../../../../plugins/data/public'; import { ExecuteScript } from '../../types'; interface TestScriptProps { @@ -48,7 +46,9 @@ interface TestScriptProps { name?: string; script?: string; executeScript: ExecuteScript; - getHttpStart: () => HttpStart; + http: HttpStart; + uiSettings: IUiSettingsClient; + SearchBar: DataPublicPluginStart['ui']['SearchBar']; } interface AdditionalField { @@ -80,7 +80,7 @@ export class TestScript extends Component { } previewScript = async (searchContext?: { query?: Query | undefined }) => { - const { indexPattern, lang, name, script, executeScript, getHttpStart } = this.props; + const { indexPattern, lang, name, script, executeScript, http } = this.props; if (!script || script.length === 0) { return; @@ -92,7 +92,7 @@ export class TestScript extends Component { let query; if (searchContext) { - const esQueryConfigs = esQuery.getEsQueryConfig(uiSettings); + const esQueryConfigs = esQuery.getEsQueryConfig(this.props.uiSettings); query = esQuery.buildEsQuery( this.props.indexPattern, searchContext.query || [], @@ -108,7 +108,7 @@ export class TestScript extends Component { indexPatternTitle: indexPattern.title, query, additionalFields: this.state.additionalFields.map((option: AdditionalField) => option.value), - getHttpStart, + http, }); if (scriptResponse.status !== 200) { @@ -143,7 +143,7 @@ export class TestScript extends Component { if (previewData.error) { return ( {

      @@ -182,7 +182,7 @@ export class TestScript extends Component { ); } - renderToolbar() { + renderToolbar(SearchBar: DataPublicPluginStart['ui']['SearchBar']) { const fieldsByTypeMap = new Map(); const fields: EuiComboBoxOptionOption[] = []; @@ -219,13 +219,13 @@ export class TestScript extends Component { return ( { showFilterBar={false} showDatePicker={false} showQueryInput={true} - query={{ language: uiSettings.get('search:queryLanguage'), query: '' }} + query={{ language: this.props.uiSettings.get('search:queryLanguage'), query: '' }} onQuerySubmit={this.previewScript} indexPatterns={[this.props.indexPattern]} customSubmitButton={ @@ -252,7 +252,7 @@ export class TestScript extends Component { data-test-subj="runScriptButton" > @@ -264,19 +264,20 @@ export class TestScript extends Component { } render() { + const { SearchBar } = this.props; return (

      {

      - {this.renderToolbar()} + {this.renderToolbar(SearchBar)} {this.renderPreview(this.state.previewData)}
      diff --git a/src/legacy/ui/public/field_editor/constants/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/constants/index.ts similarity index 93% rename from src/legacy/ui/public/field_editor/constants/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/constants/index.ts index 9bf93f39f5315..cc15380d89d4c 100644 --- a/src/legacy/ui/public/field_editor/constants/index.ts +++ b/src/plugins/index_pattern_management/public/components/field_editor/constants/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { getKbnTypeNames } from '../../../../../plugins/data/public'; +import { getKbnTypeNames } from '../../../../../data/public'; export const FIELD_TYPES_BY_LANG = { painless: ['number', 'string', 'date', 'boolean'], diff --git a/src/legacy/ui/public/field_editor/field_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx similarity index 84% rename from src/legacy/ui/public/field_editor/field_editor.test.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx index ced7aa27e5065..21b0e793bbaf0 100644 --- a/src/legacy/ui/public/field_editor/field_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx @@ -19,7 +19,6 @@ import React from 'react'; -import { npStart } from 'ui/new_platform'; import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; import { IndexPattern, @@ -27,14 +26,13 @@ import { IIndexPatternFieldList, FieldFormatInstanceType, } from 'src/plugins/data/public'; -import { HttpStart } from '../../../../core/public'; -// eslint-disable-next-line -import { docLinksServiceMock } from '../../../../core/public/doc_links/doc_links_service.mock'; + +import { coreMock } from '../../../../../core/public/mocks'; jest.mock('brace/mode/groovy', () => ({})); -jest.mock('ui/new_platform'); -import { FieldEditor } from './field_editor'; +import { FieldEdiorProps, FieldEditor } from './field_editor'; +import { dataPluginMock } from '../../../../data/public/mocks'; jest.mock('@elastic/eui', () => ({ EuiBasicTable: 'eui-basic-table', @@ -60,7 +58,7 @@ jest.mock('@elastic/eui', () => ({ euiPaletteColorBlind: () => ['red'], })); -jest.mock('ui/scripting_languages', () => ({ +jest.mock('../../scripting_languages', () => ({ getEnabledScriptingLanguages: () => ['painless', 'testlang'], getSupportedScriptingLanguages: () => ['painless'], getDeprecatedScriptingLanguages: () => ['testlang'], @@ -100,27 +98,36 @@ const field = { format: new Format(), }; -const helpers = { - Field: () => {}, - getConfig: () => {}, - getHttpStart: () => (({} as unknown) as HttpStart), - fieldFormatEditors: [], - redirectAway: () => {}, - docLinksScriptedFields: docLinksServiceMock.createStartContract().links.scriptedFields, -}; - describe('FieldEditor', () => { + const dataStartServices = dataPluginMock.createStartContract(); + const coreStartServices = coreMock.createStart(); + let indexPattern: IndexPattern; + const services: FieldEdiorProps['services'] = ({ + Field: () => {}, + getConfig: () => {}, + fieldFormatEditors: [], + redirectAway: () => {}, + docLinksScriptedFields: {}, + fieldFormats: dataStartServices.fieldFormats, + toasts: coreStartServices.notifications.toasts, + http: {}, + uiSettings: {}, + SearchBar: dataStartServices.ui.SearchBar, + indexPatterns: dataStartServices.indexPatterns, + } as unknown) as FieldEdiorProps['services']; + beforeEach(() => { indexPattern = ({ fields: fields as IIndexPatternFieldList, } as unknown) as IndexPattern; - npStart.plugins.data.fieldFormats.getDefaultType = jest.fn( + services.fieldFormats.getDefaultType = jest.fn( () => (({} as unknown) as FieldFormatInstanceType) ); - npStart.plugins.data.fieldFormats.getByFieldType = jest.fn(fieldType => { + + services.fieldFormats.getByFieldType = jest.fn(fieldType => { if (fieldType === 'number') { return [({} as unknown) as FieldFormatInstanceType]; } else { @@ -134,7 +141,7 @@ describe('FieldEditor', () => { ); @@ -161,7 +168,7 @@ describe('FieldEditor', () => { ); @@ -189,7 +196,7 @@ describe('FieldEditor', () => { ); @@ -204,7 +211,7 @@ describe('FieldEditor', () => { ); @@ -227,7 +234,7 @@ describe('FieldEditor', () => { ); diff --git a/src/legacy/ui/public/field_editor/field_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx similarity index 81% rename from src/legacy/ui/public/field_editor/field_editor.tsx rename to src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx index 7de70f5d956e8..635772fbbfe5c 100644 --- a/src/legacy/ui/public/field_editor/field_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx @@ -19,15 +19,7 @@ import React, { PureComponent, Fragment } from 'react'; import { intersection, union, get } from 'lodash'; -import { HttpStart, DocLinksStart } from 'src/core/public'; - -import { - getEnabledScriptingLanguages, - getDeprecatedScriptingLanguages, - getSupportedScriptingLanguages, -} from 'ui/scripting_languages'; - -import { npStart } from 'ui/new_platform'; +import { HttpStart, DocLinksStart, NotificationsStart, IUiSettingsClient } from 'src/core/public'; import { EuiBasicTable, @@ -54,6 +46,11 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import { + getEnabledScriptingLanguages, + getDeprecatedScriptingLanguages, + getSupportedScriptingLanguages, +} from '../../scripting_languages'; import { IndexPatternField, FieldFormatInstanceType, @@ -61,17 +58,16 @@ import { IFieldType, KBN_FIELD_TYPES, ES_FIELD_TYPES, -} from '../../../../plugins/data/public'; + DataPublicPluginStart, +} from '../../../../../plugins/data/public'; import { ScriptingDisabledCallOut, ScriptingWarningCallOut, } from './components/scripting_call_outs'; import { ScriptingHelpFlyout } from './components/scripting_help'; - import { FieldFormatEditor } from './components/field_format_editor'; - -import { DefaultFormatEditor } from './components/field_format_editor/editors/default'; +import { IndexPatternManagementStart } from '../../plugin'; import { FIELD_TYPES_BY_LANG, DEFAULT_FIELD_TYPES } from './constants'; import { executeScript, isScriptValid } from './lib'; @@ -79,13 +75,11 @@ import { executeScript, isScriptValid } from './lib'; // This loads Ace editor's "groovy" mode, used below to highlight the script. import 'brace/mode/groovy'; -const getFieldFormats = () => npStart.plugins.data.fieldFormats; - const getFieldTypeFormatsList = ( field: IFieldType, - defaultFieldFormat: FieldFormatInstanceType + defaultFieldFormat: FieldFormatInstanceType, + fieldFormats: DataPublicPluginStart['fieldFormats'] ) => { - const fieldFormats = getFieldFormats(); const formatsByType = fieldFormats .getByFieldType(field.type as KBN_FIELD_TYPES) .map(({ id, title }) => ({ @@ -97,7 +91,7 @@ const getFieldTypeFormatsList = ( { id: '', defaultFieldFormat, - title: i18n.translate('common.ui.fieldEditor.defaultFormatDropDown', { + title: i18n.translate('indexPatternManagement.defaultFormatDropDown', { defaultMessage: '- Default -', }), }, @@ -140,12 +134,16 @@ export interface FieldEditorState { export interface FieldEdiorProps { indexPattern: IndexPattern; field: IndexPatternField; - helpers: { - getConfig: (key: string) => any; - getHttpStart: () => HttpStart; - fieldFormatEditors: DefaultFormatEditor[]; + services: { + http: HttpStart; + fieldFormatEditors: IndexPatternManagementStart['fieldFormatEditors']; redirectAway: () => void; docLinksScriptedFields: DocLinksStart['links']['scriptedFields']; + fieldFormats: DataPublicPluginStart['fieldFormats']; + toasts: NotificationsStart['toasts']; + uiSettings: IUiSettingsClient; + SearchBar: DataPublicPluginStart['ui']['SearchBar']; + indexPatterns: DataPublicPluginStart['indexPatterns']; }; } @@ -180,11 +178,11 @@ export class FieldEditor extends PureComponent { - const { getConfig } = this.props.helpers; + const { uiSettings } = this.props.services; const { field } = this.state; - const fieldFormats = getFieldFormats(); - const DefaultFieldFormat = fieldFormats.getDefaultType(type) as FieldFormatInstanceType; + const DefaultFieldFormat = this.props.services.fieldFormats.getDefaultType( + type + ) as FieldFormatInstanceType; field.type = type; - field.format = new DefaultFieldFormat(null, getConfig); + + field.format = new DefaultFieldFormat(null, key => uiSettings.get(key)); this.setState({ - fieldTypeFormats: getFieldTypeFormatsList(field, DefaultFieldFormat), + fieldTypeFormats: getFieldTypeFormatsList( + field, + DefaultFieldFormat, + this.props.services.fieldFormats + ), fieldFormatId: DefaultFieldFormat.id, fieldFormatParams: field.format.params(), }); @@ -250,13 +254,14 @@ export class FieldEditor extends PureComponent { - const fieldFormats = getFieldFormats(); const { field, fieldTypeFormats } = this.state; + const { uiSettings, fieldFormats } = this.props.services; + const FieldFormat = fieldFormats.getType( formatId || (fieldTypeFormats[0] as InitialFieldTypeFormat).defaultFieldFormat.id ) as FieldFormatInstanceType; - field.format = new FieldFormat(params, this.props.helpers.getConfig); + field.format = new FieldFormat(params, key => uiSettings.get(key)); this.setState({ fieldFormatId: FieldFormat.id, @@ -286,21 +291,21 @@ export class FieldEditor extends PureComponent   @@ -314,7 +319,7 @@ export class FieldEditor extends PureComponent   @@ -397,7 +402,7 @@ export class FieldEditor extends PureComponent } size="s" > @@ -472,19 +477,19 @@ export class FieldEditor extends PureComponent{defaultFormat}, }} /> ) : ( - + ); return ( @@ -493,7 +498,7 @@ export class FieldEditor extends PureComponent @@ -530,7 +535,7 @@ export class FieldEditor extends PureComponent ) : ( ); @@ -575,7 +580,7 @@ export class FieldEditor extends PureComponent @@ -593,7 +598,7 @@ export class FieldEditor extends PureComponent {`doc['some_field'].value`} }} /> @@ -601,7 +606,7 @@ export class FieldEditor extends PureComponent @@ -629,7 +634,7 @@ export class FieldEditor extends PureComponent

      @@ -695,12 +700,12 @@ export class FieldEditor extends PureComponent {isCreating ? ( ) : ( )} @@ -709,7 +714,7 @@ export class FieldEditor extends PureComponent @@ -720,7 +725,7 @@ export class FieldEditor extends PureComponent @@ -745,7 +750,7 @@ export class FieldEditor extends PureComponent ); }; deleteField = () => { - const { redirectAway } = this.props.helpers; + const { redirectAway } = this.props.services; const { indexPattern } = this.props; const { field } = this.state; const remove = indexPattern.removeScriptedField(field); if (remove) { remove.then(() => { - const message = i18n.translate('common.ui.fieldEditor.deleteField.deletedHeader', { + const message = i18n.translate('indexPatternManagement.deleteField.deletedHeader', { defaultMessage: "Deleted '{fieldName}'", values: { fieldName: field.name }, }); - npStart.core.notifications.toasts.addSuccess(message); + this.props.services.toasts.addSuccess(message); redirectAway(); }); } else { @@ -797,7 +804,7 @@ export class FieldEditor extends PureComponent f.name === field.name); if (index > -1) { @@ -824,12 +831,12 @@ export class FieldEditor extends PureComponent { + const message = i18n.translate('indexPatternManagement.deleteField.savedHeader', { defaultMessage: "Saved '{fieldName}'", values: { fieldName: field.name }, }); - npStart.core.notifications.toasts.addSuccess(message); + this.props.services.toasts.addSuccess(message); redirectAway(); }); }; @@ -859,12 +866,12 @@ export class FieldEditor extends PureComponent {isCreating ? ( ) : ( diff --git a/src/legacy/ui/public/field_editor/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/index.ts diff --git a/src/legacy/ui/public/field_editor/lib/index.ts b/src/plugins/index_pattern_management/public/components/field_editor/lib/index.ts similarity index 100% rename from src/legacy/ui/public/field_editor/lib/index.ts rename to src/plugins/index_pattern_management/public/components/field_editor/lib/index.ts diff --git a/src/legacy/ui/public/field_editor/lib/validate_script.ts b/src/plugins/index_pattern_management/public/components/field_editor/lib/validate_script.ts similarity index 95% rename from src/legacy/ui/public/field_editor/lib/validate_script.ts rename to src/plugins/index_pattern_management/public/components/field_editor/lib/validate_script.ts index 4db827a4229fd..518cf1086e1d7 100644 --- a/src/legacy/ui/public/field_editor/lib/validate_script.ts +++ b/src/plugins/index_pattern_management/public/components/field_editor/lib/validate_script.ts @@ -28,7 +28,7 @@ export const executeScript = async ({ indexPatternTitle, query, additionalFields = [], - getHttpStart, + http, }: ExecuteScriptParams): Promise => { // Using _msearch because _search with index name in path dorks everything up const header = { @@ -62,7 +62,6 @@ export const executeScript = async ({ } const body = `${JSON.stringify(header)}\n${JSON.stringify(search)}\n`; - const http = await getHttpStart(); const esResp = await http.fetch('/elasticsearch/_msearch', { method: 'POST', body }); // unwrap _msearch response return esResp.responses[0]; @@ -73,20 +72,20 @@ export const isScriptValid = async ({ lang, script, indexPatternTitle, - getHttpStart, + http, }: { name: string; lang: string; script: string; indexPatternTitle: string; - getHttpStart: () => HttpStart; + http: HttpStart; }) => { const scriptResponse = await executeScript({ name, lang, script, indexPatternTitle, - getHttpStart, + http, }); if (scriptResponse.status !== 200) { diff --git a/src/legacy/ui/public/field_editor/types.ts b/src/plugins/index_pattern_management/public/components/field_editor/types.ts similarity index 97% rename from src/legacy/ui/public/field_editor/types.ts rename to src/plugins/index_pattern_management/public/components/field_editor/types.ts index 174cb7da73ceb..7519cc05e7fae 100644 --- a/src/legacy/ui/public/field_editor/types.ts +++ b/src/plugins/index_pattern_management/public/components/field_editor/types.ts @@ -33,7 +33,7 @@ export interface ExecuteScriptParams { indexPatternTitle: string; query?: Query['query']; additionalFields?: string[]; - getHttpStart: () => HttpStart; + http: HttpStart; } export interface ExecuteScriptResult { diff --git a/src/plugins/index_pattern_management/public/components/index.ts b/src/plugins/index_pattern_management/public/components/index.ts new file mode 100644 index 0000000000000..e0acb9d05bc84 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/index.ts @@ -0,0 +1,27 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { IndexPatternTableWithRouter } from './index_pattern_table'; +export { + EditIndexPattern, + EditIndexPatternContainer, + CreateEditField, + CreateEditFieldContainer, +} from './edit_index_pattern'; +export { CreateIndexPatternWizardWithRouter } from './create_index_pattern_wizard'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index.js b/src/plugins/index_pattern_management/public/components/index_pattern_table/index.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index.js rename to src/plugins/index_pattern_management/public/components/index_pattern_table/index.ts index adc1741f57263..29d1c886bab58 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index.js +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/index.ts @@ -17,4 +17,4 @@ * under the License. */ -import './index_patterns'; +export { IndexPatternTableWithRouter } from './index_pattern_table'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx new file mode 100644 index 0000000000000..599ed1fa04ee2 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx @@ -0,0 +1,207 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + EuiBadge, + EuiButtonEmpty, + EuiButtonIcon, + EuiFlexGroup, + EuiFlexItem, + EuiInMemoryTable, + EuiPanel, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; +import React, { useState, useEffect } from 'react'; +import { i18n } from '@kbn/i18n'; +import { + SavedObjectsClientContract, + IUiSettingsClient, + ChromeDocTitle, +} from '../../../../../core/public'; +import { ManagementAppMountParams } from '../../../../management/public'; +import { CreateButton } from '../create_button'; +import { CreateIndexPatternPrompt } from '../create_index_pattern_prompt'; +import { IndexPatternTableItem, IndexPatternCreationOption } from '../types'; +import { IndexPatternManagementStart } from '../../plugin'; +import { getIndexPatterns } from '../utils'; +import { getListBreadcrumbs } from '../breadcrumbs'; + +const columns = [ + { + field: 'title', + name: 'Pattern', + render: ( + name: string, + index: { + id: string; + tags?: Array<{ + key: string; + name: string; + }>; + } + ) => ( + + {name} + {index.tags && + index.tags.map(({ key: tagKey, name: tagName }) => ( + + {tagName} + + ))} + + ), + dataType: 'string' as const, + sortable: ({ sort }: { sort: string }) => sort, + }, +]; + +const pagination = { + initialPageSize: 10, + pageSizeOptions: [5, 10, 25, 50], +}; + +const sorting = { + sort: { + field: 'title', + direction: 'asc' as const, + }, +}; + +const search = { + box: { + incremental: true, + schema: { + fields: { title: { type: 'string' } }, + }, + }, +}; + +const ariaRegion = i18n.translate('indexPatternManagement.editIndexPatternLiveRegionAriaLabel', { + defaultMessage: 'Index patterns', +}); + +const title = i18n.translate('indexPatternManagement.indexPatternTable.title', { + defaultMessage: 'Index patterns', +}); + +interface Props extends RouteComponentProps { + getIndexPatternCreationOptions: IndexPatternManagementStart['creation']['getIndexPatternCreationOptions']; + canSave: boolean; + services: { + savedObjectsClient: SavedObjectsClientContract; + uiSettings: IUiSettingsClient; + setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; + indexPatternManagement: IndexPatternManagementStart; + docTitle: ChromeDocTitle; + }; +} + +export const IndexPatternTable = ({ + getIndexPatternCreationOptions, + canSave, + history, + services, +}: Props) => { + const [showFlyout, setShowFlyout] = useState(false); + const [indexPatterns, setIndexPatterns] = useState([]); + const [creationOptions, setCreationOptions] = useState([]); + + services.setBreadcrumbs(getListBreadcrumbs()); + + useEffect(() => { + (async function() { + const options = await getIndexPatternCreationOptions(history.push); + const gettedIndexPatterns: IndexPatternTableItem[] = await getIndexPatterns( + services.savedObjectsClient, + services.uiSettings.get('defaultIndex'), + services.indexPatternManagement + ); + setCreationOptions(options); + setIndexPatterns(gettedIndexPatterns); + setShowFlyout(gettedIndexPatterns.length === 0); + })(); + }, [ + getIndexPatternCreationOptions, + history.push, + indexPatterns.length, + services.indexPatternManagement, + services.savedObjectsClient, + services.uiSettings, + ]); + + services.docTitle.change(title); + + const createButton = canSave ? ( + + + + ) : ( + <> + ); + + return ( + + {showFlyout && setShowFlyout(false)} />} + + + + + +

      {title}

      +
      + + + setShowFlyout(true)} + aria-label="Help" + /> + + + + {createButton} + + + + + ); +}; + +export const IndexPatternTableWithRouter = withRouter(IndexPatternTable); diff --git a/src/plugins/index_pattern_management/public/components/types.ts b/src/plugins/index_pattern_management/public/components/types.ts new file mode 100644 index 0000000000000..2a820dd5f2c7a --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/types.ts @@ -0,0 +1,32 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export interface IndexPatternCreationOption { + text: string; + description?: string; + onClick: () => void; +} + +export interface IndexPatternTableItem { + id: string; + title: string; + default: boolean; + tag?: string[]; + sort: string; +} diff --git a/src/plugins/index_pattern_management/public/components/utils.test.ts b/src/plugins/index_pattern_management/public/components/utils.test.ts new file mode 100644 index 0000000000000..2d6224c9fc36b --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/utils.test.ts @@ -0,0 +1,51 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { getIndexPatterns } from './utils'; +import { coreMock } from '../../../../core/public/mocks'; +import { mockManagementPlugin } from '../mocks'; + +const { savedObjects } = coreMock.createStart(); +const mockManagementPluginStart = mockManagementPlugin.createStartContract(); + +(savedObjects.client.find as jest.Mock).mockResolvedValue({ + savedObjects: [ + { + id: 'test', + get: () => { + return 'test name'; + }, + }, + { + id: 'test1', + get: () => { + return 'test name 1'; + }, + }, + ], +}); + +test('getting index patterns', async () => { + const indexPatterns = await getIndexPatterns( + savedObjects.client, + 'test', + mockManagementPluginStart + ); + expect(indexPatterns).toMatchSnapshot(); +}); diff --git a/src/plugins/index_pattern_management/public/components/utils.ts b/src/plugins/index_pattern_management/public/components/utils.ts new file mode 100644 index 0000000000000..11da73aafb7b1 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/utils.ts @@ -0,0 +1,69 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { IIndexPattern } from 'src/plugins/data/public'; +import { SavedObjectsClientContract } from 'src/core/public'; +import { IndexPatternManagementStart } from '../plugin'; + +export async function getIndexPatterns( + savedObjectsClient: SavedObjectsClientContract, + defaultIndex: string, + indexPatternManagementStart: IndexPatternManagementStart +) { + return ( + savedObjectsClient + .find({ + type: 'index-pattern', + fields: ['title', 'type'], + perPage: 10000, + }) + .then(response => + response.savedObjects + .map(pattern => { + const id = pattern.id; + const title = pattern.get('title'); + const isDefault = defaultIndex === id; + + const tags = (indexPatternManagementStart as IndexPatternManagementStart).list.getIndexPatternTags( + pattern, + isDefault + ); + + return { + id, + title, + default: isDefault, + tags, + // the prepending of 0 at the default pattern takes care of prioritization + // so the sorting will but the default index on top + // or on bottom of a the table + sort: `${isDefault ? '0' : '1'}${title}`, + }; + }) + .sort((a, b) => { + if (a.sort < b.sort) { + return -1; + } else if (a.sort > b.sort) { + return 1; + } else { + return 0; + } + }) + ) || [] + ); +} diff --git a/src/plugins/index_pattern_management/public/index.ts b/src/plugins/index_pattern_management/public/index.ts index da482c0c51f0a..2d6db13757eea 100644 --- a/src/plugins/index_pattern_management/public/index.ts +++ b/src/plugins/index_pattern_management/public/index.ts @@ -36,4 +36,8 @@ export function plugin(initializerContext: PluginInitializerContext) { return new IndexPatternManagementPlugin(initializerContext); } -export { IndexPatternCreationConfig, IndexPatternListConfig } from './service'; +export { + IndexPatternCreationConfig, + IndexPatternCreationOption, + IndexPatternListConfig, +} from './service'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index.js b/src/plugins/index_pattern_management/public/management_app/index.tsx similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index.js rename to src/plugins/index_pattern_management/public/management_app/index.tsx index cd258eb033915..9883d28dcede9 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/index_pattern_table/index.js +++ b/src/plugins/index_pattern_management/public/management_app/index.tsx @@ -17,4 +17,4 @@ * under the License. */ -export { IndexPatternTable } from './index_pattern_table'; +export { mountManagementSection } from './mount_management_section'; diff --git a/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx new file mode 100644 index 0000000000000..b6b58d8f006c8 --- /dev/null +++ b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx @@ -0,0 +1,143 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { HashRouter, Switch, Route } from 'react-router-dom'; + +import { i18n } from '@kbn/i18n'; +import { I18nProvider } from '@kbn/i18n/react'; +import { StartServicesAccessor } from 'src/core/public'; + +import { ManagementAppMountParams } from '../../../management/public'; +import { + IndexPatternTableWithRouter, + EditIndexPatternContainer, + CreateEditFieldContainer, + CreateIndexPatternWizardWithRouter, +} from '../components'; +import { IndexPatternManagementStartDependencies, IndexPatternManagementStart } from '../plugin'; + +const readOnlyBadge = { + text: i18n.translate('indexPatternManagement.indexPatterns.badge.readOnly.text', { + defaultMessage: 'Read only', + }), + tooltip: i18n.translate('indexPatternManagement.indexPatterns.badge.readOnly.tooltip', { + defaultMessage: 'Unable to save index patterns', + }), + iconType: 'glasses', +}; + +export async function mountManagementSection( + getStartServices: StartServicesAccessor, + params: ManagementAppMountParams +) { + const [ + { chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks }, + { data }, + indexPatternManagementStart, + ] = await getStartServices(); + const canSave = Boolean(application.capabilities.indexPatterns.save); + + if (!canSave) { + chrome.setBadge(readOnlyBadge); + } + + ReactDOM.render( + + + + + + + + + + + + + + + + + + , + params.element + ); + + return () => { + ReactDOM.unmountComponentAtNode(params.element); + }; +} diff --git a/src/plugins/index_pattern_management/public/mocks.ts b/src/plugins/index_pattern_management/public/mocks.ts index bc97f46c302e3..6a2a63d776c67 100644 --- a/src/plugins/index_pattern_management/public/mocks.ts +++ b/src/plugins/index_pattern_management/public/mocks.ts @@ -19,6 +19,9 @@ import { PluginInitializerContext } from 'src/core/public'; import { coreMock } from '../../../core/public/mocks'; +import { managementPluginMock } from '../../management/public/mocks'; +import { kibanaLegacyPluginMock } from '../../kibana_legacy/public/mocks'; +import { dataPluginMock } from '../../data/public/mocks'; import { IndexPatternManagementSetup, IndexPatternManagementStart, @@ -32,6 +35,10 @@ const createSetupContract = (): IndexPatternManagementSetup => ({ list: { addListConfig: jest.fn(), } as any, + fieldFormatEditors: { + getAll: jest.fn(), + getById: jest.fn(), + } as any, }); const createStartContract = (): IndexPatternManagementStart => ({ @@ -44,13 +51,23 @@ const createStartContract = (): IndexPatternManagementStart => ({ getFieldInfo: jest.fn(), areScriptedFieldsEnabled: jest.fn(), } as any, + fieldFormatEditors: { + getAll: jest.fn(), + getById: jest.fn(), + } as any, }); const createInstance = async () => { const plugin = new IndexPatternManagementPlugin({} as PluginInitializerContext); - const setup = plugin.setup(coreMock.createSetup()); - const doStart = () => plugin.start(coreMock.createStart(), {}); + const setup = plugin.setup(coreMock.createSetup(), { + management: managementPluginMock.createSetupContract(), + kibanaLegacy: kibanaLegacyPluginMock.createSetupContract(), + }); + const doStart = () => + plugin.start(coreMock.createStart(), { + data: dataPluginMock.createStartContract(), + }); return { plugin, diff --git a/src/plugins/index_pattern_management/public/plugin.ts b/src/plugins/index_pattern_management/public/plugin.ts index 93bb0ead1df4a..aa28422956a38 100644 --- a/src/plugins/index_pattern_management/public/plugin.ts +++ b/src/plugins/index_pattern_management/public/plugin.ts @@ -16,23 +16,38 @@ * specific language governing permissions and limitations * under the License. */ + +import { i18n } from '@kbn/i18n'; import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { DataPublicPluginStart } from 'src/plugins/data/public'; +import { KibanaLegacySetup } from '../../kibana_legacy/public'; import { IndexPatternManagementService, IndexPatternManagementServiceSetup, IndexPatternManagementServiceStart, } from './service'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface IndexPatternManagementSetupDependencies {} +import { ManagementSetup, ManagementApp, ManagementSectionId } from '../../management/public'; + +export interface IndexPatternManagementSetupDependencies { + management: ManagementSetup; + kibanaLegacy: KibanaLegacySetup; +} -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface IndexPatternManagementStartDependencies {} +export interface IndexPatternManagementStartDependencies { + data: DataPublicPluginStart; +} export type IndexPatternManagementSetup = IndexPatternManagementServiceSetup; export type IndexPatternManagementStart = IndexPatternManagementServiceStart; +const sectionsHeader = i18n.translate('indexPatternManagement.indexPattern.sectionsHeader', { + defaultMessage: 'Index Patterns', +}); + +const IPM_APP_ID = 'indexPatterns'; + export class IndexPatternManagementPlugin implements Plugin< @@ -41,19 +56,53 @@ export class IndexPatternManagementPlugin IndexPatternManagementSetupDependencies, IndexPatternManagementStartDependencies > { - private readonly indexPattern = new IndexPatternManagementService(); + private readonly indexPatternManagementService = new IndexPatternManagementService(); + private managementApp?: ManagementApp; constructor(initializerContext: PluginInitializerContext) {} - public setup(core: CoreSetup) { - return this.indexPattern.setup({ httpClient: core.http }); + public setup( + core: CoreSetup, + { management, kibanaLegacy }: IndexPatternManagementSetupDependencies + ) { + const kibanaSection = management.sections.getSection(ManagementSectionId.Kibana); + + if (!kibanaSection) { + throw new Error('`kibana` management section not found.'); + } + + const newAppPath = `kibana#/management/kibana/${IPM_APP_ID}`; + const legacyPatternsPath = 'management/kibana/index_patterns'; + + kibanaLegacy.forwardApp('management/kibana/index_pattern', newAppPath, path => '/create'); + kibanaLegacy.forwardApp(legacyPatternsPath, newAppPath, path => { + const pathInApp = path.substr(legacyPatternsPath.length + 1); + return pathInApp && `/patterns${pathInApp}`; + }); + + this.managementApp = kibanaSection.registerApp({ + id: IPM_APP_ID, + title: sectionsHeader, + order: 0, + mount: async params => { + const { mountManagementSection } = await import('./management_app'); + + return mountManagementSection(core.getStartServices, params); + }, + }); + + return this.indexPatternManagementService.setup({ httpClient: core.http }); } public start(core: CoreStart, plugins: IndexPatternManagementStartDependencies) { - return this.indexPattern.start(); + if (!core.application.capabilities.management.kibana.index_patterns) { + this.managementApp!.disable(); + } + + return this.indexPatternManagementService.start(); } public stop() { - this.indexPattern.stop(); + this.indexPatternManagementService.stop(); } } diff --git a/src/legacy/ui/public/scripting_languages/index.ts b/src/plugins/index_pattern_management/public/scripting_languages/index.ts similarity index 80% rename from src/legacy/ui/public/scripting_languages/index.ts rename to src/plugins/index_pattern_management/public/scripting_languages/index.ts index 459e72c0c67c1..b4883a8276e41 100644 --- a/src/legacy/ui/public/scripting_languages/index.ts +++ b/src/plugins/index_pattern_management/public/scripting_languages/index.ts @@ -18,8 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { HttpStart } from 'src/core/public'; -import { toastNotifications } from '../notify'; +import { HttpStart, NotificationsStart } from 'src/core/public'; export function getSupportedScriptingLanguages(): string[] { return ['painless']; @@ -29,12 +28,16 @@ export function getDeprecatedScriptingLanguages(): string[] { return []; } -export const getEnabledScriptingLanguages = (http: HttpStart) => +export const getEnabledScriptingLanguages = ( + http: HttpStart, + toasts: NotificationsStart['toasts'] +) => http.get('/api/kibana/scripts/languages').catch(() => { - toastNotifications.addDanger( - i18n.translate('common.ui.scriptingLanguages.errorFetchingToastDescription', { + toasts.addDanger( + i18n.translate('indexPatternManagement.scriptingLanguages.errorFetchingToastDescription', { defaultMessage: 'Error getting available scripting languages from Elasticsearch', }) ); + return []; }); diff --git a/src/plugins/index_pattern_management/public/service/creation/config.ts b/src/plugins/index_pattern_management/public/service/creation/config.ts index 29ab0ebfc3d5f..95a91fd7594ca 100644 --- a/src/plugins/index_pattern_management/public/service/creation/config.ts +++ b/src/plugins/index_pattern_management/public/service/creation/config.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { MatchedIndex } from '../../../../../legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/types'; +import { MatchedIndex } from '../../components/create_index_pattern_wizard/types'; const indexPatternTypeName = i18n.translate( 'indexPatternManagement.editIndexPattern.createIndex.defaultTypeName', @@ -74,15 +74,13 @@ export class IndexPatternCreationConfig { this.isBeta = isBeta; } - public async getIndexPatternCreationOption( - urlHandler: UrlHandler - ): Promise { + public getIndexPatternCreationOption(urlHandler: UrlHandler): IndexPatternCreationOption { return { text: indexPatternButtonText, description: indexPatternButtonDescription, testSubj: `createStandardIndexPatternButton`, onClick: () => { - urlHandler('/management/kibana/index_pattern'); + urlHandler('/create'); }, }; } diff --git a/src/plugins/index_pattern_management/public/service/creation/index.ts b/src/plugins/index_pattern_management/public/service/creation/index.ts index 84c4c28aa2260..1df97a74c496d 100644 --- a/src/plugins/index_pattern_management/public/service/creation/index.ts +++ b/src/plugins/index_pattern_management/public/service/creation/index.ts @@ -17,5 +17,5 @@ * under the License. */ -export { IndexPatternCreationConfig } from './config'; +export { IndexPatternCreationConfig, IndexPatternCreationOption } from './config'; export { IndexPatternCreationManager } from './manager'; diff --git a/src/plugins/index_pattern_management/public/service/creation/manager.ts b/src/plugins/index_pattern_management/public/service/creation/manager.ts index 32b3e7ee7a133..c97d7a084dca3 100644 --- a/src/plugins/index_pattern_management/public/service/creation/manager.ts +++ b/src/plugins/index_pattern_management/public/service/creation/manager.ts @@ -21,52 +21,56 @@ import { HttpSetup } from '../../../../../core/public'; import { IndexPatternCreationConfig, UrlHandler, IndexPatternCreationOption } from './config'; export class IndexPatternCreationManager { - private configs: IndexPatternCreationConfig[]; + private configs: IndexPatternCreationConfig[] = []; - constructor() { - this.configs = []; - } + setup(httpClient: HttpSetup) { + return { + addCreationConfig: (Config: typeof IndexPatternCreationConfig) => { + const config = new Config({ httpClient }); - public addCreationConfig = (httpClient: HttpSetup) => ( - Config: typeof IndexPatternCreationConfig - ) => { - const config = new Config({ httpClient }); - if (this.configs.findIndex(c => c.key === config.key) !== -1) { - throw new Error(`${config.key} exists in IndexPatternCreationManager.`); - } - this.configs.push(config); - }; + if (this.configs.findIndex(c => c.key === config.key) !== -1) { + throw new Error(`${config.key} exists in IndexPatternCreationManager.`); + } - public getType(key: string | undefined): IndexPatternCreationConfig | null { - if (key) { - const index = this.configs.findIndex(config => config.key === key); - return this.configs[index] || null; - } else { - return this.getType('default'); - } + this.configs.push(config); + }, + }; } - public async getIndexPatternCreationOptions(urlHandler: UrlHandler) { - const options: IndexPatternCreationOption[] = []; - await Promise.all( - this.configs.map(async config => { - const option = config.getIndexPatternCreationOption - ? await config.getIndexPatternCreationOption(urlHandler) - : null; - if (option) { - options.push(option); + start() { + const getType = (key: string | undefined): IndexPatternCreationConfig => { + if (key) { + const index = this.configs.findIndex(config => config.key === key); + const config = this.configs[index]; + + if (config) { + return config; + } else { + throw new Error(`Index pattern creation type not found: ${key}`); } - }) - ); - return options; - } + } else { + return getType('default'); + } + }; + + return { + getType, + getIndexPatternCreationOptions: async (urlHandler: UrlHandler) => { + const options: IndexPatternCreationOption[] = []; - setup = (httpClient: HttpSetup) => ({ - addCreationConfig: this.addCreationConfig(httpClient).bind(this), - }); + await Promise.all( + this.configs.map(async config => { + const option = config.getIndexPatternCreationOption + ? await config.getIndexPatternCreationOption(urlHandler) + : null; + if (option) { + options.push(option); + } + }) + ); - start = () => ({ - getType: this.getType.bind(this), - getIndexPatternCreationOptions: this.getIndexPatternCreationOptions.bind(this), - }); + return options; + }, + }; + } } diff --git a/src/plugins/index_pattern_management/public/service/field_format_editors/field_format_editors.ts b/src/plugins/index_pattern_management/public/service/field_format_editors/field_format_editors.ts new file mode 100644 index 0000000000000..f85238c5d9622 --- /dev/null +++ b/src/plugins/index_pattern_management/public/service/field_format_editors/field_format_editors.ts @@ -0,0 +1,43 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { DefaultFormatEditor } from '../../components/field_editor/components/field_format_editor'; + +export class FieldFormatEditors { + private editors: Array = []; + + public setup(defaultFieldEditors: FieldFormatEditors['editors'] = []) { + this.editors = defaultFieldEditors; + + return { + register: (editor: typeof DefaultFormatEditor) => { + this.editors.push(editor); + }, + }; + } + + public start() { + return { + getAll: () => [...this.editors], + getById: (id: string) => { + return this.editors.find(editor => editor.formatId === id); + }, + }; + } +} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/index.ts b/src/plugins/index_pattern_management/public/service/field_format_editors/index.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/index.ts rename to src/plugins/index_pattern_management/public/service/field_format_editors/index.ts index 473a8f5b57c82..799586654073c 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/index.ts +++ b/src/plugins/index_pattern_management/public/service/field_format_editors/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export { CreateEditField } from './create_edit_field'; +export { FieldFormatEditors } from './field_format_editors'; diff --git a/src/plugins/index_pattern_management/public/service/index.ts b/src/plugins/index_pattern_management/public/service/index.ts index 2abe13eb0e292..2c590f85fe8ea 100644 --- a/src/plugins/index_pattern_management/public/service/index.ts +++ b/src/plugins/index_pattern_management/public/service/index.ts @@ -18,5 +18,5 @@ */ export * from './index_pattern_management_service'; -export { IndexPatternCreationConfig } from './creation'; +export { IndexPatternCreationConfig, IndexPatternCreationOption } from './creation'; export { IndexPatternListConfig } from './list'; diff --git a/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts b/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts index 4780fa00ed468..d4cc9c95e76a7 100644 --- a/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts +++ b/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts @@ -20,6 +20,21 @@ import { HttpSetup } from '../../../../core/public'; import { IndexPatternCreationManager, IndexPatternCreationConfig } from './creation'; import { IndexPatternListManager, IndexPatternListConfig } from './list'; +import { FieldFormatEditors } from './field_format_editors'; + +import { + BytesFormatEditor, + ColorFormatEditor, + DateFormatEditor, + DateNanosFormatEditor, + DurationFormatEditor, + NumberFormatEditor, + PercentFormatEditor, + StaticLookupFormatEditor, + StringFormatEditor, + TruncateFormatEditor, + UrlFormatEditor, +} from '../components/field_editor/components/field_format_editor'; interface SetupDependencies { httpClient: HttpSetup; @@ -33,20 +48,41 @@ interface SetupDependencies { export class IndexPatternManagementService { indexPatternCreationManager: IndexPatternCreationManager; indexPatternListConfig: IndexPatternListManager; + fieldFormatEditors: FieldFormatEditors; constructor() { this.indexPatternCreationManager = new IndexPatternCreationManager(); this.indexPatternListConfig = new IndexPatternListManager(); + this.fieldFormatEditors = new FieldFormatEditors(); } public setup({ httpClient }: SetupDependencies) { const creationManagerSetup = this.indexPatternCreationManager.setup(httpClient); creationManagerSetup.addCreationConfig(IndexPatternCreationConfig); - this.indexPatternListConfig.setup().addListConfig(IndexPatternListConfig); + + const indexPatternListConfigSetup = this.indexPatternListConfig.setup(); + indexPatternListConfigSetup.addListConfig(IndexPatternListConfig); + + const defaultFieldFormatEditors = [ + BytesFormatEditor, + ColorFormatEditor, + DateFormatEditor, + DateNanosFormatEditor, + DurationFormatEditor, + NumberFormatEditor, + PercentFormatEditor, + StaticLookupFormatEditor, + StringFormatEditor, + TruncateFormatEditor, + UrlFormatEditor, + ]; + + const fieldFormatEditorsSetup = this.fieldFormatEditors.setup(defaultFieldFormatEditors); return { creation: creationManagerSetup, - list: this.indexPatternListConfig.setup(), + list: indexPatternListConfigSetup, + fieldFormatEditors: fieldFormatEditorsSetup, }; } @@ -54,6 +90,7 @@ export class IndexPatternManagementService { return { creation: this.indexPatternCreationManager.start(), list: this.indexPatternListConfig.start(), + fieldFormatEditors: this.fieldFormatEditors.start(), }; } diff --git a/src/plugins/index_pattern_management/public/service/list/config.ts b/src/plugins/index_pattern_management/public/service/list/config.ts index 87c246e8913e5..d90c548ac350a 100644 --- a/src/plugins/index_pattern_management/public/service/list/config.ts +++ b/src/plugins/index_pattern_management/public/service/list/config.ts @@ -19,26 +19,32 @@ import { i18n } from '@kbn/i18n'; import { IIndexPattern, IFieldType } from 'src/plugins/data/public'; +import { SimpleSavedObject } from 'src/core/public'; export interface IndexPatternTag { key: string; name: string; } +const defaultIndexPatternListName = i18n.translate( + 'indexPatternManagement.editIndexPattern.list.defaultIndexPatternListName', + { + defaultMessage: 'Default', + } +); + export class IndexPatternListConfig { public readonly key = 'default'; - public getIndexPatternTags(indexPattern: IIndexPattern, isDefault: boolean): IndexPatternTag[] { + public getIndexPatternTags( + indexPattern: IIndexPattern | SimpleSavedObject, + isDefault: boolean + ): IndexPatternTag[] { return isDefault ? [ { key: 'default', - name: i18n.translate( - 'indexPatternManagement.editIndexPattern.list.defaultIndexPatternListName', - { - defaultMessage: 'Default', - } - ), + name: defaultIndexPatternListName, }, ] : []; diff --git a/src/plugins/index_pattern_management/public/service/list/manager.ts b/src/plugins/index_pattern_management/public/service/list/manager.ts index 3a2910a222cd7..6e8b430ffdc26 100644 --- a/src/plugins/index_pattern_management/public/service/list/manager.ts +++ b/src/plugins/index_pattern_management/public/service/list/manager.ts @@ -18,50 +18,50 @@ */ import { IIndexPattern, IFieldType } from 'src/plugins/data/public'; +import { SimpleSavedObject } from 'src/core/public'; import { IndexPatternListConfig, IndexPatternTag } from './config'; export class IndexPatternListManager { - private configs: IndexPatternListConfig[]; + private configs: IndexPatternListConfig[] = []; - constructor() { - this.configs = []; - } + setup() { + return { + addListConfig: (Config: typeof IndexPatternListConfig) => { + const config = new Config(); - private addListConfig(Config: typeof IndexPatternListConfig) { - const config = new Config(); - if (this.configs.findIndex(c => c.key === config.key) !== -1) { - throw new Error(`${config.key} exists in IndexPatternListManager.`); - } - this.configs.push(config); + if (this.configs.findIndex(c => c.key === config.key) !== -1) { + throw new Error(`${config.key} exists in IndexPatternListManager.`); + } + this.configs.push(config); + }, + }; } - private getIndexPatternTags(indexPattern: IIndexPattern, isDefault: boolean) { - return this.configs.reduce((tags: IndexPatternTag[], config) => { - return config.getIndexPatternTags - ? tags.concat(config.getIndexPatternTags(indexPattern, isDefault)) - : tags; - }, []); - } + start() { + return { + getIndexPatternTags: ( + indexPattern: IIndexPattern | SimpleSavedObject, + isDefault: boolean + ) => + this.configs.reduce( + (tags: IndexPatternTag[], config) => + config.getIndexPatternTags + ? tags.concat(config.getIndexPatternTags(indexPattern, isDefault)) + : tags, + [] + ), - private getFieldInfo(indexPattern: IIndexPattern, field: IFieldType): string[] { - return this.configs.reduce((info: string[], config) => { - return config.getFieldInfo ? info.concat(config.getFieldInfo(indexPattern, field)) : info; - }, []); - } + getFieldInfo: (indexPattern: IIndexPattern, field: IFieldType): string[] => + this.configs.reduce( + (info: string[], config) => + config.getFieldInfo ? info.concat(config.getFieldInfo(indexPattern, field)) : info, + [] + ), - private areScriptedFieldsEnabled(indexPattern: IIndexPattern): boolean { - return this.configs.every(config => { - return config.areScriptedFieldsEnabled ? config.areScriptedFieldsEnabled(indexPattern) : true; - }); + areScriptedFieldsEnabled: (indexPattern: IIndexPattern): boolean => + this.configs.every(config => + config.areScriptedFieldsEnabled ? config.areScriptedFieldsEnabled(indexPattern) : true + ), + }; } - - setup = () => ({ - addListConfig: this.addListConfig.bind(this), - }); - - start = () => ({ - getIndexPatternTags: this.getIndexPatternTags.bind(this), - getFieldInfo: this.getFieldInfo.bind(this), - areScriptedFieldsEnabled: this.areScriptedFieldsEnabled.bind(this), - }); } diff --git a/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.test.ts b/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.test.ts index 513c70e60048a..8db1d60f09d72 100644 --- a/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.test.ts @@ -35,7 +35,7 @@ import { ScopedHistory } from '../../../../../core/public'; describe('kbn_url_storage', () => { describe('getStateFromUrl & setStateToUrl', () => { - const url = 'http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id'; + const url = 'http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id'; const state1 = { testStr: '123', testNumber: 0, @@ -50,14 +50,14 @@ describe('kbn_url_storage', () => { it('should set expanded state to url', () => { let newUrl = setStateToKbnUrl('_s', state1, { useHash: false }, url); expect(newUrl).toMatchInlineSnapshot( - `"http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_s=(testArray:!(1,2,()),testNull:!n,testNumber:0,testObj:(test:'123'),testStr:'123')"` + `"http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_s=(testArray:!(1,2,()),testNull:!n,testNumber:0,testObj:(test:'123'),testStr:'123')"` ); const retrievedState1 = getStateFromKbnUrl('_s', newUrl); expect(retrievedState1).toEqual(state1); newUrl = setStateToKbnUrl('_s', state2, { useHash: false }, newUrl); expect(newUrl).toMatchInlineSnapshot( - `"http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_s=(test:'123')"` + `"http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_s=(test:'123')"` ); const retrievedState2 = getStateFromKbnUrl('_s', newUrl); expect(retrievedState2).toEqual(state2); @@ -66,14 +66,14 @@ describe('kbn_url_storage', () => { it('should set hashed state to url', () => { let newUrl = setStateToKbnUrl('_s', state1, { useHash: true }, url); expect(newUrl).toMatchInlineSnapshot( - `"http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_s=h@a897fac"` + `"http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_s=h@a897fac"` ); const retrievedState1 = getStateFromKbnUrl('_s', newUrl); expect(retrievedState1).toEqual(state1); newUrl = setStateToKbnUrl('_s', state2, { useHash: true }, newUrl); expect(newUrl).toMatchInlineSnapshot( - `"http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_s=h@40f94d5"` + `"http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_s=h@40f94d5"` ); const retrievedState2 = getStateFromKbnUrl('_s', newUrl); expect(retrievedState2).toEqual(state2); @@ -244,66 +244,66 @@ describe('kbn_url_storage', () => { it('should extract path relative to browser history without basename', () => { const history = createBrowserHistory(); const url = - "http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const relativePath = getRelativeToHistoryPath(url, history); expect(relativePath).toEqual( - "/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); it('should extract path relative to browser history with basename', () => { const url = - "http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const history1 = createBrowserHistory({ basename: '/oxf/app/' }); const relativePath1 = getRelativeToHistoryPath(url, history1); expect(relativePath1).toEqual( - "/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); const history2 = createBrowserHistory({ basename: '/oxf/app/kibana/' }); const relativePath2 = getRelativeToHistoryPath(url, history2); expect(relativePath2).toEqual( - "#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); it('should extract path relative to browser history with basename from relative url', () => { const history = createBrowserHistory({ basename: '/oxf/app/' }); const url = - "/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const relativePath = getRelativeToHistoryPath(url, history); expect(relativePath).toEqual( - "/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); it('should extract path relative to hash history without basename', () => { const history = createHashHistory(); const url = - "http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const relativePath = getRelativeToHistoryPath(url, history); expect(relativePath).toEqual( - "/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); it('should extract path relative to hash history with basename', () => { const history = createHashHistory({ basename: 'management' }); const url = - "http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const relativePath = getRelativeToHistoryPath(url, history); expect(relativePath).toEqual( - "/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); it('should extract path relative to hash history with basename from relative url', () => { const history = createHashHistory({ basename: 'management' }); const url = - "/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; + "/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')"; const relativePath = getRelativeToHistoryPath(url, history); expect(relativePath).toEqual( - "/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" + "/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'')" ); }); }); diff --git a/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.ts b/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.ts index 337d122e2854b..6d2570b932204 100644 --- a/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.ts +++ b/src/plugins/kibana_utils/public/state_management/url/kbn_url_storage.ts @@ -31,7 +31,7 @@ import { url as urlUtils } from '../../../common'; * e.g.: * * given an url: - * http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') + * http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') * will return object: * {_a: {tab: 'indexedFields'}, _b: {f: 'test', i: '', l: ''}}; */ @@ -57,7 +57,7 @@ export function getStatesFromKbnUrl( * e.g.: * * given an url: - * http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') + * http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') * and key '_a' * will return object: * {tab: 'indexedFields'} @@ -74,12 +74,12 @@ export function getStateFromKbnUrl( * Doesn't actually updates history * * e.g.: - * given a url: http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') + * given a url: http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:indexedFields)&_b=(f:test,i:'',l:'') * key: '_a' * and state: {tab: 'other'} * * will return url: - * http://localhost:5601/oxf/app/kibana#/management/kibana/index_patterns/id?_a=(tab:other)&_b=(f:test,i:'',l:'') + * http://localhost:5601/oxf/app/kibana#/management/kibana/indexPatterns/patterns/id?_a=(tab:other)&_b=(f:test,i:'',l:'') */ export function setStateToKbnUrl( key: string, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap index 79c9db8250d4c..78af61c20c828 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap @@ -391,10 +391,10 @@ exports[`SavedObjectsTable should render normally 1`] = ` Object { "id": "1", "meta": Object { - "editUrl": "#/management/kibana/index_patterns/1", + "editUrl": "#/management/kibana/indexPatterns/patterns/1", "icon": "indexPatternApp", "inAppUrl": Object { - "path": "/management/kibana/index_patterns/1", + "path": "/management/kibana/indexPatterns/patterns/1", "uiCapabilitiesPath": "management.kibana.index_patterns", }, "title": "MyIndexPattern*", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap index e9ff1e12dd109..cb2a2dd0e4d1e 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap @@ -452,10 +452,10 @@ exports[`Relationships should render searches normally 1`] = ` Object { "id": "1", "meta": Object { - "editUrl": "/management/kibana/index_patterns/1", + "editUrl": "/management/kibana/indexPatterns/patterns/1", "icon": "indexPatternApp", "inAppUrl": Object { - "path": "/app/kibana#/management/kibana/index_patterns/1", + "path": "/app/kibana#/management/kibana/indexPatterns/patterns/1", "uiCapabilitiesPath": "management.kibana.index_patterns", }, "title": "My Index Pattern", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap index d09dd6f8b868b..92e4e637e0d3f 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap @@ -174,10 +174,10 @@ exports[`Table prevents saved objects from being deleted 1`] = ` "attributes": Object {}, "id": "1", "meta": Object { - "editUrl": "#/management/kibana/index_patterns/1", + "editUrl": "#/management/kibana/indexPatterns/patterns/1", "icon": "indexPatternApp", "inAppUrl": Object { - "path": "/management/kibana/index_patterns/1", + "path": "/management/kibana/indexPatterns/patterns/1", "uiCapabilitiesPath": "management.kibana.index_patterns", }, "title": "MyIndexPattern*", @@ -389,10 +389,10 @@ exports[`Table should render normally 1`] = ` "attributes": Object {}, "id": "1", "meta": Object { - "editUrl": "#/management/kibana/index_patterns/1", + "editUrl": "#/management/kibana/indexPatterns/patterns/1", "icon": "indexPatternApp", "inAppUrl": Object { - "path": "/management/kibana/index_patterns/1", + "path": "/management/kibana/indexPatterns/patterns/1", "uiCapabilitiesPath": "management.kibana.index_patterns", }, "title": "MyIndexPattern*", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index 56245ab02fb43..b3372ccb6fda5 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -74,9 +74,9 @@ describe('Relationships', () => { meta: { title: 'MyIndexPattern*', icon: 'indexPatternApp', - editUrl: '#/management/kibana/index_patterns/1', + editUrl: '#/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/management/kibana/index_patterns/1', + path: '/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, @@ -109,10 +109,10 @@ describe('Relationships', () => { id: '1', relationship: 'child', meta: { - editUrl: '/management/kibana/index_patterns/1', + editUrl: '/management/kibana/indexPatterns/patterns/1', icon: 'indexPatternApp', inAppUrl: { - path: '/app/kibana#/management/kibana/index_patterns/1', + path: '/app/kibana#/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, title: 'My Index Pattern', diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index 356f227773610..b9dad983cb42d 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -38,9 +38,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/kibana/index_patterns/1', + editUrl: '#/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/management/kibana/index_patterns/1', + path: '/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, @@ -65,9 +65,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/kibana/index_patterns/1', + editUrl: '#/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/management/kibana/index_patterns/1', + path: '/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 0f385f57f0604..fc01e558f5020 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -155,9 +155,9 @@ describe('SavedObjectsTable', () => { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/management/kibana/index_patterns/1', + editUrl: '#/management/kibana/indexPatterns/patterns/1', inAppUrl: { - path: '/management/kibana/index_patterns/1', + path: '/management/kibana/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.kibana.index_patterns', }, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index b9ebaf2b236f4..0ed6a49275f67 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -456,7 +456,7 @@ export class SavedObjectsTable extends Component { const currentUrl = await browser.getCurrentUrl(); log.info('currentUrl', currentUrl); - if (!currentUrl.match(/index_patterns\/.+\?/)) { + if (!currentUrl.match(/indexPatterns\/.+\?/)) { throw new Error('Index pattern not created'); } else { log.debug('Index pattern created: ' + currentUrl); diff --git a/x-pack/plugins/graph/public/components/guidance_panel/guidance_panel.tsx b/x-pack/plugins/graph/public/components/guidance_panel/guidance_panel.tsx index 7f57a3c207ccd..4404ea494b288 100644 --- a/x-pack/plugins/graph/public/components/guidance_panel/guidance_panel.tsx +++ b/x-pack/plugins/graph/public/components/guidance_panel/guidance_panel.tsx @@ -147,7 +147,7 @@ function GuidancePanelComponent(props: GuidancePanelProps) { if (noIndexPatterns) { const managementUrl = chrome.navLinks.get('kibana:stack_management')!.url; - const indexPatternUrl = `${managementUrl}/kibana/index_patterns`; + const indexPatternUrl = `${managementUrl}/kibana/indexPatterns`; const sampleDataUrl = `${application.getUrlForApp('home')}#/tutorial_directory/sampleData`; content = ( diff --git a/x-pack/plugins/maps/public/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/components/no_index_pattern_callout.js index f6c8b7ebba63b..89cd884a6dd32 100644 --- a/x-pack/plugins/maps/public/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/components/no_index_pattern_callout.js @@ -24,7 +24,7 @@ export function NoIndexPatternCallout() { id="xpack.maps.noIndexPattern.doThisPrefixDescription" defaultMessage="You'll need to " /> - + = ({ /> } description="" - href={`${basePath.get()}/app/kibana#/management/kibana/index_patterns/${ - createIndexPattern ? indexPatternId : '' + href={`${basePath.get()}/app/kibana#/management/kibana/indexPatterns${ + createIndexPattern ? `/patterns/${indexPatternId}` : '' }`} /> 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 c29fba44285be..a1c1fb4c7b388 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 @@ -84,7 +84,7 @@ export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig testSubj: `createRollupIndexPatternButton`, isBeta: this.isBeta, onClick: () => { - urlHandler('/management/kibana/index_pattern?type=rollup'); + urlHandler('/create?type=rollup'); }, } : null; diff --git a/x-pack/plugins/siem/public/network/components/embeddables/__snapshots__/index_patterns_missing_prompt.test.tsx.snap b/x-pack/plugins/siem/public/network/components/embeddables/__snapshots__/index_patterns_missing_prompt.test.tsx.snap index 171926b53e5b9..2f063bfbea288 100644 --- a/x-pack/plugins/siem/public/network/components/embeddables/__snapshots__/index_patterns_missing_prompt.test.tsx.snap +++ b/x-pack/plugins/siem/public/network/components/embeddables/__snapshots__/index_patterns_missing_prompt.test.tsx.snap @@ -6,7 +6,7 @@ exports[`IndexPatternsMissingPrompt renders correctly against snapshot 1`] = ` Configure index patterns diff --git a/x-pack/plugins/siem/public/network/components/embeddables/index_patterns_missing_prompt.tsx b/x-pack/plugins/siem/public/network/components/embeddables/index_patterns_missing_prompt.tsx index aeed6fb2fe20e..f972acc142d25 100644 --- a/x-pack/plugins/siem/public/network/components/embeddables/index_patterns_missing_prompt.tsx +++ b/x-pack/plugins/siem/public/network/components/embeddables/index_patterns_missing_prompt.tsx @@ -61,7 +61,7 @@ export const IndexPatternsMissingPromptComponent = () => { } actions={ { - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/index_patterns', { + it(`does not allow navigation to Index Patterns; redirects to management home`, async () => { + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/indexPatterns', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); - await testSubjects.existOrFail('homeApp', { timeout: config.get('timeouts.waitFor') }); + await testSubjects.existOrFail('managementHome', { + timeout: config.get('timeouts.waitFor'), + }); }); }); }); diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts index 6513c0be44683..69f315cff5c3f 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts @@ -69,13 +69,15 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await esArchiver.unload('empty_kibana'); }); - it(`redirects to Kibana home`, async () => { - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/index_patterns', { + it(`redirects to management home`, async () => { + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/indexPatterns', { basePath: `/s/custom_space`, ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); - await testSubjects.existOrFail('homeApp', { timeout: config.get('timeouts.waitFor') }); + await testSubjects.existOrFail('managementHome', { + timeout: config.get('timeouts.waitFor'), + }); }); }); });