From 1aa30eaca569a0d8af6c9ce0e0ae5eaa578d14eb Mon Sep 17 00:00:00 2001 From: Yibo Wang Date: Wed, 5 Oct 2022 18:04:25 -0700 Subject: [PATCH] Add experimental callout for index pattern section Signed-off-by: Yibo Wang --- CHANGELOG.md | 1 + .../create_index_pattern_wizard.tsx | 2 + .../experimental_callout.tsx | 61 ++++++++++++++++++ .../components/experimental_callout/index.ts | 6 ++ .../index_pattern_table.tsx | 64 ++++++++++--------- 5 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 src/plugins/index_pattern_management/public/components/experimental_callout/experimental_callout.tsx create mode 100644 src/plugins/index_pattern_management/public/components/experimental_callout/index.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 46fc61baa7b6..9a7ac95d5b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * [MD] Support legacy client for data source ([#2204](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2204)) * [Plugin Helpers] Facilitate version changes ([#2398](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2398)) +* [MD] Add experimental callout for index pattern section ([#2523](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2523)) ### 🐛 Bug Fixes * [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401)) 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 f0f0563eee87..88499919d65a 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 @@ -65,6 +65,7 @@ import { DataSourceRef, IndexPatternManagmentContextValue } from '../../types'; import { MatchedItem } from './types'; import { DuplicateIndexPatternError, IndexPattern } from '../../../../data/public'; import { StepDataSource } from './components/step_data_source'; +import { ExperimentalCallout } from '../experimental_callout'; interface CreateIndexPatternWizardState { step: StepType; @@ -352,6 +353,7 @@ export class CreateIndexPatternWizard extends Component< return ( <> + {content} { + return ( + <> + +

+ + {DESCRIPTION_FIRST_PART} + {DATASOURCE_CONNECTION} + {DESCRIPTION_SECOND_PART} + {DEFAULT} + {DESCRIPTION_THIRD_PART} + +

+
+ + + ); +}; + +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.', + } +); diff --git a/src/plugins/index_pattern_management/public/components/experimental_callout/index.ts b/src/plugins/index_pattern_management/public/components/experimental_callout/index.ts new file mode 100644 index 000000000000..1f6d2620bf37 --- /dev/null +++ b/src/plugins/index_pattern_management/public/components/experimental_callout/index.ts @@ -0,0 +1,6 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './experimental_callout'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx index c19c9f5b0c2d..a750db2df802 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx @@ -58,6 +58,7 @@ import { EmptyState } from './empty_state'; import { MatchedItem, ResolveIndexResponseItemAlias } from '../create_index_pattern_wizard/types'; import { EmptyIndexPatternPrompt } from './empty_index_pattern_prompt'; import { getIndices } from '../create_index_pattern_wizard/lib'; +import { ExperimentalCallout } from '../experimental_callout'; const pagination = { initialPageSize: 10, @@ -242,36 +243,39 @@ export const IndexPatternTable = ({ canSave, history }: Props) => { } return ( - - - - -

{title}

-
- - -

- -

-
-
- {createButton} -
- - -
+ <> + + + + + +

{title}

+
+ + +

+ +

+
+
+ {createButton} +
+ + +
+ ); };