import { App , AppMountParameters , CoreSetup } from 'opensearch-dashboards/public' ; import { AppNavLinkStatus } from '../../../../core/public' ; import { navigateToLegacyOpenSearchDashboardsUrl } from './navigate_to_legacy_opensearch_dashboards_url' ; import { ForwardDefinition , UrlForwardingStart } from '../plugin' ; export const createLegacyUrlForwardApp = ( core , forwards ) : App => ( { id : 'kibana' , chromeless : true , title : 'Legacy URL migration' , appRoute : '/app/kibana#/' , navLinkStatus : AppNavLinkStatus . hidden , async mount ( params ) { const hash = params . history . location . hash . substr ( 1 ) ; if ( ! hash ) { const [ , , opensearchDashboardsLegacyStart ] = await core . getStartServices ( ) ; opensearchDashboardsLegacyStart . navigateToDefaultApp ( ) ; } const [ { application , http : { basePath } , } , ] = await core . getStartServices ( ) ; const result = await navigateToLegacyOpenSearchDashboardsUrl ( hash , forwards , basePath , application ) ; if ( ! result . navigated ) { const [ , , opensearchDashboardsLegacyStart ] = await core . getStartServices ( ) ; opensearchDashboardsLegacyStart . navigateToDefaultApp ( ) ; } return ( ) => { } ; } , } ) ; export const createLegacyUrlForwardCurrentApp = ( core , forwards ) : App => ( { id : 'opensearch-dashboards' , chromeless : true , title : 'Legacy URL migration' , appRoute : '/app/opensearch-dashboards#/' , navLinkStatus : AppNavLinkStatus . hidden , async mount ( params ) { const hash = params . history . location . hash . substr ( 1 ) ; if ( ! hash ) { const [ , , opensearchDashboardsLegacyStart ] = await core . getStartServices ( ) ; opensearchDashboardsLegacyStart . navigateToDefaultApp ( ) ; } const [ { application , http : { basePath } , } , ] = await core . getStartServices ( ) ; const result = await navigateToLegacyOpenSearchDashboardsUrl ( hash , forwards , basePath , application ) ; if ( ! result . navigated ) { const [ , , opensearchDashboardsLegacyStart ] = await core . getStartServices ( ) ; opensearchDashboardsLegacyStart . navigateToDefaultApp ( ) ; } return ( ) => { } ; } , } ) ;