mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[8.x] [Index Management/Data Streams] Add warning callout in single edit data retention modal (#206760) (#207112)
# Backport This will backport the following commits from `main` to `8.x`: - [[Index Management/Data Streams] Add warning callout in single edit data retention modal (#206760)](https://github.com/elastic/kibana/pull/206760) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-17T17:15:37Z","message":"[Index Management/Data Streams] Add warning callout in single edit data retention modal (#206760)\n\nCloses https://github.com/elastic/kibana/issues/204992\r\n\r\n## Summary\r\n\r\nCallout for single edit data retention (opened from data stream details\r\npanel):\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 29 29\"\r\nsrc=\"https://github.com/user-attachments/assets/c415e634-4b39-43d3-b1ae-8a1de55cb144\"\r\n/>\r\n\r\n\r\n\r\nFor reference, this is the callout for bulk edit data retention (exists\r\nfrom before this PR):\r\n\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 26 08\"\r\nsrc=\"https://github.com/user-attachments/assets/6d167f94-9882-4b48-b1f9-20d26e9bdea7\"\r\n/>\r\n\r\n\r\n**How to test:**\r\n1. Start Es and Kibana\r\n2. Go to Index Management -> Data streams and click on one of the data\r\nstreams.\r\n3. Click on the \"Manage\" button and edit data retention.\r\n4. Decrease the data retention period and verify that the callout\r\nmessage is correct.\r\n5. Also, verify that the callout message in the bulk edit data retention\r\nmodal is still the same.","sha":"61c2d18e5ccb80723eeaf2720621cfc4d38d8ccf","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Kibana Management","Team:Kibana Management","release_note:skip","v9.0.0","backport:prev-minor","v8.18.0"],"title":"[Index Management/Data Streams] Add warning callout in single edit data retention modal","number":206760,"url":"https://github.com/elastic/kibana/pull/206760","mergeCommit":{"message":"[Index Management/Data Streams] Add warning callout in single edit data retention modal (#206760)\n\nCloses https://github.com/elastic/kibana/issues/204992\r\n\r\n## Summary\r\n\r\nCallout for single edit data retention (opened from data stream details\r\npanel):\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 29 29\"\r\nsrc=\"https://github.com/user-attachments/assets/c415e634-4b39-43d3-b1ae-8a1de55cb144\"\r\n/>\r\n\r\n\r\n\r\nFor reference, this is the callout for bulk edit data retention (exists\r\nfrom before this PR):\r\n\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 26 08\"\r\nsrc=\"https://github.com/user-attachments/assets/6d167f94-9882-4b48-b1f9-20d26e9bdea7\"\r\n/>\r\n\r\n\r\n**How to test:**\r\n1. Start Es and Kibana\r\n2. Go to Index Management -> Data streams and click on one of the data\r\nstreams.\r\n3. Click on the \"Manage\" button and edit data retention.\r\n4. Decrease the data retention period and verify that the callout\r\nmessage is correct.\r\n5. Also, verify that the callout message in the bulk edit data retention\r\nmodal is still the same.","sha":"61c2d18e5ccb80723eeaf2720621cfc4d38d8ccf"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206760","number":206760,"mergeCommit":{"message":"[Index Management/Data Streams] Add warning callout in single edit data retention modal (#206760)\n\nCloses https://github.com/elastic/kibana/issues/204992\r\n\r\n## Summary\r\n\r\nCallout for single edit data retention (opened from data stream details\r\npanel):\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 29 29\"\r\nsrc=\"https://github.com/user-attachments/assets/c415e634-4b39-43d3-b1ae-8a1de55cb144\"\r\n/>\r\n\r\n\r\n\r\nFor reference, this is the callout for bulk edit data retention (exists\r\nfrom before this PR):\r\n\r\n<img width=\"1446\" alt=\"Screenshot 2025-01-15 at 13 26 08\"\r\nsrc=\"https://github.com/user-attachments/assets/6d167f94-9882-4b48-b1f9-20d26e9bdea7\"\r\n/>\r\n\r\n\r\n**How to test:**\r\n1. Start Es and Kibana\r\n2. Go to Index Management -> Data streams and click on one of the data\r\nstreams.\r\n3. Click on the \"Manage\" button and edit data retention.\r\n4. Decrease the data retention period and verify that the callout\r\nmessage is correct.\r\n5. Also, verify that the callout message in the bulk edit data retention\r\nmodal is still the same.","sha":"61c2d18e5ccb80723eeaf2720621cfc4d38d8ccf"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
4a645b511c
commit
6e8fe98851
3 changed files with 78 additions and 16 deletions
|
@ -95,6 +95,7 @@ export type TestSubjects =
|
|||
| 'editDataRetentionButton'
|
||||
| 'bulkEditDataRetentionButton'
|
||||
| 'dataStreamActionsPopoverButton'
|
||||
| 'reducedDataRetentionCallout'
|
||||
| 'errorWhenCreatingCallout'
|
||||
| 'manageDataStreamButton'
|
||||
| 'dataRetentionValue'
|
||||
|
|
|
@ -533,6 +533,30 @@ describe('Data Streams tab', () => {
|
|||
testBed.component.update();
|
||||
});
|
||||
|
||||
test('shows bulk edit callout for reduced data retention', async () => {
|
||||
const {
|
||||
actions: { selectDataStream, clickBulkEditDataRetentionButton },
|
||||
} = testBed;
|
||||
|
||||
selectDataStream('dataStream1', true);
|
||||
selectDataStream('dataStream2', true);
|
||||
|
||||
clickBulkEditDataRetentionButton();
|
||||
|
||||
// Decrease data retention value to 5d (it was 7d initially)
|
||||
testBed.form.setInputValue('dataRetentionValue', '5');
|
||||
|
||||
// Verify that callout is displayed
|
||||
expect(testBed.exists('reducedDataRetentionCallout')).toBeTruthy();
|
||||
|
||||
// Verify message in callout
|
||||
const calloutText = testBed.find('reducedDataRetentionCallout').text();
|
||||
expect(calloutText).toContain(
|
||||
'The retention period will be reduced for 2 data streams. Data older than then new retention period will be permanently deleted.'
|
||||
);
|
||||
expect(calloutText).toContain('Affected data streams: dataStream1, dataStream2');
|
||||
});
|
||||
|
||||
test('can set data retention period for mutliple data streams', async () => {
|
||||
const {
|
||||
actions: { selectDataStream, clickBulkEditDataRetentionButton },
|
||||
|
@ -796,6 +820,28 @@ describe('Data Streams tab', () => {
|
|||
expect.objectContaining({ body: JSON.stringify({ dataStreams: ['dataStream1'] }) })
|
||||
);
|
||||
});
|
||||
|
||||
test('shows single edit callout for reduced data retention', async () => {
|
||||
const {
|
||||
actions: { clickNameAt, clickEditDataRetentionButton },
|
||||
} = testBed;
|
||||
|
||||
await clickNameAt(0);
|
||||
|
||||
clickEditDataRetentionButton();
|
||||
|
||||
// Decrease data retention value to 5d (it was 7d initially)
|
||||
testBed.form.setInputValue('dataRetentionValue', '5');
|
||||
|
||||
// Verify that callout is displayed
|
||||
expect(testBed.exists('reducedDataRetentionCallout')).toBeTruthy();
|
||||
|
||||
// Verify message in callout
|
||||
const calloutText = testBed.find('reducedDataRetentionCallout').text();
|
||||
expect(calloutText).toContain(
|
||||
'The retention period will be reduced. Data older than then new retention period will be permanently deleted.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('clicking index template name navigates to the index template details', async () => {
|
||||
|
|
|
@ -201,16 +201,23 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
|
|||
<EuiModal
|
||||
onClose={() => onClose()}
|
||||
data-test-subj="editDataRetentionModal"
|
||||
css={{ minWidth: isBulkEdit ? 650 : 450, maxWidth: 650 }}
|
||||
css={{ width: 650 }}
|
||||
>
|
||||
<Form form={form} data-test-subj="editDataRetentionForm">
|
||||
<EuiModalHeader>
|
||||
<EuiModalHeaderTitle>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.modalTitleText"
|
||||
defaultMessage="Edit data retention for {dataStreamCount} {dataStreamCount, plural, one {data stream} other {data streams}}"
|
||||
values={{ dataStreamCount: dataStreams?.length }}
|
||||
/>
|
||||
{isBulkEdit ? (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.bulkEdit.modalTitleText"
|
||||
defaultMessage="Edit data retention for {dataStreamCount} {dataStreamCount, plural, one {data stream} other {data streams}}"
|
||||
values={{ dataStreamCount: dataStreams?.length }}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.singleEdit.modalTitleText"
|
||||
defaultMessage="Edit data retention"
|
||||
/>
|
||||
)}
|
||||
</EuiModalHeaderTitle>
|
||||
</EuiModalHeader>
|
||||
|
||||
|
@ -292,7 +299,7 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
|
|||
)
|
||||
}
|
||||
componentProps={{
|
||||
fullWidth: isBulkEdit,
|
||||
fullWidth: true,
|
||||
euiFieldProps: {
|
||||
disabled:
|
||||
formData.infiniteRetentionPeriod ||
|
||||
|
@ -343,7 +350,7 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
|
|||
|
||||
<EuiSpacer />
|
||||
|
||||
{isBulkEdit && affectedDataStreams.length > 0 && !formData.infiniteRetentionPeriod && (
|
||||
{affectedDataStreams.length > 0 && !formData.infiniteRetentionPeriod && (
|
||||
<EuiCallOut
|
||||
title={i18n.translate(
|
||||
'xpack.idxMgmt.dataStreams.editDataRetentionModal.affectedDataStreamsCalloutTitle',
|
||||
|
@ -353,18 +360,26 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
|
|||
)}
|
||||
color="danger"
|
||||
iconType="warning"
|
||||
data-test-subj="reducedDataRetentionCallout"
|
||||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.affectedDataStreamsCalloutText"
|
||||
defaultMessage="The retention period will be reduced for {affectedDataStreamCount} data streams. Data older than then new
|
||||
{isBulkEdit ? (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.bulkEdit.affectedDataStreamsCalloutText"
|
||||
defaultMessage="The retention period will be reduced for {affectedDataStreamCount} {affectedDataStreamCount, plural, one {data stream} other {data streams}}. Data older than then new
|
||||
retention period will be permanently deleted."
|
||||
values={{
|
||||
affectedDataStreamCount: affectedDataStreams.length,
|
||||
}}
|
||||
/>
|
||||
values={{
|
||||
affectedDataStreamCount: affectedDataStreams.length,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.singleEdit.affectedDataStreamsSingleCalloutText"
|
||||
defaultMessage="The retention period will be reduced. Data older than then new retention period will be permanently deleted."
|
||||
/>
|
||||
)}
|
||||
</p>
|
||||
{affectedDataStreams.length <= 10 && (
|
||||
{isBulkEdit && affectedDataStreams.length <= 10 && (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.affectedDataStreamsCalloutList"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue