import type { TrainedModelsNodesUrlState , TrainedModelsUrlState , } from '../../../common/types/locator' ; import { ML_PAGES } from '../../../common/constants/locator' ; import type { AppPageState , ListingPageUrlState } from '../../../common/types/common' ; import { setStateToKbnUrl } from '../../../../../../src/plugins/kibana_utils/public' ; export function formatTrainedModelsManagementUrl ( appBasePath , mlUrlGeneratorState ) { return `${ appBasePath }/${ ML_PAGES . TRAINED_MODELS_MANAGE }` ; } export function formatTrainedModelsNodesManagementUrl ( appBasePath , mlUrlGeneratorState ) { let url = `${ appBasePath }/${ ML_PAGES . TRAINED_MODELS_NODES }` ; if ( mlUrlGeneratorState ) { const { nodeId } = mlUrlGeneratorState ; if ( nodeId ) { const nodesListState = { queryText : `name:(${ nodeId })` , } ; const queryState = { [ ML_PAGES . TRAINED_MODELS_NODES ] : nodesListState , } ; url = setStateToKbnUrl < AppPageState < ListingPageUrlState > > ( '_a' , queryState , { useHash : false , storeInHashQuery : false } , url ) ; } } return url ; }