import { i18n } from '@kbn/i18n' ; interface Breadcrumb { text : string ; href ? : string ; } interface Breadcrumbs { home : Breadcrumb ; add : Breadcrumb ; edit : Breadcrumb ; } let _setBreadcrumbs ; let _breadcrumbs ; export function init ( setGlobalBreadcrumbs ) { _setBreadcrumbs = setGlobalBreadcrumbs ; _breadcrumbs = { home : { text : i18n . translate ( 'xpack.remoteClusters.listBreadcrumbTitle' , { defaultMessage : 'Remote Clusters' , } ) , href : `/list` , } , add : { text : i18n . translate ( 'xpack.remoteClusters.addBreadcrumbTitle' , { defaultMessage : 'Add' , } ) , } , edit : { text : i18n . translate ( 'xpack.remoteClusters.editBreadcrumbTitle' , { defaultMessage : 'Edit' , } ) , } , } ; } export function setBreadcrumbs ( type , queryParams ? ) { if ( ! _breadcrumbs [ type ] ) { return ; } if ( type === 'home' ) { _setBreadcrumbs ( [ _breadcrumbs . home ] ) ; } else { const homeBreadcrumb = { text : _breadcrumbs . home . text , href : `${ _breadcrumbs . home . href }${ queryParams }` , } ; _setBreadcrumbs ( [ homeBreadcrumb , _breadcrumbs [ type ] ] ) ; } }