import { i18n } from '@osd/i18n' ; import { FormattedMessage } from '@osd/i18n/react' ; import { EuiButton , EuiFlexGroup , EuiFlexItem } from '@elastic/eui' ; import React from 'react' ; import { CoreStart } from 'opensearch-dashboards/public' ; import { toMountPoint } from '../../../../opensearch_dashboards_react/public' ; export const onUnsupportedTimePattern = ( toasts , navigateToApp ) => ( { id , title , index } ) => { const warningTitle = i18n . translate ( 'data.indexPatterns.warningTitle' , { defaultMessage : 'Support for time interval index patterns removed' , } ) ; const warningText = i18n . translate ( 'data.indexPatterns.warningText' , { defaultMessage : 'Currently querying all indices matching {index}. {title} should be migrated to a wildcard-based index pattern.' , values : { title , index } , } ) ; toasts . addWarning ( { title : warningTitle , text : toMountPoint ( < div > < p > { warningText } < /p> < EuiFlexGroup justifyContent = "flexEnd" gutterSize = "s" > < EuiFlexItem grow = { false } > < EuiButton size = "s" onClick = { ( ) => navigateToApp ( 'management' , { path : `/opensearch-dashboards/index_patterns/index_pattern/${ id ! || '' }` , } ) } > < FormattedMessage id = "data.indexPatterns.editIndexPattern" defaultMessage = "Edit index pattern" / > < /EuiButton> < /EuiFlexItem> < /EuiFlexGroup> < /div>), } ) ; } ;