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

[Discover] Remove the legacy table #201254

Merged
merged 27 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7274d1e
[Discover] Initial clean up
jughosta Nov 21, 2024
c5c8d21
[Discover] Clean up translations
jughosta Nov 21, 2024
b47faca
[Discover] Remove the reference
jughosta Nov 21, 2024
cf59379
[Discover] Update tests
jughosta Nov 22, 2024
041c9de
[Discover] Remove legacy view from DocViewer
jughosta Nov 22, 2024
0074895
[Discover] Clean up
jughosta Nov 22, 2024
24ff08a
[Discover] Exclude legacy tests
jughosta Nov 22, 2024
e9c99e0
[Discover] Remove from context
jughosta Nov 22, 2024
4118f7c
[Discover] Remove from embeddable
jughosta Nov 22, 2024
b5dc7aa
[Discover] Clean up
jughosta Nov 22, 2024
2a79fb3
Merge branch 'main' into 167582-remove-legacy-table
jughosta Nov 25, 2024
4d06178
[Discover] Remove legacy view from Discover main page
jughosta Nov 25, 2024
7eebf07
[Discover] Clean up tests
jughosta Nov 25, 2024
dcc82bc
[Discover] Clean up translations
jughosta Nov 25, 2024
e4f1e41
[Discover] Clean up more
jughosta Nov 25, 2024
02720b3
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Nov 25, 2024
724e35b
[Discover] Clean up more
jughosta Nov 25, 2024
189a62d
Merge remote-tracking branch 'origin/167582-remove-legacy-table' into…
jughosta Nov 25, 2024
910113e
[Discover] Clean up more
jughosta Nov 25, 2024
66b3f56
Merge branch 'main' into 167582-remove-legacy-table
jughosta Nov 25, 2024
94d2ab7
Merge branch 'main' into 167582-remove-legacy-table
jughosta Nov 27, 2024
a1c48c9
Merge branch 'main' into 167582-remove-legacy-table
jughosta Nov 27, 2024
6a667af
[Discover] Remove new references
jughosta Nov 27, 2024
e4d601a
Merge branch 'main' into 167582-remove-legacy-table
jughosta Nov 28, 2024
228aa03
Merge branch 'main' into 167582-remove-legacy-table
elasticmachine Dec 2, 2024
f900727
Merge with main
jughosta Dec 3, 2024
a3ce399
[Discover] Remove new occurrences
jughosta Dec 3, 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
1 change: 0 additions & 1 deletion .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ enabled:
- test/functional/apps/dashboard/group5/config.ts
- test/functional/apps/dashboard/group6/config.ts
- test/functional/apps/discover/ccs_compatibility/config.ts
- test/functional/apps/discover/classic/config.ts
- test/functional/apps/discover/embeddable/config.ts
- test/functional/apps/discover/esql/config.ts
- test/functional/apps/discover/group1/config.ts
Expand Down
12 changes: 0 additions & 12 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ The default refresh interval for the time filter. Example:
[[timepicker-timedefaults]]`timepicker:timeDefaults`::
The default selection in the time filter.

[[truncate-maxheight]]`truncate:maxHeight`::
deprecated:[8.16.0]The maximum height that a cell occupies in a table. Set to 0 to disable
truncation.

[[enableESQL]]`enableESQL`::
This setting enables ES|QL in Kibana.

Expand Down Expand Up @@ -340,14 +336,6 @@ Hides the "Time" column in *Discover* and in all saved searches on dashboards.
Highlights results in *Discover* and saved searches on dashboards. Highlighting
slows requests when working on big documents.

[[doctable-legacy]]`doc_table:legacy`::
deprecated:[8.15.0] Controls the way the document table looks and works.
To use the new *Document Explorer* instead of the classic view, turn off this option.
The *Document Explorer* offers better data sorting, resizable columns, and a full screen view.

[[truncate-max-height]]`truncate:maxHeight`::
The maximum height that a cell in a table can occupy. To disable truncation, set to 0.


[float]
[[kibana-ml-settings]]
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-discover-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export {
DEFAULT_ALLOWED_LOGS_BASE_PATTERNS,
DEFAULT_COLUMNS_SETTING,
DOC_HIDE_TIME_COLUMN_SETTING,
DOC_TABLE_LEGACY,
FIELDS_LIMIT_SETTING,
HIDE_ANNOUNCEMENTS,
MAX_DOC_FIELDS_DISPLAYED,
Expand All @@ -28,8 +27,6 @@ export {
SHOW_FIELD_STATISTICS,
SHOW_MULTIFIELDS,
SORT_DEFAULT_ORDER_SETTING,
TRUNCATE_MAX_HEIGHT,
TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE,
IgnoredReason,
buildDataTableRecord,
buildDataTableRecordList,
Expand All @@ -45,7 +42,6 @@ export {
getMessageFieldWithFallbacks,
getShouldShowFieldHandler,
isNestedFieldParent,
isLegacyTableEnabled,
usePager,
calcFieldCounts,
getLogLevelColor,
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-discover-utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const CONTEXT_STEP_SETTING = 'context:step';
export const CONTEXT_TIE_BREAKER_FIELDS_SETTING = 'context:tieBreakerFields';
export const DEFAULT_COLUMNS_SETTING = 'defaultColumns';
export const DOC_HIDE_TIME_COLUMN_SETTING = 'doc_table:hideTimeColumn';
export const DOC_TABLE_LEGACY = 'doc_table:legacy';
export const FIELDS_LIMIT_SETTING = 'fields:popularLimit';
export const HIDE_ANNOUNCEMENTS = 'hideAnnouncements';
export const MAX_DOC_FIELDS_DISPLAYED = 'discover:maxDocFieldsDisplayed';
Expand All @@ -26,5 +25,3 @@ export const SEARCH_ON_PAGE_LOAD_SETTING = 'discover:searchOnPageLoad';
export const SHOW_FIELD_STATISTICS = 'discover:showFieldStatistics';
export const SHOW_MULTIFIELDS = 'discover:showMultiFields';
export const SORT_DEFAULT_ORDER_SETTING = 'discover:sort:defaultOrder';
export const TRUNCATE_MAX_HEIGHT = 'truncate:maxHeight';
export const TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE = 115;
2 changes: 1 addition & 1 deletion packages/kbn-discover-utils/src/utils/build_data_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { DataTableRecord, EsHitRecord } from '../types';
import { getDocId } from './get_doc_id';

/**
* Build a record for data table, explorer + classic one
* Build a record for data grid
* @param doc the document returned from Elasticsearch
* @param dataView this current data view
* @param isAnchor determines if the given doc is the anchor doc when viewing surrounding documents
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-discover-utils/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ export * from './nested_fields';
export * from './get_field_value';
export * from './calc_field_counts';
export * from './get_visible_columns';
export { isLegacyTableEnabled } from './is_legacy_table_enabled';
export { DiscoverFlyouts, dismissAllFlyoutsExceptFor, dismissFlyouts } from './dismiss_flyouts';
25 changes: 0 additions & 25 deletions packages/kbn-discover-utils/src/utils/is_legacy_table_enabled.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/kbn-discover-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@kbn/field-formats-plugin",
"@kbn/field-types",
"@kbn/i18n",
"@kbn/core-ui-settings-browser",
"@kbn/expressions-plugin",
"@kbn/logs-data-access-plugin",
"@kbn/i18n-react",
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export const DISCOVER_SHOW_MULTI_FIELDS_ID = 'discover:showMultiFields';
export const DISCOVER_SORT_DEFAULT_ORDER_ID = 'discover:sort:defaultOrder';
export const DOC_TABLE_HIDE_TIME_COLUMNS_ID = 'doc_table:hideTimeColumn';
export const DOC_TABLE_HIGHLIGHT_ID = 'doc_table:highlight';
export const DOC_TABLE_LEGACY_ID = 'doc_table:legacy';
export const TRUNCATE_MAX_HEIGHT_ID = 'truncate:maxHeight';

// Machine learning settings
export const ML_ANOMALY_DETECTION_RESULTS_ENABLE_TIME_DEFAULTS_ID =
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-unified-doc-viewer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

This package contains components and services for the unified doc viewer component.

Discover (Classic view → Expanded document)

![image](https://github.com/elastic/kibana/assets/1178348/a0a360bf-2697-4427-a32e-c728f06f5a7e)

Discover (Document explorer → Toggle dialog with details)

![image](https://github.com/elastic/kibana/assets/1178348/c9c11587-c53f-4bcd-8d48-aaceb64981ea)
Expand Down
28 changes: 2 additions & 26 deletions packages/kbn-unified-doc-viewer/src/services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import type { DataView } from '@kbn/data-views-plugin/public';
import type { AggregateQuery, Query } from '@kbn/es-query';
import type {
DataTableRecord,
DataTableColumnsMeta,
IgnoredReason,
} from '@kbn/discover-utils/types';
import type { DataTableRecord, DataTableColumnsMeta } from '@kbn/discover-utils/types';
import { DocViewsRegistry } from './doc_views_registry';

export interface FieldMapping {
Expand Down Expand Up @@ -77,23 +73,3 @@ interface ComponentDocViewInput extends BaseDocViewInput {
export type DocView = ComponentDocViewInput | RenderDocViewInput;

export type DocViewFactory = () => DocView;

export interface FieldRecordLegacy {
action: {
isActive: boolean;
onFilter?: DocViewFilterFn;
onToggleColumn: ((field: string) => void) | undefined;
flattenedField: unknown;
};
field: {
displayName: string;
field: string;
scripted: boolean;
fieldType?: string;
fieldMapping?: DataViewField;
};
value: {
formattedValue: string;
ignored?: IgnoredReason;
};
}
1 change: 0 additions & 1 deletion packages/kbn-unified-doc-viewer/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export type {
DocViewFilterFn,
DocViewRenderFn,
DocViewRenderProps,
FieldRecordLegacy,
} from './services/types';
2 changes: 1 addition & 1 deletion packages/kbn-unified-doc-viewer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export type { ElasticRequestState } from '.';
export type { DocViewFilterFn, DocViewRenderProps, FieldRecordLegacy } from './src/types';
export type { DocViewFilterFn, DocViewRenderProps } from './src/types';
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { identity } from 'lodash';
import { IUiSettingsClient } from '@kbn/core/public';
import {
DEFAULT_COLUMNS_SETTING,
DOC_TABLE_LEGACY,
MAX_DOC_FIELDS_DISPLAYED,
ROW_HEIGHT_OPTION,
SAMPLE_SIZE_SETTING,
Expand All @@ -39,8 +38,6 @@ export const uiSettingsMock = {
return 10;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
} else if (key === DOC_TABLE_LEGACY) {
return false;
} else if (key === SEARCH_FIELDS_FROM_SOURCE) {
return false;
} else if (key === SHOW_MULTIFIELDS) {
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/discover/public/__mocks__/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { IUiSettingsClient } from '@kbn/core/public';
import {
CONTEXT_TIE_BREAKER_FIELDS_SETTING,
DEFAULT_COLUMNS_SETTING,
DOC_TABLE_LEGACY,
SAMPLE_SIZE_SETTING,
SAMPLE_ROWS_PER_PAGE_SETTING,
SHOW_MULTIFIELDS,
Expand All @@ -27,8 +26,6 @@ export const uiSettingsMock = {
return 100;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
} else if (key === DOC_TABLE_LEGACY) {
return true;
} else if (key === CONTEXT_TIE_BREAKER_FIELDS_SETTING) {
return ['_doc'];
} else if (key === SEARCH_FIELDS_FROM_SOURCE) {
Expand Down
11 changes: 2 additions & 9 deletions src/plugins/discover/public/application/context/context_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import React, { Fragment, memo, useEffect, useRef, useMemo, useCallback } from 'react';
import './context_app.scss';
import classNames from 'classnames';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiText, EuiPage, EuiPageBody, EuiSpacer, useEuiPaddingSize } from '@elastic/eui';
import { css } from '@emotion/react';
Expand All @@ -19,11 +18,7 @@ import { useExecutionContext } from '@kbn/kibana-react-plugin/public';
import { generateFilters } from '@kbn/data-plugin/public';
import { i18n } from '@kbn/i18n';
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import {
DOC_TABLE_LEGACY,
SEARCH_FIELDS_FROM_SOURCE,
SORT_DEFAULT_ORDER_SETTING,
} from '@kbn/discover-utils';
import { SEARCH_FIELDS_FROM_SOURCE, SORT_DEFAULT_ORDER_SETTING } from '@kbn/discover-utils';
import { UseColumnsProps, popularizeField, useColumns } from '@kbn/unified-data-table';
import { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import { DiscoverGridSettings } from '@kbn/saved-search-plugin/common';
Expand Down Expand Up @@ -60,7 +55,6 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
fieldsMetadata,
} = services;

const isLegacy = useMemo(() => uiSettings.get(DOC_TABLE_LEGACY), [uiSettings]);
const useNewFieldsApi = useMemo(() => !uiSettings.get(SEARCH_FIELDS_FROM_SOURCE), [uiSettings]);

/**
Expand Down Expand Up @@ -266,7 +260,7 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
})}
</h1>
<TopNavMenu {...getNavBarProps()} />
<EuiPage className={classNames({ dscDocsPage: !isLegacy })}>
<EuiPage className="dscDocsPage">
<EuiPageBody
panelled
paddingSize="none"
Expand All @@ -291,7 +285,6 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) =>
<ContextAppContentMemoized
dataView={dataView}
useNewFieldsApi={useNewFieldsApi}
isLegacy={isLegacy}
columns={columns}
grid={appState.grid}
onAddColumn={onAddColumnWithTracking}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
import React from 'react';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { ActionBar } from './components/action_bar/action_bar';
import { GetStateReturn } from './services/context_state';
import { SortDirection } from '@kbn/data-plugin/public';
import { UnifiedDataTable } from '@kbn/unified-data-table';
import { ContextAppContent, ContextAppContentProps } from './context_app_content';
import { LoadingStatus } from './services/context_query_state';
import { discoverServiceMock } from '../../__mocks__/services';
import { DocTableWrapper } from '../../components/doc_table/doc_table_wrapper';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { buildDataTableRecord } from '@kbn/discover-utils';
import { act } from 'react-dom/test-utils';
Expand All @@ -29,13 +27,7 @@ const dataViewMock = buildDataViewMock({
});

describe('ContextAppContent test', () => {
const mountComponent = async ({
anchorStatus,
isLegacy,
}: {
anchorStatus?: LoadingStatus;
isLegacy?: boolean;
}) => {
const mountComponent = async ({ anchorStatus }: { anchorStatus?: LoadingStatus }) => {
const hit = {
_id: '123',
_index: 'test_index',
Expand Down Expand Up @@ -75,7 +67,6 @@ describe('ContextAppContent test', () => {
onRemoveColumn: () => {},
onSetColumns: () => {},
sort: [['order_date', 'desc']] as Array<[string, SortDirection]>,
isLegacy: isLegacy ?? true,
setAppState: () => {},
addFilter: () => {},
interceptedWarnings: [],
Expand All @@ -93,29 +84,14 @@ describe('ContextAppContent test', () => {
return component;
};

it('should render legacy table correctly', async () => {
const component = await mountComponent({});
expect(component.find(DocTableWrapper).length).toBe(1);
const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator');
expect(loadingIndicator.length).toBe(0);
expect(component.find(ActionBar).length).toBe(2);
});

it('renders loading indicator', async () => {
const component = await mountComponent({ anchorStatus: LoadingStatus.LOADING });
const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator');
expect(component.find(DocTableWrapper).length).toBe(1);
expect(loadingIndicator.length).toBe(1);
});

it('should render discover grid correctly', async () => {
const component = await mountComponent({ isLegacy: false });
const component = await mountComponent({});
expect(component.find(UnifiedDataTable).length).toBe(1);
expect(findTestSubject(component, 'unifiedDataTableToolbar').exists()).toBe(true);
});

it('should not show display options button', async () => {
const component = await mountComponent({ isLegacy: false });
const component = await mountComponent({});
expect(findTestSubject(component, 'unifiedDataTableToolbar').exists()).toBe(true);
expect(findTestSubject(component, 'dataGridDisplaySelectorButton').exists()).toBe(false);
});
Expand Down
Loading