[onechat] Implement ES|QL tool editing#229224
Conversation
jedrazb
left a comment
There was a problem hiding this comment.
Lgtm! Testes locally, one question if we really need to disable that eslint rule
x-pack/platform/plugins/shared/onechat/public/application/components/tools/esql/esql_tools.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/onechat/public/application/components/tools/esql/esql_tools.tsx
Outdated
Show resolved
Hide resolved
| onError, | ||
| }); | ||
|
|
||
| const openFlyout = useCallback((tool: EsqlToolDefinitionWithSchema) => { |
There was a problem hiding this comment.
doing it this way is fine if we stick with flyout, but will be problematic if we ever change tool creation to be a separate page.
There was a problem hiding this comment.
Yeah, I think it's a given that the implementation will need to change once we move to a separate page view — it shouldn't be terribly difficult to refactor
There was a problem hiding this comment.
and by the looks of latest designs we will be moving there
3254421 to
0d70d03
Compare
| defaultMessage: 'New ES|QL tool', | ||
| })} | ||
| </h2> | ||
| <h2 id={esqlToolFlyoutTitleId}>{title}</h2> |
There was a problem hiding this comment.
NIT: if we just have two title (one for create mode, one for edit mode), I think it would make sense to just pass a edition: boolean prop to the component and handling the two labels internally instead of passing the title as a props. Seems like a better isolation of concerns to me
| onClick={() => { | ||
| editTool(tool); | ||
| }} |
There was a problem hiding this comment.
I think @jedrazb mentioned something similar - It feels strange to me that we're passing the full tool definition to the edit handler / flyout. I would expect to just be passing the toolId, and let the edition view fetch the corresponding data. What we are doing here is coupling the interface we're using to list tools, and to edit them, and if today those are the same, this will likely change (e.g. we don't need to return all properties for the edition page).
Not strictly blocker, but this is a code smell ihmo.
There was a problem hiding this comment.
Yeah, I see your point here. Fixed it to take in a toolId instead of the entire tool definition
x-pack/platform/plugins/shared/onechat/public/application/hooks/tools/use_edit_tools.ts
Show resolved
Hide resolved
| const handleEditSuccess = useCallback(() => { | ||
| addSuccessToast({ | ||
| title: i18n.translate('xpack.onechat.tools.editEsqlToolSuccessToast', { | ||
| defaultMessage: 'ES|QL tool updated', |
There was a problem hiding this comment.
NIT: we usually have the id/name of the entity for "XXX created/updated/delete" toasts in Kibana.
Also I'm not sure we want to surface the type of the tool in those messages, I feel like maybe something like Tool {toolName} updated would make more sense? (but it's more a product, design question)
There was a problem hiding this comment.
Makes sense to me, I've added the ID for now and will incorporate the latest copy from the UX mocks as part of my next task to incorporate the Tools V2 design
0d70d03 to
5e46219
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
|
## Summary Adds the ability to edit ES|QL tools from the tools page, leveraging the existing flyout UI used when creating new ES|QL tools. https://github.com/user-attachments/assets/7d80a2a2-ac66-41c2-9c7a-4b7de941451f ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
Summary
Adds the ability to edit ES|QL tools from the tools page, leveraging the existing flyout UI used when creating new ES|QL tools.
Screen.Recording.2025-07-23.at.5.11.06.PM.mov
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.