"`;
exports[`ModalService openConfirm() with a currently active confirm replaces the current confirm with the new one 1`] = `
Array [
diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker
index 0913d4ba4e83a..a7e0c9acd4f38 100755
--- a/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker
+++ b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker
@@ -177,6 +177,8 @@ kibana_vars=(
xpack.ingestManager.fleet.tlsCheckDisabled
xpack.ingestManager.registryUrl
xpack.license_management.enabled
+ xpack.maps.enabled
+ xpack.maps.showMapVisualizationTypes
xpack.ml.enabled
xpack.reporting.capture.browser.autoDownload
xpack.reporting.capture.browser.chromium.disableSandbox
diff --git a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana
index 449fc4e75fce8..c13676ef031b0 100755
--- a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana
+++ b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana
@@ -15,6 +15,24 @@
# Description: Kibana
### END INIT INFO
+#
+# Source function libraries if present.
+# (It improves integration with systemd)
+#
+# Red Hat
+if [ -f /etc/rc.d/init.d/functions ]; then
+ . /etc/rc.d/init.d/functions
+
+# Debian
+elif [ -f /lib/lsb/init-functions ]; then
+ . /lib/lsb/init-functions
+
+# SUSE
+elif [ -f /etc/rc.status ]; then
+ . /etc/rc.status
+ rc_reset
+fi
+
name=kibana
program=/usr/share/kibana/bin/kibana
pidfile="/var/run/kibana/$name.pid"
diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js
index 74e1ec5e2b4ed..d46b955f6668d 100644
--- a/src/dev/jest/config.js
+++ b/src/dev/jest/config.js
@@ -78,6 +78,7 @@ export default {
setupFilesAfterEnv: [
'/src/dev/jest/setup/mocks.js',
'/src/dev/jest/setup/react_testing_library.js',
+ '/src/dev/jest/setup/default_timeout.js',
],
coverageDirectory: '/target/kibana-coverage/jest',
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
diff --git a/src/dev/jest/setup/default_timeout.js b/src/dev/jest/setup/default_timeout.js
new file mode 100644
index 0000000000000..eea38e745b960
--- /dev/null
+++ b/src/dev/jest/setup/default_timeout.js
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/* eslint-env jest */
+
+/**
+ * Set the default timeout for the unit tests to 30 seconds, temporarily
+ */
+jest.setTimeout(30 * 1000);
diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx
index 72992c190e8ae..5b33b0e0ea120 100644
--- a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx
+++ b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx
@@ -25,7 +25,6 @@ import { FieldSetting } from '../../types';
import { UiSettingsType, StringValidation } from '../../../../../../core/public';
import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { Field, getEditableValue } from './field';
diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx
index 0e942665b23a9..e42432d0bc319 100644
--- a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx
+++ b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx
@@ -21,7 +21,6 @@ import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
import { UiSettingsType } from '../../../../../../core/public';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { notificationServiceMock } from '../../../../../../core/public/mocks';
diff --git a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx
index 0e3fbb3cf97fa..01f54cce60319 100644
--- a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx
+++ b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx
@@ -20,7 +20,6 @@
import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { Query } from '@elastic/eui';
diff --git a/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap b/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap
index 698c124d2d805..201c6e83a4a44 100644
--- a/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap
+++ b/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap
@@ -671,35 +671,54 @@ exports[`DashboardEmptyScreen renders correctly with visualize paragraph 1`] = `
iconType="plusInCircle"
size="s"
>
-
-
-
-
-
-
- Create new
-
-
-
+
+
+
+
+
+ Create new
+
+
+
+
+
diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx
index 933475d354cfa..0a49e524d3350 100644
--- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx
+++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx
@@ -19,7 +19,6 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { coreMock } from '../../../../core/public/mocks';
diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
index 1e07c610b0ef2..60395bce678c2 100644
--- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
@@ -17,7 +17,6 @@
* under the License.
*/
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import React from 'react';
import { skip } from 'rxjs/operators';
diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx
index 6eb85faeea014..24075e0a634ba 100644
--- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx
+++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx
@@ -17,7 +17,6 @@
* under the License.
*/
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import React from 'react';
import { mount } from 'enzyme';
diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx
index 18b1237895f79..aee8d1f4eac4d 100644
--- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx
+++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx
@@ -22,7 +22,6 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ShardFailureOpenModalButton } from './shard_failure_open_modal_button';
import { shardFailureRequest } from './__mocks__/shard_failure_request';
import { shardFailureResponse } from './__mocks__/shard_failure_response';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('ShardFailureOpenModalButton', () => {
diff --git a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx
index 8976f8ea3c107..ab7adba193d87 100644
--- a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx
+++ b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx
@@ -20,7 +20,6 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ActionBar, ActionBarProps } from './action_bar';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../query_parameters/constants';
diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx
index 524161c77cbf8..2cd829d89f78e 100644
--- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx
+++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx
@@ -20,7 +20,6 @@
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { ToolBarPagerButtons } from './tool_bar_pager_buttons';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
test('it renders ToolBarPagerButtons', () => {
diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx
index b201bea26503e..224e249a274cd 100644
--- a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx
+++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx
@@ -20,7 +20,6 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { TableHeader } from './table_header';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { SortOrder } from './helpers';
import { IndexPattern, IFieldType } from '../../../../../kibana_services';
diff --git a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx
index 1c9439bc34e58..1cc8247957512 100644
--- a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx
+++ b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx
@@ -22,7 +22,6 @@ import { ReactWrapper } from 'enzyme';
import { ContextErrorMessage } from './context_error_message';
// @ts-ignore
import { FAILURE_REASONS, LOADING_STATUS } from '../../angular/context/query';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('loading spinner', function () {
diff --git a/src/plugins/discover/public/application/components/doc/doc.test.tsx b/src/plugins/discover/public/application/components/doc/doc.test.tsx
index 0bc621714c70f..c9fa551f61aca 100644
--- a/src/plugins/discover/public/application/components/doc/doc.test.tsx
+++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx
@@ -20,7 +20,6 @@ import React from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { Doc, DocProps } from './doc';
diff --git a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx
index 3710ce72533db..9115915690324 100644
--- a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx
+++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx
@@ -19,7 +19,6 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import { DocViewer } from './doc_viewer';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { getDocViewsRegistry } from '../../../kibana_services';
import { DocViewRenderProps } from '../../doc_views/doc_views_types';
diff --git a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx
index 84ad19dbddcbf..c2eb4f08cf549 100644
--- a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx
+++ b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx
@@ -20,7 +20,6 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { HitsCounter, HitsCounterProps } from './hits_counter';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('hits counter', function () {
diff --git a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx
index 3321ac764a05b..e996da5fe0e3c 100644
--- a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx
+++ b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx
@@ -20,7 +20,6 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { LoadingSpinner } from './loading_spinner';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('loading spinner', function () {
diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx
index 3f12a8c0fa769..e1abbfd7657d0 100644
--- a/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx
+++ b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx
@@ -18,7 +18,6 @@
*/
import React from 'react';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import StubIndexPattern from 'test_utils/stub_index_pattern';
diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx
index 654df5bfa9ee9..625d6833406eb 100644
--- a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx
+++ b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx
@@ -19,7 +19,6 @@
import React, { EventHandler, MouseEvent as ReactMouseEvent } from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { DiscoverFieldSearch, Props } from './discover_field_search';
import { EuiButtonGroupProps, EuiPopover } from '@elastic/eui';
diff --git a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx
index 24e6f5993a0a5..a1b231c2d4479 100644
--- a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx
+++ b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx
@@ -24,7 +24,7 @@ import { ShallowWrapper } from 'enzyme';
import { ChangeIndexPattern } from './change_indexpattern';
import { SavedObject } from 'kibana/server';
import { DiscoverIndexPattern } from './discover_index_pattern';
-import { EuiSelectable, EuiSelectableList } from '@elastic/eui';
+import { EuiSelectable } from '@elastic/eui';
import { IIndexPattern } from 'src/plugins/data/public';
const indexPattern = {
@@ -57,7 +57,7 @@ function getIndexPatternPickerList(instance: ShallowWrapper) {
}
function getIndexPatternPickerOptions(instance: ShallowWrapper) {
- return getIndexPatternPickerList(instance).dive().find(EuiSelectableList).prop('options');
+ return getIndexPatternPickerList(instance).prop('options');
}
function selectIndexPatternPickerOption(instance: ShallowWrapper, selectedLabel: string) {
diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx
index 90ade60d2073d..9572f35641d69 100644
--- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx
+++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx
@@ -19,7 +19,6 @@
import _ from 'lodash';
import { ReactWrapper } from 'enzyme';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import StubIndexPattern from 'test_utils/stub_index_pattern';
diff --git a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx b/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx
index bf417f9f1890b..fdb0ff973dcf0 100644
--- a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx
+++ b/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx
@@ -20,8 +20,6 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { SkipBottomButton, SkipBottomButtonProps } from './skip_bottom_button';
-// @ts-ignore
-import { findTestSubject } from '@elastic/eui/lib/test';
describe('Skip to Bottom Button', function () {
let props: SkipBottomButtonProps;
diff --git a/src/plugins/discover/public/application/components/table/table.test.tsx b/src/plugins/discover/public/application/components/table/table.test.tsx
index 29659b3969365..5b840a25d8beb 100644
--- a/src/plugins/discover/public/application/components/table/table.test.tsx
+++ b/src/plugins/discover/public/application/components/table/table.test.tsx
@@ -18,7 +18,6 @@
*/
import React from 'react';
import { mount } from 'enzyme';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { DocViewTable } from './table';
import { indexPatterns, IndexPattern } from '../../../../../data/public';
diff --git a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx
index 964f94ca9d9b2..a4c10e749d868 100644
--- a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx
+++ b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx
@@ -21,7 +21,6 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { TimechartHeader, TimechartHeaderProps } from './timechart_header';
import { EuiIconTip } from '@elastic/eui';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('timechart header', function () {
diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx
index 131069909dd2a..cb900884fde97 100644
--- a/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx
+++ b/src/plugins/embeddable/public/lib/embeddables/embeddable_root.test.tsx
@@ -20,7 +20,6 @@ import React from 'react';
import { HelloWorldEmbeddable } from '../../../../../../examples/embeddable_examples/public';
import { EmbeddableRoot } from './embeddable_root';
import { mount } from 'enzyme';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
test('EmbeddableRoot renders an embeddable', async () => {
diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
index 341a51d7348b2..fcf79c1d6b211 100644
--- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
+++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
@@ -21,7 +21,6 @@ import React from 'react';
import { mount } from 'enzyme';
import { nextTick } from 'test_utils/enzyme_helpers';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { I18nProvider } from '@kbn/i18n/react';
import { CONTEXT_MENU_TRIGGER } from '../triggers';
diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx
index 34a176400dbb9..95aee3d9cb335 100644
--- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx
+++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx
@@ -30,7 +30,6 @@ import { ContainerInput } from '../../../../containers';
import { mountWithIntl as mount } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { coreMock } from '../../../../../../../../core/public/mocks';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { embeddablePluginMock } from '../../../../../mocks';
@@ -125,7 +124,7 @@ test('selecting embeddable in "Create new ..." list calls createNewEmbeddable()'
notifications={core.notifications}
SavedObjectFinder={(props) => }
/>
- ) as ReactWrapper;
+ ) as ReactWrapper;
const spy = jest.fn();
component.instance().createNewEmbeddable = spy;
diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts
index 6fddcbc84faf7..dbfa55a4e0f13 100644
--- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts
+++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts
@@ -18,8 +18,6 @@
*/
import { Container, isErrorEmbeddable } from '../../../..';
-// @ts-ignore
-import { findTestSubject } from '@elastic/eui/lib/test';
import { nextTick } from 'test_utils/enzyme_helpers';
import { CustomizePanelTitleAction } from './customize_panel_action';
import {
diff --git a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
index e094afe528498..d12a55dd827e6 100644
--- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
+++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
@@ -17,7 +17,6 @@
* under the License.
*/
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import * as React from 'react';
import { Container, isErrorEmbeddable } from '../lib';
diff --git a/src/plugins/home/public/application/components/tutorial/__snapshots__/saved_objects_installer.test.js.snap b/src/plugins/home/public/application/components/tutorial/__snapshots__/saved_objects_installer.test.js.snap
index 1e7b3d5c6284c..9a9e055d54d2f 100644
--- a/src/plugins/home/public/application/components/tutorial/__snapshots__/saved_objects_installer.test.js.snap
+++ b/src/plugins/home/public/application/components/tutorial/__snapshots__/saved_objects_installer.test.js.snap
@@ -245,22 +245,41 @@ exports[`bulkCreate should display error message when bulkCreate request fails 1
isLoading={false}
onClick={[Function]}
>
-
-
-
- Load Kibana objects
-
-
-
+
+
+ Load Kibana objects
+
+
+
+
+
@@ -565,22 +584,41 @@ exports[`bulkCreate should display success message when bulkCreate is successful
isLoading={false}
onClick={[Function]}
>
-
-
-
- Load Kibana objects
-
-
-
+
+
+ Load Kibana objects
+
+
+
+
+
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
index 6261ea2c90793..5218ebd1b4ad4 100644
--- 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
@@ -33,7 +33,7 @@ exports[`Header should render normally 1`] = `
type="button"
>
-
-
-
-
-
+
+
+
- View: View 1
-
+
+ View: View 1
+
+
-
+
diff --git a/src/plugins/kibana_utils/public/state_management/url/format.ts b/src/plugins/kibana_utils/public/state_management/url/format.ts
index 2912b665ff014..4497e509bc86b 100644
--- a/src/plugins/kibana_utils/public/state_management/url/format.ts
+++ b/src/plugins/kibana_utils/public/state_management/url/format.ts
@@ -22,6 +22,23 @@ import { stringify, ParsedQuery } from 'query-string';
import { parseUrl, parseUrlHash } from './parse';
import { url as urlUtils } from '../../../common';
+export function replaceUrlQuery(
+ rawUrl: string,
+ queryReplacer: (query: ParsedQuery) => ParsedQuery
+) {
+ const url = parseUrl(rawUrl);
+ const newQuery = queryReplacer(url.query || {});
+ const searchQueryString = stringify(urlUtils.encodeQuery(newQuery), {
+ sort: false,
+ encode: false,
+ });
+ if (!url.search && !searchQueryString) return rawUrl; // nothing to change. return original url
+ return formatUrl({
+ ...url,
+ search: searchQueryString,
+ });
+}
+
export function replaceUrlHashQuery(
rawUrl: string,
queryReplacer: (query: ParsedQuery) => ParsedQuery
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 a8c3aab2202d1..3d25134cd178d 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
@@ -78,6 +78,27 @@ describe('kbn_url_storage', () => {
const retrievedState2 = getStateFromKbnUrl('_s', newUrl);
expect(retrievedState2).toEqual(state2);
});
+
+ it('should set query to url with storeInHashQuery: false', () => {
+ let newUrl = setStateToKbnUrl(
+ '_a',
+ { tab: 'other' },
+ { useHash: false, storeInHashQuery: false },
+ 'http://localhost:5601/oxf/app/kibana/yourApp'
+ );
+ expect(newUrl).toMatchInlineSnapshot(
+ `"http://localhost:5601/oxf/app/kibana/yourApp?_a=(tab:other)"`
+ );
+ newUrl = setStateToKbnUrl(
+ '_b',
+ { f: 'test', i: '', l: '' },
+ { useHash: false, storeInHashQuery: false },
+ newUrl
+ );
+ expect(newUrl).toMatchInlineSnapshot(
+ `"http://localhost:5601/oxf/app/kibana/yourApp?_a=(tab:other)&_b=(f:test,i:'',l:'')"`
+ );
+ });
});
describe('urlControls', () => {
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 fefd5f668c6b3..a3b220f911504 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
@@ -22,7 +22,7 @@ import { stringify } from 'query-string';
import { createBrowserHistory, History } from 'history';
import { decodeState, encodeState } from '../state_encoder';
import { getCurrentUrl, parseUrl, parseUrlHash } from './parse';
-import { replaceUrlHashQuery } from './format';
+import { replaceUrlHashQuery, replaceUrlQuery } from './format';
import { url as urlUtils } from '../../../common';
/**
@@ -84,10 +84,14 @@ export function getStateFromKbnUrl(
export function setStateToKbnUrl(
key: string,
state: State,
- { useHash = false }: { useHash: boolean } = { useHash: false },
+ { useHash = false, storeInHashQuery = true }: { useHash: boolean; storeInHashQuery?: boolean } = {
+ useHash: false,
+ storeInHashQuery: true,
+ },
rawUrl = window.location.href
): string {
- return replaceUrlHashQuery(rawUrl, (query) => {
+ const replacer = storeInHashQuery ? replaceUrlHashQuery : replaceUrlQuery;
+ return replacer(rawUrl, (query) => {
const encoded = encodeState(state, useHash);
return {
...query,
diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx
index a1653c5289255..992a2fcf0c89d 100644
--- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx
+++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx
@@ -17,7 +17,7 @@
* under the License.
*/
-import { ButtonIconSide } from '@elastic/eui';
+import { EuiButtonProps } from '@elastic/eui';
export type TopNavMenuAction = (anchorElement: HTMLElement) => void;
@@ -32,7 +32,7 @@ export interface TopNavMenuData {
tooltip?: string | (() => string | undefined);
emphasize?: boolean;
iconType?: string;
- iconSide?: ButtonIconSide;
+ iconSide?: EuiButtonProps['iconSide'];
}
export interface RegisteredTopNavMenuData extends TopNavMenuData {
diff --git a/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/header.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/header.test.tsx.snap
index d56776c2be9d7..f5c2d3efd56f7 100644
--- a/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/header.test.tsx.snap
+++ b/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/header.test.tsx.snap
@@ -58,45 +58,63 @@ exports[`Intro component renders correctly 1`] = `
iconType="eye"
size="s"
>
-
-
-
-
-
-
-
+
- View search
-
-
-
-
+
+
+
+
+
+ View search
+
+
+
+
+
+
@@ -113,45 +131,64 @@ exports[`Intro component renders correctly 1`] = `
onClick={[Function]}
size="s"
>
-
-
-
-
-
-
-
+
- Delete search
-
-
-
-
+
+
+
+
+
+ Delete search
+
+
+
+
+
+
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 6256e5fcd49c5..0c7bf64ca011d 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
@@ -19,7 +19,6 @@
import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
-// @ts-expect-error
import { findTestSubject } from '@elastic/eui/lib/test';
import { keys } from '@elastic/eui';
import { httpServiceMock } from '../../../../../../core/public/mocks';
diff --git a/src/plugins/vis_type_timeseries/public/application/components/color_picker.test.tsx b/src/plugins/vis_type_timeseries/public/application/components/color_picker.test.tsx
index 7c930fa2e2960..ee13408511ab5 100644
--- a/src/plugins/vis_type_timeseries/public/application/components/color_picker.test.tsx
+++ b/src/plugins/vis_type_timeseries/public/application/components/color_picker.test.tsx
@@ -22,7 +22,6 @@ import { ColorPicker, ColorPickerProps } from './color_picker';
import { mount } from 'enzyme';
import { ReactWrapper } from 'enzyme';
import { EuiColorPicker, EuiIconTip } from '@elastic/eui';
-// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
describe('ColorPicker', () => {
diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap b/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap
index 8a90ff8982732..6e8d018bd8f0e 100644
--- a/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap
+++ b/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap
@@ -2,4 +2,4 @@
exports[`VisLegend Component Legend closed should match the snapshot 1`] = `"
"`;
-exports[`VisLegend Component Legend open should match the snapshot 1`] = `"
A
B
"`;
+exports[`VisLegend Component Legend open should match the snapshot 1`] = `"
A
B
"`;
diff --git a/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap b/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap
index 5458c88974572..a27dfa13e743e 100644
--- a/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap
+++ b/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap
@@ -142,11 +142,15 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
class="euiOverlayMask euiOverlayMask--aboveHeader"
>
-
-
-
-
-
-
-
-
-
-
-
-
- New Visualization
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2 types found
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Vis with alias Url
-
-
-
-
-
-
-
-
-
-
-
-
-
- Vis with search
-
-
-
-
-
-
-
-
-
-
-
-
-
- Vis Type 1
-
-
-
-
-
-
-
-
-
-
-
- Select a visualization type
-
-
-
-
- Start creating your visualization by selecting a type for that visualization.
-
"
`;
exports[`Canvas Shareable Workpad API Placed successfully with page specified 1`] = `""`;
@@ -33,7 +33,7 @@ exports[`Canvas Shareable Workpad API Placed successfully with page specified 2`
markdown mock
markdown mock
My Canvas Workpad
Page 1
"
+
markdown mock
My Canvas Workpad
Page 1
"
`;
exports[`Canvas Shareable Workpad API Placed successfully with width and height specified 1`] = `""`;
@@ -45,7 +45,7 @@ exports[`Canvas Shareable Workpad API Placed successfully with width and height
markdown mock
markdown mock
My Canvas Workpad
Page 1
"
+
markdown mock
My Canvas Workpad
Page 1
"
`;
exports[`Canvas Shareable Workpad API Placed successfully with width specified 1`] = `""`;
@@ -57,5 +57,5 @@ exports[`Canvas Shareable Workpad API Placed successfully with width specified 2
"
`;
diff --git a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot
index 6ff39b723a49a..2d3a9c460272c 100644
--- a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot
+++ b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot
@@ -1351,7 +1351,7 @@ exports[`Storyshots shareables/Footer contextual: austin 1`] = `
type="button"
>
can navigate Autoplay Settings 2`] = `
type="submit"
>
{
+ it('renders', () => {
+ const wrapper = shallow();
+
+ expect(wrapper.find(SideNav)).toHaveLength(1);
+ expect(wrapper.find(SideNavLink).first().prop('to')).toEqual('/');
+ expect(wrapper.find(SideNavLink).last().prop('to')).toEqual('http://localhost:3002/ws/search');
+ });
+});
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx
new file mode 100644
index 0000000000000..8f8edc61620ab
--- /dev/null
+++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx
@@ -0,0 +1,74 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import React, { useContext } from 'react';
+import { i18n } from '@kbn/i18n';
+
+import { EuiSpacer } from '@elastic/eui';
+
+import { WORKPLACE_SEARCH_PLUGIN } from '../../../../../common/constants';
+import { KibanaContext, IKibanaContext } from '../../../index';
+import { SideNav, SideNavLink } from '../../../shared/layout';
+
+import {
+ ORG_SOURCES_PATH,
+ SOURCES_PATH,
+ SECURITY_PATH,
+ ROLE_MAPPINGS_PATH,
+ GROUPS_PATH,
+ ORG_SETTINGS_PATH,
+} from '../../routes';
+
+export const WorkplaceSearchNav: React.FC = () => {
+ const { enterpriseSearchUrl } = useContext(KibanaContext) as IKibanaContext;
+ const legacyUrl = (path: string) => `${enterpriseSearchUrl}/ws#${path}`;
+
+ // TODO: icons
+ return (
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.overview', {
+ defaultMessage: 'Overview',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.sources', {
+ defaultMessage: 'Sources',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.groups', {
+ defaultMessage: 'Groups',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.roleMappings', {
+ defaultMessage: 'Role Mappings',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.security', {
+ defaultMessage: 'Security',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.settings', {
+ defaultMessage: 'Settings',
+ })}
+
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard', {
+ defaultMessage: 'View my personal dashboard',
+ })}
+
+
+ {i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.search', {
+ defaultMessage: 'Go to search application',
+ })}
+
+
+ );
+};
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/overview/overview.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/overview/overview.tsx
index 2c3e78b404d42..b816eb2973207 100644
--- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/overview/overview.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/overview/overview.tsx
@@ -4,6 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
+// TODO: Remove EuiPage & EuiPageBody before exposing full app
+
import React, { useContext, useEffect } from 'react';
import { EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx
index 743080d965c36..a4af405247f83 100644
--- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx
@@ -15,7 +15,7 @@ import { Overview } from './components/overview';
import { WorkplaceSearch } from './';
-describe('Workplace Search Routes', () => {
+describe('Workplace Search', () => {
describe('/', () => {
it('redirects to Setup Guide when enterpriseSearchUrl is not set', () => {
(useContext as jest.Mock).mockImplementationOnce(() => ({ enterpriseSearchUrl: '' }));
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx
index cfa70ea29eca8..6470a3b78c5f1 100644
--- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx
@@ -5,7 +5,7 @@
*/
import React, { useContext } from 'react';
-import { Route, Redirect } from 'react-router-dom';
+import { Route, Redirect, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { Store } from 'redux';
import { getContext, resetContext } from 'kea';
@@ -15,6 +15,8 @@ resetContext({ createStore: true });
const store = getContext().store as Store;
import { KibanaContext, IKibanaContext } from '../index';
+import { Layout } from '../shared/layout';
+import { WorkplaceSearchNav } from './components/layout/nav';
import { SETUP_GUIDE_PATH } from './routes';
@@ -23,14 +25,39 @@ import { Overview } from './components/overview';
export const WorkplaceSearch: React.FC = () => {
const { enterpriseSearchUrl } = useContext(KibanaContext) as IKibanaContext;
+ if (!enterpriseSearchUrl)
+ return (
+
+
+
+
+
+
+ {/* Kibana displays a blank page on redirect if this isn't included */}
+
+
+ );
+
return (
-
- {!enterpriseSearchUrl ? : }
-
-
-
-
+
+
+
+
+
+
+
+
+ }>
+
+
+ {/* Will replace with groups component subsequent PR */}
+
+
+
+
+
+
);
};
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/routes.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/routes.ts
index d9798d1f30cfc..993a1a378e738 100644
--- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/routes.ts
+++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/routes.ts
@@ -4,9 +4,107 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export const ORG_SOURCES_PATH = '/org/sources';
-export const USERS_PATH = '/org/users';
-export const ORG_SETTINGS_PATH = '/org/settings';
+import { CURRENT_MAJOR_VERSION } from '../../../common/version';
+
export const SETUP_GUIDE_PATH = '/setup_guide';
+export const LEAVE_FEEDBACK_EMAIL = 'support@elastic.co';
+export const LEAVE_FEEDBACK_URL = `mailto:${LEAVE_FEEDBACK_EMAIL}?Subject=Elastic%20Workplace%20Search%20Feedback`;
+
+export const DOCS_PREFIX = `https://www.elastic.co/guide/en/workplace-search/${CURRENT_MAJOR_VERSION}`;
+export const ENT_SEARCH_DOCS_PREFIX = `https://www.elastic.co/guide/en/enterprise-search/${CURRENT_MAJOR_VERSION}`;
+export const DOCUMENT_PERMISSIONS_DOCS_URL = `${DOCS_PREFIX}/workplace-search-sources-document-permissions.html`;
+export const DOCUMENT_PERMISSIONS_SYNC_DOCS_URL = `${DOCUMENT_PERMISSIONS_DOCS_URL}#sources-permissions-synchronizing`;
+export const PRIVATE_SOURCES_DOCS_URL = `${DOCUMENT_PERMISSIONS_DOCS_URL}#sources-permissions-org-private`;
+export const EXTERNAL_IDENTITIES_DOCS_URL = `${DOCS_PREFIX}/workplace-search-external-identities-api.html`;
+export const SECURITY_DOCS_URL = `${DOCS_PREFIX}/workplace-search-security.html`;
+export const SMTP_DOCS_URL = `${DOCS_PREFIX}/workplace-search-smtp-mailer.html`;
+export const CONFLUENCE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-confluence-cloud-connector.html`;
+export const CONFLUENCE_SERVER_DOCS_URL = `${DOCS_PREFIX}/workplace-search-confluence-server-connector.html`;
+export const DROPBOX_DOCS_URL = `${DOCS_PREFIX}/workplace-search-dropbox-connector.html`;
+export const GITHUB_DOCS_URL = `${DOCS_PREFIX}/workplace-search-github-connector.html`;
+export const GITHUB_ENTERPRISE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-github-connector.html`;
+export const GMAIL_DOCS_URL = `${DOCS_PREFIX}/workplace-search-gmail-connector.html`;
+export const GOOGLE_DRIVE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-google-drive-connector.html`;
+export const JIRA_DOCS_URL = `${DOCS_PREFIX}/workplace-search-jira-cloud-connector.html`;
+export const JIRA_SERVER_DOCS_URL = `${DOCS_PREFIX}/workplace-search-jira-server-connector.html`;
+export const ONE_DRIVE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-onedrive-connector.html`;
+export const SALESFORCE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-salesforce-connector.html`;
+export const SERVICE_NOW_DOCS_URL = `${DOCS_PREFIX}/workplace-search-servicenow-connector.html`;
+export const SHARE_POINT_DOCS_URL = `${DOCS_PREFIX}/workplace-search-sharepoint-online-connector.html`;
+export const SLACK_DOCS_URL = `${DOCS_PREFIX}/workplace-search-slack-connector.html`;
+export const ZENDESK_DOCS_URL = `${DOCS_PREFIX}/workplace-search-zendesk-connector.html`;
+export const CUSTOM_SOURCE_DOCS_URL = `${DOCS_PREFIX}/workplace-search-custom-api-sources.html`;
+export const CUSTOM_API_DOCS_URL = `${DOCS_PREFIX}/workplace-search-custom-sources-api.html`;
+export const CUSTOM_API_DOCUMENT_PERMISSIONS_DOCS_URL = `${CUSTOM_SOURCE_DOCS_URL}#custom-api-source-document-level-access-control`;
+export const ENT_SEARCH_LICENSE_MANAGEMENT = `${ENT_SEARCH_DOCS_PREFIX}/license-management.html`;
+
+export const ORG_PATH = '/org';
+
+export const ROLE_MAPPINGS_PATH = `${ORG_PATH}/role-mappings`;
+export const ROLE_MAPPING_PATH = `${ROLE_MAPPINGS_PATH}/:roleId`;
+export const ROLE_MAPPING_NEW_PATH = `${ROLE_MAPPINGS_PATH}/new`;
+
+export const USERS_PATH = `${ORG_PATH}/users`;
+export const SECURITY_PATH = `${ORG_PATH}/security`;
+
+export const GROUPS_PATH = `${ORG_PATH}/groups`;
+export const GROUP_PATH = `${GROUPS_PATH}/:groupId`;
+export const GROUP_SOURCE_PRIORITIZATION_PATH = `${GROUPS_PATH}/:groupId/source-prioritization`;
+
+export const SOURCES_PATH = '/sources';
+export const ORG_SOURCES_PATH = `${ORG_PATH}${SOURCES_PATH}`;
+
+export const SOURCE_ADDED_PATH = `${SOURCES_PATH}/added`;
+export const ADD_SOURCE_PATH = `${SOURCES_PATH}/add`;
+export const ADD_CONFLUENCE_PATH = `${SOURCES_PATH}/add/confluence-cloud`;
+export const ADD_CONFLUENCE_SERVER_PATH = `${SOURCES_PATH}/add/confluence-server`;
+export const ADD_DROPBOX_PATH = `${SOURCES_PATH}/add/dropbox`;
+export const ADD_GITHUB_ENTERPRISE_PATH = `${SOURCES_PATH}/add/github-enterprise-server`;
+export const ADD_GITHUB_PATH = `${SOURCES_PATH}/add/github`;
+export const ADD_GMAIL_PATH = `${SOURCES_PATH}/add/gmail`;
+export const ADD_GOOGLE_DRIVE_PATH = `${SOURCES_PATH}/add/google-drive`;
+export const ADD_JIRA_PATH = `${SOURCES_PATH}/add/jira-cloud`;
+export const ADD_JIRA_SERVER_PATH = `${SOURCES_PATH}/add/jira-server`;
+export const ADD_ONE_DRIVE_PATH = `${SOURCES_PATH}/add/one-drive`;
+export const ADD_SALESFORCE_PATH = `${SOURCES_PATH}/add/salesforce`;
+export const ADD_SERVICE_NOW_PATH = `${SOURCES_PATH}/add/service-now`;
+export const ADD_SHARE_POINT_PATH = `${SOURCES_PATH}/add/share-point`;
+export const ADD_SLACK_PATH = `${SOURCES_PATH}/add/slack`;
+export const ADD_ZENDESK_PATH = `${SOURCES_PATH}/add/zendesk`;
+export const ADD_CUSTOM_PATH = `${SOURCES_PATH}/add/custom`;
+
+export const PERSONAL_SETTINGS_PATH = '/settings';
+
+export const SOURCE_DETAILS_PATH = `${SOURCES_PATH}/:sourceId`;
+export const SOURCE_CONTENT_PATH = `${SOURCES_PATH}/:sourceId/content`;
+export const SOURCE_SCHEMAS_PATH = `${SOURCES_PATH}/:sourceId/schemas`;
+export const SOURCE_DISPLAY_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/display-settings`;
+export const SOURCE_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/settings`;
+export const REINDEX_JOB_PATH = `${SOURCES_PATH}/:sourceId/schema-errors/:activeReindexJobId`;
+
+export const DISPLAY_SETTINGS_SEARCH_RESULT_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/`;
+export const DISPLAY_SETTINGS_RESULT_DETAIL_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/result-detail`;
+
+export const ORG_SETTINGS_PATH = `${ORG_PATH}/settings`;
+export const ORG_SETTINGS_CUSTOMIZE_PATH = `${ORG_SETTINGS_PATH}/customize`;
+export const ORG_SETTINGS_CONNECTORS_PATH = `${ORG_SETTINGS_PATH}/connectors`;
+export const ORG_SETTINGS_OAUTH_APPLICATION_PATH = `${ORG_SETTINGS_PATH}/oauth`;
+export const EDIT_CONFLUENCE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence-cloud/edit`;
+export const EDIT_CONFLUENCE_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/confluence-server/edit`;
+export const EDIT_DROPBOX_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/dropbox/edit`;
+export const EDIT_GITHUB_ENTERPRISE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/github-enterprise-server/edit`;
+export const EDIT_GITHUB_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/github/edit`;
+export const EDIT_GMAIL_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/gmail/edit`;
+export const EDIT_GOOGLE_DRIVE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/google-drive/edit`;
+export const EDIT_JIRA_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira-cloud/edit`;
+export const EDIT_JIRA_SERVER_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/jira-server/edit`;
+export const EDIT_ONE_DRIVE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/one-drive/edit`;
+export const EDIT_SALESFORCE_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/salesforce/edit`;
+export const EDIT_SERVICE_NOW_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/service-now/edit`;
+export const EDIT_SHARE_POINT_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/share-point/edit`;
+export const EDIT_SLACK_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/slack/edit`;
+export const EDIT_ZENDESK_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/zendesk/edit`;
+export const EDIT_CUSTOM_PATH = `${ORG_SETTINGS_CONNECTORS_PATH}/custom/edit`;
+
export const getSourcePath = (sourceId: string): string => `${ORG_SOURCES_PATH}/${sourceId}`;
diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.js.snap b/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.js.snap
index 5edc5a9343fc3..ad3e0956fcf25 100644
--- a/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.js.snap
+++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.js.snap
@@ -97,11 +97,10 @@ exports[`policy table should show empty state when there are not any policies 1`
type="button"
>
({
- phaseData: getPhase(state, PHASE_COLD),
- hotPhaseRolloverEnabled: getPhase(state, PHASE_HOT)[PHASE_ROLLOVER_ENABLED],
- }),
- {
- setPhaseData: (key, value) => setPhaseData(PHASE_COLD, key, value),
- }
-)(PresentationComponent);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/index.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/index.js
deleted file mode 100644
index e0d70ceb57726..0000000000000
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { ColdPhase } from './cold_phase.container';
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.container.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.container.js
deleted file mode 100644
index 84bd17e3637e8..0000000000000
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.container.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { connect } from 'react-redux';
-import { getPhase } from '../../../../store/selectors';
-import { setPhaseData } from '../../../../store/actions';
-import { PHASE_DELETE, PHASE_HOT, PHASE_ROLLOVER_ENABLED } from '../../../../constants';
-import { DeletePhase as PresentationComponent } from './delete_phase';
-
-export const DeletePhase = connect(
- (state) => ({
- phaseData: getPhase(state, PHASE_DELETE),
- hotPhaseRolloverEnabled: getPhase(state, PHASE_HOT)[PHASE_ROLLOVER_ENABLED],
- }),
- {
- setPhaseData: (key, value) => setPhaseData(PHASE_DELETE, key, value),
- }
-)(PresentationComponent);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form_errors.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/form_errors.tsx
similarity index 100%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form_errors.tsx
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/form_errors.tsx
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.container.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.container.js
deleted file mode 100644
index 5f1451afdcc31..0000000000000
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.container.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { connect } from 'react-redux';
-
-import { getPhase } from '../../../../store/selectors';
-import { setPhaseData } from '../../../../store/actions';
-import { PHASE_HOT, PHASE_WARM, WARM_PHASE_ON_ROLLOVER } from '../../../../constants';
-import { HotPhase as PresentationComponent } from './hot_phase';
-
-export const HotPhase = connect(
- (state) => ({
- phaseData: getPhase(state, PHASE_HOT),
- }),
- {
- setPhaseData: (key, value) => setPhaseData(PHASE_HOT, key, value),
- setWarmPhaseOnRollover: (value) => setPhaseData(PHASE_WARM, WARM_PHASE_ON_ROLLOVER, value),
- }
-)(PresentationComponent);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/index.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/index.ts
similarity index 54%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/components/index.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/index.ts
index a2ae37780b9f9..e933c46e98491 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/index.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/index.ts
@@ -5,6 +5,13 @@
*/
export { ActiveBadge } from './active_badge';
+export { ErrableFormRow } from './form_errors';
export { LearnMoreLink } from './learn_more_link';
-export { PhaseErrorMessage } from './phase_error_message';
+export { MinAgeInput } from './min_age_input';
+export { NodeAllocation } from './node_allocation';
+export { NodeAttrsDetails } from './node_attrs_details';
export { OptionalLabel } from './optional_label';
+export { PhaseErrorMessage } from './phase_error_message';
+export { PolicyJsonFlyout } from './policy_json_flyout';
+export { SetPriorityInput } from './set_priority_input';
+export { SnapshotPolicies } from './snapshot_policies';
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/learn_more_link.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx
similarity index 92%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/components/learn_more_link.tsx
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx
index 623ff982438d7..5ada49b318018 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/learn_more_link.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx
@@ -8,7 +8,7 @@ import React, { ReactNode } from 'react';
import { EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-import { createDocLink } from '../../services/documentation';
+import { createDocLink } from '../../../services/documentation';
interface Props {
docPath: string;
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.tsx
similarity index 91%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.tsx
index d90ad9378efd4..c9732f2311758 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/min_age_input.tsx
@@ -16,10 +16,10 @@ import {
PHASE_COLD,
PHASE_DELETE,
} from '../../../constants';
-import { LearnMoreLink } from '../../components';
-import { ErrableFormRow } from '../form_errors';
+import { LearnMoreLink } from './learn_more_link';
+import { ErrableFormRow } from './form_errors';
-function getTimingLabelForPhase(phase) {
+function getTimingLabelForPhase(phase: string) {
// NOTE: Hot phase isn't necessary, because indices begin in the hot phase.
switch (phase) {
case PHASE_WARM:
@@ -39,7 +39,7 @@ function getTimingLabelForPhase(phase) {
}
}
-function getUnitsAriaLabelForPhase(phase) {
+function getUnitsAriaLabelForPhase(phase: string) {
// NOTE: Hot phase isn't necessary, because indices begin in the hot phase.
switch (phase) {
case PHASE_WARM:
@@ -68,9 +68,24 @@ function getUnitsAriaLabelForPhase(phase) {
}
}
-export const MinAgeInput = (props) => {
- const { rolloverEnabled, errors, phaseData, phase, setPhaseData, isShowingErrors } = props;
+interface Props {
+ rolloverEnabled: boolean;
+ errors: Record;
+ phase: string;
+ // TODO add types for phaseData and setPhaseData after policy is typed
+ phaseData: any;
+ setPhaseData: (dataKey: string, value: any) => void;
+ isShowingErrors: boolean;
+}
+export const MinAgeInput: React.FunctionComponent = ({
+ rolloverEnabled,
+ errors,
+ phaseData,
+ phase,
+ setPhaseData,
+ isShowingErrors,
+}) => {
let daysOptionLabel;
let hoursOptionLabel;
let minutesOptionLabel;
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/node_allocation.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation.tsx
similarity index 93%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/node_allocation.tsx
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation.tsx
index 31261de45c743..576483a5ab9c2 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/node_allocation.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation.tsx
@@ -16,17 +16,18 @@ import {
EuiButton,
} from '@elastic/eui';
-import { PHASE_NODE_ATTRS } from '../../../../constants';
-import { LearnMoreLink } from '../../../components/learn_more_link';
-import { ErrableFormRow } from '../../form_errors';
-import { useLoadNodes } from '../../../../services/api';
-import { NodeAttrsDetails } from '../node_attrs_details';
+import { PHASE_NODE_ATTRS } from '../../../constants';
+import { LearnMoreLink } from './learn_more_link';
+import { ErrableFormRow } from './form_errors';
+import { useLoadNodes } from '../../../services/api';
+import { NodeAttrsDetails } from './node_attrs_details';
interface Props {
phase: string;
- setPhaseData: (dataKey: string, value: any) => void;
- errors: any;
+ errors: Record;
+ // TODO add types for phaseData and setPhaseData after policy is typed
phaseData: any;
+ setPhaseData: (dataKey: string, value: any) => void;
isShowingErrors: boolean;
}
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/node_attrs_details.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details.tsx
similarity index 97%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/node_attrs_details.tsx
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details.tsx
index 6fcbd94dc5e9a..cd87cc324a414 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/node_attrs_details.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details.tsx
@@ -20,7 +20,7 @@ import {
EuiButton,
} from '@elastic/eui';
-import { useLoadNodeDetails } from '../../../../services/api';
+import { useLoadNodeDetails } from '../../../services/api';
interface Props {
close: () => void;
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/index.ts
deleted file mode 100644
index 056d2f2f600f3..0000000000000
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_attrs_details/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { NodeAttrsDetails } from './node_attrs_details';
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/optional_label.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/optional_label.tsx
similarity index 100%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/components/optional_label.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/optional_label.tsx
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/phase_error_message.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_error_message.tsx
similarity index 87%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/components/phase_error_message.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_error_message.tsx
index 904ac7c25f2f9..750f68543f221 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/components/phase_error_message.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_error_message.tsx
@@ -7,7 +7,7 @@ import React from 'react';
import { EuiBadge } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-export const PhaseErrorMessage = ({ isShowingErrors }) => {
+export const PhaseErrorMessage = ({ isShowingErrors }: { isShowingErrors: boolean }) => {
return isShowingErrors ? (
'}`;
- const request = `${endpoint}\n${this.getEsJson(lifecycle)}`;
-
- return (
-
-
-
-
- {policyName ? (
-
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {request}
-
-
-
-
-
-
-
-
-
- );
- }
-}
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/policy_json_flyout.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/policy_json_flyout.tsx
new file mode 100644
index 0000000000000..aaf4aa6e6222d
--- /dev/null
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/policy_json_flyout.tsx
@@ -0,0 +1,98 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React from 'react';
+import { FormattedMessage } from '@kbn/i18n/react';
+
+import {
+ EuiButtonEmpty,
+ EuiCodeBlock,
+ EuiFlyout,
+ EuiFlyoutBody,
+ EuiFlyoutFooter,
+ EuiFlyoutHeader,
+ EuiSpacer,
+ EuiText,
+ EuiTitle,
+} from '@elastic/eui';
+
+interface Props {
+ close: () => void;
+ // TODO add types for lifecycle after policy is typed
+ lifecycle: any;
+ policyName: string;
+}
+
+export const PolicyJsonFlyout: React.FunctionComponent = ({
+ close,
+ lifecycle,
+ policyName,
+}) => {
+ // @ts-ignore until store is typed
+ const getEsJson = ({ phases }) => {
+ return JSON.stringify(
+ {
+ policy: {
+ phases,
+ },
+ },
+ null,
+ 2
+ );
+ };
+
+ const endpoint = `PUT _ilm/policy/${policyName || ''}`;
+ const request = `${endpoint}\n${getEsJson(lifecycle)}`;
+
+ return (
+
+
+
+
+ {policyName ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {request}
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.tsx
similarity index 80%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.tsx
index bdcc1e23b4230..0034de85fce17 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/set_priority_input.tsx
@@ -8,12 +8,26 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFieldNumber, EuiTextColor, EuiDescribedFormGroup } from '@elastic/eui';
import { PHASE_INDEX_PRIORITY } from '../../../constants';
-import { LearnMoreLink, OptionalLabel } from '../../components';
-import { ErrableFormRow } from '../form_errors';
-export const SetPriorityInput = (props) => {
- const { errors, phaseData, phase, setPhaseData, isShowingErrors } = props;
+import { LearnMoreLink } from './';
+import { OptionalLabel } from './';
+import { ErrableFormRow } from './';
+interface Props {
+ errors: Record;
+ // TODO add types for phaseData and setPhaseData after policy is typed
+ phase: string;
+ phaseData: any;
+ setPhaseData: (dataKey: string, value: any) => void;
+ isShowingErrors: boolean;
+}
+export const SetPriorityInput: React.FunctionComponent = ({
+ errors,
+ phaseData,
+ phase,
+ setPhaseData,
+ isShowingErrors,
+}) => {
return (
({
- phaseData: getPhase(state, PHASE_WARM),
- hotPhaseRolloverEnabled: getPhase(state, PHASE_HOT)[PHASE_ROLLOVER_ENABLED],
- }),
- {
- setPhaseData: (key, value) => setPhaseData(PHASE_WARM, key, value),
- }
-)(PresentationComponent);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.container.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.container.js
index 1c6ced8953211..e7f20a66d09f0 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.container.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.container.js
@@ -15,6 +15,7 @@ import {
isPolicyListLoaded,
getIsNewPolicy,
getSelectedOriginalPolicyName,
+ getPhases,
} from '../../store/selectors';
import {
@@ -23,6 +24,7 @@ import {
setSaveAsNewPolicy,
saveLifecyclePolicy,
fetchPolicies,
+ setPhaseData,
} from '../../store/actions';
import { findFirstError } from '../../services/find_errors';
@@ -42,6 +44,7 @@ export const EditPolicy = connect(
isPolicyListLoaded: isPolicyListLoaded(state),
isNewPolicy: getIsNewPolicy(state),
originalPolicyName: getSelectedOriginalPolicyName(state),
+ phases: getPhases(state),
};
},
{
@@ -50,5 +53,6 @@ export const EditPolicy = connect(
setSaveAsNewPolicy,
saveLifecyclePolicy,
fetchPolicies,
+ setPhaseData,
}
)(PresentationComponent);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
index d9d8866a2e2cc..a29ecd07c5e45 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
@@ -33,17 +33,15 @@ import {
PHASE_DELETE,
PHASE_WARM,
STRUCTURE_POLICY_NAME,
+ WARM_PHASE_ON_ROLLOVER,
+ PHASE_ROLLOVER_ENABLED,
} from '../../constants';
import { toasts } from '../../services/notification';
import { findFirstError } from '../../services/find_errors';
-import { LearnMoreLink } from '../components';
-import { PolicyJsonFlyout } from './components/policy_json_flyout';
-import { ErrableFormRow } from './form_errors';
-import { HotPhase } from './components/hot_phase';
-import { WarmPhase } from './components/warm_phase';
-import { DeletePhase } from './components/delete_phase';
-import { ColdPhase } from './components/cold_phase';
+import { LearnMoreLink, PolicyJsonFlyout, ErrableFormRow } from './components';
+
+import { HotPhase, WarmPhase, ColdPhase, DeletePhase } from './phases';
export class EditPolicy extends Component {
static propTypes = {
@@ -137,6 +135,8 @@ export class EditPolicy extends Component {
isNewPolicy,
lifecycle,
originalPolicyName,
+ phases,
+ setPhaseData,
} = this.props;
const selectedPolicyName = selectedPolicy.name;
const { isShowingErrors, isShowingPolicyJsonFlyout } = this.state;
@@ -275,9 +275,13 @@ export class EditPolicy extends Component {
setPhaseData(PHASE_HOT, key, value)}
+ phaseData={phases[PHASE_HOT]}
+ setWarmPhaseOnRollover={(value) =>
+ setPhaseData(PHASE_WARM, WARM_PHASE_ON_ROLLOVER, value)
+ }
/>
@@ -285,6 +289,9 @@ export class EditPolicy extends Component {
setPhaseData(PHASE_WARM, key, value)}
+ phaseData={phases[PHASE_WARM]}
+ hotPhaseRolloverEnabled={phases[PHASE_HOT][PHASE_ROLLOVER_ENABLED]}
/>
@@ -292,6 +299,9 @@ export class EditPolicy extends Component {
setPhaseData(PHASE_COLD, key, value)}
+ phaseData={phases[PHASE_COLD]}
+ hotPhaseRolloverEnabled={phases[PHASE_HOT][PHASE_ROLLOVER_ENABLED]}
/>
@@ -300,6 +310,9 @@ export class EditPolicy extends Component {
errors={errors[PHASE_DELETE]}
isShowingErrors={isShowingErrors && !!findFirstError(errors[PHASE_DELETE], false)}
getUrlForApp={this.props.getUrlForApp}
+ setPhaseData={(key, value) => setPhaseData(PHASE_DELETE, key, value)}
+ phaseData={phases[PHASE_DELETE]}
+ hotPhaseRolloverEnabled={phases[PHASE_HOT][PHASE_ROLLOVER_ENABLED]}
/>
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/cold_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/cold_phase.tsx
similarity index 92%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/cold_phase.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/cold_phase.tsx
index 200bf0e767d9d..babbbf7638ebe 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/cold_phase/cold_phase.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/cold_phase.tsx
@@ -5,7 +5,6 @@
*/
import React, { PureComponent, Fragment } from 'react';
-import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
@@ -24,20 +23,27 @@ import {
PHASE_ENABLED,
PHASE_REPLICA_COUNT,
PHASE_FREEZE_ENABLED,
-} from '../../../../constants';
-import { LearnMoreLink, ActiveBadge, PhaseErrorMessage, OptionalLabel } from '../../../components';
-import { ErrableFormRow } from '../../form_errors';
-import { MinAgeInput } from '../min_age_input';
-import { NodeAllocation } from '../node_allocation';
-import { SetPriorityInput } from '../set_priority_input';
+} from '../../../constants';
+import {
+ LearnMoreLink,
+ ActiveBadge,
+ PhaseErrorMessage,
+ OptionalLabel,
+ ErrableFormRow,
+ MinAgeInput,
+ NodeAllocation,
+ SetPriorityInput,
+} from '../components';
-export class ColdPhase extends PureComponent {
- static propTypes = {
- setPhaseData: PropTypes.func.isRequired,
+interface Props {
+ setPhaseData: (key: string, value: any) => void;
+ phaseData: any;
+ isShowingErrors: boolean;
+ errors: Record;
+ hotPhaseRolloverEnabled: boolean;
+}
- isShowingErrors: PropTypes.bool.isRequired,
- errors: PropTypes.object.isRequired,
- };
+export class ColdPhase extends PureComponent {
render() {
const {
setPhaseData,
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/delete_phase.tsx
similarity index 88%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/delete_phase.tsx
index 2b12eec953e11..0143cc4af24e3 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/delete_phase.tsx
@@ -5,22 +5,35 @@
*/
import React, { PureComponent, Fragment } from 'react';
-import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiDescribedFormGroup, EuiSwitch, EuiTextColor, EuiFormRow } from '@elastic/eui';
-import { PHASE_DELETE, PHASE_ENABLED, PHASE_WAIT_FOR_SNAPSHOT_POLICY } from '../../../../constants';
-import { ActiveBadge, LearnMoreLink, OptionalLabel, PhaseErrorMessage } from '../../../components';
-import { MinAgeInput } from '../min_age_input';
-import { SnapshotPolicies } from '../snapshot_policies';
+import { PHASE_DELETE, PHASE_ENABLED, PHASE_WAIT_FOR_SNAPSHOT_POLICY } from '../../../constants';
+import {
+ ActiveBadge,
+ LearnMoreLink,
+ OptionalLabel,
+ PhaseErrorMessage,
+ MinAgeInput,
+ SnapshotPolicies,
+} from '../components';
-export class DeletePhase extends PureComponent {
- static propTypes = {
- setPhaseData: PropTypes.func.isRequired,
- isShowingErrors: PropTypes.bool.isRequired,
- errors: PropTypes.object.isRequired,
- };
+interface Props {
+ setPhaseData: (key: string, value: any) => void;
+ phaseData: any;
+ isShowingErrors: boolean;
+ errors: Record;
+ hotPhaseRolloverEnabled: boolean;
+ getUrlForApp: (
+ appId: string,
+ options?: {
+ path?: string;
+ absolute?: boolean;
+ }
+ ) => string;
+}
+export class DeletePhase extends PureComponent {
render() {
const {
setPhaseData,
@@ -28,6 +41,7 @@ export class DeletePhase extends PureComponent {
errors,
isShowingErrors,
hotPhaseRolloverEnabled,
+ getUrlForApp,
} = this.props;
return (
@@ -123,7 +137,7 @@ export class DeletePhase extends PureComponent {
setPhaseData(PHASE_WAIT_FOR_SNAPSHOT_POLICY, value)}
- getUrlForApp={this.props.getUrlForApp}
+ getUrlForApp={getUrlForApp}
/>
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/hot_phase.tsx
similarity index 96%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/hot_phase.tsx
index b420442198712..dbd48f3a85634 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/hot_phase/hot_phase.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/hot_phase.tsx
@@ -5,7 +5,6 @@
*/
import React, { Fragment, PureComponent } from 'react';
-import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
@@ -28,18 +27,24 @@ import {
PHASE_ROLLOVER_MAX_SIZE_STORED,
PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS,
PHASE_ROLLOVER_ENABLED,
-} from '../../../../constants';
-import { LearnMoreLink, ActiveBadge, PhaseErrorMessage } from '../../../components';
-import { ErrableFormRow } from '../../form_errors';
-import { SetPriorityInput } from '../set_priority_input';
+} from '../../../constants';
+import {
+ LearnMoreLink,
+ ActiveBadge,
+ PhaseErrorMessage,
+ ErrableFormRow,
+ SetPriorityInput,
+} from '../components';
-export class HotPhase extends PureComponent {
- static propTypes = {
- setPhaseData: PropTypes.func.isRequired,
- isShowingErrors: PropTypes.bool.isRequired,
- errors: PropTypes.object.isRequired,
- };
+interface Props {
+ errors: Record;
+ isShowingErrors: boolean;
+ phaseData: any;
+ setPhaseData: (key: string, value: any) => void;
+ setWarmPhaseOnRollover: (value: boolean) => void;
+}
+export class HotPhase extends PureComponent {
render() {
const { setPhaseData, phaseData, isShowingErrors, errors, setWarmPhaseOnRollover } = this.props;
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/index.ts
similarity index 58%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/index.ts
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/index.ts
index 4675ab46ee501..8d1ace5950497 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation/index.ts
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/index.ts
@@ -4,4 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { NodeAllocation } from './node_allocation';
+export { HotPhase } from './hot_phase';
+export { WarmPhase } from './warm_phase';
+export { ColdPhase } from './cold_phase';
+export { DeletePhase } from './delete_phase';
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/warm_phase/warm_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/warm_phase.tsx
similarity index 95%
rename from x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/warm_phase/warm_phase.js
rename to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/warm_phase.tsx
index 60b5ab4781b6d..6ed81bf8f45d5 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/warm_phase/warm_phase.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/warm_phase.tsx
@@ -5,7 +5,6 @@
*/
import React, { Fragment, PureComponent } from 'react';
-import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import {
@@ -28,21 +27,26 @@ import {
PHASE_PRIMARY_SHARD_COUNT,
PHASE_REPLICA_COUNT,
PHASE_SHRINK_ENABLED,
-} from '../../../../constants';
-import { LearnMoreLink, ActiveBadge, PhaseErrorMessage, OptionalLabel } from '../../../components';
-import { ErrableFormRow } from '../../form_errors';
-import { SetPriorityInput } from '../set_priority_input';
-import { NodeAllocation } from '../node_allocation';
-import { MinAgeInput } from '../min_age_input';
-
-export class WarmPhase extends PureComponent {
- static propTypes = {
- setPhaseData: PropTypes.func.isRequired,
-
- isShowingErrors: PropTypes.bool.isRequired,
- errors: PropTypes.object.isRequired,
- };
+} from '../../../constants';
+import {
+ LearnMoreLink,
+ ActiveBadge,
+ PhaseErrorMessage,
+ OptionalLabel,
+ ErrableFormRow,
+ SetPriorityInput,
+ NodeAllocation,
+ MinAgeInput,
+} from '../components';
+interface Props {
+ setPhaseData: (key: string, value: any) => void;
+ phaseData: any;
+ isShowingErrors: boolean;
+ errors: Record;
+ hotPhaseRolloverEnabled: boolean;
+}
+export class WarmPhase extends PureComponent {
render() {
const {
setPhaseData,
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/policy_table/add_policy_to_template_confirm_modal.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/policy_table/add_policy_to_template_confirm_modal.js
index 8e53569047d8f..47134ad097720 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/policy_table/add_policy_to_template_confirm_modal.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/policy_table/add_policy_to_template_confirm_modal.js
@@ -23,7 +23,7 @@ import {
import { toasts } from '../../../../services/notification';
import { addLifecyclePolicyToTemplate, loadIndexTemplates } from '../../../../services/api';
import { showApiError } from '../../../../services/api_errors';
-import { LearnMoreLink } from '../../../components/learn_more_link';
+import { LearnMoreLink } from '../../../edit_policy/components';
export class AddPolicyToTemplateConfirmModal extends Component {
state = {
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/store/actions/nodes.js b/x-pack/plugins/index_lifecycle_management/public/application/store/actions/nodes.js
index 3f1c00db621a7..45a8e63f70e83 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/store/actions/nodes.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/store/actions/nodes.js
@@ -4,8 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { createAction } from 'redux-actions';
-import { SET_SELECTED_NODE_ATTRS } from '../../constants';
-
-export const setSelectedNodeAttrs = createAction(SET_SELECTED_NODE_ATTRS);
export const setSelectedPrimaryShardCount = createAction('SET_SELECTED_PRIMARY_SHARED_COUNT');
export const setSelectedReplicaCount = createAction('SET_SELECTED_REPLICA_COUNT');
diff --git a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts
index e8bf63843c623..3fc42b661ddab 100644
--- a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts
+++ b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts
@@ -20,6 +20,9 @@ export const logSourceConfigurationOriginRT = rt.keyof({
export type LogSourceConfigurationOrigin = rt.TypeOf;
const logSourceFieldsConfigurationRT = rt.strict({
+ container: rt.string,
+ host: rt.string,
+ pod: rt.string,
timestamp: rt.string,
tiebreaker: rt.string,
});
diff --git a/x-pack/plugins/infra/common/inventory_models/index.ts b/x-pack/plugins/infra/common/inventory_models/index.ts
index 84bdb7887b1d1..9238989609ce5 100644
--- a/x-pack/plugins/infra/common/inventory_models/index.ts
+++ b/x-pack/plugins/infra/common/inventory_models/index.ts
@@ -30,7 +30,6 @@ export const findInventoryModel = (type: InventoryItemType) => {
};
interface InventoryFields {
- message: string[];
host: string;
pod: string;
container: string;
diff --git a/x-pack/plugins/infra/public/components/loading_page.tsx b/x-pack/plugins/infra/public/components/loading_page.tsx
index c410f37e7bf6b..ae8e18a2f98ea 100644
--- a/x-pack/plugins/infra/public/components/loading_page.tsx
+++ b/x-pack/plugins/infra/public/components/loading_page.tsx
@@ -17,10 +17,14 @@ import { FlexPage } from './page';
interface LoadingPageProps {
message?: ReactNode;
+ 'data-test-subj'?: string;
}
-export const LoadingPage = ({ message }: LoadingPageProps) => (
-
+export const LoadingPage = ({
+ message,
+ 'data-test-subj': dataTestSubj = 'loadingPage',
+}: LoadingPageProps) => (
+
diff --git a/x-pack/plugins/infra/public/components/page.tsx b/x-pack/plugins/infra/public/components/page.tsx
index 67e82310f0807..9636a5fc3a631 100644
--- a/x-pack/plugins/infra/public/components/page.tsx
+++ b/x-pack/plugins/infra/public/components/page.tsx
@@ -23,5 +23,6 @@ export const PageContent = euiStyled.div`
`;
export const FlexPage = euiStyled(EuiPage)`
+ align-self: stretch;
flex: 1 0 0%;
`;
diff --git a/x-pack/plugins/infra/public/components/source_loading_page.tsx b/x-pack/plugins/infra/public/components/source_loading_page.tsx
index 11e68e216b470..c24f7876d12f0 100644
--- a/x-pack/plugins/infra/public/components/source_loading_page.tsx
+++ b/x-pack/plugins/infra/public/components/source_loading_page.tsx
@@ -11,6 +11,7 @@ import { LoadingPage } from './loading_page';
export const SourceLoadingPage: React.FunctionComponent = () => (
typeof useLogSource;
+
+const defaultSourceId = 'default';
+
+export const createUninitializedUseLogSourceMock: CreateUseLogSource = ({
+ sourceId = defaultSourceId,
+} = {}) => () => ({
+ derivedIndexPattern: {
+ fields: [],
+ title: 'unknown',
+ },
+ hasFailedLoadingSource: false,
+ hasFailedLoadingSourceStatus: false,
+ initialize: jest.fn(),
+ isLoading: false,
+ isLoadingSourceConfiguration: false,
+ isLoadingSourceStatus: false,
+ isUninitialized: true,
+ loadSource: jest.fn(),
+ loadSourceConfiguration: jest.fn(),
+ loadSourceFailureMessage: undefined,
+ loadSourceStatus: jest.fn(),
+ sourceConfiguration: undefined,
+ sourceId,
+ sourceStatus: undefined,
+ updateSourceConfiguration: jest.fn(),
+});
+
+export const createLoadingUseLogSourceMock: CreateUseLogSource = ({
+ sourceId = defaultSourceId,
+} = {}) => (args) => ({
+ ...createUninitializedUseLogSourceMock({ sourceId })(args),
+ isLoading: true,
+ isLoadingSourceConfiguration: true,
+ isLoadingSourceStatus: true,
+});
+
+export const createLoadedUseLogSourceMock: CreateUseLogSource = ({
+ sourceId = defaultSourceId,
+} = {}) => (args) => ({
+ ...createUninitializedUseLogSourceMock({ sourceId })(args),
+ sourceConfiguration: createBasicSourceConfiguration(sourceId),
+ sourceStatus: {
+ logIndexFields: [],
+ logIndexStatus: 'available',
+ },
+});
+
+export const createBasicSourceConfiguration = (sourceId: string): LogSourceConfiguration => ({
+ id: sourceId,
+ origin: 'stored',
+ configuration: {
+ description: `description for ${sourceId}`,
+ logAlias: 'LOG_INDICES',
+ logColumns: [],
+ fields: {
+ container: 'CONTAINER_FIELD',
+ host: 'HOST_FIELD',
+ pod: 'POD_FIELD',
+ tiebreaker: 'TIEBREAKER_FIELD',
+ timestamp: 'TIMESTAMP_FIELD',
+ },
+ name: sourceId,
+ },
+});
+
+export const createAvailableSourceStatus = (logIndexFields = []): LogSourceStatus => ({
+ logIndexFields,
+ logIndexStatus: 'available',
+});
diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
index b45ea0a042f49..51b32a4c4eacf 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
@@ -5,13 +5,14 @@
*/
import createContainer from 'constate';
-import { useState, useMemo, useCallback } from 'react';
+import { useCallback, useMemo, useState } from 'react';
+import { useMountedState } from 'react-use';
import { HttpSetup } from 'src/core/public';
import {
LogSourceConfiguration,
- LogSourceStatus,
- LogSourceConfigurationPropertiesPatch,
LogSourceConfigurationProperties,
+ LogSourceConfigurationPropertiesPatch,
+ LogSourceStatus,
} from '../../../../common/http_api/log_sources';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { callFetchLogSourceConfigurationAPI } from './api/fetch_log_source_configuration';
@@ -32,6 +33,7 @@ export const useLogSource = ({
sourceId: string;
fetch: HttpSetup['fetch'];
}) => {
+ const getIsMounted = useMountedState();
const [sourceConfiguration, setSourceConfiguration] = useState<
LogSourceConfiguration | undefined
>(undefined);
@@ -45,6 +47,10 @@ export const useLogSource = ({
return await callFetchLogSourceConfigurationAPI(sourceId, fetch);
},
onResolve: ({ data }) => {
+ if (!getIsMounted()) {
+ return;
+ }
+
setSourceConfiguration(data);
},
},
@@ -58,6 +64,10 @@ export const useLogSource = ({
return await callPatchLogSourceConfigurationAPI(sourceId, patchedProperties, fetch);
},
onResolve: ({ data }) => {
+ if (!getIsMounted()) {
+ return;
+ }
+
setSourceConfiguration(data);
loadSourceStatus();
},
@@ -72,6 +82,10 @@ export const useLogSource = ({
return await callFetchLogSourceStatusAPI(sourceId, fetch);
},
onResolve: ({ data }) => {
+ if (!getIsMounted()) {
+ return;
+ }
+
setSourceStatus(data);
},
},
diff --git a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx
new file mode 100644
index 0000000000000..945b299674aaa
--- /dev/null
+++ b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx
@@ -0,0 +1,326 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { render } from '@testing-library/react';
+import { createMemoryHistory } from 'history';
+import React from 'react';
+import { Route, Router, Switch } from 'react-router-dom';
+import { httpServiceMock } from 'src/core/public/mocks';
+// import { HttpSetup } from 'src/core/public';
+import { KibanaContextProvider } from 'src/plugins/kibana_react/public';
+import { useLogSource } from '../../containers/logs/log_source';
+import {
+ createLoadedUseLogSourceMock,
+ createLoadingUseLogSourceMock,
+} from '../../containers/logs/log_source/log_source.mock';
+import { LinkToLogsPage } from './link_to_logs';
+
+jest.mock('../../containers/logs/log_source');
+const useLogSourceMock = useLogSource as jest.MockedFunction;
+
+const renderRoutes = (routes: React.ReactElement) => {
+ const history = createMemoryHistory();
+ const services = {
+ http: httpServiceMock.createStartContract(),
+ };
+ const renderResult = render(
+
+ {routes}
+
+ );
+
+ return {
+ ...renderResult,
+ history,
+ services,
+ };
+};
+
+describe('LinkToLogsPage component', () => {
+ beforeEach(() => {
+ useLogSourceMock.mockImplementation(createLoadedUseLogSourceMock());
+ });
+
+ afterEach(() => {
+ useLogSourceMock.mockRestore();
+ });
+
+ describe('default route', () => {
+ it('redirects to the stream at a given time filtered for a user-defined criterion', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to?time=1550671089404&filter=FILTER_FIELD:FILTER_VALUE');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toMatchInlineSnapshot(
+ `"(end:'2019-02-20T14:58:09.404Z',position:(tiebreaker:0,time:1550671089404),start:'2019-02-20T12:58:09.404Z',streamLive:!f)"`
+ );
+ });
+
+ it('redirects to the stream using a specific source id', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/OTHER_SOURCE');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('OTHER_SOURCE');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(`"(expression:'',kind:kuery)"`);
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+ });
+
+ describe('logs route', () => {
+ it('redirects to the stream at a given time filtered for a user-defined criterion', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/logs?time=1550671089404&filter=FILTER_FIELD:FILTER_VALUE');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toMatchInlineSnapshot(
+ `"(end:'2019-02-20T14:58:09.404Z',position:(tiebreaker:0,time:1550671089404),start:'2019-02-20T12:58:09.404Z',streamLive:!f)"`
+ );
+ });
+
+ it('redirects to the stream using a specific source id', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/OTHER_SOURCE/logs');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('OTHER_SOURCE');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(`"(expression:'',kind:kuery)"`);
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+ });
+
+ describe('host-logs route', () => {
+ it('redirects to the stream filtered for a host', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/host-logs/HOST_NAME');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'HOST_FIELD: HOST_NAME',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+
+ it('redirects to the stream at a given time filtered for a host and a user-defined criterion', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push(
+ '/link-to/host-logs/HOST_NAME?time=1550671089404&filter=FILTER_FIELD:FILTER_VALUE'
+ );
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'(HOST_FIELD: HOST_NAME) and (FILTER_FIELD:FILTER_VALUE)',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toMatchInlineSnapshot(
+ `"(end:'2019-02-20T14:58:09.404Z',position:(tiebreaker:0,time:1550671089404),start:'2019-02-20T12:58:09.404Z',streamLive:!f)"`
+ );
+ });
+
+ it('redirects to the stream filtered for a host using a specific source id', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/OTHER_SOURCE/host-logs/HOST_NAME');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('OTHER_SOURCE');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'HOST_FIELD: HOST_NAME',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+
+ it('renders a loading page while loading the source configuration', () => {
+ useLogSourceMock.mockImplementation(createLoadingUseLogSourceMock());
+
+ const { history, queryByTestId } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/host-logs/HOST_NAME');
+
+ expect(queryByTestId('nodeLoadingPage-host')).not.toBeEmpty();
+ });
+ });
+
+ describe('container-logs route', () => {
+ it('redirects to the stream filtered for a container', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/container-logs/CONTAINER_ID');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'CONTAINER_FIELD: CONTAINER_ID',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+
+ it('redirects to the stream at a given time filtered for a container and a user-defined criterion', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push(
+ '/link-to/container-logs/CONTAINER_ID?time=1550671089404&filter=FILTER_FIELD:FILTER_VALUE'
+ );
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'(CONTAINER_FIELD: CONTAINER_ID) and (FILTER_FIELD:FILTER_VALUE)',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toMatchInlineSnapshot(
+ `"(end:'2019-02-20T14:58:09.404Z',position:(tiebreaker:0,time:1550671089404),start:'2019-02-20T12:58:09.404Z',streamLive:!f)"`
+ );
+ });
+
+ it('renders a loading page while loading the source configuration', () => {
+ useLogSourceMock.mockImplementation(createLoadingUseLogSourceMock());
+
+ const { history, queryByTestId } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/container-logs/CONTAINER_ID');
+
+ expect(queryByTestId('nodeLoadingPage-container')).not.toBeEmpty();
+ });
+ });
+
+ describe('pod-logs route', () => {
+ it('redirects to the stream filtered for a pod', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/pod-logs/POD_UID');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'POD_FIELD: POD_UID',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toEqual(null);
+ });
+
+ it('redirects to the stream at a given time filtered for a pod and a user-defined criterion', () => {
+ const { history } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/pod-logs/POD_UID?time=1550671089404&filter=FILTER_FIELD:FILTER_VALUE');
+
+ expect(history.location.pathname).toEqual('/stream');
+
+ const searchParams = new URLSearchParams(history.location.search);
+ expect(searchParams.get('sourceId')).toEqual('default');
+ expect(searchParams.get('logFilter')).toMatchInlineSnapshot(
+ `"(expression:'(POD_FIELD: POD_UID) and (FILTER_FIELD:FILTER_VALUE)',kind:kuery)"`
+ );
+ expect(searchParams.get('logPosition')).toMatchInlineSnapshot(
+ `"(end:'2019-02-20T14:58:09.404Z',position:(tiebreaker:0,time:1550671089404),start:'2019-02-20T12:58:09.404Z',streamLive:!f)"`
+ );
+ });
+
+ it('renders a loading page while loading the source configuration', () => {
+ useLogSourceMock.mockImplementation(createLoadingUseLogSourceMock());
+
+ const { history, queryByTestId } = renderRoutes(
+
+
+
+ );
+
+ history.push('/link-to/pod-logs/POD_UID');
+
+ expect(queryByTestId('nodeLoadingPage-pod')).not.toBeEmpty();
+ });
+ });
+});
diff --git a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.tsx
index 7a77b1525aea3..68adca83ac903 100644
--- a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.tsx
+++ b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.tsx
@@ -27,6 +27,7 @@ export const LinkToLogsPage: React.FC = (props) => {
path={`${props.match.url}/:sourceId?/:nodeType(${ITEM_TYPES})-logs/:nodeId`}
component={RedirectToNodeLogs}
/>
+
diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx
deleted file mode 100644
index e62b29974674a..0000000000000
--- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { createLocation } from 'history';
-import React from 'react';
-import { matchPath } from 'react-router-dom';
-import { shallow } from 'enzyme';
-
-import { RedirectToNodeLogs } from './redirect_to_node_logs';
-
-jest.mock('../../containers/source/source', () => ({
- useSource: ({ sourceId }: { sourceId: string }) => ({
- sourceId,
- source: {
- configuration: {
- fields: {
- container: 'CONTAINER_FIELD',
- host: 'HOST_FIELD',
- pod: 'POD_FIELD',
- },
- },
- },
- isLoading: sourceId === 'perpetuallyLoading',
- }),
-}));
-
-describe('RedirectToNodeLogs component', () => {
- it('renders a redirect with the correct host filter', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-
- it('renders a redirect with the correct container filter', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-
- it('renders a redirect with the correct pod filter', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-
- it('renders a redirect with the correct position', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-
- it('renders a redirect with the correct user-defined filter', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-
- it('renders a redirect with the correct custom source id', () => {
- const component = shallow(
-
- );
-
- expect(component).toMatchInlineSnapshot(`
-
- `);
- });
-});
-
-const createRouteComponentProps = (path: string) => {
- const location = createLocation(path);
- return {
- match: matchPath(location.pathname, { path: '/:sourceId?/:nodeType-logs/:nodeId' }) as any,
- history: null as any,
- location,
- };
-};
diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx
index 37203084124f5..d1d4b829fefc1 100644
--- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx
+++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx
@@ -5,21 +5,20 @@
*/
import { i18n } from '@kbn/i18n';
-
-import { flowRight } from 'lodash';
+import flowRight from 'lodash/flowRight';
import React from 'react';
import { Redirect, RouteComponentProps } from 'react-router-dom';
-
+import { useMount } from 'react-use';
+import { useKibana } from '../../../../../../src/plugins/kibana_react/public';
+import { findInventoryFields } from '../../../common/inventory_models';
+import { InventoryItemType } from '../../../common/inventory_models/types';
import { LoadingPage } from '../../components/loading_page';
import { replaceLogFilterInQueryString } from '../../containers/logs/log_filter';
import { replaceLogPositionInQueryString } from '../../containers/logs/log_position';
+import { useLogSource } from '../../containers/logs/log_source';
import { replaceSourceIdInQueryString } from '../../containers/source_id';
-import { SourceConfigurationFields } from '../../graphql/types';
-import { getFilterFromLocation, getTimeFromLocation } from './query_params';
-import { useSource } from '../../containers/source/source';
-import { findInventoryFields } from '../../../common/inventory_models';
-import { InventoryItemType } from '../../../common/inventory_models/types';
import { LinkDescriptor } from '../../hooks/use_link_props';
+import { getFilterFromLocation, getTimeFromLocation } from './query_params';
type RedirectToNodeLogsType = RouteComponentProps<{
nodeId: string;
@@ -27,26 +26,27 @@ type RedirectToNodeLogsType = RouteComponentProps<{
sourceId?: string;
}>;
-const getFieldByNodeType = (
- nodeType: InventoryItemType,
- fields: SourceConfigurationFields.Fields
-) => {
- const inventoryFields = findInventoryFields(nodeType, fields);
- return inventoryFields.id;
-};
-
export const RedirectToNodeLogs = ({
match: {
params: { nodeId, nodeType, sourceId = 'default' },
},
location,
}: RedirectToNodeLogsType) => {
- const { source, isLoading } = useSource({ sourceId });
- const configuration = source && source.configuration;
+ const { services } = useKibana();
+ const { isLoading, loadSourceConfiguration, sourceConfiguration } = useLogSource({
+ fetch: services.http.fetch,
+ sourceId,
+ });
+ const fields = sourceConfiguration?.configuration.fields;
+
+ useMount(() => {
+ loadSourceConfiguration();
+ });
if (isLoading) {
return (
);
- }
-
- if (!configuration) {
+ } else if (fields == null) {
return null;
}
- const nodeFilter = `${getFieldByNodeType(nodeType, configuration.fields)}: ${nodeId}`;
+ const nodeFilter = `${findInventoryFields(nodeType, fields).id}: ${nodeId}`;
const userFilter = getFilterFromLocation(location);
const filter = userFilter ? `(${nodeFilter}) and (${userFilter})` : nodeFilter;
diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/index.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/index.ts
index 6450f7303dd88..4f2c7c4c339f1 100644
--- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/index.ts
+++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/index.ts
@@ -6,4 +6,4 @@
export { installPipelines } from './install';
-export { deletePipelines, deletePipeline } from './remove';
+export { deletePreviousPipelines, deletePipeline } from './remove';
diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/remove.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/remove.ts
index 8be3a1beab392..836b53b5a9225 100644
--- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/remove.ts
+++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/remove.ts
@@ -8,24 +8,32 @@ import { SavedObjectsClientContract } from 'src/core/server';
import { appContextService } from '../../../';
import { CallESAsCurrentUser, ElasticsearchAssetType } from '../../../../types';
import { getInstallation } from '../../packages/get';
-import { PACKAGES_SAVED_OBJECT_TYPE } from '../../../../../common';
+import { PACKAGES_SAVED_OBJECT_TYPE, EsAssetReference } from '../../../../../common';
-export const deletePipelines = async (
+export const deletePreviousPipelines = async (
callCluster: CallESAsCurrentUser,
savedObjectsClient: SavedObjectsClientContract,
pkgName: string,
- pkgVersion: string
+ previousPkgVersion: string
) => {
const logger = appContextService.getLogger();
- const previousPipelinesPattern = `*-${pkgName}.*-${pkgVersion}`;
-
+ const installation = await getInstallation({ savedObjectsClient, pkgName });
+ if (!installation) return;
+ const installedEsAssets = installation.installed_es;
+ const installedPipelines = installedEsAssets.filter(
+ ({ type, id }) =>
+ type === ElasticsearchAssetType.ingestPipeline && id.includes(previousPkgVersion)
+ );
+ const deletePipelinePromises = installedPipelines.map(({ type, id }) => {
+ return deletePipeline(callCluster, id);
+ });
try {
- await deletePipeline(callCluster, previousPipelinesPattern);
+ await Promise.all(deletePipelinePromises);
} catch (e) {
logger.error(e);
}
try {
- await deletePipelineRefs(savedObjectsClient, pkgName, pkgVersion);
+ await deletePipelineRefs(savedObjectsClient, installedEsAssets, pkgName, previousPkgVersion);
} catch (e) {
logger.error(e);
}
@@ -33,12 +41,10 @@ export const deletePipelines = async (
export const deletePipelineRefs = async (
savedObjectsClient: SavedObjectsClientContract,
+ installedEsAssets: EsAssetReference[],
pkgName: string,
pkgVersion: string
) => {
- const installation = await getInstallation({ savedObjectsClient, pkgName });
- if (!installation) return;
- const installedEsAssets = installation.installed_es;
const filteredAssets = installedEsAssets.filter(({ type, id }) => {
if (type !== ElasticsearchAssetType.ingestPipeline) return true;
if (!id.includes(pkgVersion)) return true;
diff --git a/x-pack/plugins/ingest_manager/server/services/epm/packages/install.ts b/x-pack/plugins/ingest_manager/server/services/epm/packages/install.ts
index 0911aaf248e7a..6bc461845f124 100644
--- a/x-pack/plugins/ingest_manager/server/services/epm/packages/install.ts
+++ b/x-pack/plugins/ingest_manager/server/services/epm/packages/install.ts
@@ -22,7 +22,7 @@ import * as Registry from '../registry';
import { getInstallation, getInstallationObject, isRequiredPackage } from './index';
import { installTemplates } from '../elasticsearch/template/install';
import { generateESIndexPatterns } from '../elasticsearch/template/template';
-import { installPipelines, deletePipelines } from '../elasticsearch/ingest_pipeline/';
+import { installPipelines, deletePreviousPipelines } from '../elasticsearch/ingest_pipeline/';
import { installILMPolicy } from '../elasticsearch/ilm/install';
import {
installKibanaAssets,
@@ -183,7 +183,7 @@ export async function installPackage({
// if this is an update, delete the previous version's pipelines
if (installedPkg && !reinstall) {
- await deletePipelines(
+ await deletePreviousPipelines(
callCluster,
savedObjectsClient,
pkgName,
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx
index f9a74ee477d57..560c48b2155ee 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx
@@ -9,11 +9,16 @@ import { IndexPatternPrivateState } from './types';
import { IndexPatternLayerPanelProps, LayerPanel } from './layerpanel';
import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers';
import { ShallowWrapper } from 'enzyme';
-import { EuiSelectable, EuiSelectableList } from '@elastic/eui';
+import { EuiSelectable } from '@elastic/eui';
import { ChangeIndexPattern } from './change_indexpattern';
jest.mock('./state_helpers');
+interface IndexPatternPickerOption {
+ label: string;
+ checked?: 'on' | 'off';
+}
+
const initialState: IndexPatternPrivateState = {
indexPatternRefs: [
{ id: '1', title: 'my-fake-index-pattern' },
@@ -187,9 +192,9 @@ describe('Layer Data Panel', () => {
}
function selectIndexPatternPickerOption(instance: ShallowWrapper, selectedLabel: string) {
- const options: Array<{ label: string; checked?: 'on' | 'off' }> = getIndexPatternPickerOptions(
+ const options: IndexPatternPickerOption[] = getIndexPatternPickerOptions(
instance
- ).map((option) =>
+ ).map((option: IndexPatternPickerOption) =>
option.label === selectedLabel
? { ...option, checked: 'on' }
: { ...option, checked: undefined }
@@ -198,17 +203,17 @@ describe('Layer Data Panel', () => {
}
function getIndexPatternPickerOptions(instance: ShallowWrapper) {
- return getIndexPatternPickerList(instance).dive().find(EuiSelectableList).prop('options');
+ return getIndexPatternPickerList(instance).prop('options');
}
it('should list all index patterns', () => {
const instance = shallow();
- expect(getIndexPatternPickerOptions(instance)!.map((option) => option.label)).toEqual([
- 'my-fake-index-pattern',
- 'my-fake-restricted-pattern',
- 'my-compatible-pattern',
- ]);
+ expect(
+ getIndexPatternPickerOptions(instance)!.map(
+ (option: IndexPatternPickerOption) => option.label
+ )
+ ).toEqual(['my-fake-index-pattern', 'my-fake-restricted-pattern', 'my-compatible-pattern']);
});
it('should switch data panel to target index pattern', () => {
diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/add_license.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/add_license.test.js.snap
index 28ce3c6c07501..768c7175e6edc 100644
--- a/x-pack/plugins/license_management/__jest__/__snapshots__/add_license.test.js.snap
+++ b/x-pack/plugins/license_management/__jest__/__snapshots__/add_license.test.js.snap
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`AddLicense component when license is active should display correct verbiage 1`] = `"
Update your license
If you already have a new license, upload it now.
"`;
+exports[`AddLicense component when license is active should display correct verbiage 1`] = `"
Update your license
If you already have a new license, upload it now.
"`;
-exports[`AddLicense component when license is expired should display with correct verbiage 1`] = `"
Update your license
If you already have a new license, upload it now.
"`;
+exports[`AddLicense component when license is expired should display with correct verbiage 1`] = `"
Update your license
If you already have a new license, upload it now.
"`;
diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap
index 096f26eb22fe3..db37bc6cb98c4 100644
--- a/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap
+++ b/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`RequestTrialExtension component should display when enterprise license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
+exports[`RequestTrialExtension component should display when enterprise license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
-exports[`RequestTrialExtension component should display when license is active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
+exports[`RequestTrialExtension component should display when license is active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
-exports[`RequestTrialExtension component should display when license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
+exports[`RequestTrialExtension component should display when license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
-exports[`RequestTrialExtension component should display when platinum license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
+exports[`RequestTrialExtension component should display when platinum license is not active and trial has been used 1`] = `"
Extend your trial
If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.
"`;
diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap
index 0a5656aa266bc..24598635b28e3 100644
--- a/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap
+++ b/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`RevertToBasic component should display when license is about to expire 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
+exports[`RevertToBasic component should display when license is about to expire 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
-exports[`RevertToBasic component should display when license is expired 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
+exports[`RevertToBasic component should display when license is expired 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
-exports[`RevertToBasic component should display when trial is active 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
+exports[`RevertToBasic component should display when trial is active 1`] = `"
Revert to Basic license
You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.
"`;
diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap
index 9da8bb958941b..24872a888b090 100644
--- a/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap
+++ b/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`StartTrial component when trial is allowed display for basic license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
+exports[`StartTrial component when trial is allowed display for basic license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
-exports[`StartTrial component when trial is allowed should display for expired enterprise license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
+exports[`StartTrial component when trial is allowed should display for expired enterprise license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
-exports[`StartTrial component when trial is allowed should display for expired platinum license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
+exports[`StartTrial component when trial is allowed should display for expired platinum license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
-exports[`StartTrial component when trial is allowed should display for gold license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
+exports[`StartTrial component when trial is allowed should display for gold license 1`] = `"
Start a 30-day trial
Experience what machine learning, advanced security, and all our other subscription features have to offer.
"`;
diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap
index f0feb826f956d..32e4d116f0a06 100644
--- a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap
+++ b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap
@@ -297,11 +297,15 @@ exports[`UploadLicense should display a modal when license requires acknowledgem
class="euiOverlayMask euiOverlayMask--aboveHeader"
>
-
-
-
-
-
-
-
-
-
-
-
-
- Confirm License Upload
-
-
-
-
-
-
-
- Some functionality will be lost if you replace your TRIAL license with a BASIC license. Review the list of features below.
-