Skip to content

[Discover] Cell actions extension#190754

Merged
davismcphee merged 21 commits intoelastic:mainfrom
davismcphee:discover-cell-actions-extension
Sep 11, 2024
Merged

[Discover] Cell actions extension#190754
davismcphee merged 21 commits intoelastic:mainfrom
davismcphee:discover-cell-actions-extension

Conversation

@davismcphee
Copy link
Copy Markdown
Contributor

@davismcphee davismcphee commented Aug 20, 2024

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:
cell_actions

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 #186576.

Checklist

For maintainers

@davismcphee davismcphee added Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Project:OneDiscover Enrich Discover with contextual awareness labels Aug 20, 2024
@davismcphee davismcphee self-assigned this Aug 20, 2024
@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

@davismcphee davismcphee force-pushed the discover-cell-actions-extension branch from 68000ef to 82ecafc Compare August 20, 2024 22:27
@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

@davismcphee davismcphee force-pushed the discover-cell-actions-extension branch from e901ed7 to ffebaab Compare September 1, 2024 01:43
@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

@davismcphee davismcphee force-pushed the discover-cell-actions-extension branch from ffebaab to b16eccd Compare September 5, 2024 20:12
@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

@davismcphee davismcphee added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Sep 6, 2024
Copy link
Copy Markdown
Contributor Author

@davismcphee davismcphee left a 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.

Comment on lines +154 to +157
// 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';
Copy link
Copy Markdown
Contributor Author

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.

@davismcphee davismcphee marked this pull request as ready for review September 6, 2024 04:35
@davismcphee davismcphee requested a review from a team as a code owner September 6, 2024 04:35
@davismcphee davismcphee requested a review from a team as a code owner September 6, 2024 04:35
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@davismcphee
Copy link
Copy Markdown
Contributor Author

/ci

Copy link
Copy Markdown
Contributor

@jughosta jughosta left a 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?

[documentState.esqlQueryColumns]
);

const { filters } = useQuerySubscriber({ data: services.data });
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

@davismcphee davismcphee left a 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

[documentState.esqlQueryColumns]
);

const { filters } = useQuerySubscriber({ data: services.data });
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #45 / serverless observability UI Observability Logs Explorer DataSourceSelector with installed integrations and uncategorized data streams "after all" hook in "with installed integrations and uncategorized data streams"
  • [job] [logs] FTR Configs #45 / serverless observability UI Observability Logs Explorer DataSourceSelector with installed integrations and uncategorized data streams "before all" hook in "with installed integrations and uncategorized data streams"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 973 988 +15

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cloudSecurityPosture 495.8KB 496.0KB +185.0B
discover 797.2KB 807.9KB +10.7KB
esqlDataGrid 152.6KB 152.8KB +195.0B
securitySolution 19.7MB 19.7MB +975.0B
slo 852.1KB 852.3KB +183.0B
total +12.2KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 47.9KB 47.2KB -744.0B
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 184 185 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @davismcphee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Project:OneDiscover Enrich Discover with contextual awareness release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OneDiscover][Extension] DataTable Cell Actions

5 participants