Skip to content

Commit

Permalink
[8.7] [Fleet] Warn user when they are sending data to stream managed …
Browse files Browse the repository at this point in the history
…by different integration (#151075) (#151146)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Fleet] Warn user when they are sending data to stream managed by
different integration
(#151075)](#151075)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mark
Hopkin","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-02-14T14:40:46Z","message":"[Fleet]
Warn user when they are sending data to stream managed by different
integration (#151075)\n\n## Summary\r\n\r\nCloses #149427\r\n\r\nGive
the user a warning if they are sending data to a data stream
that\r\nisn't managed by the integration being added.\r\n\r\n<img
width=\"697\" alt=\"Screenshot 2023-02-13 at 21 17
13\"\r\nsrc=\"https://user-images.githubusercontent.com/3315046/218576500-a0817207-451e-47c5-ba0b-d0faaddca1a4.png\">","sha":"25d4c9f3297bfcf685287d4b0fd3a91934d8eb04","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.7.0","v8.8.0"],"number":151075,"url":"https://github.com/elastic/kibana/pull/151075","mergeCommit":{"message":"[Fleet]
Warn user when they are sending data to stream managed by different
integration (#151075)\n\n## Summary\r\n\r\nCloses #149427\r\n\r\nGive
the user a warning if they are sending data to a data stream
that\r\nisn't managed by the integration being added.\r\n\r\n<img
width=\"697\" alt=\"Screenshot 2023-02-13 at 21 17
13\"\r\nsrc=\"https://user-images.githubusercontent.com/3315046/218576500-a0817207-451e-47c5-ba0b-d0faaddca1a4.png\">","sha":"25d4c9f3297bfcf685287d4b0fd3a91934d8eb04"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151075","number":151075,"mergeCommit":{"message":"[Fleet]
Warn user when they are sending data to stream managed by different
integration (#151075)\n\n## Summary\r\n\r\nCloses #149427\r\n\r\nGive
the user a warning if they are sending data to a data stream
that\r\nisn't managed by the integration being added.\r\n\r\n<img
width=\"697\" alt=\"Screenshot 2023-02-13 at 21 17
13\"\r\nsrc=\"https://user-images.githubusercontent.com/3315046/218576500-a0817207-451e-47c5-ba0b-d0faaddca1a4.png\">","sha":"25d4c9f3297bfcf685287d4b0fd3a91934d8eb04"}}]}]
BACKPORT-->

Co-authored-by: Mark Hopkin <[email protected]>
  • Loading branch information
kibanamachine and hop-dev authored Feb 14, 2023
1 parent 238244e commit ff2877b
Showing 1 changed file with 57 additions and 20 deletions.
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>
</>
)}
</>
);
};

0 comments on commit ff2877b

Please sign in to comment.