Skip to content

Commit

Permalink
[8.x] [ML][ES|QL] Adds query guardrails and technical preview badge t…
Browse files Browse the repository at this point in the history
…o ES|QL data visualizer (#200325) (#200677)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML][ES|QL] Adds query guardrails and technical preview badge to
ES|QL data visualizer
(#200325)](#200325)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Quynh Nguyen
(Quinn)","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-19T08:11:46Z","message":"[ML][ES|QL]
Adds query guardrails and technical preview badge to ES|QL data
visualizer (#200325)\n\n## Summary\r\n\r\nAdds extra guardrails to the
searches, plus the technical preview badge,\r\nto the ES|QL data
visualizer. \\\r\n\r\nThe extra safety guards applied are:\r\n- Lowers
the limit of # of rows sampled to 5000\r\n- Changes the pagination to 10
by default, and only allows 10 to 25 rows\r\nvisible concurrently\r\n-
Hides distribution charts by default\r\n- Always have frozen tier
excluded in the queries\r\n\r\n<img width=\"1164\" alt=\"Screenshot
2024-11-16 at 18 26
20\"\r\nsrc=\"https://github.com/user-attachments/assets/a558fdfa-189a-4ba9-b038-8d14df4594be\">\r\n\r\n\r\nhttps://github.com/user-attachments/assets/488f44dd-4a3c-48c7-8416-5091b614edfd\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ]
...","sha":"94aaed3b139b0bdeeb581954053871d75c098a4a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:File
and Index Data
Viz","v9.0.0","backport:version","v8.17.0"],"title":"[ML][ES|QL] Adds
query guardrails and technical preview badge to ES|QL data
visualizer","number":200325,"url":"https://github.com/elastic/kibana/pull/200325","mergeCommit":{"message":"[ML][ES|QL]
Adds query guardrails and technical preview badge to ES|QL data
visualizer (#200325)\n\n## Summary\r\n\r\nAdds extra guardrails to the
searches, plus the technical preview badge,\r\nto the ES|QL data
visualizer. \\\r\n\r\nThe extra safety guards applied are:\r\n- Lowers
the limit of # of rows sampled to 5000\r\n- Changes the pagination to 10
by default, and only allows 10 to 25 rows\r\nvisible concurrently\r\n-
Hides distribution charts by default\r\n- Always have frozen tier
excluded in the queries\r\n\r\n<img width=\"1164\" alt=\"Screenshot
2024-11-16 at 18 26
20\"\r\nsrc=\"https://github.com/user-attachments/assets/a558fdfa-189a-4ba9-b038-8d14df4594be\">\r\n\r\n\r\nhttps://github.com/user-attachments/assets/488f44dd-4a3c-48c7-8416-5091b614edfd\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ]
...","sha":"94aaed3b139b0bdeeb581954053871d75c098a4a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200325","number":200325,"mergeCommit":{"message":"[ML][ES|QL]
Adds query guardrails and technical preview badge to ES|QL data
visualizer (#200325)\n\n## Summary\r\n\r\nAdds extra guardrails to the
searches, plus the technical preview badge,\r\nto the ES|QL data
visualizer. \\\r\n\r\nThe extra safety guards applied are:\r\n- Lowers
the limit of # of rows sampled to 5000\r\n- Changes the pagination to 10
by default, and only allows 10 to 25 rows\r\nvisible concurrently\r\n-
Hides distribution charts by default\r\n- Always have frozen tier
excluded in the queries\r\n\r\n<img width=\"1164\" alt=\"Screenshot
2024-11-16 at 18 26
20\"\r\nsrc=\"https://github.com/user-attachments/assets/a558fdfa-189a-4ba9-b038-8d14df4594be\">\r\n\r\n\r\nhttps://github.com/user-attachments/assets/488f44dd-4a3c-48c7-8416-5091b614edfd\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ]
...","sha":"94aaed3b139b0bdeeb581954053871d75c098a4a"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Quynh Nguyen (Quinn) <[email protected]>
  • Loading branch information
kibanamachine and qn895 authored Nov 19, 2024
1 parent cffa72b commit 14d8575
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React from 'react';
import React, { useEffect } from 'react';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import { useExpandedRowCss } from './use_expanded_row_css';
import { GeoPointContentWithMap } from './geo_point_content_with_map';
Expand Down Expand Up @@ -34,6 +34,7 @@ export const IndexBasedDataVisualizerExpandedRow = ({
totalDocuments,
timeFieldName,
typeAccessor = 'type',
onVisibilityChange,
}: {
item: FieldVisConfig;
dataView: DataView | undefined;
Expand All @@ -46,6 +47,7 @@ export const IndexBasedDataVisualizerExpandedRow = ({
*/
onAddFilter?: (field: DataViewField | string, value: string, type: '+' | '-') => void;
timeFieldName?: string;
onVisibilityChange?: (visible: boolean, item: FieldVisConfig) => void;
}) => {
const config = { ...item, stats: { ...item.stats, totalDocuments } };
const { loading, existsInDocs, fieldName } = config;
Expand Down Expand Up @@ -98,6 +100,14 @@ export const IndexBasedDataVisualizerExpandedRow = ({
}
}

useEffect(() => {
onVisibilityChange?.(true, item);

return () => {
onVisibilityChange?.(false, item);
};
}, [item, onVisibilityChange]);

return (
<div css={dvExpandedRow} data-test-subj={`dataVisualizerFieldExpandedRow-${fieldName}`}>
{loading === true ? <LoadingIndicator /> : getCardContent()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ interface DataVisualizerTableProps<T extends object> {
overallStatsRunning: boolean;
renderFieldName?: FieldStatisticTableEmbeddableProps['renderFieldName'];
error?: Error | string;
isEsql?: boolean;
}

const UnmemoizedDataVisualizerTable = <T extends DataVisualizerTableItem>({
Expand All @@ -78,6 +79,7 @@ const UnmemoizedDataVisualizerTable = <T extends DataVisualizerTableItem>({
overallStatsRunning,
renderFieldName,
error,
isEsql = false,
}: DataVisualizerTableProps<T>) => {
const { euiTheme } = useEuiTheme();

Expand All @@ -87,7 +89,8 @@ const UnmemoizedDataVisualizerTable = <T extends DataVisualizerTableItem>({
const { onTableChange, pagination, sorting } = useTableSettings<T>(
items,
pageState,
updatePageState
updatePageState,
isEsql
);
const [showDistributions, setShowDistributions] = useState<boolean>(showPreviewByDefault ?? true);
const [dimensions, setDimensions] = useState(calculateTableColumnsDimensions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ interface UseTableSettingsReturnValue<T extends object> {
export function useTableSettings<TypeOfItem extends object>(
items: TypeOfItem[],
pageState: DataVisualizerTableState,
updatePageState: (update: DataVisualizerTableState) => void
updatePageState: (update: DataVisualizerTableState) => void,
isEsql: boolean = false
): UseTableSettingsReturnValue<TypeOfItem> {
const { pageIndex, pageSize, sortField, sortDirection } = pageState;

Expand All @@ -50,9 +51,9 @@ export function useTableSettings<TypeOfItem extends object>(
pageIndex,
pageSize,
totalItemCount: items.length,
pageSizeOptions: PAGE_SIZE_OPTIONS,
pageSizeOptions: isEsql ? [10, 25] : PAGE_SIZE_OPTIONS,
}),
[items, pageIndex, pageSize]
[items, pageIndex, pageSize, isEsql]
);

const sorting = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ export const IndexDataVisualizerESQL: FC<IndexDataVisualizerESQLProps> = (dataVi

<EuiProgress value={combinedProgress} max={100} size="xs" />
<DataVisualizerTable
isEsql={true}
items={configs}
pageState={dataVisualizerListState}
updatePageState={setDataVisualizerListState}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ const options = [
values: { limit: '10,000' },
}),
},
{
'data-test-subj': 'dvESQLLimitSize-100000',
value: '100000',
text: i18n.translate('xpack.dataVisualizer.searchPanel.esql.limitSizeOptionLabel', {
defaultMessage: '{limit} rows',
values: { limit: '100,000' },
}),
},
];

export const ESQLDefaultLimitSizeSelect = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 2.0.
*/

export const DEFAULT_ESQL_LIMIT = 10000;
export const DEFAULT_ESQL_LIMIT = 5000;
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const EmbeddableESQLFieldStatsTableWrapper = React.memo(

return (
<DataVisualizerTable<FieldVisConfig>
isEsql={true}
items={configs}
pageState={dataVisualizerListState}
updatePageState={onTableChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ const defaultSearchQuery = {
};

const FALLBACK_ESQL_QUERY: ESQLQuery = { esql: '' };
const DEFAULT_LIMIT_SIZE = '10000';
const DEFAULT_LIMIT_SIZE = '5000';
const defaults = getDefaultPageState();

export const getDefaultESQLDataVisualizerListState = (
overrides?: Partial<ESQLDataVisualizerIndexBasedAppState>
): Required<ESQLDataVisualizerIndexBasedAppState> => ({
pageIndex: 0,
pageSize: 25,
pageSize: 10,
sortField: 'fieldName',
sortDirection: 'asc',
visibleFieldTypes: [],
Expand All @@ -70,7 +70,7 @@ export const getDefaultESQLDataVisualizerListState = (
searchQuery: defaultSearchQuery,
searchQueryLanguage: SEARCH_QUERY_LANGUAGE.KUERY,
filters: [],
showDistributions: true,
showDistributions: false,
showAllFields: false,
showEmptyFields: false,
probability: null,
Expand Down Expand Up @@ -229,6 +229,21 @@ export const useESQLDataVisualizerData = (
} as QueryDslQueryContainer;
}
}

// Ensure that we don't query frozen data
if (filter.bool === undefined) {
filter.bool = Object.create(null);
}

if (filter.bool && filter.bool.must_not === undefined) {
filter.bool.must_not = [];
}

if (filter.bool && Array.isArray(filter?.bool?.must_not)) {
filter.bool.must_not!.push({
term: { _tier: 'data_frozen' },
});
}
return {
id: input.id,
earliest,
Expand Down Expand Up @@ -332,9 +347,25 @@ export const useESQLDataVisualizerData = (

const visibleFieldTypes =
dataVisualizerListState.visibleFieldTypes ?? restorableDefaults.visibleFieldTypes;
const [expandedRows, setExpandedRows] = useState<string[]>([]);

const onVisibilityChange = useCallback((visible: boolean, item: FieldVisConfig) => {
if (visible) {
setExpandedRows((prev) => [...prev, item.fieldName]);
} else {
setExpandedRows((prev) => prev.filter((fieldName) => fieldName !== item.fieldName));
}
}, []);

const hasExpandedRows = useMemo(() => expandedRows.length > 0, [expandedRows]);

useEffect(
function updateFieldStatFieldsToFetch() {
if (dataVisualizerListState?.showDistributions === false && !hasExpandedRows) {
setFieldStatFieldsToFetch(undefined);
return;
}

const { sortField, sortDirection } = dataVisualizerListState;

// Otherwise, sort the list of fields by the initial sort field and sort direction
Expand Down Expand Up @@ -376,6 +407,8 @@ export const useESQLDataVisualizerData = (
dataVisualizerListState.sortDirection,
nonMetricConfigs,
metricConfigs,
dataVisualizerListState?.showDistributions,
hasExpandedRows,
]
);

Expand Down Expand Up @@ -618,14 +651,15 @@ export const useESQLDataVisualizerData = (
typeAccessor="secondaryType"
timeFieldName={timeFieldName}
onAddFilter={input.onAddFilter}
onVisibilityChange={onVisibilityChange}
/>
);
}
return map;
}, {} as ItemIdToExpandedRowMap);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[currentDataView, totalCount, query.esql, timeFieldName]
[currentDataView, totalCount, query.esql, timeFieldName, onVisibilityChange]
);

const combinedProgress = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ export const useESQLOverallStatsData = (
{ strategy: ESQL_ASYNC_SEARCH_STRATEGY }
)) as ESQLResponse | undefined;
setQueryHistoryStatus(false);

const columnInfo = columnsResp?.rawResponse
? columnsResp.rawResponse.all_columns ?? columnsResp.rawResponse.columns
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { i18n } from '@kbn/i18n';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import type { DataView } from '@kbn/data-views-plugin/public';
import { getNestedProperty } from '@kbn/ml-nested-property';
Expand Down Expand Up @@ -49,8 +48,6 @@ import { DATA_VISUALIZER_INDEX_VIEWER } from './constants/index_data_visualizer_
import { INDEX_DATA_VISUALIZER_NAME } from '../common/constants';
import { DV_STORAGE_KEYS } from './types/storage';

const XXL_BREAKPOINT = 1400;

const localStorage = new Storage(window.localStorage);

export interface DataVisualizerStateContextProviderProps {
Expand Down Expand Up @@ -341,29 +338,20 @@ export const IndexDataVisualizer: FC<Props> = ({

return (
<KibanaRenderContextProvider {...startServices}>
<KibanaThemeProvider
theme={coreStart.theme}
modify={{
breakpoint: {
xxl: XXL_BREAKPOINT,
},
}}
>
<KibanaContextProvider services={{ ...services }}>
<StorageContextProvider storage={localStorage} storageKeys={DV_STORAGE_KEYS}>
<DatePickerContextProvider {...datePickerDeps}>
{!esql ? (
<DataVisualizerStateContextProvider
IndexDataVisualizerComponent={IndexDataVisualizerView}
getAdditionalLinks={getAdditionalLinks}
/>
) : (
<DataVisualizerESQLStateContextProvider />
)}
</DatePickerContextProvider>
</StorageContextProvider>
</KibanaContextProvider>
</KibanaThemeProvider>
<KibanaContextProvider services={{ ...services }}>
<StorageContextProvider storage={localStorage} storageKeys={DV_STORAGE_KEYS}>
<DatePickerContextProvider {...datePickerDeps}>
{!esql ? (
<DataVisualizerStateContextProvider
IndexDataVisualizerComponent={IndexDataVisualizerView}
getAdditionalLinks={getAdditionalLinks}
/>
) : (
<DataVisualizerESQLStateContextProvider />
)}
</DatePickerContextProvider>
</StorageContextProvider>
</KibanaContextProvider>
</KibanaRenderContextProvider>
);
};
1 change: 0 additions & 1 deletion x-pack/plugins/data_visualizer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@kbn/ml-time-buckets",
"@kbn/aiops-log-rate-analysis",
"@kbn/react-kibana-context-render",
"@kbn/react-kibana-context-theme",
"@kbn/presentation-publishing",
"@kbn/shared-ux-utility",
"@kbn/search-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiLink,
EuiSpacer,
EuiText,
EuiBetaBadge,
EuiTextAlign,
} from '@elastic/eui';

Expand Down Expand Up @@ -64,7 +65,6 @@ export const DatavisualizerSelector: FC = () => {
},
} = useMlKibana();
const isEsqlEnabled = useMemo(() => uiSettings.get(ENABLE_ESQL), [uiSettings]);

const helpLink = docLinks.links.ml.guide;
const navigateToPath = useNavigateToPath();

Expand Down Expand Up @@ -172,6 +172,19 @@ export const DatavisualizerSelector: FC = () => {
<FormattedMessage
id="xpack.ml.datavisualizer.selector.selectESQLTitle"
defaultMessage="Visualize data using ES|QL"
/>{' '}
<EuiBetaBadge
label=""
iconType="beaker"
size="m"
color="hollow"
tooltipContent={
<FormattedMessage
id="xpack.ml.datavisualizer.selector.esqlTechnicalPreviewBadge.titleMsg"
defaultMessage="ES|QL data visualizer is in technical preview."
/>
}
tooltipPosition={'right'}
/>
</>
</EuiTextAlign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
GetAdditionalLinksParams,
} from '@kbn/data-visualizer-plugin/public';
import { useTimefilter } from '@kbn/ml-date-picker';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, useEuiTheme } from '@elastic/eui';
import useMountedState from 'react-use/lib/useMountedState';
import { useMlApi, useMlKibana, useMlLocator } from '../../contexts/kibana';
import { HelpMenu } from '../../components/help_menu';
Expand All @@ -26,6 +26,7 @@ import { mlNodesAvailable, getMlNodeCount } from '../../ml_nodes_check/check_ml_
import { checkPermission } from '../../capabilities/check_capabilities';
import { MlPageHeader } from '../../components/page_header';
import { useEnabledFeatures } from '../../contexts/ml';
import { TechnicalPreviewBadge } from '../../components/technical_preview_badge';
export const IndexDataVisualizerPage: FC<{ esql: boolean }> = ({ esql = false }) => {
useTimefilter({ timeRangeSelector: false, autoRefreshSelector: false });
const {
Expand Down Expand Up @@ -188,6 +189,7 @@ export const IndexDataVisualizerPage: FC<{ esql: boolean }> = ({ esql = false })
// eslint-disable-next-line react-hooks/exhaustive-deps
[mlLocator, mlFeaturesDisabled]
);
const { euiTheme } = useEuiTheme();
return IndexDataVisualizer ? (
<Fragment>
{IndexDataVisualizer !== null ? (
Expand All @@ -203,6 +205,9 @@ export const IndexDataVisualizerPage: FC<{ esql: boolean }> = ({ esql = false })
<EuiFlexItem grow={false}>
<FormattedMessage id="xpack.ml.datavisualizer" defaultMessage="(ES|QL)" />
</EuiFlexItem>
<EuiFlexItem grow={false} css={{ marginTop: euiTheme.size.xs }}>
<TechnicalPreviewBadge />
</EuiFlexItem>
</>
) : null}
</EuiFlexGroup>
Expand Down
Loading

0 comments on commit 14d8575

Please sign in to comment.