[8.16] [ML] Fix Trained model deletion with expanded row (#198530) (#198567)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ML] Fix Trained model deletion with expanded row
(#198530)](https://github.com/elastic/kibana/pull/198530)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2024-10-31T15:33:17Z","message":"[ML]
Fix Trained model deletion with expanded row (#198530)\n\n##
Summary\r\n\r\nFixes #198408.\r\n\r\nFixes trained model item deletion
with expanded row.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"bd21496b3c0af2167918bd385bd259b05c8e765d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","v9.0.0","Team:ML","v8.16.0","backport:version","v8.17.0"],"title":"[ML]
Fix Trained model deletion with expanded
row","number":198530,"url":"https://github.com/elastic/kibana/pull/198530","mergeCommit":{"message":"[ML]
Fix Trained model deletion with expanded row (#198530)\n\n##
Summary\r\n\r\nFixes #198408.\r\n\r\nFixes trained model item deletion
with expanded row.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"bd21496b3c0af2167918bd385bd259b05c8e765d"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198530","number":198530,"mergeCommit":{"message":"[ML]
Fix Trained model deletion with expanded row (#198530)\n\n##
Summary\r\n\r\nFixes #198408.\r\n\r\nFixes trained model item deletion
with expanded row.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"bd21496b3c0af2167918bd385bd259b05c8e765d"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
This commit is contained in:
Kibana Machine 2024-11-01 04:18:34 +11:00 committed by GitHub
parent 7dbd7c79a0
commit 6d6852dcd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -957,6 +957,14 @@ export const ModelsList: FC<Props> = ({
}
});
setItemIdToExpandedRowMap((prev) => {
const newMap = { ...prev };
modelsToDelete.forEach((model) => {
delete newMap[model.model_id];
});
return newMap;
});
setModelsToDelete([]);
if (refreshList) {

View file

@ -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'