-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MD] Add experimental callout for index pattern section (#2523)
* Add experimental callout for index pattern section Signed-off-by: Yibo Wang <[email protected]> * add switch for experimental callout & update snapshots Signed-off-by: Yibo Wang <[email protected]> * Update UT Signed-off-by: Yibo Wang <[email protected]> Signed-off-by: Yibo Wang <[email protected]>
- Loading branch information
Showing
7 changed files
with
223 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...t/public/components/experimental_callout/__snapshots__/experimental_callout.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...x_pattern_management/public/components/experimental_callout/experimental_callout.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { ExperimentalCallout } from './experimental_callout'; | ||
|
||
const titleIdentifier = '.euiCallOutHeader__title'; | ||
const descriptionIdentifier = '[data-test-subj="index-pattern-experimental-callout-text"]'; | ||
const expectedTitleText = 'Experimental feature active'; | ||
const expectedDescriptionText = | ||
'The experimental feature Data Source Connection is active. To create an index pattern without using data from an external source, use default. Any index pattern created using an external data source will result in an error if the experimental feature is deactivated.'; | ||
|
||
describe('Index pattern experimental callout component', () => { | ||
test('should render normally', () => { | ||
const component = mount(<ExperimentalCallout />); | ||
const titleText = component.find(titleIdentifier).text(); | ||
const descriptionText = component.find(descriptionIdentifier).last().text(); | ||
|
||
expect(titleText).toBe(expectedTitleText); | ||
expect(descriptionText).toBe(expectedDescriptionText); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
66 changes: 66 additions & 0 deletions
66
.../index_pattern_management/public/components/experimental_callout/experimental_callout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import { EuiCallOut, EuiSpacer, EuiText } from '@elastic/eui'; | ||
|
||
export const ExperimentalCallout = () => { | ||
return ( | ||
<> | ||
<EuiCallOut | ||
title={TITLE} | ||
iconType="alert" | ||
color="warning" | ||
data-test-subj="index-pattern-experimental-callout" | ||
> | ||
<EuiText data-test-subj="index-pattern-experimental-callout-text"> | ||
<p> | ||
{DESCRIPTION_FIRST_PART} | ||
<b>{DATASOURCE_CONNECTION}</b> | ||
{DESCRIPTION_SECOND_PART} | ||
<b>{DEFAULT}</b> | ||
{DESCRIPTION_THIRD_PART} | ||
</p> | ||
</EuiText> | ||
</EuiCallOut> | ||
<EuiSpacer size="m" /> | ||
</> | ||
); | ||
}; | ||
|
||
const TITLE = i18n.translate('indexPatternManagement.experimentalFeatureCallout.title', { | ||
defaultMessage: 'Experimental feature active', | ||
}); | ||
|
||
const DESCRIPTION_FIRST_PART = i18n.translate( | ||
'indexPatternManagement.experimentalFeatureCallout.descriptionPartOne', | ||
{ | ||
defaultMessage: 'The experimental feature ', | ||
} | ||
); | ||
const DATASOURCE_CONNECTION = i18n.translate( | ||
'indexPatternManagement.experimentalFeatureCallout.datasourceConnection', | ||
{ | ||
defaultMessage: 'Data Source Connection ', | ||
} | ||
); | ||
const DESCRIPTION_SECOND_PART = i18n.translate( | ||
'indexPatternManagement.experimentalFeatureCallout.descriptionPartTwo', | ||
{ | ||
defaultMessage: | ||
'is active. To create an index pattern without using data from an external source, use ', | ||
} | ||
); | ||
const DEFAULT = i18n.translate('indexPatternManagement.experimentalFeatureCallout.default', { | ||
defaultMessage: 'default', | ||
}); | ||
const DESCRIPTION_THIRD_PART = i18n.translate( | ||
'indexPatternManagement.experimentalFeatureCallout.descriptionPartThree', | ||
{ | ||
defaultMessage: | ||
'. Any index pattern created using an external data source will result in an error if the experimental feature is deactivated.', | ||
} | ||
); |
6 changes: 6 additions & 0 deletions
6
src/plugins/index_pattern_management/public/components/experimental_callout/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * from './experimental_callout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters