import { ApplicationStart , IBasePath } from 'opensearch-dashboards/public' ; import { ForwardDefinition } from './plugin' ; export function navigateToDefaultApp ( defaultAppId , forwards , application , basePath , currentAppId , overwriteHash ) { let targetAppId = 'opensearchDashboards' ; let targetAppPath = `#/${ defaultAppId }` ; const relevantForward = forwards . find ( ( forward ) => defaultAppId . startsWith ( forward . legacyAppId ) ) ; if ( relevantForward ) { targetAppPath = relevantForward . rewritePath ( `/${ defaultAppId }` ) ; targetAppId = relevantForward . newAppId ; } if ( currentAppId !== targetAppId ) { application . navigateToApp ( targetAppId , { path : targetAppPath , replace : true } ) ; } else if ( overwriteHash ) { window . location . hash = targetAppPath ; } }