import { Location } from 'history' ; import { toQuery } from './url_helpers' ; export interface TimepickerRisonData { time ? : { from ? : string ; to ? : string ; } ; refreshInterval ? : { pause ? : boolean | string ; value ? : number | string ; } ; } export function getTimepickerRisonData ( currentSearch ) { const currentQuery = toQuery ( currentSearch ) ; return { time : { from : currentQuery . rangeFrom || '' , to : currentQuery . rangeTo || '' , } , refreshInterval : { pause : currentQuery . refreshPaused ? Boolean ( currentQuery . refreshPaused ) : true , value : currentQuery . refreshInterval ? parseInt ( currentQuery . refreshInterval , 10 ) : 0 , } , } ; }