Skip to content

Commit

Permalink
[SecuritySolutions] Remove filter actions from Cases alerts table and…
Browse files Browse the repository at this point in the history
… fix show_top_n action (#161150)

issue #134442

## Summary

* Remove filter actions from the cases alerts page because it has no
search bar (as suggested by Sergi).
* Fix the `show_top_n` action not executing from inside a table cell
* Fix the `show_top_n` action not preselecting alerts on the cases
alerts table

Warning: `show_top_n` uses the global `timerange` but the cases page
doesn't have the time range picker.
  • Loading branch information
machadoum authored Jul 5, 2023
1 parent d79e69a commit 71da754
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const getParentCellElement = (element?: HTMLElement | null): HTMLElement | null
if (element == null) {
return null;
}
if (element.nodeName === 'div' && element.getAttribute('role') === 'gridcell') {
if (element.nodeName === 'DIV' && element.getAttribute('role') === 'gridcell') {
return element;
}
return getParentCellElement(element.parentElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface TopNOption {
export const detectionAlertsTables: string[] = [
TableId.alertsOnAlertsPage,
TableId.alertsOnRuleDetailsPage,
TableId.alertsOnCasePage,
TimelineId.casePage,
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import type { BrowserField, TimelineNonEcsData } from '@kbn/timelines-plugin/common';
import type { AlertsTableConfigurationRegistry } from '@kbn/triggers-actions-ui-plugin/public/types';
import { useCallback, useMemo } from 'react';
import { tableDefaults, dataTableSelectors } from '@kbn/securitysolution-data-table';
import type { TableId } from '@kbn/securitysolution-data-table';
import { TableId, tableDefaults, dataTableSelectors } from '@kbn/securitysolution-data-table';
import { getAllFieldsByName } from '../../../common/containers/source';
import type { UseDataGridColumnsSecurityCellActionsProps } from '../../../common/components/cell_actions';
import { useDataGridColumnsSecurityCellActions } from '../../../common/components/cell_actions';
import { SecurityCellActionsTrigger } from '../../../actions/constants';
import { SecurityCellActionsTrigger, SecurityCellActionType } from '../../../actions/constants';
import { VIEW_SELECTION } from '../../../../common/constants';
import { useSourcererDataView } from '../../../common/containers/sourcerer';
import { SourcererScopeName } from '../../../common/store/sourcerer/model';
Expand Down Expand Up @@ -89,12 +88,16 @@ export const getUseCellActionsHook = (tableId: TableId) => {
[finalData]
);

const disabledActionTypes =
tableId === TableId.alertsOnCasePage ? [SecurityCellActionType.FILTER] : undefined;

const cellActions = useDataGridColumnsSecurityCellActions({
triggerId: SecurityCellActionsTrigger.DEFAULT,
fields: cellActionsFields,
getCellValue,
metadata: cellActionsMetadata,
dataGridRef,
disabledActionTypes,
});

const getCellActions = useCallback(
Expand Down

0 comments on commit 71da754

Please sign in to comment.