Skip to content

Commit

Permalink
Upgrade EUI, simplify rendering of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jen-huang committed Mar 23, 2018
1 parent 01347ee commit bfc67f1
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 146 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,91 +1,42 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Table should render conflicting type 1`] = `
<div
data-test-subj="indexedFieldType"
>
<EuiFlexGroup
alignItems="center"
component="div"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
<span>
conflict
<span>
 
<EuiToolTip
content="The type of this field changes across indices. It is unavailable for many analysis functions."
position="top"
>
conflict
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<EuiToolTip
content="The type of this field changes across indices. It is unavailable for many analysis functions."
position="top"
>
<EuiIcon
color="warning"
size="m"
type="alert"
/>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
</div>
<EuiIcon
color="warning"
size="m"
type="alert"
/>
</EuiToolTip>
</span>
</span>
`;

exports[`Table should render normal field name 1`] = `
<div
data-test-subj="indexedFieldName"
>
<EuiFlexGroup
alignItems="center"
component="div"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
Elastic
</EuiFlexItem>
</EuiFlexGroup>
</div>
<span>
Elastic
</span>
`;

exports[`Table should render normal type 1`] = `
<div
data-test-subj="indexedFieldType"
>
<EuiFlexGroup
alignItems="center"
component="div"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
string
</EuiFlexItem>
</EuiFlexGroup>
</div>
<span>
string
</span>
`;

exports[`Table should render normally 1`] = `
<EuiInMemoryTable
columns={
Array [
Object {
"data-test-subj": "indexedFieldName",
"dataType": "string",
"field": "displayName",
"name": "Name",
Expand All @@ -94,6 +45,7 @@ exports[`Table should render normally 1`] = `
"width": "38%",
},
Object {
"data-test-subj": "indexedFieldType",
"dataType": "string",
"field": "type",
"name": "Type",
Expand Down Expand Up @@ -193,38 +145,20 @@ exports[`Table should render the boolean template (true) 1`] = `
`;

exports[`Table should render timestamp field name 1`] = `
<div
data-test-subj="indexedFieldName"
>
<EuiFlexGroup
alignItems="center"
component="div"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
timestamp
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
<span>
timestamp
<span>
 
<EuiToolTip
content="This field represents the time that events occurred."
position="top"
>
<EuiToolTip
content="This field represents the time that events occurred."
position="top"
>
<EuiIcon
color="primary"
size="m"
type="clock"
/>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
</div>
<EuiIcon
color="primary"
size="m"
type="clock"
/>
</EuiToolTip>
</span>
</span>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

import {
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiInMemoryTable,
EuiToolTip,
Expand All @@ -22,39 +20,33 @@ export class Table extends PureComponent {

renderFieldName(name, isTimeField) {
return (
<div data-test-subj="indexedFieldName">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
{name}
</EuiFlexItem>
{isTimeField ? (
<EuiFlexItem>
<EuiToolTip content="This field represents the time that events occurred.">
<EuiIcon type="clock" color="primary" />
</EuiToolTip>
</EuiFlexItem>
) : ''}
</EuiFlexGroup>
</div>
<span>
{name}
{isTimeField ? (
<span>
&nbsp;
<EuiToolTip content="This field represents the time that events occurred.">
<EuiIcon type="clock" color="primary" />
</EuiToolTip>
</span>
) : ''}
</span>
);
}

renderFieldType(type, isConflict) {
return (
<div data-test-subj="indexedFieldType">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
{type}
</EuiFlexItem>
{isConflict ? (
<EuiFlexItem>
<EuiToolTip content="The type of this field changes across indices. It is unavailable for many analysis functions.">
<EuiIcon type="alert" color="warning" />
</EuiToolTip>
</EuiFlexItem>
) : ''}
</EuiFlexGroup>
</div>
<span>
{type}
{isConflict ? (
<span>
&nbsp;
<EuiToolTip content="The type of this field changes across indices. It is unavailable for many analysis functions.">
<EuiIcon type="alert" color="warning" />
</EuiToolTip>
</span>
) : ''}
</span>
);
}

Expand All @@ -76,6 +68,7 @@ export class Table extends PureComponent {
return this.renderFieldName(value, indexPattern.timeFieldName === value);
},
width: '38%',
'data-test-subj': 'indexedFieldName',
},
{
field: 'type',
Expand All @@ -85,6 +78,7 @@ export class Table extends PureComponent {
render: (value) => {
return this.renderFieldType(value, value === 'conflict');
},
'data-test-subj': 'indexedFieldType',
},
{
field: 'format',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ export class Table extends PureComponent {
description: `Language used for the field`,
dataType: 'string',
sortable: true,
render: value => {
return (
<span data-test-subj="scriptedFieldLang">
{value}
</span>
);
}
'data-test-subj': 'scriptedFieldLang',
}, {
field: 'script',
name: 'Script',
Expand Down
9 changes: 6 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
version "0.0.0"
uid ""

"@elastic/[email protected].33":
version "0.0.33"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-0.0.33.tgz#de30a9301d48644a94e3cec02dd77332a16cd2a9"
"@elastic/[email protected].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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit bfc67f1

Please sign in to comment.