Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into np/history-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Feb 21, 2020
2 parents 5b545f0 + 9c8c47b commit cedf596
Show file tree
Hide file tree
Showing 36 changed files with 485 additions and 467 deletions.
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

0 comments on commit cedf596

Please sign in to comment.