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] EuiDataGrid Implementation #67259

Merged
merged 272 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
272 commits
Select commit Hold shift + click to select a range
9eb57e6
Merge remote-tracking branch 'upstream/master' into discover-data-grid
Feb 25, 2020
156a558
perf improvements
mbondyra Feb 25, 2020
8761909
Merge branch 'discover-data-grid' of github.com:myasonik/kibana into …
snide Feb 26, 2020
f6b2cee
basic layout and scrolling now works
snide Feb 27, 2020
78a7405
attempting to get tests to pass again
Feb 27, 2020
2bc70e9
fixed infinite scroll of legacy table
Feb 28, 2020
1702235
fixing sorting and schema detection and other bugs
Feb 28, 2020
b3b873d
Merge remote-tracking branch 'upstream/master' into discover-data-grid
Mar 10, 2020
c372a0d
updating to use new state stuff
Mar 11, 2020
464eb22
Merge remote-tracking branch 'upstream/master' into discover-data-grid
snide Mar 12, 2020
6443dea
Merge master /fix conflicts
kertal May 23, 2020
6809cfc
Merge commit 'dcfa4850098972b6b00fe869048e61602aea4683' into kertal-p…
kertal May 23, 2020
5c97e03
Merge master /fix conflicts
kertal May 23, 2020
0819ae5
Activate DataGrid in embeddable
kertal May 25, 2020
3cfe3d3
Add missing setLegacyDiscoverTable
kertal May 25, 2020
2378865
Remove discover_page.js
kertal May 25, 2020
1afe791
Fix tests
kertal May 25, 2020
7febeb6
Fix i18n
kertal May 26, 2020
0b37c40
Add uiSettings
kertal May 27, 2020
c2d44e3
Fix pagination
kertal May 27, 2020
6921cbf
Fix i18n
kertal May 27, 2020
b821f58
Improve performance
kertal May 28, 2020
bf18d72
Implement column selection
kertal Jun 8, 2020
57adb3f
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 9, 2020
3ca7c95
Adapt Histogram layout
kertal Jun 9, 2020
b8ff6b1
Merge master /fix conflicts
kertal Jun 9, 2020
485ad26
Fix adding columns
kertal Jun 10, 2020
3388519
Make position of timecolumn sortable
kertal Jun 10, 2020
f3b90e6
Modify naming of a indexpatterns timefield
kertal Jun 10, 2020
d54621d
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 10, 2020
fedddb9
Undo accidentally commited kbn-pm changes
kertal Jun 10, 2020
c285360
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 10, 2020
1334dec
Undo accidentally commited kbn-pm changes II
kertal Jun 10, 2020
f440260
Merge master /fix conflicts
kertal Jun 12, 2020
75db54e
Improve performance by removing inMemory property of EuiDataGrid
kertal Jun 12, 2020
2a1cc5d
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 15, 2020
82b164c
Fix the header/EuiDataGrid overlapping
kertal Jun 15, 2020
36984e2
Migrate flyout and popover to separate files
kertal Jun 15, 2020
637950d
Improve performance
kertal Jun 15, 2020
3b18bc4
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 16, 2020
0b9deb0
Code improvements
kertal Jun 16, 2020
5c7b26c
Even more code improvements
kertal Jun 16, 2020
3d84981
Debugging version for chandler
kertal Jun 16, 2020
5c2cfc5
Refactor to use context for flyout
kertal Jun 18, 2020
5c4b98d
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jun 18, 2020
b413092
Refactor to use context for flyout II
kertal Jun 18, 2020
7a5db46
Datagrid vision
kertal Jun 23, 2020
1281668
Merge master /fix conflicts
kertal Jun 26, 2020
80ad99e
cleanup and split of components into files
kertal Jun 26, 2020
43e5bce
Merge master
kertal Jul 6, 2020
b73f4e6
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 9, 2020
9395e51
Migrate discover.html to discover.tsx
kertal Jul 9, 2020
9048c18
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 9, 2020
be0dcb7
Fix filters
kertal Jul 9, 2020
8a504bc
Improve CSS
kertal Jul 11, 2020
81cba19
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 11, 2020
9136db3
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 13, 2020
ddfedda
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 14, 2020
e0cb6a8
Add column header actions
kertal Jul 15, 2020
9a5dc1c
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 15, 2020
c502415
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 16, 2020
d053550
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 17, 2020
acdc592
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Jul 21, 2020
096a81d
Fix tests
kertal Jul 21, 2020
7682282
adding toggle of chart
andreadelrio Jul 21, 2020
369dd1d
Merge master /fix conflicts
kertal Jul 22, 2020
62b480f
Fix tests
kertal Jul 22, 2020
9a26fcf
Fix i18n
kertal Jul 22, 2020
a1151df
Use EuiResizableContainer to make columns resizeable
kertal Jul 23, 2020
2039f1c
fix conflict
andreadelrio Jul 27, 2020
d9c9997
merged from kertal's branch
andreadelrio Jul 28, 2020
e751fd4
clean sass file
andreadelrio Jul 28, 2020
539b1ac
improve dscResultCount in smaller screens
andreadelrio Jul 30, 2020
6c8bf2d
Merge pull request #6 from andreadelrio/hide-chart
kertal Aug 5, 2020
16b0a8c
Merge master/fix conflicts
kertal Aug 18, 2020
ae4ee04
Merge branch 'kertal-pr-2020-04-25-discover-data-grid' of github.com:…
kertal Aug 19, 2020
7a243bb
Fix type error
kertal Aug 19, 2020
0c79e40
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Aug 19, 2020
a26169f
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Aug 24, 2020
2cde541
Rename doc_table:legacyTable to doc_table:legacy for eslint
kertal Aug 24, 2020
182bea2
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Aug 25, 2020
70fb429
Use records instead of hits as wording
kertal Aug 25, 2020
381e3bf
Enable persistence of data grid columns width
kertal Aug 25, 2020
8a780b9
improve expanded doc flyout design
andreadelrio Aug 31, 2020
72bdf33
remove EuiLink
andreadelrio Aug 31, 2020
e226a84
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Sep 1, 2020
f4bac9c
Fix legacy embeddable
kertal Sep 1, 2020
c09e420
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Sep 4, 2020
638d0e7
Enable columnsWidth in embeddable, remove filters from cell
kertal Sep 5, 2020
e24ab3e
Fix types
kertal Sep 8, 2020
d070949
Fix context href
kertal Sep 8, 2020
e4750d8
Merge pull request #7 from andreadelrio/expandedDocFlyout
kertal Sep 14, 2020
59de5e8
Merge master/fix conflicts
kertal Sep 14, 2020
c52931d
Improve dashboard code, add no results rendering
kertal Sep 14, 2020
4df03eb
temporarily remove EuiResizableContainer
andreadelrio Sep 14, 2020
760b84a
need to move button to the right section
andreadelrio Sep 15, 2020
39cb3b2
working on Fields mobile button
andreadelrio Sep 16, 2020
df9a482
improve Fields button in mobile
andreadelrio Sep 21, 2020
aaee7e2
Merge master / fix conflicts
kertal Sep 23, 2020
997c00f
didn't really need an extra component
andreadelrio Sep 23, 2020
9e74d0c
available fields accordion
andreadelrio Sep 23, 2020
38acb01
lots of cleanup
andreadelrio Sep 25, 2020
e582aa3
Merge master / fix conflicts
kertal Sep 25, 2020
28f8897
Fix functional test
kertal Sep 26, 2020
a04bc8d
Refactor getDefaultState
kertal Sep 27, 2020
0f8bc2f
i18n for fields
andreadelrio Sep 28, 2020
b2ad20d
Merge master / fix conflicts
kertal Sep 28, 2020
8793fb4
fix No Results screen on mobile
andreadelrio Sep 28, 2020
ee40566
improve Expanded Document flyout in mobile
andreadelrio Sep 29, 2020
709afd9
give tokens color
andreadelrio Sep 29, 2020
8830406
add NotificationBadge to accordions
andreadelrio Sep 29, 2020
e629524
add EuiShowFor and EuiHideFor
andreadelrio Sep 29, 2020
aae3b7e
make NotificationBadges in sidebar consider filters
andreadelrio Sep 30, 2020
e4f3e89
update Filter button on sidebar
andreadelrio Sep 30, 2020
2e30b1e
removed some boostrap and did some cleanup in legacy
andreadelrio Oct 1, 2020
567b6f2
show the flyout in legacy
andreadelrio Oct 1, 2020
0aa72ed
Merge master / fix conflicts
kertal Oct 2, 2020
03af0ce
Shared state refactoring
kertal Oct 2, 2020
789e469
Fix flyover not showing icons permanetly
kertal Oct 2, 2020
b6d3a93
update loading screens
andreadelrio Oct 2, 2020
8127b20
fix empty state
andreadelrio Oct 5, 2020
4ad36d9
remove fixed height
andreadelrio Oct 6, 2020
88cb1d2
Fix infinite scrolling
kertal Oct 7, 2020
429e4a4
Adapt infinite scrolling, allow user to hide chart in legacy
kertal Oct 7, 2020
fd5fe4f
couple of tiny styling fixes
andreadelrio Oct 7, 2020
9a29cfb
revert
andreadelrio Oct 7, 2020
fbd920a
Merge pull request #8 from andreadelrio/responsive-discover
andreadelrio Oct 7, 2020
0ca31a4
Merge and fix conflicts
kertal Oct 8, 2020
d0d81cf
Merge and fix conflicts
kertal Oct 9, 2020
121d0d0
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Oct 12, 2020
e8a9b08
Fix jest test + type errors + unused variables
kertal Oct 15, 2020
e2232c8
Merge and fix conflicts
kertal Oct 15, 2020
e56455c
Fix a11y test
kertal Oct 15, 2020
e7f7edf
Fix skipToBottom button
kertal Oct 15, 2020
5b5385a
Adapt mocks
kertal Oct 16, 2020
7b74b09
Add JSON schema rendering
kertal Oct 16, 2020
d6f89ac
Fix _source schema
kertal Oct 18, 2020
4ca957d
Fix a11y tests
kertal Oct 19, 2020
9383958
Improve loading spinner for legacy
kertal Oct 19, 2020
7fa93ee
Fix functional tests
kertal Oct 19, 2020
9663022
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Oct 19, 2020
2b10e04
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Oct 20, 2020
bce5d48
Fix dashboard rendering, refactor col width persistence
kertal Oct 20, 2020
b89e980
fix datagrid in fullscreen
andreadelrio Oct 21, 2020
cca4d3e
Improve document selection code
kertal Oct 22, 2020
5099bed
better fix
andreadelrio Oct 22, 2020
f94a073
Merge upstream, fix conflicts
kertal Nov 2, 2020
52afe76
Fix conflicts
kertal Nov 2, 2020
379ba45
Merge pull request #9 from andreadelrio/dg-fullscreen
kertal Nov 2, 2020
679bee9
Fix get_inner_angular.ts
kertal Nov 2, 2020
2b9fb24
Merge branch 'kertal-pr-2020-04-25-discover-data-grid' of github.com:…
kertal Nov 2, 2020
e1e52f0
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 4, 2020
f9fe460
Simplify code and cleanup CSS
kertal Nov 4, 2020
61ef7cc
Merge and fix conflicts
kertal Nov 6, 2020
06239d7
Fix types
kertal Nov 6, 2020
1e64917
Fix types
kertal Nov 6, 2020
c66dca5
Cleanup
kertal Nov 6, 2020
fa36978
simple cleanup to Selected Records flyout
andreadelrio Nov 10, 2020
5c9c203
Merge pull request #11 from andreadelrio/sr-basic
kertal Nov 12, 2020
7864bed
Merge and fix conflicts
kertal Nov 12, 2020
5bdeaeb
Merge branch 'kertal-pr-2020-04-25-discover-data-grid' of github.com:…
kertal Nov 12, 2020
40c8419
Fix column actions displayed in expand column
kertal Nov 12, 2020
495500a
Cleanup code
kertal Nov 16, 2020
3b85fbb
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 16, 2020
daf9939
Remove selection code (to restore in a different PR)
kertal Nov 17, 2020
ab68cfd
Merge and fix conflicts
kertal Nov 17, 2020
f9522f2
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 20, 2020
e9e7cb0
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 22, 2020
dec4609
Add functional tests
kertal Nov 23, 2020
34ed605
Refactor functional tests
kertal Nov 23, 2020
caf50b6
Add field data tests
kertal Nov 23, 2020
91270f6
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 24, 2020
f76e4a2
Fix bad syntax test
kertal Nov 24, 2020
e5ebfe4
Add doc navigation functional tests
kertal Nov 24, 2020
6711c00
Merge and fix conflicts
kertal Nov 28, 2020
7248c0b
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 30, 2020
f613d0e
Cleanup code
kertal Nov 30, 2020
cb23203
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Nov 30, 2020
62d6a87
Add doc table functional tests
kertal Dec 1, 2020
bde5f96
Fix functional
kertal Dec 1, 2020
32ac7cd
Fix functional
kertal Dec 1, 2020
072bf4d
Add jest tests
kertal Dec 1, 2020
02ee34a
Fix functional tests
kertal Dec 1, 2020
cf53aee
Merge and fix conflicts
kertal Dec 3, 2020
a457a28
Merge master / Add jest tests
kertal Dec 7, 2020
8e6dbb1
Merge and fix conflicts
kertal Dec 7, 2020
60ec2e9
Fix tests
kertal Dec 7, 2020
0f6f58d
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 7, 2020
13de7ed
Cleanup
kertal Dec 7, 2020
59a7102
More cleanups
kertal Dec 7, 2020
1a3f19a
Small fixes
kertal Dec 7, 2020
c0b3a24
Fix embeddable
kertal Dec 8, 2020
23ef438
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 8, 2020
3353dac
Address review comments
kertal Dec 9, 2020
4ab2702
Address review comments
kertal Dec 9, 2020
731e63c
Change handling of default sort, allow unsorted data
kertal Dec 10, 2020
4210bbc
Allow user to remove all sorting
kertal Dec 10, 2020
5786f1e
Fix get_sharing_data.test.ts
kertal Dec 10, 2020
d3245b6
Fix discover_grid_columns.test.tsx
kertal Dec 10, 2020
ba40602
Don't add default for grid in saved object
kertal Dec 10, 2020
29198b1
Fix sharing functional test
kertal Dec 10, 2020
7a72c75
Add string to data grid schemas
kertal Dec 10, 2020
12bad03
Improve default column handling
kertal Dec 10, 2020
ad590fa
Fix test and types
kertal Dec 10, 2020
61c485d
Improve documentation
kertal Dec 10, 2020
beccad2
add truncation to source
andreadelrio Dec 11, 2020
5b79f66
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 12, 2020
3f0fee6
Fix types
kertal Dec 12, 2020
ee6dd92
Undo search source modification
kertal Dec 12, 2020
49c7fc0
Merge branch 'kertal-pr-2020-04-25-discover-data-grid' of github.com:…
kertal Dec 12, 2020
20d6492
Fix discover - dashboard overlapping
kertal Dec 13, 2020
689c888
Adapt UI settings wording
kertal Dec 13, 2020
1e61efe
Add functional test for dashboard
kertal Dec 13, 2020
33a68d8
Improve columns sorting
kertal Dec 13, 2020
e54cc4c
Improve selected columns sorting
kertal Dec 13, 2020
5a7b02c
Refactorings and docs
kertal Dec 13, 2020
5833f8a
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 13, 2020
c13501c
Fix type
kertal Dec 14, 2020
3282a02
Merge and fix conflicts
kertal Dec 15, 2020
01b5868
Fix types and tests
kertal Dec 15, 2020
ee0739c
Add sidebar aria label
kertal Dec 15, 2020
f2f18e5
Address review comments
kertal Dec 15, 2020
1cbfee5
Fix adding of filter in full screen mode
kertal Dec 15, 2020
b87e721
Merge branch 'master' into kertal-pr-2020-04-25-discover-data-grid
kibanamachine Dec 15, 2020
832205b
Merge master / update uiSettings text
kertal Dec 16, 2020
6b78e84
Merge branch 'kertal-pr-2020-04-25-discover-data-grid' of github.com:…
kertal Dec 16, 2020
0ad2cb7
Change _source to use EuiDescriptionList component
Dec 17, 2020
db0ff46
Change remove column icon from eye to cross
Dec 17, 2020
ec996e2
Change expand button to use EuiButtonIcon
Dec 17, 2020
9eb6375
Remove unused CSS
Dec 17, 2020
917fd5c
Stylistic update to flyout
Dec 17, 2020
91df3b7
Adding tooltips / titles to icon only buttons
Dec 17, 2020
49938ef
Min height for chart heading and added border
Dec 17, 2020
41d645a
Address review comments part 1
kertal Dec 18, 2020
9d5b5c4
Fix functional test
kertal Dec 18, 2020
ef0933e
Show filters also if a field is searchable ... of course
kertal Dec 18, 2020
f9685c7
more design cleanup for dg
snide Dec 18, 2020
b20b6e9
amsterdam fix
snide Dec 18, 2020
a97af79
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 18, 2020
917fdcd
Fix import
kertal Dec 18, 2020
53b7499
Close flyout when filter, column is added
kertal Dec 21, 2020
1c23410
Implement row highlighting when flyout is displayed
kertal Dec 22, 2020
3836c15
Fix TypeScript errors
kertal Dec 22, 2020
ccf908b
Merge and fix conflicts
kertal Dec 22, 2020
c0eadc9
Fix embeddable
kertal Dec 22, 2020
61774d3
Improve schema for objects and geo_point data
kertal Dec 22, 2020
5847ad9
Fix functional test
kertal Dec 22, 2020
f482f11
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-04…
kertal Dec 22, 2020
46f60d7
Move embeddable functional tests to dashboard
kertal Dec 22, 2020
71d943f
Hopefully fix functional test
kertal Dec 23, 2020
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
4 changes: 4 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ 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`::
Control the way the Discover's table looks and works. Set this property to `true` to revert to the legacy implementation.


[float]
[[kibana-ml-settings]]
==== Machine learning
Expand Down
14 changes: 14 additions & 0 deletions src/core/public/chrome/ui/header/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
@include euiHeaderAffordForFixed;

.euiDataGrid__restrictBody {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is necessary to prevent the overlapping of our application header with the full height view of data grid

.headerGlobalNav,
.kbnQueryBar {
display: none;
}
}

.euiDataGrid__restrictBody.euiBody--headerIsFixed {
.euiFlyout {
top: 0;
height: 100%;
}
}

.chrHeaderHelpMenu__version {
text-transform: none;
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/discover/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export const FIELDS_LIMIT_SETTING = 'fields:popularLimit';
export const CONTEXT_DEFAULT_SIZE_SETTING = 'context:defaultSize';
export const CONTEXT_STEP_SETTING = 'context:step';
export const CONTEXT_TIE_BREAKER_FIELDS_SETTING = 'context:tieBreakerFields';
export const DOC_TABLE_LEGACY = 'doc_table:legacy';
export const MODIFY_COLUMNS_ON_SWITCH = 'discover:modifyColumnsOnSwitch';
18 changes: 17 additions & 1 deletion src/plugins/discover/public/__mocks__/index_pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,40 @@ import { IndexPattern } from '../../../data/common';
import { indexPatterns } from '../../../data/public';

const fields = [
{
name: '_source',
type: '_source',
scripted: false,
filterable: false,
aggregatable: false,
},
{
name: '_index',
type: 'string',
scripted: false,
filterable: true,
aggregatable: false,
},
{
name: 'message',
type: 'string',
scripted: false,
filterable: false,
aggregatable: false,
},
{
name: 'extension',
type: 'string',
scripted: false,
filterable: true,
aggregatable: true,
},
{
name: 'bytes',
type: 'number',
scripted: false,
filterable: true,
aggregatable: true,
},
{
name: 'scripted',
Expand All @@ -62,16 +73,21 @@ const indexPattern = ({
id: 'the-index-pattern-id',
title: 'the-index-pattern-title',
metaFields: ['_index', '_score'],
formatField: jest.fn(),
flattenHit: undefined,
formatHit: jest.fn((hit) => hit._source),
fields,
getComputedFields: () => ({}),
getComputedFields: () => ({ docvalueFields: [], scriptFields: {}, storedFields: ['*'] }),
getSourceFiltering: () => ({}),
getFieldByName: () => ({}),
timeFieldName: '',
docvalueFields: [],
} as unknown) as IndexPattern;

indexPattern.flattenHit = indexPatterns.flattenHitWrapper(indexPattern, indexPattern.metaFields);
indexPattern.isTimeBased = () => !!indexPattern.timeFieldName;
indexPattern.formatField = (hit: Record<string, any>, fieldName: string) => {
return fieldName === '_source' ? hit._source : indexPattern.flattenHit(hit)[fieldName];
};

export const indexPatternMock = indexPattern;
28 changes: 25 additions & 3 deletions src/plugins/discover/public/application/angular/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import moment from 'moment';
import dateMath from '@elastic/datemath';
import { i18n } from '@kbn/i18n';
import { createSearchSessionRestorationDataProvider, getState, splitState } from './discover_state';

import { RequestAdapter } from '../../../../inspector/public';
import {
connectToQueryState,
Expand All @@ -35,6 +34,7 @@ import {
import { getSortArray } from './doc_table';
import * as columnActions from './doc_table/actions/columns';
import indexTemplateLegacy from './discover_legacy.html';
import indexTemplateGrid from './discover_datagrid.html';
import { addHelpMenuToAppChrome } from '../components/help_menu/help_menu_util';
import { discoverResponseHandler } from './response_handler';
import {
Expand Down Expand Up @@ -124,7 +124,9 @@ app.config(($routeProvider) => {
};
const discoverRoute = {
...defaults,
template: indexTemplateLegacy,
template: getServices().uiSettings.get('doc_table:legacy', true)
? indexTemplateLegacy
: indexTemplateGrid,
reloadOnSearch: false,
resolve: {
savedObjects: function ($route, Promise) {
Expand Down Expand Up @@ -340,6 +342,8 @@ function discoverController($element, $route, $scope, $timeout, Promise, uiCapab
$scope.minimumVisibleRows = 50;
$scope.fetchStatus = fetchStatuses.UNINITIALIZED;
$scope.showSaveQuery = uiCapabilities.discover.saveQuery;
$scope.showTimeCol =
!config.get('doc_table:hideTimeColumn', false) && $scope.indexPattern.timeFieldName;

let abortController;
$scope.$on('$destroy', () => {
Expand Down Expand Up @@ -414,7 +418,7 @@ function discoverController($element, $route, $scope, $timeout, Promise, uiCapab
const query = $scope.searchSource.getField('query') || data.query.queryString.getDefaultQuery();
const sort = getSortArray(savedSearch.sort, $scope.indexPattern);

return {
const defaultState = {
query,
sort: !sort.length
? getDefaultSort($scope.indexPattern, config.get(SORT_DEFAULT_ORDER_SETTING, 'desc'))
Expand All @@ -427,6 +431,11 @@ function discoverController($element, $route, $scope, $timeout, Promise, uiCapab
interval: 'auto',
filters: _.cloneDeep($scope.searchSource.getOwnField('filter')),
};
if (savedSearch.grid) {
defaultState.grid = savedSearch.grid;
}

return defaultState;
}

$scope.state.index = $scope.indexPattern.id;
Expand All @@ -440,6 +449,8 @@ function discoverController($element, $route, $scope, $timeout, Promise, uiCapab
indexPatternList: $route.current.locals.savedObjects.ip.list,
config: config,
setHeaderActionMenu: getHeaderActionMenuMounter(),
filterManager,
setAppState,
data,
};

Expand Down Expand Up @@ -783,6 +794,17 @@ function discoverController($element, $route, $scope, $timeout, Promise, uiCapab
const columns = columnActions.moveColumn($scope.state.columns, columnName, newIndex);
setAppState({ columns });
};

$scope.setColumns = function setColumns(columns) {
// remove first element of columns if it's the configured timeFieldName, which is prepended automatically
const actualColumns =
$scope.indexPattern.timeFieldName && $scope.indexPattern.timeFieldName === columns[0]
? columns.slice(1)
: columns;
$scope.state = { ...$scope.state, columns: actualColumns };
setAppState({ columns: actualColumns });
};

async function setupVisualization() {
// If no timefield has been specified we don't create a histogram of messages
if (!getTimeField()) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<discover-app>
<discover
fetch="fetch"
fetch-counter="fetchCounter"
fetch-error="fetchError"
field-counts="fieldCounts"
histogram-data="histogramData"
hits="hits"
index-pattern="indexPattern"
on-add-column="addColumn"
on-add-filter="filterQuery"
on-change-interval="changeInterval"
on-remove-column="removeColumn"
on-set-columns="setColumns"
on-sort="setSortOrder"
opts="opts"
reset-query="resetQuery"
result-state="resultState"
rows="rows"
search-source="searchSource"
set-index-pattern="setIndexPattern"
show-save-query="showSaveQuery"
state="state"
time-filter-update-handler="timefilterUpdateHandler"
time-range="timeRange"
top-nav-menu="topNavMenu"
update-query="updateQuery"
update-saved-query-id="updateSavedQueryId"
>
</discover>
</discover-app>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<discover-app>
<discover-legacy
add-column="addColumn"
fetch="fetch"
fetch-counter="fetchCounter"
fetch-error="fetchError"
Expand All @@ -9,6 +8,7 @@
hits="hits"
index-pattern="indexPattern"
minimum-visible-rows="minimumVisibleRows"
on-add-column="addColumn"
on-add-filter="filterQuery"
on-move-column="moveColumn"
on-change-interval="changeInterval"
Expand All @@ -20,7 +20,6 @@
reset-query="resetQuery"
result-state="resultState"
rows="rows"
saved-search="savedSearch"
search-source="searchSource"
set-index-pattern="setIndexPattern"
show-save-query="showSaveQuery"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
SearchSessionInfoProvider,
} from '../../../../data/public';
import { migrateLegacyQuery } from '../helpers/migrate_legacy_query';
import { DiscoverGridSettings } from '../components/discover_grid/types';
import { DISCOVER_APP_URL_GENERATOR, DiscoverUrlGeneratorState } from '../../url_generator';

export interface AppState {
Expand All @@ -47,6 +48,10 @@ export interface AppState {
* Array of applied filters
*/
filters?: Filter[];
/**
* Data Grid related state
*/
grid?: DiscoverGridSettings;
/**
* id of the used index pattern
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Discover } from './discover';

export function createDiscoverDirective(reactDirective: any) {
return reactDirective(Discover, [
['fetch', { watchDepth: 'reference' }],
['fetchCounter', { watchDepth: 'reference' }],
['fetchError', { watchDepth: 'reference' }],
['fieldCounts', { watchDepth: 'reference' }],
['histogramData', { watchDepth: 'reference' }],
['hits', { watchDepth: 'reference' }],
['indexPattern', { watchDepth: 'reference' }],
['onAddColumn', { watchDepth: 'reference' }],
['onAddFilter', { watchDepth: 'reference' }],
['onChangeInterval', { watchDepth: 'reference' }],
['onRemoveColumn', { watchDepth: 'reference' }],
['onSetColumns', { watchDepth: 'reference' }],
['onSort', { watchDepth: 'reference' }],
['opts', { watchDepth: 'reference' }],
['resetQuery', { watchDepth: 'reference' }],
['resultState', { watchDepth: 'reference' }],
['rows', { watchDepth: 'reference' }],
['searchSource', { watchDepth: 'reference' }],
['setColumns', { watchDepth: 'reference' }],
['setIndexPattern', { watchDepth: 'reference' }],
['showSaveQuery', { watchDepth: 'reference' }],
['state', { watchDepth: 'reference' }],
['timefilterUpdateHandler', { watchDepth: 'reference' }],
['timeRange', { watchDepth: 'reference' }],
['topNavMenu', { watchDepth: 'reference' }],
['updateQuery', { watchDepth: 'reference' }],
['updateSavedQueryId', { watchDepth: 'reference' }],
]);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import * as React from 'react';
import { I18nProvider } from '@kbn/i18n/react';
import { DiscoverGrid, DiscoverGridProps } from './discover_grid/discover_grid';
import { getServices } from '../../kibana_services';

export const DataGridMemoized = React.memo((props: DiscoverGridProps) => (
<DiscoverGrid {...props} />
));

export function DiscoverGridEmbeddable(props: DiscoverGridProps) {
return (
<I18nProvider>
<DataGridMemoized {...props} services={getServices()} />
</I18nProvider>
);
}

/**
* this is just needed for the embeddable
*/
export function createDiscoverGridDirective(reactDirective: any) {
return reactDirective(DiscoverGridEmbeddable, [
['columns', { watchDepth: 'collection' }],
['indexPattern', { watchDepth: 'reference' }],
['onAddColumn', { watchDepth: 'reference', wrapApply: false }],
['onFilter', { watchDepth: 'reference', wrapApply: false }],
['onRemoveColumn', { watchDepth: 'reference', wrapApply: false }],
['onSetColumns', { watchDepth: 'reference', wrapApply: false }],
['onSort', { watchDepth: 'reference', wrapApply: false }],
['rows', { watchDepth: 'collection' }],
['sampleSize', { watchDepth: 'reference' }],
['searchDescription', { watchDepth: 'reference' }],
['searchTitle', { watchDepth: 'reference' }],
['settings', { watchDepth: 'reference' }],
['showTimeCol', { watchDepth: 'value' }],
['sort', { watchDepth: 'value' }],
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { DiscoverLegacy } from './discover_legacy';

export function createDiscoverLegacyDirective(reactDirective: any) {
return reactDirective(DiscoverLegacy, [
['addColumn', { watchDepth: 'reference' }],
['fetch', { watchDepth: 'reference' }],
['fetchCounter', { watchDepth: 'reference' }],
['fetchError', { watchDepth: 'reference' }],
Expand All @@ -30,6 +29,7 @@ export function createDiscoverLegacyDirective(reactDirective: any) {
['hits', { watchDepth: 'reference' }],
['indexPattern', { watchDepth: 'reference' }],
['minimumVisibleRows', { watchDepth: 'reference' }],
['onAddColumn', { watchDepth: 'reference' }],
['onAddFilter', { watchDepth: 'reference' }],
['onChangeInterval', { watchDepth: 'reference' }],
['onMoveColumn', { watchDepth: 'reference' }],
Expand Down
Loading