Skip to content

Commit b89e13e

Browse files
committed
[ML] Use EuiDataGrid for transform wizard. (#52510)
Replaces the custom EuiInMemoryTable component with EuiDataGrid for the transforms wizard.
1 parent e099793 commit b89e13e

17 files changed

Lines changed: 515 additions & 582 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { EuiDataGridStyle } from '@elastic/eui';
8+
9+
export const euiDataGridStyle: EuiDataGridStyle = {
10+
border: 'all',
11+
fontSize: 's',
12+
cellPadding: 's',
13+
stripes: false,
14+
rowHover: 'highlight',
15+
header: 'shade',
16+
};
17+
18+
export const euiDataGridToolbarSettings = {
19+
showColumnSelector: true,
20+
showStyleSelector: false,
21+
showSortSelector: true,
22+
showFullScreenSelector: false,
23+
};

x-pack/legacy/plugins/transform/public/app/common/fields.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export interface EsDoc extends Dictionary<any> {
1515
_source: EsDocSource;
1616
}
1717

18-
export const MAX_COLUMNS = 5;
19-
2018
export function getFlattenedFields(obj: EsDocSource): EsFieldName[] {
2119
const flatDocFields: EsFieldName[] = [];
2220
const newDocFields = Object.keys(obj);
@@ -33,35 +31,33 @@ export function getFlattenedFields(obj: EsDocSource): EsFieldName[] {
3331
return flatDocFields;
3432
}
3533

36-
export const getSelectableFields = (docs: EsDoc[]): EsFieldName[] => {
34+
export const getSelectableFields = (docs: EsDocSource[]): EsFieldName[] => {
3735
if (docs.length === 0) {
3836
return [];
3937
}
4038

41-
const newDocFields = getFlattenedFields(docs[0]._source);
39+
const newDocFields = getFlattenedFields(docs[0]);
4240
newDocFields.sort();
4341
return newDocFields;
4442
};
4543

46-
export const getDefaultSelectableFields = (docs: EsDoc[]): EsFieldName[] => {
44+
export const getDefaultSelectableFields = (docs: EsDocSource[]): EsFieldName[] => {
4745
if (docs.length === 0) {
4846
return [];
4947
}
5048

51-
const newDocFields = getFlattenedFields(docs[0]._source);
49+
const newDocFields = getFlattenedFields(docs[0]);
5250
newDocFields.sort();
53-
return newDocFields
54-
.filter(k => {
55-
let value = false;
56-
docs.forEach(row => {
57-
const source = row._source;
58-
if (source[k] !== null) {
59-
value = true;
60-
}
61-
});
62-
return value;
63-
})
64-
.slice(0, MAX_COLUMNS);
51+
return newDocFields.filter(k => {
52+
let value = false;
53+
docs.forEach(row => {
54+
const source = row;
55+
if (source[k] !== null) {
56+
value = true;
57+
}
58+
});
59+
return value;
60+
});
6561
};
6662

6763
export const toggleSelectedField = (

x-pack/legacy/plugins/transform/public/app/common/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
export { AggName, isAggName } from './aggregations';
8+
export { euiDataGridStyle, euiDataGridToolbarSettings } from './data_grid';
89
export {
910
getDefaultSelectableFields,
1011
getFlattenedFields,
@@ -13,7 +14,6 @@ export {
1314
EsDoc,
1415
EsDocSource,
1516
EsFieldName,
16-
MAX_COLUMNS,
1717
} from './fields';
1818
export { DropDownLabel, DropDownOption, Label } from './dropdown';
1919
export {

0 commit comments

Comments
 (0)