-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Obs ai assistant] - bug bulk import for knowledge base #205075
[Obs ai assistant] - bug bulk import for knowledge base #205075
Conversation
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
@@ -54,6 +54,7 @@ export function KnowledgeBaseBulkImportFlyout({ onClose }: { onClose: () => void | |||
|
|||
try { | |||
entries = elements.map((el) => JSON.parse(el)); | |||
mutateAsync({ entries }).then(onClose); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'd need to await
this presumably? and I think you can remove the .then(onClose)
(both here and in the catch block) and move it to below the try/catch block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgieselaar, updated it to await mutateAsync and moved onClose outside the try/catch block.
0fcc09a
to
7848536
Compare
entries = elements.map((el) => JSON.parse(el)); | ||
await mutateAsync({ entries }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaict entries
can be declared as const now:
entries = elements.map((el) => JSON.parse(el)); | |
await mutateAsync({ entries }); | |
const entries = elements.map((el) => JSON.parse(el)); | |
await mutateAsync({ entries }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion! You’re right, entries
can be declared as const since it doesn’t get reassigned. I’ve updated the code to remove the let declaration and added the appropriate type annotation to ensure type safety.
...ility_ai_assistant_management/public/routes/components/knowledge_base_bulk_import_flyout.tsx
Outdated
Show resolved
Hide resolved
… ensuring onClose is called correctly
…es with proper type
…ant_management/public/routes/components/knowledge_base_bulk_import_flyout.tsx - Move the type assertion to the JSON parsing and let the compiler handle the rest. Co-authored-by: Søren Louv-Jansen <[email protected]>
0753032
to
d6fe09e
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
Starting backport for target branches: 8.16, 8.17, 8.x |
Closes elastic#196096 ## Summary Wrong successful message with error notification pop up on adding a wrong format file under bulk import for knowledge base [elastic#196096](elastic#196096) --------- Co-authored-by: Søren Louv-Jansen <[email protected]> Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 2c97ed3)
Closes elastic#196096 ## Summary Wrong successful message with error notification pop up on adding a wrong format file under bulk import for knowledge base [elastic#196096](elastic#196096) --------- Co-authored-by: Søren Louv-Jansen <[email protected]> Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 2c97ed3)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…) (#205687) # Backport This will backport the following commits from `main` to `8.17`: - [[Obs ai assistant] - bug bulk import for knowledge base (#205075)](#205075) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-07T09:44:16Z","message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Obs AI Assistant","v8.16.0","backport:version","v8.17.0","v8.18.0"],"title":"[Obs ai assistant] - bug bulk import for knowledge base","number":205075,"url":"https://github.com/elastic/kibana/pull/205075","mergeCommit":{"message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205075","number":205075,"mergeCommit":{"message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"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"}]}] BACKPORT--> Co-authored-by: Arturo Lidueña <[email protected]>
… (#205688) # Backport This will backport the following commits from `main` to `8.x`: - [[Obs ai assistant] - bug bulk import for knowledge base (#205075)](#205075) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-07T09:44:16Z","message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Obs AI Assistant","v8.16.0","backport:version","v8.17.0","v8.18.0"],"title":"[Obs ai assistant] - bug bulk import for knowledge base","number":205075,"url":"https://github.com/elastic/kibana/pull/205075","mergeCommit":{"message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205075","number":205075,"mergeCommit":{"message":"[Obs ai assistant] - bug bulk import for knowledge base (#205075)\n\nCloses #196096 \r\n\r\n## Summary\r\n\r\nWrong successful message with error notification pop up on adding a\r\nwrong format file under bulk import for knowledge base\r\n[#196096](https://github.com/elastic/kibana/issues/196096)\r\n\r\n---------\r\n\r\nCo-authored-by: Søren Louv-Jansen <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"2c97ed3bfec8a99de931d85f50b1e940835bde47"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"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"}]}] BACKPORT--> Co-authored-by: Arturo Lidueña <[email protected]>
Closes elastic#196096 ## Summary Wrong successful message with error notification pop up on adding a wrong format file under bulk import for knowledge base [elastic#196096](elastic#196096) --------- Co-authored-by: Søren Louv-Jansen <[email protected]> Co-authored-by: kibanamachine <[email protected]>
Closes elastic#196096 ## Summary Wrong successful message with error notification pop up on adding a wrong format file under bulk import for knowledge base [elastic#196096](elastic#196096) --------- Co-authored-by: Søren Louv-Jansen <[email protected]> Co-authored-by: kibanamachine <[email protected]>
Closes #196096
Summary
Wrong successful message with error notification pop up on adding a wrong format file under bulk import for knowledge base
#196096