diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
index 4b720d3ed16c7e..0e333844b39134 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
@@ -22,7 +22,7 @@ import {
EuiCallOut,
EuiFlexGroup,
EuiFlexItem,
- EuiText,
+ EuiTitle,
EuiSpacer,
EuiLoadingSpinner,
EuiHorizontalRule,
@@ -185,17 +185,20 @@ export class StepTimeField extends Component
+
-
+
+
+
+
+
+
-
-
-
+
);
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
index 9ad6f942c5637f..b47985ae9e47df 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
@@ -22,12 +22,14 @@ import React, { ReactElement, Component } from 'react';
import {
EuiGlobalToastList,
EuiGlobalToastListToast,
- EuiPanel,
+ EuiPageContent,
EuiSwitchEvent,
+ EuiHorizontalRule,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { withRouter, RouteComponentProps } from 'react-router-dom';
+import { DocLinksStart } from 'src/core/public';
import { StepIndexPattern } from './components/step_index_pattern';
import { StepTimeField } from './components/step_time_field';
import { Header } from './components/header';
@@ -51,6 +53,7 @@ interface CreateIndexPatternWizardState {
toasts: EuiGlobalToastListToast[];
indexPatternCreationType: IndexPatternCreationConfig;
selectedTimeField?: string;
+ docLinks: DocLinksStart;
}
export class CreateIndexPatternWizard extends Component<
@@ -77,6 +80,7 @@ export class CreateIndexPatternWizard extends Component<
isIncludingSystemIndices: false,
toasts: [],
indexPatternCreationType: context.services.indexPatternManagementStart.creation.getType(type),
+ docLinks: context.services.docLinks,
};
}
@@ -224,11 +228,14 @@ export class CreateIndexPatternWizard extends Component<
return (
);
}
@@ -257,30 +264,39 @@ export class CreateIndexPatternWizard extends Component<
);
}
+ const header = this.renderHeader();
+
if (step === 1) {
const { location } = this.props;
const initialQuery = new URLSearchParams(location.search).get('id') || undefined;
return (
-
+
+ {header}
+
+
+
);
}
if (step === 2) {
return (
-
+
+ {header}
+
+
+
);
}
@@ -294,15 +310,11 @@ export class CreateIndexPatternWizard extends Component<
};
render() {
- const header = this.renderHeader();
const content = this.renderContent();
return (
-
-
- {header}
- {content}
-
+ <>
+ {content}
{
@@ -310,7 +322,7 @@ export class CreateIndexPatternWizard extends Component<
}}
toastLifeTimeMs={6000}
/>
-
+ >
);
}
}
From 7dda4a0d024cbe94c2dcdd54bc38cf6a6a06d745 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Thu, 2 Jul 2020 23:14:00 -0500
Subject: [PATCH 24/76] simplify timestamp preset code
---
.../step_index_pattern.test.tsx | 22 +++++++------------
.../step_index_pattern/step_index_pattern.tsx | 12 +++++-----
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx
index de4a01c843a3cf..c88918041ca810 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx
@@ -242,22 +242,16 @@ describe('StepIndexPattern', () => {
},
};
- expect(canPreselectTimeField([index]).canPreselect).toEqual(false);
- expect(canPreselectTimeField([alias]).canPreselect).toEqual(false);
- expect(canPreselectTimeField([index, alias, dataStream1]).canPreselect).toEqual(false);
+ expect(canPreselectTimeField([index])).toEqual(undefined);
+ expect(canPreselectTimeField([alias])).toEqual(undefined);
+ expect(canPreselectTimeField([index, alias, dataStream1])).toEqual(undefined);
- expect(canPreselectTimeField([dataStream1])).toEqual({
- canPreselect: true,
- timeFieldName: 'timestamp_field',
- });
+ expect(canPreselectTimeField([dataStream1])).toEqual('timestamp_field');
- expect(canPreselectTimeField([dataStream1, dataStream2])).toEqual({
- canPreselect: true,
- timeFieldName: 'timestamp_field',
- });
+ expect(canPreselectTimeField([dataStream1, dataStream2])).toEqual('timestamp_field');
- expect(
- canPreselectTimeField([dataStream1, dataStream2, differentDataStream]).canPreselect
- ).toEqual(false);
+ expect(canPreselectTimeField([dataStream1, dataStream2, differentDataStream])).toEqual(
+ undefined
+ );
});
});
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx
index c6d9ec9de227b1..55a568a10c8c77 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx
@@ -62,8 +62,8 @@ interface StepIndexPatternState {
indexPatternName: string;
}
-export const canPreselectTimeField = (indices: MatchedItem[]) =>
- indices.reduce(
+export const canPreselectTimeField = (indices: MatchedItem[]) => {
+ const preselectStatus = indices.reduce(
(
{ canPreselect, timeFieldName }: { canPreselect: boolean; timeFieldName?: string },
matchedItem
@@ -85,6 +85,9 @@ export const canPreselectTimeField = (indices: MatchedItem[]) =>
}
);
+ return preselectStatus.canPreselect ? preselectStatus.timeFieldName : undefined;
+};
+
export class StepIndexPattern extends Component {
static contextType = contextType;
@@ -330,9 +333,6 @@ export class StepIndexPattern extends Component 0;
const isNextStepDisabled = containsErrors || indices.length === 0 || indexPatternExists;
- // if all are data streams with same time field then create index pattern
- const { canPreselect, timeFieldName: matchingTimestamp } = canPreselectTimeField(indices);
-
return (
goToNextStep(query, canPreselect ? matchingTimestamp : undefined)}
+ goToNextStep={() => goToNextStep(query, canPreselectTimeField(indices))}
isNextStepDisabled={isNextStepDisabled}
/>
);
From 4fc352768df12e7e9bef6d8a3755d93d3b2abb88 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Fri, 3 Jul 2020 00:05:29 -0500
Subject: [PATCH 25/76] add functional test, update text
---
.../header/__snapshots__/header.test.tsx.snap | 18 +++---
.../components/header/header.tsx | 2 +-
.../status_message.test.tsx.snap | 21 ++-----
.../status_message/status_message.tsx | 16 ++----
.../create_index_pattern_wizard.tsx | 1 +
.../_create_index_pattern_wizard.js | 55 +++++++++++++++++++
6 files changed, 74 insertions(+), 39 deletions(-)
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap
index 9e00c6d657966f..124b57f7241eef 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap
@@ -51,7 +51,7 @@ exports[`Header should render a different name, prompt, and beta tag if provided
>
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data souces,
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data souces,
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data souces,
multiple,
single: filebeat-4-3-22,
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap
index 925aaf341a7a3b..94da6bcca0f6aa 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap
@@ -10,21 +10,11 @@ exports[`StatusMessage should render with exact matches 1`] = `
-
- ,
+ "sourceCount": 1,
}
}
/>
@@ -105,14 +95,11 @@ exports[`StatusMessage should render without a query 1`] = `
title={
- 2
- indices
- ,
+ "sourceCount": 2,
}
}
/>
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
index e979e7ed7df4f1..102adcf5b1426c 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
@@ -57,8 +57,8 @@ export const StatusMessage: React.FC = ({
{allIndicesLength} indices }}
+ defaultMessage="Your index pattern can match any of your {sourceCount} sources below."
+ values={{ sourceCount: allIndicesLength }}
/>
);
@@ -89,17 +89,9 @@ export const StatusMessage: React.FC = ({
-
-
- ),
+ sourceCount: exactMatchedIndices.length,
}}
/>
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
index b47985ae9e47df..695a84367ad02d 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
@@ -295,6 +295,7 @@ export class CreateIndexPatternWizard extends Component<
goToPreviousStep={this.goToIndexPatternStep}
createIndexPattern={this.createIndexPattern}
indexPatternCreationType={this.state.indexPatternCreationType}
+ selectedTimeField={this.state.selectedTimeField}
/>
);
diff --git a/test/functional/apps/management/_create_index_pattern_wizard.js b/test/functional/apps/management/_create_index_pattern_wizard.js
index 8209f3e1ac9d6d..292fbec5d31d2b 100644
--- a/test/functional/apps/management/_create_index_pattern_wizard.js
+++ b/test/functional/apps/management/_create_index_pattern_wizard.js
@@ -22,6 +22,8 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
+ const es = getService('legacyEs');
+ const browser = getService('browser');
const PageObjects = getPageObjects(['settings', 'common']);
describe('"Create Index Pattern" wizard', function () {
@@ -48,5 +50,58 @@ export default function ({ getService, getPageObjects }) {
expect(isEnabled).to.be.ok();
});
});
+
+ describe('can create data stream index patttern', async () => {
+ es.transport.request({
+ path: '/_index_template/generic-logs',
+ method: 'PUT',
+ body: ```{
+ "index_patterns": ["logs-*", "test_data_stream"],
+ "template": {
+ "mappings" : {
+ "properties": {
+ "@timestamp": {
+ "type": "date"
+ }
+ }
+ }
+ },
+ "data_stream": {
+ "timestamp_field": "@timestamp"
+ }
+ }```,
+ });
+
+ es.transport.request({
+ path: '/_data_stream/test_data_stream',
+ method: 'PUT',
+ });
+
+ await PageObjects.settings.setIndexPatternField('test_data_stream');
+ await PageObjects.common.sleep(1000);
+ await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
+ await (await this.getCreateIndexPatternButton()).click();
+ expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ });
+
+ describe('can create alias index patttern', async () => {
+ es.transport.request({
+ path: '/blogs/_doc',
+ method: 'POST',
+ body: '{ "user" : "matt", "message" : 20 }',
+ });
+
+ es.transport.request({
+ path: '/_aliases',
+ method: 'POST',
+ body: '{ "actions" : [{ "add" : { "index" : "blogs", "alias" : "alias1" } }]}',
+ });
+
+ await PageObjects.settings.setIndexPatternField('alias1');
+ await PageObjects.common.sleep(1000);
+ await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
+ await (await this.getCreateIndexPatternButton()).click();
+ expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ });
});
}
From e40db395b279d575ae1a27b78dd6bfece8e2f1a1 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Fri, 3 Jul 2020 00:42:58 -0500
Subject: [PATCH 26/76] fix functional test
---
.../_create_index_pattern_wizard.js | 68 ++++++++++---------
1 file changed, 37 insertions(+), 31 deletions(-)
diff --git a/test/functional/apps/management/_create_index_pattern_wizard.js b/test/functional/apps/management/_create_index_pattern_wizard.js
index 292fbec5d31d2b..74d2ddcce05ed4 100644
--- a/test/functional/apps/management/_create_index_pattern_wizard.js
+++ b/test/functional/apps/management/_create_index_pattern_wizard.js
@@ -51,11 +51,13 @@ export default function ({ getService, getPageObjects }) {
});
});
- describe('can create data stream index patttern', async () => {
- es.transport.request({
- path: '/_index_template/generic-logs',
- method: 'PUT',
- body: ```{
+ describe('data streams', () => {
+ it('can be an index pattern', async () => {
+ await es.init();
+ await es.transport.request({
+ path: '/_index_template/generic-logs',
+ method: 'PUT',
+ body: ```{
"index_patterns": ["logs-*", "test_data_stream"],
"template": {
"mappings" : {
@@ -70,38 +72,42 @@ export default function ({ getService, getPageObjects }) {
"timestamp_field": "@timestamp"
}
}```,
- });
+ });
- es.transport.request({
- path: '/_data_stream/test_data_stream',
- method: 'PUT',
- });
+ await es.transport.request({
+ path: '/_data_stream/test_data_stream',
+ method: 'PUT',
+ });
- await PageObjects.settings.setIndexPatternField('test_data_stream');
- await PageObjects.common.sleep(1000);
- await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
- await (await this.getCreateIndexPatternButton()).click();
- expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ await PageObjects.settings.setIndexPatternField('test_data_stream');
+ await PageObjects.common.sleep(1000);
+ await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
+ await (await this.getCreateIndexPatternButton()).click();
+ expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ });
});
- describe('can create alias index patttern', async () => {
- es.transport.request({
- path: '/blogs/_doc',
- method: 'POST',
- body: '{ "user" : "matt", "message" : 20 }',
- });
+ describe('index alias', () => {
+ it('can be an index pattern', async () => {
+ await es.init();
+ await es.transport.request({
+ path: '/blogs/_doc',
+ method: 'POST',
+ body: '{ "user" : "matt", "message" : 20 }',
+ });
- es.transport.request({
- path: '/_aliases',
- method: 'POST',
- body: '{ "actions" : [{ "add" : { "index" : "blogs", "alias" : "alias1" } }]}',
- });
+ await es.transport.request({
+ path: '/_aliases',
+ method: 'POST',
+ body: '{ "actions" : [{ "add" : { "index" : "blogs", "alias" : "alias1" } }]}',
+ });
- await PageObjects.settings.setIndexPatternField('alias1');
- await PageObjects.common.sleep(1000);
- await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
- await (await this.getCreateIndexPatternButton()).click();
- expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ await PageObjects.settings.setIndexPatternField('alias1');
+ await PageObjects.common.sleep(1000);
+ await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
+ await (await this.getCreateIndexPatternButton()).click();
+ expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ });
});
});
}
From 7f8802e3b5794222211f4c63141d847801619dc5 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Fri, 3 Jul 2020 16:42:22 -0500
Subject: [PATCH 27/76] fix functional tests
---
.../step_time_field/step_time_field.tsx | 3 ++
.../_create_index_pattern_wizard.js | 52 ++++++++-----------
2 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
index 0e333844b39134..5d33a08557fed5 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx
@@ -88,6 +88,9 @@ export class StepTimeField extends Component {
it('can be an index pattern', async () => {
- await es.init();
await es.transport.request({
path: '/_index_template/generic-logs',
method: 'PUT',
- body: ```{
- "index_patterns": ["logs-*", "test_data_stream"],
- "template": {
- "mappings" : {
- "properties": {
- "@timestamp": {
- "type": "date"
- }
- }
- }
+ body: {
+ index_patterns: ['logs-*', 'test_data_stream'],
+ template: {
+ mappings: {
+ properties: {
+ '@timestamp': {
+ type: 'date',
+ },
+ },
+ },
+ },
+ data_stream: {
+ timestamp_field: '@timestamp',
+ },
},
- "data_stream": {
- "timestamp_field": "@timestamp"
- }
- }```,
});
await es.transport.request({
@@ -79,34 +77,30 @@ export default function ({ getService, getPageObjects }) {
method: 'PUT',
});
- await PageObjects.settings.setIndexPatternField('test_data_stream');
- await PageObjects.common.sleep(1000);
- await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
- await (await this.getCreateIndexPatternButton()).click();
- expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ await PageObjects.settings.createIndexPattern('test_data_stream', false);
+
+ await es.transport.request({
+ path: '/_data_stream/test_data_stream',
+ method: 'DELETE',
+ });
});
});
describe('index alias', () => {
it('can be an index pattern', async () => {
- await es.init();
await es.transport.request({
path: '/blogs/_doc',
method: 'POST',
- body: '{ "user" : "matt", "message" : 20 }',
+ body: { user: 'matt', message: 20 },
});
await es.transport.request({
path: '/_aliases',
method: 'POST',
- body: '{ "actions" : [{ "add" : { "index" : "blogs", "alias" : "alias1" } }]}',
+ body: { actions: [{ add: { index: 'blogs', alias: 'alias1' } }] },
});
- await PageObjects.settings.setIndexPatternField('alias1');
- await PageObjects.common.sleep(1000);
- await (await PageObjects.settings.getCreateIndexPatternGoToStep2Button).click();
- await (await this.getCreateIndexPatternButton()).click();
- expect((await browser.getCurrentUrl()).match(/indexPatterns\/.+\?/)).equal(true);
+ await PageObjects.settings.createIndexPattern('alias1', false);
});
});
});
From cb28e99e343cfb83f0e8006f9ec01c1c75af5120 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Sat, 4 Jul 2020 13:35:16 -0500
Subject: [PATCH 28/76] source instead of index
---
.../create_index_pattern_wizard/components/header/header.tsx | 2 +-
.../components/status_message/status_message.tsx | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx
index 5c8da009c040a1..225697d7d2c127 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx
@@ -85,7 +85,7 @@ export const Header = ({
multiple,
single: filebeat-4-3-22,
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
index e444e12ce19c61..9b05927f2649f0 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx
@@ -57,8 +57,8 @@ export const StatusMessage: React.FC = ({
{allIndicesLength} indices }}
+ defaultMessage="Your index pattern can match any of your {indicesCount} sources below."
+ values={{ indicesCount: allIndicesLength }}
/>
);
From 1a4db4b3581fb0f0c10d689fa0cfe723ad4496e6 Mon Sep 17 00:00:00 2001
From: Matt Kime
Date: Sat, 4 Jul 2020 21:57:41 -0500
Subject: [PATCH 29/76] fix routing and state issues
---
.../index_pattern_management/kibana.json | 2 +-
.../create_index_pattern_wizard.test.tsx.snap | 224 ++++++++++--------
.../header/__snapshots__/header.test.tsx.snap | 18 +-
.../status_message.test.tsx.snap | 7 +-
.../create_index_pattern_wizard.test.tsx | 1 -
.../create_index_pattern_wizard.tsx | 8 +-
.../public/components/index.ts | 4 -
.../empty_index_pattern_prompt.test.tsx.snap | 0
.../assets/index_pattern_illustration.js | 0
.../assets/index_pattern_illustration.scss | 0
.../empty_index_pattern_prompt.scss | 4 +-
.../empty_index_pattern_prompt.test.tsx | 10 +-
.../empty_index_pattern_prompt.tsx | 36 +--
.../empty_index_pattern_prompt/index.tsx | 5 +-
.../__snapshots__/empty_state.test.tsx.snap | 15 +-
.../empty_state/empty_state.scss | 4 +-
.../empty_state/empty_state.test.tsx | 16 +-
.../empty_state/empty_state.tsx | 19 +-
.../empty_state/index.ts | 0
.../index_pattern_table.tsx | 35 +++
.../mount_management_section.tsx | 4 -
21 files changed, 226 insertions(+), 186 deletions(-)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap (100%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/assets/index_pattern_illustration.js (100%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/assets/index_pattern_illustration.scss (100%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/empty_index_pattern_prompt.scss (92%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx (85%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx (77%)
rename src/plugins/index_pattern_management/public/components/{ => index_pattern_table}/empty_index_pattern_prompt/index.tsx (87%)
rename src/plugins/index_pattern_management/public/components/{create_index_pattern_wizard/components => index_pattern_table}/empty_state/__snapshots__/empty_state.test.tsx.snap (96%)
rename src/plugins/index_pattern_management/public/components/{create_index_pattern_wizard/components => index_pattern_table}/empty_state/empty_state.scss (86%)
rename src/plugins/index_pattern_management/public/components/{create_index_pattern_wizard/components => index_pattern_table}/empty_state/empty_state.test.tsx (79%)
rename src/plugins/index_pattern_management/public/components/{create_index_pattern_wizard/components => index_pattern_table}/empty_state/empty_state.tsx (90%)
rename src/plugins/index_pattern_management/public/components/{create_index_pattern_wizard/components => index_pattern_table}/empty_state/index.ts (100%)
diff --git a/src/plugins/index_pattern_management/kibana.json b/src/plugins/index_pattern_management/kibana.json
index 364edbb030dc99..88a2e7101cc314 100644
--- a/src/plugins/index_pattern_management/kibana.json
+++ b/src/plugins/index_pattern_management/kibana.json
@@ -3,5 +3,5 @@
"version": "kibana",
"server": false,
"ui": true,
- "requiredPlugins": ["management", "data", "kibanaLegacy"]
+ "requiredPlugins": ["management", "data", "kibanaLegacy","home"]
}
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap
index f60f840d9f0c23..fd9d176b2bba76 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap
@@ -154,109 +154,131 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi
exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = `
-
+
+ indexPatternName="name"
+ isBeta={false}
+ isIncludingSystemIndices={false}
+ onChangeIncludingSystemIndices={[Function]}
+ prompt={null}
+ showSystemIndices={true}
+ />
+
+
+
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data sources,
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data sources,
- An index pattern can match a single index, for example,
+ An index pattern can match a single source, for example,
multiple
- indices,
+ data sources,
- 2
- indices
- ,
+ "indicesCount": 2,
}
}
/>
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx
index b14cd526d7e276..af5618424bbc08 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx
@@ -27,7 +27,6 @@ jest.mock('./components/step_index_pattern', () => ({ StepIndexPattern: 'StepInd
jest.mock('./components/step_time_field', () => ({ StepTimeField: 'StepTimeField' }));
jest.mock('./components/header', () => ({ Header: 'Header' }));
jest.mock('./components/loading_state', () => ({ LoadingState: 'LoadingState' }));
-jest.mock('./components/empty_state', () => ({ EmptyState: 'EmptyState' }));
jest.mock('./lib/get_indices', () => ({
getIndices: () => {
return [{ name: 'kibana' }];
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
index f0a5fab4ef82f2..d55d90da484f92 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
+++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx
@@ -33,7 +33,7 @@ import { StepIndexPattern } from './components/step_index_pattern';
import { StepTimeField } from './components/step_time_field';
import { Header } from './components/header';
import { LoadingState } from './components/loading_state';
-import { EmptyState } from './components/empty_state';
+// import { EmptyState } from './components/empty_state';
import { context as contextType } from '../../../../kibana_react/public';
import { getCreateBreadcrumbs } from '../breadcrumbs';
@@ -246,14 +246,15 @@ export class CreateIndexPatternWizard extends Component<
isIncludingSystemIndices,
step,
indexPattern,
- remoteClustersExist,
- docLinks,
+ // remoteClustersExist,
+ // docLinks,
} = this.state;
if (isInitiallyLoadingIndices) {
return ;
}
+ /*
const hasDataIndices = allIndices.some(({ name }: MatchedIndex) => !name.startsWith('.'));
if (!hasDataIndices && !isIncludingSystemIndices && !remoteClustersExist) {
return (
@@ -264,6 +265,7 @@ export class CreateIndexPatternWizard extends Component<
/>
);
}
+ */
const header = this.renderHeader();
diff --git a/src/plugins/index_pattern_management/public/components/index.ts b/src/plugins/index_pattern_management/public/components/index.ts
index fede54dcfc5096..e0acb9d05bc848 100644
--- a/src/plugins/index_pattern_management/public/components/index.ts
+++ b/src/plugins/index_pattern_management/public/components/index.ts
@@ -25,7 +25,3 @@ export {
CreateEditFieldContainer,
} from './edit_index_pattern';
export { CreateIndexPatternWizardWithRouter } from './create_index_pattern_wizard';
-export {
- EmptyIndexPatternPrompt,
- EmptyIndexPatternPromptWithRouter,
-} from './empty_index_pattern_prompt';
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap
similarity index 100%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/assets/index_pattern_illustration.js b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.js
similarity index 100%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/assets/index_pattern_illustration.js
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.js
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/assets/index_pattern_illustration.scss b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.scss
similarity index 100%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/assets/index_pattern_illustration.scss
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.scss
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.scss b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss
similarity index 92%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.scss
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss
index f6db2fc89f353a..11ac55b098a57c 100644
--- a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.scss
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss
@@ -1,5 +1,5 @@
-@import '../../variables';
-@import '../../templates';
+@import '../../../variables';
+@import '../../../templates';
.inpEmptyIndexPatternPrompt {
// override EUI specificity
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx
similarity index 85%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx
index 41c561e2e972bf..fcd68c697a8281 100644
--- a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx
@@ -21,18 +21,10 @@ import React from 'react';
import { EmptyIndexPatternPrompt } from '../empty_index_pattern_prompt';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
-const routeComponentPropsMock = {
- history: {
- push: jest.fn(),
- } as any,
- location: {} as any,
- match: {} as any,
-};
-
describe('EmptyIndexPatternPrompt', () => {
it.skip('should render normally', () => {
const component = shallowWithI18nProvider(
-
+ {} }]} />
);
expect(component).toMatchSnapshot();
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx
similarity index 77%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx
index 6da80525732f12..4a2db96e699db0 100644
--- a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx
@@ -18,42 +18,30 @@
*/
import './empty_index_pattern_prompt.scss';
-import React, { useState, useEffect } from 'react';
+import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
-import { withRouter, RouteComponentProps } from 'react-router-dom';
import { EuiPageContent, EuiSpacer, EuiText, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import { EuiDescriptionListTitle } from '@elastic/eui';
import { EuiDescriptionListDescription, EuiDescriptionList } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
-import { getListBreadcrumbs } from '../breadcrumbs';
-import { IndexPatternManagmentContext } from '../../types';
-import { useKibana } from '../../../../../plugins/kibana_react/public';
-import { IndexPatternCreationOption } from '../types';
-import { CreateButton } from '../create_button';
-// @ts-ignore
+import { getListBreadcrumbs } from '../../breadcrumbs';
+import { IndexPatternManagmentContext } from '../../../types';
+import { useKibana } from '../../../../../../plugins/kibana_react/public';
+import { IndexPatternCreationOption } from '../../types';
+import { CreateButton } from '../../create_button';
+// @ts-expect-error
import { Illustration } from './assets/index_pattern_illustration';
-interface Props extends RouteComponentProps {
+interface Props {
canSave: boolean;
+ creationOptions: IndexPatternCreationOption[];
}
-export const EmptyIndexPatternPrompt = ({ canSave, history }: Props) => {
- const { indexPatternManagementStart, setBreadcrumbs, docLinks } = useKibana<
- IndexPatternManagmentContext
- >().services;
- const [creationOptions, setCreationOptions] = useState([]);
+export const EmptyIndexPatternPrompt = ({ canSave, creationOptions }: Props) => {
+ const { setBreadcrumbs, docLinks } = useKibana().services;
setBreadcrumbs(getListBreadcrumbs());
- useEffect(() => {
- (async function () {
- const options = await indexPatternManagementStart.creation.getIndexPatternCreationOptions(
- history.push
- );
- setCreationOptions(options);
- })();
- }, [history.push, indexPatternManagementStart]);
-
return (
{
);
};
-
-export const EmptyIndexPatternPromptWithRouter = withRouter(EmptyIndexPatternPrompt);
diff --git a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/index.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/index.tsx
similarity index 87%
rename from src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/index.tsx
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/index.tsx
index ddf1c83725ca01..239bb272b23abc 100644
--- a/src/plugins/index_pattern_management/public/components/empty_index_pattern_prompt/index.tsx
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/index.tsx
@@ -17,7 +17,4 @@
* under the License.
*/
-export {
- EmptyIndexPatternPrompt,
- EmptyIndexPatternPromptWithRouter,
-} from './empty_index_pattern_prompt';
+export { EmptyIndexPatternPrompt } from './empty_index_pattern_prompt';
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap
similarity index 96%
rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap
index ed70b99a4b03b6..6f629c36834544 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/__snapshots__/empty_state.test.tsx.snap
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap
@@ -39,7 +39,6 @@ exports[`EmptyState should render normally 1`] = `
values={Object {}}
/>
}
- href="/app/home#/tutorial_directory"
icon={
}
+ onClick={[Function]}
title={
}
isDisabled={true}
+ onClick={[Function]}
title={
}
- href="/app/home#/tutorial_directory/sampleData"
icon={
}
+ onClick={[Function]}
title={
- Some indices may be hidden. Try to
-
+ Some indices may be hidden. Try to
+
+
create an index pattern
- anyway.
+
+ anyway.
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.scss b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss
similarity index 86%
rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.scss
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss
index 269d6ae99ff3b6..5b9eaa77a0088f 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.scss
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss
@@ -1,5 +1,5 @@
-@import '../../../../variables';
-@import '../../../../templates';
+@import '../../../variables';
+@import '../../../templates';
.inpEmptyState {
// override EUI specificity
diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx
similarity index 79%
rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx
rename to src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx
index 292a8a8c8cbd9a..5d445fb7a0cba0 100644
--- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/empty_state/empty_state.test.tsx
+++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx
@@ -24,14 +24,20 @@ import sinon from 'sinon';
// @ts-expect-error
import { findTestSubject } from '@elastic/eui/lib/test';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
-import { docLinksServiceMock } from '../../../../../../../core/public/mocks';
+import { docLinksServiceMock } from '../../../../../../core/public/mocks';
const docLinks = docLinksServiceMock.createStartContract();
+jest.mock('react-router-dom', () => ({
+ useHistory: () => ({
+ createHref: jest.fn(),
+ }),
+}));
+
describe('EmptyState', () => {
it('should render normally', () => {
const component = shallow(
-