Skip to content

Commit

Permalink
[Lens] Show 'No data for this field' for empty field in accordion (el…
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra authored Aug 21, 2020
1 parent 6a334c3 commit 5edba21
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,13 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) {
? i18n.translate('xpack.lens.indexPattern.fieldItemTooltip', {
defaultMessage: 'Drag and drop to visualize.',
})
: i18n.translate('xpack.lens.indexPattern.fieldStatsButtonLabel', {
: exists
? i18n.translate('xpack.lens.indexPattern.fieldStatsButtonLabel', {
defaultMessage: 'Click for a field preview, or drag and drop to visualize.',
})
: i18n.translate('xpack.lens.indexPattern.fieldStatsButtonEmptyLabel', {
defaultMessage: "This field doesn't have data. Drag and drop to visualize.",
})
}
type="iInCircle"
color="subdued"
Expand Down Expand Up @@ -217,11 +221,7 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) {
isDraggable
isActive={infoIsOpen}
data-test-subj={`lnsFieldListPanelField-${field.name}`}
onClick={() => {
if (exists) {
togglePopover();
}
}}
onClick={togglePopover}
aria-label={i18n.translate('xpack.lens.indexPattern.fieldStatsButtonAriaLabel', {
defaultMessage: '{fieldName}: {fieldType}. Hit enter for a field preview.',
values: {
Expand Down Expand Up @@ -313,7 +313,8 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
return (
<EuiText size="s">
{i18n.translate('xpack.lens.indexPattern.fieldStatsNoData', {
defaultMessage: 'No data to display.',
defaultMessage:
'This field is empty because it doesn’t exist in the 500 sampled documents.',
})}
</EuiText>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export const InnerFieldsAccordion = function InnerFieldsAccordion({
showExistenceFetchError,
}: FieldsAccordionProps) {
const renderField = useCallback(
(field: IndexPatternField) => {
return <FieldItem {...fieldProps} key={field.name} field={field} exists={!!exists} />;
},
(field: IndexPatternField) => (
<FieldItem {...fieldProps} key={field.name} field={field} exists={!!exists} />
),
[fieldProps, exists]
);

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -9934,7 +9934,6 @@
"xpack.lens.indexPattern.fieldStatsButtonLabel": "フィールドプレビューを表示するには、クリックします。可視化するには、ドラッグアンドドロップします。",
"xpack.lens.indexPattern.fieldStatsCountLabel": "カウント",
"xpack.lens.indexPattern.fieldStatsDisplayToggle": "次のどちらかを切り替えます:",
"xpack.lens.indexPattern.fieldStatsNoData": "表示するデータがありません",
"xpack.lens.indexPattern.fieldTimeDistributionLabel": "時間分布",
"xpack.lens.indexPattern.fieldTopValuesLabel": "トップの値",
"xpack.lens.indexPattern.groupByDropdown": "グループ分けの条件",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -9937,7 +9937,6 @@
"xpack.lens.indexPattern.fieldStatsButtonLabel": "单击以进行字段预览,或拖放以进行可视化。",
"xpack.lens.indexPattern.fieldStatsCountLabel": "计数",
"xpack.lens.indexPattern.fieldStatsDisplayToggle": "切换",
"xpack.lens.indexPattern.fieldStatsNoData": "没有可显示的数据",
"xpack.lens.indexPattern.fieldTimeDistributionLabel": "时间分布",
"xpack.lens.indexPattern.fieldTopValuesLabel": "排名最前值",
"xpack.lens.indexPattern.groupByDropdown": "分组依据",
Expand Down

0 comments on commit 5edba21

Please sign in to comment.