2020-06-26 18:43:35 +02:00
|
|
|
/*
|
|
|
|
* 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';
|
|
|
|
|
2020-10-05 23:07:07 +02:00
|
|
|
const defaultNoFieldsMessageCopy = i18n.translate('xpack.lens.indexPatterns.noDataLabel', {
|
|
|
|
defaultMessage: 'There are no fields.',
|
|
|
|
});
|
|
|
|
|
2020-06-26 18:43:35 +02:00
|
|
|
export const NoFieldsCallout = ({
|
|
|
|
existFieldsInIndex,
|
2020-10-05 23:07:07 +02:00
|
|
|
defaultNoFieldsMessage = defaultNoFieldsMessageCopy,
|
|
|
|
isAffectedByFieldFilter = false,
|
2020-06-26 18:43:35 +02:00
|
|
|
isAffectedByTimerange = false,
|
|
|
|
isAffectedByGlobalFilter = false,
|
|
|
|
}: {
|
|
|
|
existFieldsInIndex: boolean;
|
2020-10-05 23:07:07 +02:00
|
|
|
isAffectedByFieldFilter?: boolean;
|
|
|
|
defaultNoFieldsMessage?: string;
|
2020-06-26 18:43:35 +02:00
|
|
|
isAffectedByTimerange?: boolean;
|
|
|
|
isAffectedByGlobalFilter?: boolean;
|
|
|
|
}) => {
|
2020-10-05 23:07:07 +02:00
|
|
|
if (!existFieldsInIndex) {
|
|
|
|
return (
|
|
|
|
<EuiCallOut
|
|
|
|
size="s"
|
|
|
|
color="warning"
|
|
|
|
title={i18n.translate('xpack.lens.indexPatterns.noFieldsLabel', {
|
|
|
|
defaultMessage: 'No fields exist in this index pattern.',
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-06-26 18:43:35 +02:00
|
|
|
return (
|
|
|
|
<EuiCallOut
|
|
|
|
size="s"
|
|
|
|
color="warning"
|
|
|
|
title={
|
|
|
|
isAffectedByFieldFilter
|
|
|
|
? i18n.translate('xpack.lens.indexPatterns.noFilteredFieldsLabel', {
|
|
|
|
defaultMessage: 'No fields match the selected filters.',
|
|
|
|
})
|
2020-10-05 23:07:07 +02:00
|
|
|
: defaultNoFieldsMessage
|
2020-06-26 18:43:35 +02:00
|
|
|
}
|
|
|
|
>
|
2020-10-05 23:07:07 +02:00
|
|
|
{(isAffectedByTimerange || isAffectedByFieldFilter || isAffectedByGlobalFilter) && (
|
2020-06-26 18:43:35 +02:00
|
|
|
<>
|
|
|
|
<strong>
|
|
|
|
{i18n.translate('xpack.lens.indexPatterns.noFields.tryText', {
|
|
|
|
defaultMessage: 'Try:',
|
|
|
|
})}
|
|
|
|
</strong>
|
|
|
|
<ul>
|
|
|
|
{isAffectedByTimerange && (
|
2020-10-05 23:07:07 +02:00
|
|
|
<li>
|
|
|
|
{i18n.translate('xpack.lens.indexPatterns.noFields.extendTimeBullet', {
|
|
|
|
defaultMessage: 'Extending the time range',
|
|
|
|
})}
|
|
|
|
</li>
|
2020-06-26 18:43:35 +02:00
|
|
|
)}
|
2020-10-05 23:07:07 +02:00
|
|
|
{isAffectedByFieldFilter && (
|
2020-06-26 18:43:35 +02:00
|
|
|
<li>
|
|
|
|
{i18n.translate('xpack.lens.indexPatterns.noFields.fieldTypeFilterBullet', {
|
|
|
|
defaultMessage: 'Using different field filters',
|
|
|
|
})}
|
|
|
|
</li>
|
2020-10-05 23:07:07 +02:00
|
|
|
)}
|
|
|
|
{isAffectedByGlobalFilter && (
|
2020-06-26 18:43:35 +02:00
|
|
|
<li>
|
|
|
|
{i18n.translate('xpack.lens.indexPatterns.noFields.globalFiltersBullet', {
|
|
|
|
defaultMessage: 'Changing the global filters',
|
|
|
|
})}
|
|
|
|
</li>
|
2020-10-05 23:07:07 +02:00
|
|
|
)}
|
2020-06-26 18:43:35 +02:00
|
|
|
</ul>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</EuiCallOut>
|
|
|
|
);
|
|
|
|
};
|