import React from 'react' ; import { useValues } from 'kea' ; import { EuiBasicTable , EuiBasicTableColumn , EuiTableFieldDataColumnType } from '@elastic/eui' ; import { i18n } from '@kbn/i18n' ; import { AppLogic } from '../../../../app_logic' ; import { UNIVERSAL_LANGUAGE } from '../../../../constants' ; import { EngineDetails } from '../../../engine/types' ; import { renderEngineLink } from './engine_link_helpers' ; import { ACTIONS_COLUMN , CREATED_AT_COLUMN , DOCUMENT_COUNT_COLUMN , FIELD_COUNT_COLUMN , NAME_COLUMN , } from './shared_columns' ; import { EnginesTableProps } from './types' ; const LANGUAGE_COLUMN = { field : 'language' , name : i18n . translate ( 'xpack.enterpriseSearch.appSearch.enginesOverview.table.column.language' , { defaultMessage : 'Language' , } ) , dataType : 'string' , render : ( language ) => language || UNIVERSAL_LANGUAGE , } ; export const EnginesTable = ( { items , loading , noItemsMessage , pagination , onChange , } ) => { const { myRole : { canManageEngines } , } = useValues ( AppLogic ) ; const columns = [ { ... NAME_COLUMN , render : ( name ) => renderEngineLink ( name ) , } , CREATED_AT_COLUMN , LANGUAGE_COLUMN , DOCUMENT_COUNT_COLUMN , FIELD_COUNT_COLUMN , ] ; if ( canManageEngines ) { columns . push ( ACTIONS_COLUMN ) ; } return ( < EuiBasicTable items = { items } columns = { columns } loading = { loading } pagination = { pagination } onChange = { onChange } noItemsMessage = { noItemsMessage } / > ) ; } ;