diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.test.tsx index 723ddf823dd1e..6d7706f7e0ece 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.test.tsx +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.test.tsx @@ -54,6 +54,30 @@ describe('ContextPills', () => { }); }); + it('does not render item if description is empty', () => { + render( + + Promise.resolve('Context 2 data'), + id: 'context3', + tooltip: 'Context 2 tooltip', + }, + }} + selectedPromptContexts={{}} + setSelectedPromptContexts={jest.fn()} + /> + + ); + expect(screen.getByTestId(`pillButton-context2`)).toBeInTheDocument(); + expect(screen.queryByTestId(`pillButton-context3`)).not.toBeInTheDocument(); + }); + it('invokes setSelectedPromptContexts() when the prompt is NOT already selected', async () => { const context = mockPromptContexts.context1; const setSelectedPromptContexts = jest.fn(); diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.tsx index d3ae29643804e..a950b8457f826 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.tsx +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/context_pills/index.tsx @@ -67,7 +67,7 @@ const ContextPillsComponent: React.FC = ({ {description} ); - return ( + return description.length > 0 ? ( {selectedPromptContexts[id] != null ? ( button @@ -75,7 +75,7 @@ const ContextPillsComponent: React.FC = ({ {button} )} - ); + ) : null; })} ); diff --git a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.test.tsx index 7b632e973090c..ef5d26822f5f1 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.test.tsx @@ -12,7 +12,6 @@ import { ActionsCell } from './actions_cell'; import { useExpandableFlyoutApi } from '@kbn/expandable-flyout'; import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs'; import { MORE_ACTIONS_BUTTON_TEST_ID } from './more_actions_row_control_column'; -import { useAssistant } from '../../../hooks/alert_summary/use_assistant'; import { useAddToCaseActions } from '../../alerts_table/timeline_actions/use_add_to_case_actions'; import { useAlertTagsActions } from '../../alerts_table/timeline_actions/use_alert_tags_actions'; import { ROW_ACTION_FLYOUT_ICON_TEST_ID } from './open_flyout_row_control_column'; @@ -27,10 +26,6 @@ describe('ActionsCell', () => { (useExpandableFlyoutApi as jest.Mock).mockReturnValue({ openFlyout: jest.fn(), }); - (useAssistant as jest.Mock).mockReturnValue({ - showAssistant: true, - showAssistantOverlay: jest.fn(), - }); (useAddToCaseActions as jest.Mock).mockReturnValue({ addToCaseActionItems: [], }); @@ -51,7 +46,6 @@ describe('ActionsCell', () => { const { getByTestId } = render(); expect(getByTestId(ROW_ACTION_FLYOUT_ICON_TEST_ID)).toBeInTheDocument(); - expect(getByTestId('newChatByTitle')).toBeInTheDocument(); expect(getByTestId(MORE_ACTIONS_BUTTON_TEST_ID)).toBeInTheDocument(); }); }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.tsx b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.tsx index 9de99b9d88a33..e20e6bff894f6 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/actions_cell.tsx @@ -9,7 +9,6 @@ import React, { memo } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import type { Alert } from '@kbn/alerting-types'; import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs'; -import { AssistantRowControlColumn } from './assistant_row_control_column'; import { MoreActionsRowControlColumn } from './more_actions_row_control_column'; import { OpenFlyoutRowControlColumn } from './open_flyout_row_control_column'; @@ -37,9 +36,6 @@ export const ActionsCell = memo(({ alert, ecsAlert }: ActionsCellProps) => ( - - - diff --git a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/assistant_row_control_column.tsx b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/assistant_row_control_column.tsx index ef3a0d2cce090..8de3a694c3ed5 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/assistant_row_control_column.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/assistant_row_control_column.tsx @@ -20,6 +20,7 @@ export interface AssistantRowControlColumnProps { /** * Renders the assistant icon and opens the assistant flyout for the current alert when clicked. * This is used in the AI for SOC alert summary table. + * TODO: reimplement in the alert table once context issue is resolved https://github.com/elastic/kibana/issues/219142 */ export const AssistantRowControlColumn = memo(({ alert }: AssistantRowControlColumnProps) => { const { showAssistantOverlay } = useAssistant({ alert }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/table.tsx b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/table.tsx index c745ae1412814..7a12d8e9e725d 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/table.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alert_summary/table/table.tsx @@ -75,7 +75,7 @@ export const columns: EuiDataGridProps['columns'] = [ }, ]; -export const ACTION_COLUMN_WIDTH = 98; // px +export const ACTION_COLUMN_WIDTH = 72; // px export const ALERT_TABLE_CONSUMERS: AlertsTableProps['consumers'] = [AlertConsumers.SIEM]; export const RULE_TYPE_IDS = [ESQL_RULE_TYPE_ID, QUERY_RULE_TYPE_ID]; export const ROW_HEIGHTS_OPTIONS = { defaultHeight: 40 };