import React from 'react'; import { useTranslation } from 'next-i18next'; import PropTypes from 'prop-types'; class StatusTable extends React.PureComponent { renderPreInitializedLabel() { return ――; } renderConnectionStatusLabels() { const { t } = this.props; const { isErrorOccuredOnSearchService, isConnected, isConfigured } = this.props; const errorOccuredLabel = isErrorOccuredOnSearchService ? ( {t('full_text_search_management.connection_status_label_erroroccured')} ) : null; let connectionStatusLabel = null; if (!isConfigured) { connectionStatusLabel = ( {t( 'full_text_search_management.connection_status_label_unconfigured', )} ); } else { connectionStatusLabel = isConnected ? ( // eslint-disable-next-line max-len {t('full_text_search_management.connection_status_label_connected')} ) : ( {t( 'full_text_search_management.connection_status_label_disconnected', )} ); } return ( <> {connectionStatusLabel} {errorOccuredLabel} > ); } renderIndicesStatusLabel() { const { t, isNormalized } = this.props; return isNormalized ? ( {t('full_text_search_management.indices_status_label_normalized')} ) : ( {t('full_text_search_management.indices_status_label_unnormalized')} ); } renderIndexInfoPanel(indexName, body = {}, aliases = []) { const collapseId = `collapse-${indexName}`; const aliasLabels = aliases.map((aliasName) => { return ( sell {aliasName} ); }); return (
{JSON.stringify(body, null, 2)}
| {t('full_text_search_management.connection_status')} | {isInitialized ? this.renderConnectionStatusLabels() : this.renderPreInitializedLabel()} |
|---|---|
| {t('full_text_search_management.indices_status')} | {isInitialized ? this.renderIndicesStatusLabel() : this.renderPreInitializedLabel()} |
| {t('full_text_search_management.indices_summary')} | {isInitialized && this.renderIndexInfoPanels()} |