import { Capabilities } from 'kibana/public' ; import { ApmPluginSetupDeps } from '../../plugin' ; export const getAlertingCapabilities = ( plugins , capabilities ) => { const canReadAlerts = ! ! capabilities . apm [ 'alerting:show' ] ; const canSaveAlerts = ! ! capabilities . apm [ 'alerting:save' ] ; const isAlertingPluginEnabled = ! ! plugins . alerting ; const isAlertingAvailable = isAlertingPluginEnabled && ( canReadAlerts || canSaveAlerts ) ; const isMlPluginEnabled = 'ml' in plugins ; const canReadAnomalies = ! ! ( isMlPluginEnabled && capabilities . ml . canAccessML && capabilities . ml . canGetJobs ) ; return { isAlertingAvailable , canReadAlerts , canSaveAlerts , canReadAnomalies , } ; } ;