import React , { FC } from 'react' ; import { NavigateToPath } from '../../../contexts/kibana' ; import { MlRoute , PageLoader , PageProps } from '../../router' ; import { useResolver } from '../../use_resolver' ; import { useTimefilter } from '../../../contexts/kibana' ; import { checkFullLicense } from '../../../license' ; import { checkGetJobsCapabilitiesResolver , checkPermission , } from '../../../capabilities/check_capabilities' ; import { getMlNodeCount } from '../../../ml_nodes_check/check_ml_nodes' ; import { FilterLists } from '../../../settings/filter_lists' ; import { getBreadcrumbWithUrlForApp } from '../../breadcrumbs' ; export const filterListRouteFactory = ( navigateToPath , basePath ) : MlRoute => ( { path : '/settings/filter_lists' , render : ( props , deps ) => < PageWrapper { ... props } deps = { deps } / > , breadcrumbs : [ getBreadcrumbWithUrlForApp ( 'ML_BREADCRUMB' , navigateToPath , basePath ) , getBreadcrumbWithUrlForApp ( 'SETTINGS_BREADCRUMB' , navigateToPath , basePath ) , getBreadcrumbWithUrlForApp ( 'FILTER_LISTS_BREADCRUMB' , navigateToPath , basePath ) , ] , } ) ; const PageWrapper = ( { deps } ) => { const { redirectToMlAccessDeniedPage } = deps ; const { context } = useResolver ( undefined , undefined , deps . config , deps . dataViewsContract , { checkFullLicense , checkGetJobsCapabilities : ( ) => checkGetJobsCapabilitiesResolver ( redirectToMlAccessDeniedPage ) , getMlNodeCount , } ) ; useTimefilter ( { timeRangeSelector : false , autoRefreshSelector : false } ) ; const canCreateFilter = checkPermission ( 'canCreateFilter' ) ; const canDeleteFilter = checkPermission ( 'canDeleteFilter' ) ; return ( < PageLoader context = { context } > < FilterLists { ... { canCreateFilter , canDeleteFilter } } / > < /PageLoader>); } ;