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

[7.x] Use EuiTokens for ES field types (#57911) #58293

Merged
merged 1 commit into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ discover-app {
background-color: transparent;
}

.dscField--noResults {
.dscFieldName--noResults {
color: $euiColorDarkShade;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
*/
import React from 'react';
import classNames from 'classnames';
import { FieldIcon } from '../../../../../../../../../plugins/kibana_react/public';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';

import { FieldIcon, FieldIconProps } from '../../../../../../../../../plugins/kibana_react/public';
import { shortenDottedString } from '../../../../../../../../../plugins/data/common/utils';
import { getFieldTypeName } from './field_type_name';

Expand All @@ -35,25 +37,35 @@ interface Props {
fieldName?: string;
fieldType?: string;
useShortDots?: boolean;
fieldIconProps?: Omit<FieldIconProps, 'type'>;
}

export function FieldName({ field, fieldName, fieldType, useShortDots }: Props) {
export function FieldName({ field, fieldName, fieldType, useShortDots, fieldIconProps }: Props) {
const type = field ? String(field.type) : String(fieldType);
const typeName = getFieldTypeName(type);

const name = field ? String(field.name) : String(fieldName);
const displayName = useShortDots ? shortenDottedString(name) : name;

const className = classNames({
'dscField--noResults': field ? !field.rowCount && !field.scripted : false,
// this is currently not styled, should display an icon
scripted: field ? field.scripted : false,
const noResults = field ? !field.rowCount && !field.scripted : false;

const className = classNames('dscFieldName', {
'dscFieldName--noResults': noResults,
});

return (
<span className={className} title={typeName}>
<FieldIcon type={type} label={typeName} />
<span className="dscFieldName">{displayName}</span>
</span>
<EuiFlexGroup className={className} alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
<FieldIcon
type={type}
label={typeName}
scripted={field ? field.scripted : false}
{...fieldIconProps}
/>
</EuiFlexItem>
<EuiFlexItem className="eui-textTruncate">
<span className="dscFieldName__displayName eui-textTruncate">{displayName}</span>
</EuiFlexItem>
</EuiFlexGroup>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

.dscFieldName {
color: $euiColorDarkShade;
padding-left: $euiSizeS;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ export function DocViewTableRow({
</td>
)}
<td className="kbnDocViewer__field">
<FieldName field={fieldMapping} fieldName={field} fieldType={fieldType} />
<FieldName
field={fieldMapping}
fieldName={field}
fieldType={fieldType}
fieldIconProps={{ fill: 'none', color: 'gray' }}
/>
</td>
<td>
{isCollapsible && (
Expand Down
Loading