Skip to content

Commit

Permalink
[7.x] [Lens] Add datasource fields group help text (#85544) (#85988)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
dej611 and kibanamachine committed Dec 16, 2020
1 parent 514f51e commit d40ca33
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
Expand Up @@ -10,6 +10,10 @@
margin-bottom: $euiSizeS;
}

.lnsInnerIndexPatternDataPanel__titleTooltip {
margin-right: $euiSizeXS;
}

.lnsInnerIndexPatternDataPanel__fieldItems {
// Quick fix for making sure the shadow and focus rings are visible outside the accordion bounds
padding: $euiSizeXS;
Expand All @@ -34,3 +38,5 @@
margin-right: $euiSizeS;
}
}


Expand Up @@ -335,7 +335,10 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({
: i18n.translate('xpack.lens.indexPattern.availableFieldsLabel', {
defaultMessage: 'Available fields',
}),

helpText: i18n.translate('xpack.lens.indexPattern.allFieldsLabelHelp', {
defaultMessage:
'Available fields have data in the first 500 documents that match your filters. To view all fields, expand Empty fields. Some field types cannot be visualized in Lens, including full text and geographic fields.',
}),
isAffectedByGlobalFilter: !!filters.length,
isAffectedByTimeFilter: true,
hideDetails: fieldInfoUnavailable,
Expand All @@ -357,6 +360,10 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({
defaultNoFieldsMessage: i18n.translate('xpack.lens.indexPatterns.noEmptyDataLabel', {
defaultMessage: `There are no empty fields.`,
}),
helpText: i18n.translate('xpack.lens.indexPattern.emptyFieldsLabelHelp', {
defaultMessage:
'Empty fields did not contain any values in the first 500 documents based on your filters.',
}),
},
MetaFields: {
fields: groupedFields.metaFields,
Expand Down
Expand Up @@ -22,6 +22,7 @@ export type FieldGroups = Record<
showInAccordion: boolean;
isInitiallyOpen: boolean;
title: string;
helpText?: string;
isAffectedByGlobalFilter: boolean;
isAffectedByTimeFilter: boolean;
hideDetails?: boolean;
Expand Down Expand Up @@ -150,6 +151,7 @@ export function FieldList({
key={key}
id={`lnsIndexPattern${key}`}
label={fieldGroup.title}
helpTooltip={fieldGroup.helpText}
exists={exists}
hideDetails={fieldGroup.hideDetails}
hasLoaded={!!hasSyncedExistingFields}
Expand Down
Expand Up @@ -15,6 +15,7 @@ import {
EuiLoadingSpinner,
EuiIconTip,
} from '@elastic/eui';
import classNames from 'classnames';
import { DataPublicPluginStart } from 'src/plugins/data/public';
import { IndexPatternField } from './types';
import { FieldItem } from './field_item';
Expand All @@ -39,6 +40,7 @@ export interface FieldsAccordionProps {
onToggle: (open: boolean) => void;
id: string;
label: string;
helpTooltip?: string;
hasLoaded: boolean;
fieldsCount: number;
isFiltered: boolean;
Expand All @@ -55,6 +57,7 @@ export const InnerFieldsAccordion = function InnerFieldsAccordion({
onToggle,
id,
label,
helpTooltip,
hasLoaded,
fieldsCount,
isFiltered,
Expand All @@ -78,6 +81,11 @@ export const InnerFieldsAccordion = function InnerFieldsAccordion({
[fieldProps, exists, hideDetails]
);

const titleClassname = classNames({
// eslint-disable-next-line @typescript-eslint/naming-convention
lnsInnerIndexPatternDataPanel__titleTooltip: !!helpTooltip,
});

return (
<EuiAccordion
initialIsOpen={initialIsOpen}
Expand All @@ -86,7 +94,20 @@ export const InnerFieldsAccordion = function InnerFieldsAccordion({
id={id}
buttonContent={
<EuiText size="xs">
<strong>{label}</strong>
<strong className={titleClassname}>{label}</strong>
{!!helpTooltip && (
<EuiIconTip
aria-label={helpTooltip}
type="questionInCircle"
color="subdued"
size="s"
position="right"
content={helpTooltip}
iconProps={{
className: 'eui-alignTop',
}}
/>
)}
</EuiText>
}
extraAction={
Expand Down

0 comments on commit d40ca33

Please sign in to comment.