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

[ES|QL] Hide field statistics tab and Dashboard when ES|QL is in use, disable Index data visualizer for MATCH and QSRT functions #197538

Merged
merged 36 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f5fa6c6
Add getFieldStatsWarningMsgForQuery
qn895 Oct 23, 2024
8736c72
Add messaging for embeddables
qn895 Oct 23, 2024
b35e69c
Update messaging and add callout
qn895 Oct 24, 2024
2957796
Update callout style with icon
qn895 Oct 24, 2024
aff1b6f
Update styling
qn895 Oct 24, 2024
a6145ce
Make it so preview won't happen if not supported
qn895 Oct 24, 2024
ae086fc
Update messaging
qn895 Oct 24, 2024
1f9cef4
Exit early
qn895 Oct 28, 2024
38d47b9
Add new util to esql-utils
qn895 Oct 28, 2024
fafcc26
Merge remote-tracking branch 'upstream/main' into esql-match-disable
qn895 Oct 28, 2024
db63c8b
Merge branch 'main' into esql-match-disable
stratoula Oct 29, 2024
b2b7222
Refactor to have separate messaging for field stats, change from call…
qn895 Oct 30, 2024
7321cf5
Remove unused constants
qn895 Oct 31, 2024
4215c9c
Refactor
qn895 Oct 31, 2024
347e1ec
:Merge remote-tracking branch 'upstream/main' into esql-match-disable
qn895 Oct 31, 2024
989a523
Fix test
qn895 Oct 31, 2024
2dd74e9
Fix logic for detecting function
qn895 Oct 31, 2024
3ec8263
Update tests
qn895 Nov 4, 2024
cd06f88
Merge remote-tracking branch 'upstream/main' into esql-match-disable
qn895 Nov 4, 2024
2c4f740
Fix undefined
qn895 Nov 4, 2024
0dfc116
Remove field stats tab in ES|QL mode for Discover & dashboard, redire…
qn895 Nov 4, 2024
881e57b
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Nov 4, 2024
7ea2efb
Update tests
qn895 Nov 4, 2024
b3c356e
Revert field list changes
qn895 Nov 5, 2024
bafff15
Add view mode
qn895 Nov 5, 2024
a8cd5be
Update tests
qn895 Nov 6, 2024
6b7ee45
Consolidate messaging style
qn895 Nov 6, 2024
dc99c68
Consolidate messaging
qn895 Nov 6, 2024
9d4f0f1
Update types
qn895 Nov 6, 2024
eabc053
Update logic for toggle when opening saved search
qn895 Nov 6, 2024
62c5496
Merge remote-tracking branch 'upstream/main' into esql-match-disable
qn895 Nov 6, 2024
5ccbdf7
More test updates
qn895 Nov 6, 2024
47f6210
Update jest test
qn895 Nov 11, 2024
ed826d0
Fix data visualizer page
qn895 Nov 11, 2024
5cf259a
Merge remote-tracking branch 'upstream/main' into esql-match-disable
qn895 Nov 11, 2024
2f2b2fb
Merge branch 'main' into esql-match-disable
elasticmachine Nov 12, 2024
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
Prev Previous commit
Next Next commit
Update styling
  • Loading branch information
qn895 committed Oct 24, 2024
commit aff1b6f8d5d439cb52c148675d5bd5385455e078
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import type { ChartsPluginSetup } from '@kbn/charts-plugin/public';
import DateMath from '@kbn/datemath';
import {
EuiButtonGroup,
EuiCallOut,
EuiLoadingSpinner,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';
import { EuiButtonGroup, EuiLoadingSpinner, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import {
Axis,
Expand Down Expand Up @@ -352,9 +345,7 @@ const FieldStatsComponent: React.FC<FieldStatsProps> = ({
FIELD_DATA_LABEL
);
if (unsupportedReasonForQuery) {
const messageUnsupportedReason = (
<EuiCallOut size="s" iconType="warning" color="warning" title={unsupportedReasonForQuery} />
);
const messageUnsupportedReason = <FieldSummaryMessage message={unsupportedReasonForQuery} />;

return overrideMissingContent
? overrideMissingContent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { isOfAggregateQueryType } from '@kbn/es-query';
import { i18n } from '@kbn/i18n';

const FIELD_STATISTICS_LABEL = i18n.translate('unifiedFieldList.fieldStats.fieldStatisticsLabel', {
defaultMessage: `Field statistics`,
defaultMessage: `Field statistics are`,
});

export const FIELD_DATA_LABEL = i18n.translate('unifiedFieldList.fieldStats.fieldDataLabel', {
defaultMessage: `Field data`,
defaultMessage: `Field data is`,
});

export const getReasonIfFieldStatsUnavailableForQuery = (
Expand All @@ -31,7 +31,7 @@ export const getReasonIfFieldStatsUnavailableForQuery = (
return i18n.translate(
'unifiedFieldList.fieldStats.notAvailableForMatchESQLQueryDescription',
{
defaultMessage: `{label} is unavailable for ES|QL queries containing 'MATCH' or 'QSTR' functions.`,
defaultMessage: `{label} not supported when using 'MATCH' or 'QSTR' functions.`,
values: { label },
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { EuiEmptyPrompt, EuiIcon, useEuiTheme } from '@elastic/eui';
import { EmptyPlaceholder } from '@kbn/charts-plugin/public';
import { i18n } from '@kbn/i18n';
import { css } from '@emotion/react';
import type { FieldStatisticTableEmbeddableProps } from './types';
const FIELD_STATS_UNAVAILABLE_TITLE = i18n.translate(
'xpack.dataVisualizer.fieldStats.unavailableTitle',
{
defaultMessage: 'Field statistics unavailable',
}
);
export const FieldStatsUnavailableMessage = ({
id,
content,
title = FIELD_STATS_UNAVAILABLE_TITLE,
}: Pick<FieldStatisticTableEmbeddableProps, 'id'> & { content: string; title?: string }) => {
const { euiTheme } = useEuiTheme();
if (!content) return null;

if (id === 'dashboard_embeddable') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I exported a saved search SO from another branch, imported it and added to a Dashboard. For some reason, it only shows a loading indicator:
test_match.ndjson.zip
Screenshot 2024-11-01 at 13 54 55

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing that! This seems out of scope for this PR so I'll address it in a different follow up.

return <EmptyPlaceholder icon={'warning'} message={title} />;
}
return (
<EuiEmptyPrompt
icon={<EuiIcon size="l" type="warning" color="warning" />}
color="plain"
paddingSize="m"
css={css`
margin: ${euiTheme.size.xl} auto;
`}
title={<h2 data-test-subj="fieldStatsUnavailableCalloutTitle">{title}</h2>}
titleSize="xs"
hasBorder
body={<>{content}</>}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/
import React, { useMemo } from 'react';
import { EuiCallOut, EuiEmptyPrompt } from '@elastic/eui';
import { EuiEmptyPrompt } from '@elastic/eui';
import type { Required } from 'utility-types';
import { FormattedMessage } from '@kbn/i18n-react';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
Expand All @@ -22,6 +22,7 @@ import type {
FieldStatisticTableEmbeddableProps,
ESQLDataVisualizerGridEmbeddableState,
} from './types';
import { FieldStatsUnavailableMessage } from './embeddable_error_msg';

const EmbeddableESQLFieldStatsTableWrapper = dynamic(
() => import('./embeddable_esql_field_stats_table')
Expand All @@ -44,7 +45,7 @@ const FieldStatisticsWrapperContent = (props: FieldStatisticTableEmbeddableProps
if (isESQLFieldStatisticTableEmbeddableState(props)) {
const unsupportedReason = getReasonIfFieldStatsUnavailableForQuery(props.esqlQuery);
return unsupportedReason ? (
<EuiCallOut title={unsupportedReason} size="s" iconType="warning" color="warning" />
<FieldStatsUnavailableMessage id={props.id} content={unsupportedReason} />
) : (
<EmbeddableESQLFieldStatsTableWrapper
id={props.id}
Expand Down