From 3d2e4402f88b2884cbf9d347aa81b7a5dc2ed2d0 Mon Sep 17 00:00:00 2001 From: Damian Polewski <125268832+damian-polewski@users.noreply.github.com> Date: Tue, 22 Jul 2025 11:52:35 +0200 Subject: [PATCH] [Index Management] Hide Edit data retention bulk action for ILM managed data streams (#228802) Closes #211020 ## Summary This PR fixes an issue where `Edit data retention` bulk action was available when data stream fully managed by ILM was selected. (cherry picked from commit a2215da841f8af255cc9045370f3a73879bd9cc2) --- .../home/data_streams_tab.test.ts | 22 +++++++++++++++++++ .../data_stream_table/data_stream_table.tsx | 6 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts index 0ab31434ae8ac..8d69bf05c6564 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts +++ b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/data_streams_tab.test.ts @@ -958,6 +958,28 @@ describe('Data Streams tab', () => { expect(exists('editDataRetentionButton')).toBe(false); }); + test('displays/hides bulk edit data retention depending if data stream fully managed by ILM is selected', async () => { + const { + find, + actions: { selectDataStream, clickManageDataStreamsButton }, + } = testBed; + + // Select data stream fully managed by ILM + selectDataStream('dataStream1', true); + clickManageDataStreamsButton(); + expect(find('bulkEditDataRetentionButton').exists()).toBeFalsy(); + + // Select data stream managed by DSL + selectDataStream('dataStream2', true); + clickManageDataStreamsButton(); + expect(find('bulkEditDataRetentionButton').exists()).toBeFalsy(); + + // Unselect data stream fully managed by ILM + selectDataStream('dataStream1', false); + clickManageDataStreamsButton(); + expect(find('bulkEditDataRetentionButton').exists()).toBeTruthy(); + }); + test('when partially managed by dsl but has backing indices managed by ILM should show a warning', async () => { const { setLoadDataStreamResponse } = httpRequestsMockHelpers; diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx index a9b2b2c6ab51f..7adbf9175fb94 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/data_stream_list/data_stream_table/data_stream_table.tsx @@ -293,7 +293,11 @@ export const DataStreamTable: React.FunctionComponent = ({ const dataStreamActions: EuiContextMenuPanelItemDescriptor[] = []; if ( - selection.every((dataStream: DataStream) => dataStream.privileges.manage_data_stream_lifecycle) + selection.every( + (dataStream: DataStream) => + dataStream.privileges.manage_data_stream_lifecycle && + !isDataStreamFullyManagedByILM(dataStream) + ) ) { dataStreamActions.push({ name: i18n.translate('xpack.idxMgmt.dataStreamList.table.bulkEditDataRetentionButtonLabel', {