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

[Fleet] Warn user when they are sending data to stream managed by different integration #151075

Merged
Merged
Changes from all 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 @@ -6,9 +6,11 @@
*/

import React, { useEffect, useState } from 'react';
import { EuiComboBox } from '@elastic/eui';
import { EuiComboBox, EuiIcon, EuiLink, EuiSpacer, EuiText, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

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

import type { DataStream } from '../../../../../../../../../common/types';

interface SelectedDataset {
Expand Down Expand Up @@ -73,24 +75,59 @@ export const DatasetComboBox: React.FC<{
});
};
return (
<EuiComboBox
aria-label={i18n.translate('xpack.fleet.datasetCombo.ariaLabel', {
defaultMessage: 'Dataset combo box',
})}
placeholder={i18n.translate('xpack.fleet.datasetCombo.placeholder', {
defaultMessage: 'Select a dataset',
})}
singleSelection={{ asPlainText: true }}
options={datasetOptions}
selectedOptions={selectedOptions}
onCreateOption={onCreateOption}
onChange={onDatasetChange}
customOptionText={i18n.translate('xpack.fleet.datasetCombo.customOptionText', {
defaultMessage: 'Add {searchValue} as a custom option',
values: { searchValue: '{searchValue}' },
})}
isClearable={false}
isDisabled={isDisabled}
/>
<>
<EuiComboBox
aria-label={i18n.translate('xpack.fleet.datasetCombo.ariaLabel', {
defaultMessage: 'Dataset combo box',
})}
placeholder={i18n.translate('xpack.fleet.datasetCombo.placeholder', {
defaultMessage: 'Select a dataset',
})}
singleSelection={{ asPlainText: true }}
options={datasetOptions}
selectedOptions={selectedOptions}
onCreateOption={onCreateOption}
onChange={onDatasetChange}
customOptionText={i18n.translate('xpack.fleet.datasetCombo.customOptionText', {
defaultMessage: 'Add {searchValue} as a custom option',
values: { searchValue: '{searchValue}' },
})}
isClearable={false}
isDisabled={isDisabled}
/>
{valueAsOption && valueAsOption.value.package !== pkgName && (
<>
<EuiSpacer size="xs" />
<EuiText size="xs" color="warning">
<EuiIcon type="alert" />
&nbsp;
<FormattedMessage
id="xpack.fleet.datasetCombo.warning"
defaultMessage="This data stream is managed by the {package} integration, {learnMore}."
values={{
package: valueAsOption.value.package,
learnMore: (
<EuiToolTip
position="bottom"
content={
<FormattedMessage
id="xpack.fleet.datasetCombo.warningTooltip"
defaultMessage="The destination data stream may not be designed to receive data from this integration, check that the mappings and ingest pipelines are compatible before sending data."
/>
}
>
<EuiLink target="_blank">
{i18n.translate('xpack.fleet.datasetCombo.learnMoreLink', {
defaultMessage: 'learn more',
})}
</EuiLink>
</EuiToolTip>
),
}}
/>
</EuiText>
</>
)}
</>
);
};