import { CalendarEditUrlState , FilterEditUrlState } from '../../../common/types/locator' ; import { ML_PAGES } from '../../../common/constants/locator' ; import { setStateToKbnUrl } from '../../../../../../src/plugins/kibana_utils/public' ; export function formatEditCalendarUrl ( appBasePath , pageState ) { let url = `${ appBasePath }/${ ML_PAGES . CALENDARS_EDIT }` ; if ( pageState ) { const { globalState , calendarId } = pageState ; if ( calendarId !== undefined ) { url = `${ url }/${ calendarId }` ; } if ( globalState ) { url = setStateToKbnUrl ( '_g' , globalState , { useHash : false , storeInHashQuery : false } , url ) ; } } return url ; } export function formatEditFilterUrl ( appBasePath , pageState ) { let url = `${ appBasePath }/${ ML_PAGES . FILTER_LISTS_EDIT }` ; if ( pageState ) { const { globalState , filterId } = pageState ; if ( filterId !== undefined ) { url = `${ url }/${ filterId }` ; } if ( globalState ) { url = setStateToKbnUrl ( '_g' , globalState , { useHash : false , storeInHashQuery : false } , url ) ; } } return url ; }