Skip to content

Commit

Permalink
[8.x] [Cloud Security] Fix for Session View Icon Cutoff Issue (#203888)…
Browse files Browse the repository at this point in the history
… (#204276)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Fix for Session View Icon Cutoff Issue
(#203888)](#203888)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rickyanto
Ang","email":"rickyangwyn@gmail.com"},"sourceCommit":{"committedDate":"2024-12-13T19:24:24Z","message":"[Cloud
Security] Fix for Session View Icon Cutoff Issue (#203888)\n\n##
Summary\r\n\r\nThis PR addresses the issue where Session View gets
cutoff. The issue\r\ncomes from number of Default Action button is not
updated after 'Add\r\nNotes' button was introduced. Max amount button
should now be 6 instead\r\nof 5\r\n<img width=\"1192\" alt=\"Screenshot
2024-12-11 at 11 18
11 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/100f9a9f-1df3-407f-9218-10ea809ab64c\"\r\n/>\r\n<img
width=\"956\" alt=\"Screenshot 2024-12-11 at 11 18
21 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/5f3fa9cb-cd05-49b8-8fe6-4da024ff5290\"\r\n/>","sha":"f9e1089893a421a972c610029791719d0c25e3b3","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud
Security","backport:prev-minor","v8.18.0"],"title":"[Cloud Security] Fix
for Session View Icon Cutoff
Issue","number":203888,"url":"https://github.com/elastic/kibana/pull/203888","mergeCommit":{"message":"[Cloud
Security] Fix for Session View Icon Cutoff Issue (#203888)\n\n##
Summary\r\n\r\nThis PR addresses the issue where Session View gets
cutoff. The issue\r\ncomes from number of Default Action button is not
updated after 'Add\r\nNotes' button was introduced. Max amount button
should now be 6 instead\r\nof 5\r\n<img width=\"1192\" alt=\"Screenshot
2024-12-11 at 11 18
11 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/100f9a9f-1df3-407f-9218-10ea809ab64c\"\r\n/>\r\n<img
width=\"956\" alt=\"Screenshot 2024-12-11 at 11 18
21 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/5f3fa9cb-cd05-49b8-8fe6-4da024ff5290\"\r\n/>","sha":"f9e1089893a421a972c610029791719d0c25e3b3"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203888","number":203888,"mergeCommit":{"message":"[Cloud
Security] Fix for Session View Icon Cutoff Issue (#203888)\n\n##
Summary\r\n\r\nThis PR addresses the issue where Session View gets
cutoff. The issue\r\ncomes from number of Default Action button is not
updated after 'Add\r\nNotes' button was introduced. Max amount button
should now be 6 instead\r\nof 5\r\n<img width=\"1192\" alt=\"Screenshot
2024-12-11 at 11 18
11 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/100f9a9f-1df3-407f-9218-10ea809ab64c\"\r\n/>\r\n<img
width=\"956\" alt=\"Screenshot 2024-12-11 at 11 18
21 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/5f3fa9cb-cd05-49b8-8fe6-4da024ff5290\"\r\n/>","sha":"f9e1089893a421a972c610029791719d0c25e3b3"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Rickyanto Ang <rickyangwyn@gmail.com>
  • Loading branch information
kibanamachine and animehart authored Dec 13, 2024
1 parent a30c971 commit 12ecdde
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 12ecdde

Please sign in to comment.