-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Discover] Cell actions extension #190754
[Discover] Cell actions extension #190754
Conversation
/ci |
68000ef
to
82ecafc
Compare
/ci |
e901ed7
to
ffebaab
Compare
/ci |
ffebaab
to
b16eccd
Compare
/ci |
/ci |
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.
I think I may still have to investigate the page load bundle increase (we'll see what CI says), but otherwise this should be good to review now.
// Security Solution overrides our cell actions -- this is a temporary workaroud to keep | ||
// things working as they do currently until we can migrate their actions to One Discover | ||
const isInSecuritySolution = | ||
useObservable(discoverServices.application.currentAppId$) === 'securitySolutionUI'; |
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.
@elastic/security-threat-hunting-investigations I wanted to build this extension point on top of kbn-cell-actions
since Unified Data Table already supports it, rather than introducing an alternative approach. Unfortunately this conflicts with the saved search embeddable cell action overrides currently active within the Security Solution UI.
So I needed a way to disable the cell actions extension point when it would conflict with the overrides and couldn't figure out another way other than this. I'm open to ideas for a cleaner approach, but my thinking is that this won't be needed eventually anyway since ideally we'll migrate the current Security actions to a context aware Discover profile instead.
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
/ci |
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.
Looks great!
The additional cell actions don't appear on Surrounding Documents page. Is it expected?
@@ -264,6 +272,21 @@ function DiscoverDocumentsComponent({ | |||
[documentState.esqlQueryColumns] | |||
); | |||
|
|||
const { filters } = useQuerySubscriber({ data: services.data }); |
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.
Can we rather take filters
via useAppStateSelector
hook above as we do for query
?
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.
I'd prefer to do something like that, but unfortunately the app state filters
don't include the pinned filters.
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.
The additional cell actions don't appear on Surrounding Documents page. Is it expected?
Nope not expected, I just missed it, thanks! Updated to support surrounding docs here: 2d66307
@@ -264,6 +272,21 @@ function DiscoverDocumentsComponent({ | |||
[documentState.esqlQueryColumns] | |||
); | |||
|
|||
const { filters } = useQuerySubscriber({ data: services.data }); |
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.
I'd prefer to do something like that, but unfortunately the app state filters
don't include the pinned filters.
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.
LGTM, thanks!
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @davismcphee |
## Summary This PR adds a new cell actions extension to Discover using the [`kbn-cell-actions`](packages/kbn-cell-actions) framework which Unified Data Table already supports, allowing profiles to register additional cell actions within the data grid: <img width="2168" alt="cell_actions" src="https://github.com/user-attachments/assets/f01a97be-d90f-4284-9cbf-4a2e1a5dd78c"> The extension point supports the following: - Cell actions can be registered at the root or data source level. - Supports an `isCompatible` method, allowing cell actions to be shown for all cells in a column or conditionally based on the column field, etc. - Cell actions have access to a `context` object including the current `field`, `value`, `dataSource`, `dataView`, `query`, `filters`, and `timeRange`. **Note that currently cell actions do not have access to the entire record, only the current cell value. We can support this as a followup if needed, but it will require an enhancement to `kbn-cell-actions`.** ## Testing - Add `discover.experimental.enabledProfiles: ['example-root-profile', 'example-data-source-profile', 'example-document-profile']` to `kibana.dev.yml` and start Kibana. - Ingest the Discover context awareness example data using the following command: `node scripts/es_archiver --kibana-url=http://elastic:changeme@localhost:5601 --es-url=http://elastic:changeme@localhost:9200 load test/functional/fixtures/es_archiver/discover/context_awareness`. - Navigate to Discover and create a `my-example-logs` data view or target the index in an ES|QL query. - Confirm that the example cell actions appear in expanded cell popover menus and are functional. Resolves elastic#186576. ### Checklist - [ ] 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/packages/kbn-i18n/README.md) - [ ] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] 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) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
## Summary This PR adds a new cell actions extension to Discover using the [`kbn-cell-actions`](packages/kbn-cell-actions) framework which Unified Data Table already supports, allowing profiles to register additional cell actions within the data grid: <img width="2168" alt="cell_actions" src="https://github.com/user-attachments/assets/f01a97be-d90f-4284-9cbf-4a2e1a5dd78c"> The extension point supports the following: - Cell actions can be registered at the root or data source level. - Supports an `isCompatible` method, allowing cell actions to be shown for all cells in a column or conditionally based on the column field, etc. - Cell actions have access to a `context` object including the current `field`, `value`, `dataSource`, `dataView`, `query`, `filters`, and `timeRange`. **Note that currently cell actions do not have access to the entire record, only the current cell value. We can support this as a followup if needed, but it will require an enhancement to `kbn-cell-actions`.** ## Testing - Add `discover.experimental.enabledProfiles: ['example-root-profile', 'example-data-source-profile', 'example-document-profile']` to `kibana.dev.yml` and start Kibana. - Ingest the Discover context awareness example data using the following command: `node scripts/es_archiver --kibana-url=http://elastic:changeme@localhost:5601 --es-url=http://elastic:changeme@localhost:9200 load test/functional/fixtures/es_archiver/discover/context_awareness`. - Navigate to Discover and create a `my-example-logs` data view or target the index in an ES|QL query. - Confirm that the example cell actions appear in expanded cell popover menus and are functional. Resolves elastic#186576. ### Checklist - [ ] 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/packages/kbn-i18n/README.md) - [ ] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] 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) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Summary
This PR adds a new cell actions extension to Discover using the
kbn-cell-actions
framework which Unified Data Table already supports, allowing profiles to register additional cell actions within the data grid:The extension point supports the following:
isCompatible
method, allowing cell actions to be shown for all cells in a column or conditionally based on the column field, etc.context
object including the currentfield
,value
,dataSource
,dataView
,query
,filters
, andtimeRange
.Note that currently cell actions do not have access to the entire record, only the current cell value. We can support this as a followup if needed, but it will require an enhancement to
kbn-cell-actions
.Testing
discover.experimental.enabledProfiles: ['example-root-profile', 'example-data-source-profile', 'example-document-profile']
tokibana.dev.yml
and start Kibana.node scripts/es_archiver --kibana-url=http://elastic:changeme@localhost:5601 --es-url=http://elastic:changeme@localhost:9200 load test/functional/fixtures/es_archiver/discover/context_awareness
.my-example-logs
data view or target the index in an ES|QL query.Resolves #186576.
Checklist
For maintainers