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
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 messaging and add callout
  • Loading branch information
qn895 committed Oct 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b35e69ca2014a1cab239d15cd01cc4068b376d5b
Original file line number Diff line number Diff line change
@@ -19,7 +19,14 @@ 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, EuiLoadingSpinner, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import {
EuiButtonGroup,
EuiCallOut,
EuiLoadingSpinner,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import {
Axis,
@@ -53,7 +60,10 @@ import {
import { FieldSummaryMessage } from './field_summary_message';
import { FieldNumberSummary, isNumberSummaryValid } from './field_number_summary';
import { ErrorBoundary } from '../error_boundary';
import { getReasonIfQueryUnsupportedByFieldStats } from '../../utils/get_warning_message';
import {
FIELD_DATA_LABEL,
getReasonIfFieldStatsUnavailableForQuery,
} from '../../utils/get_warning_message';

export interface FieldStatsState {
isLoading: boolean;
@@ -337,9 +347,16 @@ const FieldStatsComponent: React.FC<FieldStatsProps> = ({
: messageNoAnalysis;
}

const unsupportedReason = getReasonIfQueryUnsupportedByFieldStats(query);
if (unsupportedReason) {
const messageUnsupportedReason = <FieldSummaryMessage message={unsupportedReason} />;
const unsupportedReasonForQuery = getReasonIfFieldStatsUnavailableForQuery(
query,
FIELD_DATA_LABEL
);
if (unsupportedReasonForQuery) {
const messageUnsupportedReason = (
<EuiCallOut iconType="warning" color="warning">
{unsupportedReasonForQuery}
</EuiCallOut>
);

return overrideMissingContent
? overrideMissingContent({
17 changes: 13 additions & 4 deletions packages/kbn-unified-field-list/src/utils/get_warning_message.ts
Original file line number Diff line number Diff line change
@@ -12,8 +12,17 @@ import { parse } from '@kbn/esql-ast';
import { isOfAggregateQueryType } from '@kbn/es-query';
import { i18n } from '@kbn/i18n';

export const getReasonIfQueryUnsupportedByFieldStats = (
query?: AggregateQuery | Query | { [key: string]: any }
const FIELD_STATISTICS_LABEL = i18n.translate('unifiedFieldList.fieldStats.fieldStatisticsLabel', {
defaultMessage: `Field statistics`,
});

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

export const getReasonIfFieldStatsUnavailableForQuery = (
query?: AggregateQuery | Query | { [key: string]: any },
label: string = FIELD_STATISTICS_LABEL
): string | undefined => {
if (isOfAggregateQueryType(query)) {
const { root } = parse(query.esql);
@@ -22,8 +31,8 @@ export const getReasonIfQueryUnsupportedByFieldStats = (
return i18n.translate(
'unifiedFieldList.fieldStats.notAvailableForMatchESQLQueryDescription',
{
defaultMessage:
'Field statistics is unavailable for ES|QL queries containing `MATCH` function',
defaultMessage: `{label} is unavailable for ES|QL queries containing 'MATCH' or 'QSTR' functions.`,
values: { label },
}
);
}
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import { css } from '@emotion/react';
import { isLegacyTableEnabled, SHOW_FIELD_STATISTICS } from '@kbn/discover-utils';
import type { DataView } from '@kbn/data-views-plugin/common';
import useMountedState from 'react-use/lib/useMountedState';
import { getReasonIfQueryUnsupportedByFieldStats } from '@kbn/unified-field-list/src/utils/get_warning_message';
import { getReasonIfFieldStatsUnavailableForQuery } from '@kbn/unified-field-list/src/utils/get_warning_message';
import { VIEW_MODE } from '../../../common/constants';
import { useDiscoverServices } from '../../hooks/use_discover_services';
import type { DiscoverStateContainer } from '../../application/main/state_management/discover_state';
@@ -49,7 +49,7 @@ export const DocumentViewModeToggle = ({
);
const state = stateContainer.appState.getState();
const fieldStatsWarningMsgForQuery = useMemo(() => {
return getReasonIfQueryUnsupportedByFieldStats(state.query);
return getReasonIfFieldStatsUnavailableForQuery(state.query);
}, [state.query]);

const [showPatternAnalysisTab, setShowPatternAnalysisTab] = useState<boolean | null>(null);
Loading