mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.16] [ML] Trained Models: fix NaN in a progress bar during the download task initialization (#201221) (#201341)
# Backport This will backport the following commits from `main` to `8.16`: - [[ML] Trained Models: fix `NaN` in a progress bar during the download task initialization (#201221)](https://github.com/elastic/kibana/pull/201221) <!--- 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-11-22T10:26:56Z","message":"[ML] Trained Models: fix `NaN` in a progress bar during the download task initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status of the download task right after initializing a\r\ndownload, `total_parts` might be returned with a `0` value, hence\r\ndividing by 0 for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a fallback to `-1` for that, to make sure we render 0%.\r\n\r\n### Checklist\r\n\r\n- [ ] [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":"639c9b7505020baf5dc5d31122d8924b301a77fc","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v9.0.0","Feature:3rd Party Models","Team:ML","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[ML] Trained Models: fix `NaN` in a progress bar during the download task initialization ","number":201221,"url":"https://github.com/elastic/kibana/pull/201221","mergeCommit":{"message":"[ML] Trained Models: fix `NaN` in a progress bar during the download task initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status of the download task right after initializing a\r\ndownload, `total_parts` might be returned with a `0` value, hence\r\ndividing by 0 for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a fallback to `-1` for that, to make sure we render 0%.\r\n\r\n### Checklist\r\n\r\n- [ ] [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":"639c9b7505020baf5dc5d31122d8924b301a77fc"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201221","number":201221,"mergeCommit":{"message":"[ML] Trained Models: fix `NaN` in a progress bar during the download task initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status of the download task right after initializing a\r\ndownload, `total_parts` might be returned with a `0` value, hence\r\ndividing by 0 for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a fallback to `-1` for that, to make sure we render 0%.\r\n\r\n### Checklist\r\n\r\n- [ ] [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":"639c9b7505020baf5dc5d31122d8924b301a77fc"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","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:
parent
2285ad31c3
commit
e76d4830df
1 changed files with 1 additions and 1 deletions
|
@ -697,7 +697,7 @@ export const ModelsList: FC<Props> = ({
|
|||
<>
|
||||
{downloadState
|
||||
? (
|
||||
(downloadState.downloaded_parts / downloadState.total_parts) *
|
||||
(downloadState.downloaded_parts / (downloadState.total_parts || -1)) *
|
||||
100
|
||||
).toFixed(0) + '%'
|
||||
: '100%'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue