/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { EuiCallOut } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
const defaultNoFieldsMessageCopy = i18n.translate('xpack.lens.indexPatterns.noDataLabel', {
defaultMessage: 'There are no fields.',
});
export const NoFieldsCallout = ({
existFieldsInIndex,
defaultNoFieldsMessage = defaultNoFieldsMessageCopy,
isAffectedByFieldFilter = false,
isAffectedByTimerange = false,
isAffectedByGlobalFilter = false,
}: {
existFieldsInIndex: boolean;
isAffectedByFieldFilter?: boolean;
defaultNoFieldsMessage?: string;
isAffectedByTimerange?: boolean;
isAffectedByGlobalFilter?: boolean;
}) => {
if (!existFieldsInIndex) {
return (
);
}
return (
{(isAffectedByTimerange || isAffectedByFieldFilter || isAffectedByGlobalFilter) && (
<>
{i18n.translate('xpack.lens.indexPatterns.noFields.tryText', {
defaultMessage: 'Try:',
})}
{isAffectedByTimerange && (
-
{i18n.translate('xpack.lens.indexPatterns.noFields.extendTimeBullet', {
defaultMessage: 'Extending the time range',
})}
)}
{isAffectedByFieldFilter && (
-
{i18n.translate('xpack.lens.indexPatterns.noFields.fieldTypeFilterBullet', {
defaultMessage: 'Using different field filters',
})}
)}
{isAffectedByGlobalFilter && (
-
{i18n.translate('xpack.lens.indexPatterns.noFields.globalFiltersBullet', {
defaultMessage: 'Changing the global filters',
})}
)}
>
)}
);
};