-
+ const FieldPanelHeader = () => (
+
+
+
+ {field.displayName}
+
- );
+
+
+
+ );
+
+ if (hideDetails) {
+ return ;
}
let formatter: { convert: (data: unknown) => string };
@@ -316,25 +326,18 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
(!props.topValues || props.topValues.buckets.length === 0)
) {
return (
-
+ <>
+
+
+
+
{i18n.translate('xpack.lens.indexPattern.fieldStatsNoData', {
defaultMessage:
'This field is empty because it doesn’t exist in the 500 sampled documents. Adding this field to the configuration may result in a blank chart.',
})}
-
-
-
-
+ >
);
}
@@ -369,31 +372,42 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
);
} else if (field.type === 'date') {
title = (
- <>
- {i18n.translate('xpack.lens.indexPattern.fieldTimeDistributionLabel', {
- defaultMessage: 'Time distribution',
- })}
- >
+
+
+ {i18n.translate('xpack.lens.indexPattern.fieldTimeDistributionLabel', {
+ defaultMessage: 'Time distribution',
+ })}
+
+
);
} else if (topValues && topValues.buckets.length) {
title = (
- <>
- {i18n.translate('xpack.lens.indexPattern.fieldTopValuesLabel', {
- defaultMessage: 'Top values',
- })}
- >
+
+
+ {i18n.translate('xpack.lens.indexPattern.fieldTopValuesLabel', {
+ defaultMessage: 'Top values',
+ })}
+
+
);
}
function wrapInPopover(el: React.ReactElement) {
return (
<>
- {title ? {title} : <>>}
+
+
+
+
+ {title ? title : <>>}
+
+
+
{el}
{props.totalDocuments ? (
-
+
{props.sampledDocuments && (
<>
{i18n.translate('xpack.lens.indexPattern.percentageOfLabel', {
@@ -413,17 +427,6 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
defaultMessage: 'documents',
})}
-
-
-
) : (
<>>
@@ -585,45 +588,24 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
}
const DragToWorkspaceButton = ({ field, getSuggestionForField, dropOntoWorkspace }) => {
- if (!getSuggestionForField(field)) {
+ const buttonTitle = i18n.translate('xpack.lens.indexPattern.moveToWorkspace', {
+ defaultMessage: 'Add field to workspace',
+ });
+
+ if (getSuggestionForField(field)) {
return (
-
-
+ {
dropOntoWorkspace(field);
}}
- >
- {i18n.translate('xpack.lens.indexPattern.moveToWorkspace', {
- defaultMessage: 'Move to workspace',
- })}
-
-
+ title={buttonTitle}
+ />
+
);
+ } else {
+ return null;
}
-
- return (
-