Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,30 @@ describe('ContextPills', () => {
});
});

it('does not render item if description is empty', () => {
render(
<TestProviders>
<ContextPills
{...defaultProps}
promptContexts={{
...mockPromptContexts,
context3: {
category: 'event',
description: '',
getPromptContext: () => Promise.resolve('Context 2 data'),
id: 'context3',
tooltip: 'Context 2 tooltip',
},
}}
selectedPromptContexts={{}}
setSelectedPromptContexts={jest.fn()}
/>
</TestProviders>
);
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ const ContextPillsComponent: React.FC<Props> = ({
{description}
</EuiButtonEmpty>
);
return (
return description.length > 0 ? (
<EuiFlexItem grow={false} key={id}>
{selectedPromptContexts[id] != null ? (
button
) : (
<EuiToolTip content={tooltip}>{button}</EuiToolTip>
)}
</EuiFlexItem>
);
) : null;
})}
</EuiFlexGroup>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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: [],
});
Expand All @@ -51,7 +46,6 @@ describe('ActionsCell', () => {
const { getByTestId } = render(<ActionsCell alert={alert} ecsAlert={ecsAlert} />);

expect(getByTestId(ROW_ACTION_FLYOUT_ICON_TEST_ID)).toBeInTheDocument();
expect(getByTestId('newChatByTitle')).toBeInTheDocument();
expect(getByTestId(MORE_ACTIONS_BUTTON_TEST_ID)).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -37,9 +36,6 @@ export const ActionsCell = memo(({ alert, ecsAlert }: ActionsCellProps) => (
<EuiFlexItem>
<OpenFlyoutRowControlColumn alert={alert} />
</EuiFlexItem>
<EuiFlexItem>
<AssistantRowControlColumn alert={alert} />
</EuiFlexItem>
<EuiFlexItem>
<MoreActionsRowControlColumn ecsAlert={ecsAlert} />
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down