mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fix breadcrumbs path reopens timeline when timeline modal is open (#101568)
This commit is contained in:
parent
12895d8bd0
commit
5b0d325d7e
2 changed files with 29 additions and 2 deletions
|
@ -306,6 +306,29 @@ describe('Navigation Breadcrumbs', () => {
|
|||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('should set "timeline.isOpen" to false when timeline is open', () => {
|
||||
const breadcrumbs = getBreadcrumbsForRoute(
|
||||
{
|
||||
...getMockObject('timelines', '/', undefined),
|
||||
timeline: {
|
||||
activeTab: TimelineTabs.query,
|
||||
id: 'TIMELINE_ID',
|
||||
isOpen: true,
|
||||
graphEventId: 'GRAPH_EVENT_ID',
|
||||
},
|
||||
},
|
||||
getUrlForAppMock
|
||||
);
|
||||
expect(breadcrumbs).toEqual([
|
||||
{ text: 'Security', href: 'securitySolutionoverview' },
|
||||
{
|
||||
text: 'Timelines',
|
||||
href:
|
||||
"securitySolution:timelines?sourcerer=()&timerange=(global:(linkTo:!(timeline),timerange:(from:'2019-05-16T23:10:43.696Z',fromStr:now-24h,kind:relative,to:'2019-05-17T23:10:43.697Z',toStr:now)),timeline:(linkTo:!(global),timerange:(from:'2019-05-16T23:10:43.696Z',fromStr:now-24h,kind:relative,to:'2019-05-17T23:10:43.697Z',toStr:now)))&timeline=(activeTab:query,graphEventId:GRAPH_EVENT_ID,id:TIMELINE_ID,isOpen:!f)",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('setBreadcrumbs()', () => {
|
||||
|
|
|
@ -61,10 +61,14 @@ const isAdminRoutes = (spyState: RouteSpyState): spyState is AdministrationRoute
|
|||
|
||||
// eslint-disable-next-line complexity
|
||||
export const getBreadcrumbsForRoute = (
|
||||
object: RouteSpyState & TabNavigationProps,
|
||||
objectParam: RouteSpyState & TabNavigationProps,
|
||||
getUrlForApp: GetUrlForApp
|
||||
): ChromeBreadcrumb[] | null => {
|
||||
const spyState: RouteSpyState = omit('navTabs', object);
|
||||
const spyState: RouteSpyState = omit('navTabs', objectParam);
|
||||
|
||||
// Sets `timeline.isOpen` to false in the state to avoid reopening the timeline on breadcrumb click. https://github.com/elastic/kibana/issues/100322
|
||||
const object = { ...objectParam, timeline: { ...objectParam.timeline, isOpen: false } };
|
||||
|
||||
const overviewPath = getUrlForApp(APP_ID, { path: SecurityPageName.overview });
|
||||
const siemRootBreadcrumb: ChromeBreadcrumb = {
|
||||
text: APP_NAME,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue