import React from 'react' ; import { i18n } from '@kbn/i18n' ; import { useHistory } from 'react-router-dom' ; import { ExploratoryView } from './exploratory_view' ; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public' ; import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common' ; import { ObservabilityPublicPluginsStart } from '../../../plugin' ; import { useBreadcrumbs } from '../../../hooks/use_breadcrumbs' ; import { IndexPatternContextProvider } from './hooks/use_app_index_pattern' ; import { createKbnUrlStateStorage , withNotifyOnErrors , createSessionStorageStateStorage , } from '../../../../../../../src/plugins/kibana_utils/public/' ; import { UrlStorageContextProvider } from './hooks/use_series_storage' ; import { useTrackPageview } from '../../..' ; import { TypedLensByValueInput } from '../../../../../lens/public' ; export interface ExploratoryViewPageProps { useSessionStorage ? : boolean ; saveAttributes ? : ( attr : TypedLensByValueInput [ 'attributes' ] | null ) => void ; app ? : { id : string ; label : string ; } ; } export function ExploratoryViewPage ( { app , saveAttributes , useSessionStorage = false , } ) { useTrackPageview ( { app : 'observability-overview' , path : 'exploratory-view' } ) ; useTrackPageview ( { app : 'observability-overview' , path : 'exploratory-view' , delay : 15000 , } ) ; useBreadcrumbs ( [ { text : i18n . translate ( 'xpack.observability.overview.exploratoryView' , { defaultMessage : 'Explore data' , } ) , } , ] , app ) ; const { services : { uiSettings , notifications } , } = useKibana < ObservabilityPublicPluginsStart > ( ) ; const history = useHistory ( ) ; const kbnUrlStateStorage = useSessionStorage ? createSessionStorageStateStorage ( ) : createKbnUrlStateStorage ( { history , useHash : uiSettings ! . get ( 'state:storeInSessionStorage' ) , ... withNotifyOnErrors ( notifications ! . toasts ) , } ) ; return ( < Wrapper > < IndexPatternContextProvider > < UrlStorageContextProvider storage = { kbnUrlStateStorage } > < ExploratoryView saveAttributes = { saveAttributes } /> < /UrlStorageContextProvider> < /IndexPatternContextProvider> < /Wrapper>); } const Wrapper = euiStyled . div `
  padding: ${ ( props ) => props . theme . eui . paddingSizes . l };
` ; export default ExploratoryViewPage ;