Skip to content

Commit

Permalink
[Security Solution] Fix misaligned top nav (elastic#175516)
Browse files Browse the repository at this point in the history
## Summary

Issue and steps to reproduce:
elastic#171682

Before:

<img width="1728" alt="misaligned"
src="https://github.com/elastic/kibana/assets/7074629/6c0f8484-7bfb-4329-9029-b53a3c118047">

After:

https://github.com/elastic/kibana/assets/6295984/58d3e5bc-0a9a-475b-99dd-00e061b8c4b1

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit a8f538d)
  • Loading branch information
angorayc committed Jan 25, 2024
1 parent 5c7f372 commit 5f56cdd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions x-pack/plugins/security_solution/public/helpers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
isSubPluginAvailable,
getSubPluginRoutesByCapabilities,
getField,
isDashboardViewPath,
} from './helpers';
import type { StartedSubPlugins } from './types';
import {
Expand Down Expand Up @@ -257,3 +258,23 @@ describe('public helpers getField', () => {
expect(signalQuery).toEqual(aadQuery);
});
});

describe('isDashboardViewPath', () => {
it('returns true for dashboard view path', () => {
expect(isDashboardViewPath('/dashboards/59c085c3-394d-49ab-a83a-56a63f38aa5f')).toEqual(true);
});

it('returns true for dashboard edit path', () => {
expect(isDashboardViewPath('/dashboards/59c085c3-394d-49ab-a83a-56a63f38aa5f/edit')).toEqual(
true
);
});

it('returns true for dashboard creation path', () => {
expect(isDashboardViewPath('/dashboards/create')).toEqual(true);
});

it('returns false for dashboard listing path', () => {
expect(isDashboardViewPath('/dashboards')).toEqual(false);
});
});
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const isDetectionsPath = (pathname: string): boolean => {

export const isDashboardViewPath = (pathname: string): boolean =>
matchPath(pathname, {
path: `/${DASHBOARDS_PATH}/:id`,
path: `${DASHBOARDS_PATH}/:detailName`,
exact: false,
strict: false,
}) != null;
Expand Down

0 comments on commit 5f56cdd

Please sign in to comment.