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][UnifiedFieldList] Integrate unified field list sections into Discover #144045

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
7b33d6b
[UnifiedFieldList] Extract FieldsAccordion component from Lens
jughosta Oct 5, 2022
61975d8
[UnifiedFieldList] Extract FieldList component from Lens
jughosta Oct 5, 2022
8a5c3ab
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Oct 5, 2022
21ba7b4
[UnifiedFieldList] Rename component
jughosta Oct 6, 2022
8cb999d
[UnifiedFieldList] Start extracting logic for fetching fields existen…
jughosta Oct 6, 2022
ae1b988
[UnifiedFieldList] Start extracting logic for fetching fields existen…
jughosta Oct 6, 2022
87f8c1b
[UnifiedFieldList] Fix special and runtime fields
jughosta Oct 6, 2022
8d9a819
[UnifiedFieldList] Start extracting logic for fetching fields existen…
jughosta Oct 6, 2022
ff199ea
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 10, 2022
b972d67
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 10, 2022
a84a26a
[UnifiedFieldList] Make API stricter
jughosta Oct 10, 2022
46bd6e6
[UnifiedFieldList] Make sure that key is specified for items
jughosta Oct 10, 2022
a755602
[UnifiedFieldList] Fetch data for all active data views
jughosta Oct 10, 2022
f0ce67d
[UnifiedFieldList] Refactor some other occurances
jughosta Oct 10, 2022
6035e90
[UnifiedFieldList] Update more tests
jughosta Oct 10, 2022
2db2300
[UnifiedFieldList] Fix some checks
jughosta Oct 10, 2022
78f40c8
[UnifiedFieldList] Some progress on updating tests
jughosta Oct 11, 2022
5135262
[UnifiedFieldList] Update more tests
jughosta Oct 11, 2022
94f7cd3
[UnifiedFieldList] Skip redundant request's results
jughosta Oct 12, 2022
63775a3
[UnifiedFieldList] Update more tests
jughosta Oct 12, 2022
b5759d7
[UnifiedFieldList] Improve tests
jughosta Oct 12, 2022
4d6df85
[UnifiedFieldList] Improve tests
jughosta Oct 12, 2022
76f3138
[UnifiedFieldList] Improve tests
jughosta Oct 12, 2022
5a004d5
[UnifiedFieldList] Move grouping into a customizable hook
jughosta Oct 12, 2022
b46d63d
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 12, 2022
500db7e
[UnifiedFieldList] Fix after the merge
jughosta Oct 13, 2022
f798f7e
[UnifiedFieldList] Fix checks
jughosta Oct 13, 2022
b152e4a
Revert "[UnifiedFieldList] Fix after the merge"
jughosta Oct 13, 2022
bf971e5
[UnifiedFieldList] Handle merge better
jughosta Oct 13, 2022
52dfcd7
[UnifiedFieldList] Update the naming
jughosta Oct 13, 2022
26acca0
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 13, 2022
7d900a5
[UnifiedFieldList] Support Selected fields
jughosta Oct 13, 2022
bb9223f
[UnifiedFieldList] Update tests
jughosta Oct 13, 2022
272613b
[UnifiedFieldList] Fix grouping
jughosta Oct 13, 2022
d1ee686
[UnifiedFieldList] Update more tests
jughosta Oct 13, 2022
df3745b
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 14, 2022
a78ffa3
[UnifiedFieldList] Fix refetch after adding a field
jughosta Oct 14, 2022
2314f5f
[UnifiedFieldList] Load es query builder in async way
jughosta Oct 14, 2022
5a6bdd5
[UnifiedFieldList] Fix a bug in case of renaming a field
jughosta Oct 14, 2022
acf9b3e
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 14, 2022
f3082bf
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 17, 2022
30b5729
[UnifiedFieldList] Small refactoring
jughosta Oct 17, 2022
6b054ed
[UnifiedFieldList] Refactor text based view
jughosta Oct 17, 2022
1bb4dd9
[UnifiedFieldList] Better types support
jughosta Oct 17, 2022
0935693
[UnifiedFieldList] Simplify props
jughosta Oct 17, 2022
6501fc6
[UnifiedFieldList] Fix types
jughosta Oct 17, 2022
3c1c64e
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 17, 2022
0b1218c
[UnifiedFieldList] Async loading for FieldListGrouped code
jughosta Oct 17, 2022
7f045b6
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 18, 2022
92439fd
[UnifiedFieldList] Add more tests
jughosta Oct 19, 2022
f8f7109
[UnifiedFieldList] Add more tests
jughosta Oct 19, 2022
d85b7aa
[UnifiedFieldList] Add more tests
jughosta Oct 19, 2022
c21ad0d
[UnifiedFieldList] Add more tests
jughosta Oct 19, 2022
6688938
[UnifiedFieldList] Add more tests
jughosta Oct 19, 2022
2dc8527
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 19, 2022
2fcbe48
[UnifiedFieldList] Add more tests
jughosta Oct 20, 2022
660e83a
[UnifiedFieldList] Add more tests
jughosta Oct 20, 2022
bc18fa0
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 20, 2022
ea94729
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 24, 2022
bced293
[UnifiedFieldList] Add docs
jughosta Oct 24, 2022
530b595
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 24, 2022
eb49eb5
[UnifiedFieldList] Clean up
jughosta Oct 24, 2022
2b08e8d
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 24, 2022
8ad800f
[UnifiedFieldList] Fix onNoData callback
jughosta Oct 24, 2022
ee302c1
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 24, 2022
643e567
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 25, 2022
1acc00d
[UnifiedFieldList] Address PR comments
jughosta Oct 25, 2022
27f99f9
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 26, 2022
a27f79c
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 27, 2022
cdbceeb
[UnifiedFieldList] Address PR comments
jughosta Oct 27, 2022
0de6254
Merge remote-tracking branch 'upstream/main' into 135678-unified-fiel…
jughosta Oct 28, 2022
3b5aaea
Merge branch 'main' into 135678-unified-field-list-sections
kibanamachine Oct 28, 2022
a66e7b5
[UnifiedFieldList] Support a custom data-test-subj
jughosta Oct 28, 2022
8e1892f
[UnifiedFieldList] Fix concurrency handling logic
jughosta Oct 28, 2022
8c75546
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 28, 2022
59a3590
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Oct 31, 2022
124c82b
[UnifiedFieldList] Remove a generic tooltip message. Lens and Discove…
jughosta Oct 31, 2022
3ec55d9
Merge branch 'main' into 135678-unified-field-list-sections
jughosta Nov 1, 2022
871d361
Merge branch 'main' into 135678-unified-field-list-sections
stratoula Nov 2, 2022
7b64415
[Discover] Rearrange deprecated field stats components to simplify de…
jughosta Oct 25, 2022
527eab1
[Discover] Start integrating the new grouped field list
jughosta Oct 26, 2022
ce071f6
[Discover] Render selected fields too
jughosta Oct 26, 2022
14c6e57
[Discover] Remove "Hide empty fields" toggle
jughosta Oct 26, 2022
4a5eb01
[Discover] Show popular fields
jughosta Oct 27, 2022
26e6b23
[Discover] Refactor selected fields
jughosta Oct 27, 2022
b7468fa
[Discover] Refactor general grouping
jughosta Oct 27, 2022
887d43d
[Discover] Update tests
jughosta Oct 28, 2022
6516d8d
[Discover] Update tests and fix some issues
jughosta Oct 28, 2022
fc349a3
[Discover] Update accordion tooltip and fix flags
jughosta Oct 31, 2022
3f433ed
[Discover] Show loading indicators
jughosta Oct 31, 2022
7a775ae
[Discover] Fix stuck field buttons for text-based queries
jughosta Oct 31, 2022
0dccc8d
[Discover] Add field search highlights
jughosta Oct 31, 2022
ad0fdb7
[Discover] Fix Discover icons for meta fields
jughosta Oct 31, 2022
6a7d165
[Discover] Restore icons for text-based queries
jughosta Oct 31, 2022
f90e86e
[Discover] Update tests
jughosta Oct 31, 2022
0f4cccc
[Discover] Handle edge cases
jughosta Oct 31, 2022
6c947a0
[Discover] Update tests
jughosta Nov 1, 2022
f09663a
[Discover] Update tests
jughosta Nov 1, 2022
3c215c5
[Discover] Update tests
jughosta Nov 1, 2022
616d155
[Discover] Update tests
jughosta Nov 2, 2022
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
43 changes: 24 additions & 19 deletions src/plugins/discover/public/__mocks__/data_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@ import { dataViewMock } from './data_view';
import { dataViewComplexMock } from './data_view_complex';
import { dataViewWithTimefieldMock } from './data_view_with_timefield';

export const dataViewsMock = {
getCache: async () => {
return [dataViewMock];
},
get: async (id: string) => {
if (id === 'the-data-view-id') {
return Promise.resolve(dataViewMock);
} else if (id === 'invalid-data-view-id') {
return Promise.reject('Invald');
}
},
updateSavedObject: jest.fn(),
getIdsWithTitle: jest.fn(() => {
return Promise.resolve([dataViewMock, dataViewComplexMock, dataViewWithTimefieldMock]);
}),
createFilter: jest.fn(),
create: jest.fn(),
clearInstanceCache: jest.fn(),
} as unknown as jest.Mocked<DataViewsContract>;
export function createDiscoverDataViewsMock() {
return {
getCache: async () => {
return [dataViewMock];
},
get: async (id: string) => {
if (id === 'the-data-view-id') {
return Promise.resolve(dataViewMock);
} else if (id === 'invalid-data-view-id') {
return Promise.reject('Invald');
}
},
updateSavedObject: jest.fn(),
getIdsWithTitle: jest.fn(() => {
return Promise.resolve([dataViewMock, dataViewComplexMock, dataViewWithTimefieldMock]);
}),
createFilter: jest.fn(),
create: jest.fn(),
clearInstanceCache: jest.fn(),
getFieldsForIndexPattern: jest.fn((dataView) => dataView.fields),
} as unknown as jest.Mocked<DataViewsContract>;
}

export const dataViewsMock = createDiscoverDataViewsMock();
204 changes: 110 additions & 94 deletions src/plugins/discover/public/__mocks__/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { Observable, of } from 'rxjs';
import { EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme';
import { DiscoverServices } from '../build_services';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
Expand All @@ -23,107 +24,122 @@ import {
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import { TopNavMenu } from '@kbn/navigation-plugin/public';
import { FORMATS_UI_SETTINGS } from '@kbn/field-formats-plugin/common';
import { LocalStorageMock } from './local_storage_mock';
import { chartPluginMock } from '@kbn/charts-plugin/public/mocks';
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';
import { dataViewsMock } from './data_views';
import { Observable, of } from 'rxjs';
const dataPlugin = dataPluginMock.createStartContract();
const expressionsPlugin = expressionsPluginMock.createStartContract();
import { LocalStorageMock } from './local_storage_mock';
import { createDiscoverDataViewsMock } from './data_views';

export function createDiscoverServicesMock(): DiscoverServices {
const dataPlugin = dataPluginMock.createStartContract();
const expressionsPlugin = expressionsPluginMock.createStartContract();

dataPlugin.query.filterManager.getFilters = jest.fn(() => []);
dataPlugin.query.filterManager.getUpdates$ = jest.fn(() => of({}) as unknown as Observable<void>);
dataPlugin.query.filterManager.getFilters = jest.fn(() => []);
dataPlugin.query.filterManager.getUpdates$ = jest.fn(() => of({}) as unknown as Observable<void>);
dataPlugin.query.timefilter.timefilter.createFilter = jest.fn();
dataPlugin.query.timefilter.timefilter.getAbsoluteTime = jest.fn(() => ({
from: '2021-08-31T22:00:00.000Z',
to: '2022-09-01T09:16:29.553Z',
}));
dataPlugin.query.timefilter.timefilter.getTime = jest.fn(() => {
return { from: 'now-15m', to: 'now' };
});
dataPlugin.dataViews = createDiscoverDataViewsMock();

export const discoverServiceMock = {
core: coreMock.createStart(),
chrome: chromeServiceMock.createStartContract(),
history: () => ({
location: {
search: '',
return {
core: coreMock.createStart(),
charts: chartPluginMock.createSetupContract(),
chrome: chromeServiceMock.createStartContract(),
history: () => ({
location: {
search: '',
},
listen: jest.fn(),
}),
data: dataPlugin,
docLinks: docLinksServiceMock.createStartContract(),
capabilities: {
visualize: {
show: true,
},
discover: {
save: false,
},
advancedSettings: {
save: true,
},
},
listen: jest.fn(),
}),
data: dataPlugin,
docLinks: docLinksServiceMock.createStartContract(),
capabilities: {
visualize: {
show: true,
fieldFormats: fieldFormatsMock,
filterManager: dataPlugin.query.filterManager,
inspector: {
open: jest.fn(),
},
discover: {
save: false,
uiSettings: {
get: jest.fn((key: string) => {
if (key === 'fields:popularLimit') {
return 5;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
} else if (key === UI_SETTINGS.META_FIELDS) {
return [];
} else if (key === DOC_HIDE_TIME_COLUMN_SETTING) {
return false;
} else if (key === CONTEXT_STEP_SETTING) {
return 5;
} else if (key === SORT_DEFAULT_ORDER_SETTING) {
return 'desc';
} else if (key === FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE) {
return false;
} else if (key === SAMPLE_SIZE_SETTING) {
return 250;
} else if (key === SAMPLE_ROWS_PER_PAGE_SETTING) {
return 150;
} else if (key === MAX_DOC_FIELDS_DISPLAYED) {
return 50;
} else if (key === HIDE_ANNOUNCEMENTS) {
return false;
}
}),
isDefault: (key: string) => {
return true;
},
},
advancedSettings: {
save: true,
http: {
basePath: '/',
},
},
fieldFormats: fieldFormatsMock,
filterManager: dataPlugin.query.filterManager,
inspector: {
open: jest.fn(),
},
uiSettings: {
get: jest.fn((key: string) => {
if (key === 'fields:popularLimit') {
return 5;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
} else if (key === UI_SETTINGS.META_FIELDS) {
return [];
} else if (key === DOC_HIDE_TIME_COLUMN_SETTING) {
return false;
} else if (key === CONTEXT_STEP_SETTING) {
return 5;
} else if (key === SORT_DEFAULT_ORDER_SETTING) {
return 'desc';
} else if (key === FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE) {
return false;
} else if (key === SAMPLE_SIZE_SETTING) {
return 250;
} else if (key === SAMPLE_ROWS_PER_PAGE_SETTING) {
return 150;
} else if (key === MAX_DOC_FIELDS_DISPLAYED) {
return 50;
} else if (key === HIDE_ANNOUNCEMENTS) {
return false;
}
}),
isDefault: (key: string) => {
return true;
dataViewEditor: {
userPermissions: {
editDataView: () => true,
},
},
dataViewFieldEditor: {
openEditor: jest.fn(),
userPermissions: {
editIndexPattern: jest.fn(),
},
},
navigation: {
ui: { TopNavMenu, AggregateQueryTopNavMenu: TopNavMenu },
},
},
http: {
basePath: '/',
},
dataViewEditor: {
userPermissions: {
editDataView: () => true,
metadata: {
branch: 'test',
},
},
dataViewFieldEditor: {
openEditor: jest.fn(),
userPermissions: {
editIndexPattern: jest.fn(),
theme: {
useChartsTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme),
useChartsBaseTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme),
},
},
navigation: {
ui: { TopNavMenu, AggregateQueryTopNavMenu: TopNavMenu },
},
metadata: {
branch: 'test',
},
theme: {
useChartsTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme),
useChartsBaseTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme),
},
storage: new LocalStorageMock({}) as unknown as Storage,
addBasePath: jest.fn(),
toastNotifications: {
addInfo: jest.fn(),
addWarning: jest.fn(),
addDanger: jest.fn(),
addSuccess: jest.fn(),
},
expressions: expressionsPlugin,
savedObjectsTagging: {},
dataViews: dataViewsMock,
timefilter: { createFilter: jest.fn() },
} as unknown as DiscoverServices;
storage: new LocalStorageMock({}) as unknown as Storage,
addBasePath: jest.fn(),
toastNotifications: {
addInfo: jest.fn(),
addWarning: jest.fn(),
addDanger: jest.fn(),
addSuccess: jest.fn(),
},
expressions: expressionsPlugin,
savedObjectsTagging: {},
dataViews: dataPlugin.dataViews,
timefilter: dataPlugin.query.timefilter.timefilter,
} as unknown as DiscoverServices;
}

export const discoverServiceMock = createDiscoverServicesMock();
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ discover-app {
overflow: hidden;
}

.dscPageBody__sidebar {
position: relative;
}

.dscPageContent__wrapper {
padding: $euiSizeS $euiSizeS $euiSizeS 0;
overflow: hidden; // Ensures horizontal scroll of table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
DataTotalHits$,
RecordRawType,
} from '../../hooks/use_saved_search';
import { discoverServiceMock } from '../../../../__mocks__/services';
import { createDiscoverServicesMock } from '../../../../__mocks__/services';
import { FetchStatus } from '../../../types';
import { RequestAdapter } from '@kbn/inspector-plugin/common';
import { DiscoverSidebar } from '../sidebar/discover_sidebar';
Expand Down Expand Up @@ -118,14 +118,11 @@ async function mountComponent(
) {
const searchSourceMock = createSearchSourceMock({});
const services = {
...discoverServiceMock,
...createDiscoverServicesMock(),
storage: new LocalStorageMock({
[SIDEBAR_CLOSED_KEY]: prevSidebarClosed,
}) as unknown as Storage,
} as unknown as DiscoverServices;
services.data.query.timefilter.timefilter.getAbsoluteTime = () => {
return { from: '2020-05-14T11:05:13.590', to: '2020-05-14T11:20:13.590' };
};

const dataViewList = [dataView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export function DiscoverLayout({
history={history}
/>
<EuiFlexGroup className="dscPageBody__contents" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} className="dscPageBody__sidebar">
<SidebarMemoized
columns={columns}
documents$={savedSearchData$.documents$}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
DataTotalHits$,
RecordRawType,
} from '../../hooks/use_saved_search';
import { discoverServiceMock } from '../../../../__mocks__/services';
import { createDiscoverServicesMock } from '../../../../__mocks__/services';
import { FetchStatus } from '../../../types';
import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { buildDataTableRecord } from '../../../../utils/build_data_record';
Expand Down Expand Up @@ -110,10 +110,7 @@ const mountComponent = async ({
savedSearch?: SavedSearch;
resetSavedSearch?: () => void;
} = {}) => {
let services = discoverServiceMock;
services.data.query.timefilter.timefilter.getAbsoluteTime = () => {
return { from: '2020-05-14T11:05:13.590', to: '2020-05-14T11:20:13.590' };
};
let services = createDiscoverServicesMock();

if (storage) {
services = { ...services, storage };
Expand Down
Loading