forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Cell actions extension (elastic#190754)
## 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)
- Loading branch information
1 parent
66af356
commit 034625a
Showing
28 changed files
with
1,105 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import type { DataView } from '@kbn/data-views-plugin/common'; | ||
import { dataViewWithTimefieldMock } from '../../public/__mocks__/data_view_with_timefield'; | ||
import { createDataSource, createDataViewDataSource, createEsqlDataSource } from './utils'; | ||
|
||
describe('createDataSource', () => { | ||
it('should return ES|QL source when ES|QL query', () => { | ||
const dataView = dataViewWithTimefieldMock; | ||
const query = { esql: 'FROM *' }; | ||
const result = createDataSource({ dataView, query }); | ||
expect(result).toEqual(createEsqlDataSource()); | ||
}); | ||
|
||
it('should return data view source when not ES|QL query and dataView id is defined', () => { | ||
const dataView = dataViewWithTimefieldMock; | ||
const query = { language: 'kql', query: 'test' }; | ||
const result = createDataSource({ dataView, query }); | ||
expect(result).toEqual(createDataViewDataSource({ dataViewId: dataView.id! })); | ||
}); | ||
|
||
it('should return undefined when not ES|QL query and dataView id is not defined', () => { | ||
const dataView = { ...dataViewWithTimefieldMock, id: undefined } as DataView; | ||
const query = { language: 'kql', query: 'test' }; | ||
const result = createDataSource({ dataView, query }); | ||
expect(result).toEqual(undefined); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.