[8.16] [ML] Fix the Trained Models table expanded row refresh (#198149) (#198391)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ML] Fix the Trained Models table expanded row refresh
(#198149)](https://github.com/elastic/kibana/pull/198149)

<!--- 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-30T15:34:29Z","message":"[ML]
Fix the Trained Models table expanded row refresh (#198149)\n\n##
Summary\r\n\r\nFixes a regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/194614/, where the content
of\r\nexpanded rows in the Trained Model table stopped being updated
on\r\nrefresh.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7e05d5c2e8084212584770fa52fe5701e2dd2166","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v9.0.0","Feature:3rd
Party Models","Team:ML","v8.16.0","backport:version"],"title":"[ML] Fix
the Trained Models table expanded row
refresh","number":198149,"url":"https://github.com/elastic/kibana/pull/198149","mergeCommit":{"message":"[ML]
Fix the Trained Models table expanded row refresh (#198149)\n\n##
Summary\r\n\r\nFixes a regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/194614/, where the content
of\r\nexpanded rows in the Trained Model table stopped being updated
on\r\nrefresh.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7e05d5c2e8084212584770fa52fe5701e2dd2166"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198149","number":198149,"mergeCommit":{"message":"[ML]
Fix the Trained Models table expanded row refresh (#198149)\n\n##
Summary\r\n\r\nFixes a regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/194614/, where the content
of\r\nexpanded rows in the Trained Model table stopped being updated
on\r\nrefresh.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7e05d5c2e8084212584770fa52fe5701e2dd2166"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-31 04:24:54 +11:00 committed by GitHub
parent 495a5305ab
commit 8d35157628
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -316,6 +316,16 @@ export const ModelsList: FC<Props> = ({
};
});
});
setItemIdToExpandedRowMap((prev) => {
// Refresh expanded rows
return Object.fromEntries(
Object.keys(prev).map((modelId) => {
const item = resultItems.find((i) => i.model_id === modelId);
return item ? [modelId, <ExpandedRow item={item as ModelItemFull} />] : [];
})
);
});
} catch (error) {
displayErrorToast(
error,