Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [Lens] Show 'No data for this field' for empty field in accordion (#73772) #75687

Merged
merged 2 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -9946,7 +9946,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 @@ -9949,7 +9949,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