import { i18n } from '@kbn/i18n' ; import { createAction } from '../../../../../src/plugins/ui_actions/public' ; import { MlCoreSetup } from '../plugin' ; export const CLEAR_SELECTION_ACTION = 'clearSelectionAction' ; export interface ClearSelectionContext { updateCallback : ( ) => void ; } export function createClearSelectionAction ( getStartServices ) { return createAction < ClearSelectionContext > ( { id : 'clear-selection-action' , type : CLEAR_SELECTION_ACTION , getIconType ( context ) { return 'cross' ; } , getDisplayName : ( ) => i18n . translate ( 'xpack.ml.actions.clearSelectionTitle' , { defaultMessage : 'Clear selection' , } ) , shouldAutoExecute : ( ) => Promise . resolve ( false ) , async execute ( { updateCallback } ) { updateCallback ( ) ; } , async isCompatible ( { updateCallback } ) { return typeof updateCallback === 'function' ; } , } ) ; }