[SecuritySolutions] Remove filter actions from Cases alerts table and fix show_top_n action (#161150)

issue https://github.com/elastic/kibana/issues/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.
This commit is contained in:
Pablo Machado 2023-07-05 09:03:18 +02:00 committed by GitHub
parent d79e69a1ed
commit 71da754085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -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);

View file

@ -70,6 +70,7 @@ export interface TopNOption {
export const detectionAlertsTables: string[] = [
TableId.alertsOnAlertsPage,
TableId.alertsOnRuleDetailsPage,
TableId.alertsOnCasePage,
TimelineId.casePage,
];

View file

@ -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';
@ -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(