Skip to content

Commit

Permalink
[Cloud Security] Fix for Session View Icon Cutoff Issue (elastic#203888)
Browse files Browse the repository at this point in the history
## Summary

This PR addresses the issue where Session View gets cutoff. The issue
comes from number of Default Action button is not updated after 'Add
Notes' button was introduced. Max amount button should now be 6 instead
of 5
<img width="1192" alt="Screenshot 2024-12-11 at 11 18 11 AM"
src="https://github.com/user-attachments/assets/100f9a9f-1df3-407f-9218-10ea809ab64c"
/>
<img width="956" alt="Screenshot 2024-12-11 at 11 18 21 AM"
src="https://github.com/user-attachments/assets/5f3fa9cb-cd05-49b8-8fe6-4da024ff5290"
/>
  • Loading branch information
animehart authored Dec 13, 2024
1 parent f144078 commit f9e1089
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,19 @@ describe('SessionsView', () => {
]);
});
});
it('Action tab should have 4 columns for non Enterprise users', async () => {
it('Action tab should have 5 columns for non Enterprise users', async () => {
render(
<TestProviders>
<SessionsView {...testProps} />
</TestProviders>
);

await waitFor(() => {
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(4);
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5);
});
});

it('Action tab should have 5 columns for Enterprise or above users', async () => {
it('Action tab should have 6 columns for Enterprise or above users', async () => {
const licenseServiceMock = licenseService as jest.Mocked<typeof licenseService>;

licenseServiceMock.isEnterprise.mockReturnValue(true);
Expand All @@ -189,19 +189,19 @@ describe('SessionsView', () => {
);

await waitFor(() => {
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5);
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(6);
});
});

it('Action tab should have 5 columns when accessed via K8S dahsboard', async () => {
it('Action tab should have 6 columns when accessed via K8S dahsboard', async () => {
render(
<TestProviders>
<SessionsView {...testProps} tableId={TableId.kubernetesPageSessions} />
</TestProviders>
);

await waitFor(() => {
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5);
expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(6);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useLicense } from '../../hooks/use_license';
import { eventsDefaultModel } from '../events_viewer/default_model';
import type { BulkActionsProp } from '../toolbar/bulk_actions/types';
import { SecurityCellActionsTrigger } from '../cell_actions';
import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features';

export const TEST_ID = 'security_solution:sessions_viewer:sessions_view';

Expand Down Expand Up @@ -120,8 +121,13 @@ const SessionsViewComponent: React.FC<SessionsComponentsProps> = ({
}, [dispatch, tableId]);

const isEnterprisePlus = useLicense().isEnterprise();
const ACTION_BUTTON_COUNT =
isEnterprisePlus || tableId === TableId.kubernetesPageSessions ? 5 : 4;
const securitySolutionNotesDisabled = useIsExperimentalFeatureEnabled(
'securitySolutionNotesDisabled'
);
let ACTION_BUTTON_COUNT = isEnterprisePlus || tableId === TableId.kubernetesPageSessions ? 6 : 5;
if (securitySolutionNotesDisabled) {
ACTION_BUTTON_COUNT--;
}
const leadingControlColumns = useMemo(
() => getDefaultControlColumn(ACTION_BUTTON_COUNT),
[ACTION_BUTTON_COUNT]
Expand Down

0 comments on commit f9e1089

Please sign in to comment.