From c8b3274352b3a76fd77261e51f394c016914ce1c Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 31 Oct 2024 14:33:38 +0100 Subject: [PATCH 1/2] fix deletion with expanded row --- .../public/application/model_management/models_list.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x-pack/plugins/ml/public/application/model_management/models_list.tsx b/x-pack/plugins/ml/public/application/model_management/models_list.tsx index 9dbdf6069aff6..a717995d4ee14 100644 --- a/x-pack/plugins/ml/public/application/model_management/models_list.tsx +++ b/x-pack/plugins/ml/public/application/model_management/models_list.tsx @@ -957,6 +957,14 @@ export const ModelsList: FC = ({ } }); + setItemIdToExpandedRowMap((prev) => { + const newMap = { ...prev }; + modelsToDelete.forEach((model) => { + delete newMap[model.model_id]; + }); + return newMap; + }); + setModelsToDelete([]); if (refreshList) { From 43e9f996a14c8eaf294bb60930b3fc8bd8fc03a8 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 31 Oct 2024 14:42:08 +0100 Subject: [PATCH 2/2] update functional test --- .../apps/ml/short_tests/model_management/model_list.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts b/x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts index c828e8da1f3af..7977f17bf5f65 100644 --- a/x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts +++ b/x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts @@ -416,7 +416,8 @@ export default function ({ getService }: FtrProviderContext) { it('displays a model without an ingest pipeline and model can be deleted', async () => { await ml.testExecution.logTestStep('should display the model in the table'); - await ml.trainedModelsTable.filterWithSearchString(modelWithoutPipelineData.modelId, 1); + await ml.testExecution.logTestStep('expands the row to show the model details'); + await ml.trainedModelsTable.ensureRowIsExpanded(modelWithoutPipelineData.modelId); await ml.testExecution.logTestStep( 'displays expected row values for the model in the table'