From 836d11c845adad1c701fd3beffb9dc3b24f34716 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:05:04 -0500 Subject: [PATCH] [8.12] [Security Solution] Fix misaligned top nav (#175516) (#175532) # Backport This will backport the following commits from `main` to `8.12`: - [[Security Solution] Fix misaligned top nav (#175516)](https://github.com/elastic/kibana/pull/175516) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com> --- .../security_solution/public/helpers.test.tsx | 21 +++++++++++++++++++ .../security_solution/public/helpers.tsx | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/helpers.test.tsx b/x-pack/plugins/security_solution/public/helpers.test.tsx index a305434a1ff11..1e053c84ba91d 100644 --- a/x-pack/plugins/security_solution/public/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/helpers.test.tsx @@ -15,6 +15,7 @@ import { isSubPluginAvailable, getSubPluginRoutesByCapabilities, getField, + isDashboardViewPath, } from './helpers'; import type { StartedSubPlugins } from './types'; import { @@ -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); + }); +}); diff --git a/x-pack/plugins/security_solution/public/helpers.tsx b/x-pack/plugins/security_solution/public/helpers.tsx index b245a6ae2f6bc..9a4b6418ad2fa 100644 --- a/x-pack/plugins/security_solution/public/helpers.tsx +++ b/x-pack/plugins/security_solution/public/helpers.tsx @@ -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;