Skip to content

Commit

Permalink
Add experimental callout for index pattern section
Browse files Browse the repository at this point in the history
Signed-off-by: Yibo Wang <yibow@amazon.com>
  • Loading branch information
yibow98 committed Oct 6, 2022
1 parent ca718a3 commit b5867bf
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -352,6 +353,7 @@ export class CreateIndexPatternWizard extends Component<

return (
<>
<ExperimentalCallout />
{content}
<EuiGlobalToastList
toasts={this.state.toasts}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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">
<p>
<EuiText>
{DESCRIPTION_FIRST_PART}
<b>{DATASOURCE_CONNECTION}</b>
{DESCRIPTION_SECOND_PART}
<b>{DEFAULT}</b>
{DESCRIPTION_THIRD_PART}
</EuiText>
</p>
</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.',
}
);
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';
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -242,36 +243,39 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
}

return (
<EuiPageContent data-test-subj="indexPatternTable" role="region" aria-label={ariaRegion}>
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>{title}</h2>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText>
<p>
<FormattedMessage
id="indexPatternManagement.indexPatternTable.indexPatternExplanation"
defaultMessage="Create and manage the index patterns that help you retrieve your data from OpenSearch."
/>
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>{createButton}</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />
<EuiInMemoryTable
allowNeutralSort={false}
itemId="id"
isSelectable={false}
items={indexPatterns}
columns={columns}
pagination={pagination}
sorting={sorting}
search={search}
/>
</EuiPageContent>
<>
<ExperimentalCallout />
<EuiPageContent data-test-subj="indexPatternTable" role="region" aria-label={ariaRegion}>
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>{title}</h2>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText>
<p>
<FormattedMessage
id="indexPatternManagement.indexPatternTable.indexPatternExplanation"
defaultMessage="Create and manage the index patterns that help you retrieve your data from OpenSearch."
/>
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>{createButton}</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />
<EuiInMemoryTable
allowNeutralSort={false}
itemId="id"
isSelectable={false}
items={indexPatterns}
columns={columns}
pagination={pagination}
sorting={sorting}
search={search}
/>
</EuiPageContent>
</>
);
};

Expand Down

0 comments on commit b5867bf

Please sign in to comment.