Skip to content
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

Merged
merged 21 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add workaround for security cell actions
  • Loading branch information
davismcphee committed Sep 5, 2024
commit 6c4a524fc7809c50ed6206f7bfe6bbdce3251212
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ export const useAdditionalCellActions = ({
};
}, [additionalCellActions, uiActions]);

const metadata = useMemo<DiscoverCellActionMetadata>(
return useMemo<DiscoverCellActionMetadata>(
() => ({ instanceId, dataSource, dataView, query, filters, timeRange }),
[dataSource, dataView, filters, instanceId, query, timeRange]
);

return additionalCellActions.length ? metadata : undefined;
};

const toCellActionContext = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { DataGridDensity, DataLoadingState, useColumns } from '@kbn/unified-data
import { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';

import { DiscoverGridSettings } from '@kbn/saved-search-plugin/common';
import useObservable from 'react-use/lib/useObservable';
import { DiscoverDocTableEmbeddable } from '../../components/doc_table/create_doc_table_embeddable';
import { useDiscoverServices } from '../../hooks/use_discover_services';
import { getSortForEmbeddable } from '../../utils';
Expand Down Expand Up @@ -150,6 +151,11 @@ export function SearchEmbeddableGridComponent({
timeRange,
});

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


const onStateEditedProps = useMemo(
() => ({
onAddColumn,
Expand Down Expand Up @@ -238,12 +244,12 @@ export function SearchEmbeddableGridComponent({
settings={savedSearch.grid}
ariaLabelledBy={'documentsAriaLabel'}
cellActionsTriggerId={
cellActionsMetadata
? DISCOVER_CELL_ACTIONS_TRIGGER.id
: SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER_ID
isInSecuritySolution
? SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER_ID
: DISCOVER_CELL_ACTIONS_TRIGGER.id
}
cellActionsMetadata={cellActionsMetadata}
cellActionsHandling={cellActionsMetadata ? 'append' : 'replace'}
cellActionsMetadata={isInSecuritySolution ? undefined : cellActionsMetadata}
cellActionsHandling={isInSecuritySolution ? 'replace' : 'append'}
columnsMeta={columnsMeta}
configHeaderRowHeight={defaults.headerRowHeight}
configRowHeight={defaults.rowHeight}
Expand Down