import { ApplicationStart } from 'kibana/public' ; import { IKbnUrlStateStorage } from 'src/plugins/kibana_utils/public' ; import { QueryState } from '../../../../data/public' ; import { setStateToKbnUrl } from '../../../../kibana_utils/public' ; import { getUISettings } from '../../services' ; import { GLOBAL_STATE_STORAGE_KEY , VISUALIZE_APP_NAME } from '../../../common/constants' ; export const getVisualizeListItemLink = ( application , kbnUrlStateStorage , editApp , editUrl ) => { let url = application . getUrlForApp ( editApp ?? VISUALIZE_APP_NAME , { path : editApp ? editUrl : `#${ editUrl }` , } ) ; const useHash = getUISettings ( ) . get ( 'state:storeInSessionStorage' ) ; const globalStateInUrl = kbnUrlStateStorage . get < QueryState > ( GLOBAL_STATE_STORAGE_KEY ) || { } ; url = setStateToKbnUrl < QueryState > ( GLOBAL_STATE_STORAGE_KEY , globalStateInUrl , { useHash } , url ) ; return url ; } ;