Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Transform] Show destination index mapping warning for the latest transform #87858

Merged
merged 4 commits into from
Jan 12, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React, { Fragment, FC, useEffect, useState } from 'react';

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import {
EuiAccordion,
Expand All @@ -17,6 +18,9 @@ import {
EuiFormRow,
EuiSelect,
EuiSpacer,
EuiCallOut,
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';

import { KBN_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/common';
Expand Down Expand Up @@ -50,6 +54,7 @@ import {
transformSettingsMaxPageSearchSizeValidator,
} from '../../../../common/validators';
import { StepDefineExposedState } from '../step_define/common';
import { TRANSFORM_FUNCTION } from '../../../../../../common/constants';

export interface StepDetailsExposedState {
continuousModeDateField: string;
Expand Down Expand Up @@ -397,51 +402,82 @@ export const StepDetailsForm: FC<Props> = React.memo(
data-test-subj="transformDescriptionInput"
/>
</EuiFormRow>
<EuiFormRow
label={i18n.translate('xpack.transform.stepDetailsForm.destinationIndexLabel', {
defaultMessage: 'Destination index',
})}
isInvalid={!indexNameEmpty && !indexNameValid}
helpText={
indexNameExists &&
i18n.translate('xpack.transform.stepDetailsForm.destinationIndexHelpText', {
defaultMessage:
'An index with this name already exists. Be aware that running this transform will modify this destination index.',
})
}
error={
!indexNameEmpty &&
!indexNameValid && [
<Fragment>
{i18n.translate('xpack.transform.stepDetailsForm.destinationIndexInvalidError', {
defaultMessage: 'Invalid destination index name.',
})}
<br />
<EuiLink href={esIndicesCreateIndex} target="_blank">
{i18n.translate(
'xpack.transform.stepDetailsForm.destinationIndexInvalidErrorLink',
{
defaultMessage: 'Learn more about index name limitations.',
}
)}
</EuiLink>
</Fragment>,
]
}
>
<EuiFieldText
value={destinationIndex}
onChange={(e) => setDestinationIndex(e.target.value)}
aria-label={i18n.translate(
'xpack.transform.stepDetailsForm.destinationIndexInputAriaLabel',
{
defaultMessage: 'Choose a unique destination index name.',

<EuiSpacer size={'m'} />

<EuiFlexGroup justifyContent="flexStart" gutterSize="m">
<EuiFlexItem style={{ flexBasis: '400px' }} grow={false}>
<EuiFormRow
label={i18n.translate('xpack.transform.stepDetailsForm.destinationIndexLabel', {
defaultMessage: 'Destination index',
})}
isInvalid={!indexNameEmpty && !indexNameValid}
helpText={
indexNameExists &&
i18n.translate('xpack.transform.stepDetailsForm.destinationIndexHelpText', {
defaultMessage:
'An index with this name already exists. Be aware that running this transform will modify this destination index.',
})
}
)}
isInvalid={!indexNameEmpty && !indexNameValid}
data-test-subj="transformDestinationIndexInput"
/>
</EuiFormRow>
error={
!indexNameEmpty &&
!indexNameValid && [
<Fragment>
{i18n.translate(
'xpack.transform.stepDetailsForm.destinationIndexInvalidError',
{
defaultMessage: 'Invalid destination index name.',
}
)}
<br />
<EuiLink href={esIndicesCreateIndex} target="_blank">
{i18n.translate(
'xpack.transform.stepDetailsForm.destinationIndexInvalidErrorLink',
{
defaultMessage: 'Learn more about index name limitations.',
}
)}
</EuiLink>
</Fragment>,
]
}
>
<EuiFieldText
value={destinationIndex}
onChange={(e) => setDestinationIndex(e.target.value)}
aria-label={i18n.translate(
'xpack.transform.stepDetailsForm.destinationIndexInputAriaLabel',
{
defaultMessage: 'Choose a unique destination index name.',
}
)}
isInvalid={!indexNameEmpty && !indexNameValid}
data-test-subj="transformDestinationIndexInput"
/>
</EuiFormRow>
</EuiFlexItem>
{stepDefineState.transformFunction === TRANSFORM_FUNCTION.LATEST ? (
<EuiFlexItem>
<EuiCallOut color="warning" iconType="alert" size="m">
<p>
<FormattedMessage
id="xpack.transform.stepDetailsForm.destinationIndexWarning"
defaultMessage="Note that dynamic mappings based on the source fields will be used if the destination index does not exist. If alternate mappings are required, use the {docsLink} prior to starting the transform. If the transform fails, please check the messages tab for the transform on the Stack Management page for errors."
Copy link
Contributor

@lcawl lcawl Jan 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defaultMessage="Note that dynamic mappings based on the source fields will be used if the destination index does not exist. If alternate mappings are required, use the {docsLink} prior to starting the transform. If the transform fails, please check the messages tab for the transform on the Stack Management page for errors."
defaultMessage="Before you start the transform, use index templates or the {docsLink} to ensure the mappings for your destination index match the source index. If the transform fails, check the messages tab on the Stack Management page for errors."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 8bb38f5

values={{
docsLink: (
<EuiLink href={esIndicesCreateIndex} target="_blank">
{i18n.translate('xpack.transform.stepDetailsForm.createIndexAPI', {
defaultMessage: 'Create index API',
})}
</EuiLink>
),
}}
/>
</p>
</EuiCallOut>
</EuiFlexItem>
) : null}
</EuiFlexGroup>

<EuiFormRow
isInvalid={createIndexPattern && indexPatternTitleExists}
Expand Down