File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
x-pack/legacy/plugins/siem/public Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { AutoSaveWarningMsg } from '../../components/timeline/auto_save_warning'
2121import { UseUrlState } from '../../components/url_state' ;
2222import { WithSource , indicesExistOrDataTemporarilyUnavailable } from '../../containers/source' ;
2323import { SpyRoute } from '../../utils/route/spy_routes' ;
24+ import { useShowTimeline } from '../../utils/timeline/use_show_timeline' ;
2425import { NotFoundPage } from '../404' ;
2526import { DetectionEngineContainer } from '../detection_engine' ;
2627import { HostsContainer } from '../hosts' ;
@@ -68,7 +69,7 @@ export const HomePage: React.FC = () => {
6869 windowHeight,
6970 } ) ;
7071
71- const currentLocation = useLocation ( ) ;
72+ const [ showTimeline ] = useShowTimeline ( ) ;
7273
7374 return (
7475 < WrappedByAutoSizer data-test-subj = "wrapped-by-auto-sizer" ref = { measureRef } >
@@ -79,7 +80,7 @@ export const HomePage: React.FC = () => {
7980 { ( { browserFields, indexPattern, indicesExist } ) => (
8081 < DragDropContextWrapper browserFields = { browserFields } >
8182 < UseUrlState indexPattern = { indexPattern } navTabs = { navTabs } />
82- { indicesExistOrDataTemporarilyUnavailable ( indicesExist ) && (
83+ { indicesExistOrDataTemporarilyUnavailable ( indicesExist ) && showTimeline && (
8384 < >
8485 < AutoSaveWarningMsg />
8586 < Flyout
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License;
4+ * you may not use this file except in compliance with the Elastic License.
5+ */
6+
7+ import { useLocation } from 'react-router-dom' ;
8+
9+ import { useState , useEffect } from 'react' ;
10+ import { SiemPageName } from '../../pages/home/types' ;
11+
12+ const hideTimelineForRoutes = [ `/${ SiemPageName . case } /configure` ] ;
13+
14+ export const useShowTimeline = ( ) => {
15+ const currentLocation = useLocation ( ) ;
16+ const [ showTimeline , setShowTimeline ] = useState (
17+ ! hideTimelineForRoutes . includes ( currentLocation . pathname )
18+ ) ;
19+
20+ useEffect ( ( ) => {
21+ if ( hideTimelineForRoutes . includes ( currentLocation . pathname ) ) {
22+ if ( showTimeline ) {
23+ setShowTimeline ( false ) ;
24+ }
25+ } else if ( ! showTimeline ) {
26+ setShowTimeline ( true ) ;
27+ }
28+ } , [ currentLocation . pathname ] ) ;
29+
30+ return [ showTimeline ] ;
31+ } ;
You can’t perform that action at this time.
0 commit comments