mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Lens][Unified Field list] Add functional tests to fields lists and summary popover (#143747)
* ♻️ Add testId handlers * ✅ Add functional tests * 💄 Wrap unsupported messages with testId * 🔧 Enable creation of dataViews without timefield * ✅ Extends tests for other dataview types + runtime fields * ✅ Add more checks on top values charts * 👌 Integrated feedback * 🐛 Fix testIds and added some logging
This commit is contained in:
parent
7bc63e07af
commit
2efad9d15a
7 changed files with 287 additions and 24 deletions
|
@ -190,6 +190,9 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) {
|
|||
initialFocus=".lnsFieldItem__fieldPanel"
|
||||
className="lnsFieldItem__popoverAnchor"
|
||||
data-test-subj="lnsFieldListPanelField"
|
||||
panelProps={{
|
||||
'data-test-subj': 'lnsFieldListPanelFieldContent',
|
||||
}}
|
||||
container={document.querySelector<HTMLElement>('.application') || undefined}
|
||||
button={
|
||||
<DragDrop
|
||||
|
@ -331,26 +334,30 @@ function FieldItemPopoverContents(
|
|||
field={dataViewField}
|
||||
data-test-subj="lnsFieldListPanel"
|
||||
overrideMissingContent={(params) => {
|
||||
if (params?.noDataFound) {
|
||||
if (params.reason === 'no-data') {
|
||||
// TODO: should we replace this with a default message "Analysis is not available for this field?"
|
||||
const isUsingSampling = core.uiSettings.get('lens:useFieldExistenceSampling');
|
||||
return (
|
||||
<>
|
||||
<EuiText size="s">
|
||||
{isUsingSampling
|
||||
? i18n.translate('xpack.lens.indexPattern.fieldStatsSamplingNoData', {
|
||||
defaultMessage:
|
||||
'Lens is unable to create visualizations with this field because it does not contain data in the first 500 documents that match your filters. To create a visualization, drag and drop a different field.',
|
||||
})
|
||||
: i18n.translate('xpack.lens.indexPattern.fieldStatsNoData', {
|
||||
defaultMessage:
|
||||
'Lens is unable to create visualizations with this field because it does not contain data. To create a visualization, drag and drop a different field.',
|
||||
})}
|
||||
</EuiText>
|
||||
</>
|
||||
<EuiText size="s" data-test-subj="lnsFieldListPanel-missingFieldStats">
|
||||
{isUsingSampling
|
||||
? i18n.translate('xpack.lens.indexPattern.fieldStatsSamplingNoData', {
|
||||
defaultMessage:
|
||||
'Lens is unable to create visualizations with this field because it does not contain data in the first 500 documents that match your filters. To create a visualization, drag and drop a different field.',
|
||||
})
|
||||
: i18n.translate('xpack.lens.indexPattern.fieldStatsNoData', {
|
||||
defaultMessage:
|
||||
'Lens is unable to create visualizations with this field because it does not contain data. To create a visualization, drag and drop a different field.',
|
||||
})}
|
||||
</EuiText>
|
||||
);
|
||||
}
|
||||
if (params.reason === 'unsupported') {
|
||||
return (
|
||||
<EuiText data-test-subj="lnsFieldListPanel-missingFieldStats">
|
||||
{params.element}
|
||||
</EuiText>
|
||||
);
|
||||
}
|
||||
|
||||
return params.element;
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -169,14 +169,18 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({
|
|||
}
|
||||
if (hasLoaded) {
|
||||
return (
|
||||
<EuiNotificationBadge size="m" color={isFiltered ? 'accent' : 'subdued'}>
|
||||
<EuiNotificationBadge
|
||||
size="m"
|
||||
color={isFiltered ? 'accent' : 'subdued'}
|
||||
data-test-subj={`${id}-count`}
|
||||
>
|
||||
{fieldsCount}
|
||||
</EuiNotificationBadge>
|
||||
);
|
||||
}
|
||||
|
||||
return <EuiLoadingSpinner size="m" />;
|
||||
}, [showExistenceFetchError, showExistenceFetchTimeout, hasLoaded, isFiltered, fieldsCount]);
|
||||
}, [showExistenceFetchError, showExistenceFetchTimeout, hasLoaded, isFiltered, id, fieldsCount]);
|
||||
|
||||
return (
|
||||
<EuiAccordion
|
||||
|
|
|
@ -49,14 +49,18 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({
|
|||
const extraAction = useMemo(() => {
|
||||
if (hasLoaded) {
|
||||
return (
|
||||
<EuiNotificationBadge size="m" color={isFiltered ? 'accent' : 'subdued'}>
|
||||
<EuiNotificationBadge
|
||||
size="m"
|
||||
color={isFiltered ? 'accent' : 'subdued'}
|
||||
data-test-subj={`${id}-count`}
|
||||
>
|
||||
{fields.length}
|
||||
</EuiNotificationBadge>
|
||||
);
|
||||
}
|
||||
|
||||
return <EuiLoadingSpinner size="m" />;
|
||||
}, [fields.length, hasLoaded, isFiltered]);
|
||||
}, [fields.length, hasLoaded, id, isFiltered]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue