From bfc67f1b1dc280d5e90940b99d6075aae18747a4 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Thu, 22 Mar 2018 16:55:34 -0700 Subject: [PATCH] Upgrade EUI, simplify rendering of fields --- package.json | 2 +- .../__snapshots__/table.test.js.snap | 142 +++++------------- .../components/table/table.js | 54 +++---- .../__snapshots__/table.test.js.snap | 2 +- .../components/table/table.js | 8 +- yarn.lock | 9 +- 6 files changed, 71 insertions(+), 146 deletions(-) diff --git a/package.json b/package.json index 920230c9c54dc..703b5a05b1201 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "url": "https://github.com/elastic/kibana.git" }, "dependencies": { - "@elastic/eui": "0.0.33", + "@elastic/eui": "0.0.34", "@elastic/filesaver": "1.1.2", "@elastic/numeral": "2.3.1", "@elastic/ui-ace": "0.2.3", diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap index ca3e3a088dcb5..89a9416244d4f 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap @@ -1,84 +1,34 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Table should render conflicting type 1`] = ` -
- - + conflict + +   + - conflict - - - - - - - -
+ + + + `; exports[`Table should render normal field name 1`] = ` -
- - - Elastic - - -
+ + Elastic + `; exports[`Table should render normal type 1`] = ` -
- - - string - - -
+ + string + `; exports[`Table should render normally 1`] = ` @@ -86,6 +36,7 @@ exports[`Table should render normally 1`] = ` columns={ Array [ Object { + "data-test-subj": "indexedFieldName", "dataType": "string", "field": "displayName", "name": "Name", @@ -94,6 +45,7 @@ exports[`Table should render normally 1`] = ` "width": "38%", }, Object { + "data-test-subj": "indexedFieldType", "dataType": "string", "field": "type", "name": "Type", @@ -193,38 +145,20 @@ exports[`Table should render the boolean template (true) 1`] = ` `; exports[`Table should render timestamp field name 1`] = ` -
- - - timestamp - - + timestamp + +   + - - - - - -
+ + + + `; diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js index 2e4bfb62f8481..eba7fc99ef746 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/components/table/table.js @@ -2,8 +2,6 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { - EuiFlexGroup, - EuiFlexItem, EuiIcon, EuiInMemoryTable, EuiToolTip, @@ -22,39 +20,33 @@ export class Table extends PureComponent { renderFieldName(name, isTimeField) { return ( -
- - - {name} - - {isTimeField ? ( - - - - - - ) : ''} - -
+ + {name} + {isTimeField ? ( + +   + + + + + ) : ''} + ); } renderFieldType(type, isConflict) { return ( -
- - - {type} - - {isConflict ? ( - - - - - - ) : ''} - -
+ + {type} + {isConflict ? ( + +   + + + + + ) : ''} + ); } @@ -76,6 +68,7 @@ export class Table extends PureComponent { return this.renderFieldName(value, indexPattern.timeFieldName === value); }, width: '38%', + 'data-test-subj': 'indexedFieldName', }, { field: 'type', @@ -85,6 +78,7 @@ export class Table extends PureComponent { render: (value) => { return this.renderFieldType(value, value === 'conflict'); }, + 'data-test-subj': 'indexedFieldType', }, { field: 'format', diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap index 7672556f1ae80..17294e09772a0 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/__tests__/__snapshots__/table.test.js.snap @@ -13,11 +13,11 @@ exports[`Table should render normally 1`] = ` "width": "38%", }, Object { + "data-test-subj": "scriptedFieldLang", "dataType": "string", "description": "Language used for the field", "field": "lang", "name": "Lang", - "render": [Function], "sortable": true, }, Object { diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/table.js index 310ae0b443e11..15b6c4ecd8396 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_fields_table/components/table/table.js @@ -45,13 +45,7 @@ export class Table extends PureComponent { description: `Language used for the field`, dataType: 'string', sortable: true, - render: value => { - return ( - - {value} - - ); - } + 'data-test-subj': 'scriptedFieldLang', }, { field: 'script', name: 'Script', diff --git a/yarn.lock b/yarn.lock index f06da48382f0a..588e2d4d61617 100644 --- a/yarn.lock +++ b/yarn.lock @@ -87,9 +87,9 @@ version "0.0.0" uid "" -"@elastic/eui@0.0.33": - version "0.0.33" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-0.0.33.tgz#de30a9301d48644a94e3cec02dd77332a16cd2a9" +"@elastic/eui@0.0.34": + version "0.0.34" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-0.0.34.tgz#75266fb39975903d842a7c877db27e1f4ea56a71" dependencies: brace "^0.10.0" classnames "^2.2.5" @@ -11183,6 +11183,9 @@ to-object-path@^0.3.0: to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" to-regex@^3.0.1: version "3.0.2"