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

[Discover] Replace doc viewer table with EuiInMemoryTable #102149

Merged
merged 31 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7b28f3f
[Discover] replace legacy table with euiInMemoryTable
dimaanj Jun 15, 2021
66d8f56
Merge branch 'master' of https://github.com/elastic/kibana into impro…
dimaanj Jun 16, 2021
4305e42
[Discover] update styles, add badge
dimaanj Jun 16, 2021
bd00895
fix font in badge and adjust line height
andreadelrio Jun 17, 2021
986e719
add tooltip
andreadelrio Jun 17, 2021
ce4c4ee
Merge pull request #1 from andreadelrio/doc-view-dsgn
dimaanj Jun 17, 2021
b1a87ea
[Discover] update unit tests, return actions column to left side
dimaanj Jun 17, 2021
79feadb
[Discover] update field name test snapshot
dimaanj Jun 17, 2021
d622ba6
[Discover] update wording
dimaanj Jun 18, 2021
91dad6d
Merge branch 'master' of https://github.com/elastic/kibana into impro…
dimaanj Jun 18, 2021
92d4c58
[Discover] handle pagination, return formatting value styles
dimaanj Jun 18, 2021
3343b76
[Discover] fix failing stylelint error
dimaanj Jun 18, 2021
7d8b54e
[Discover] return responsive prop, update classes
dimaanj Jun 21, 2021
09a9c26
Merge branch 'master' into improve-ui-doc-viewer
kibanamachine Jun 21, 2021
72886c8
[Discover] update test and meet formatting rules
dimaanj Jun 21, 2021
8940b6c
improve table view on medium
andreadelrio Jun 21, 2021
3ae0c1f
remove extra file
andreadelrio Jun 21, 2021
108ee43
Merge pull request #2 from andreadelrio/m-devices
dimaanj Jun 22, 2021
d3defbb
Merge branch 'master' into improve-ui-doc-viewer
kibanamachine Jun 22, 2021
fba29b5
[Discover] fix unit test
dimaanj Jun 22, 2021
4980b71
[Discover] align top vertically field name and action cells, disable …
dimaanj Jun 23, 2021
0804254
[Discover] adjust styles for cross browser compatibility
dimaanj Jun 24, 2021
0828b8b
[Discover] remove pagination optimize styles, update test
dimaanj Jun 24, 2021
77a9f4e
Merge branch 'master' into improve-ui-doc-viewer
dimaanj Jun 24, 2021
eaca5e5
Merge branch 'master' into improve-ui-doc-viewer
kibanamachine Jun 24, 2021
d5c65f5
[Discover] fix eslint
dimaanj Jun 24, 2021
3ab15f3
[Discover] clean up styles
dimaanj Jun 25, 2021
96b70e5
Merge branch 'master' into improve-ui-doc-viewer
kibanamachine Jun 25, 2021
1a65a04
Merge branch 'master' into improve-ui-doc-viewer
kibanamachine Jun 27, 2021
37b5b41
[Discover] fix single doc view
dimaanj Jun 28, 2021
d4b5ad3
[Discover] add check lack of multifieldBadge
dimaanj Jun 29, 2021
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
@@ -1,82 +1,57 @@
.kbnDocViewerTable {
@include euiBreakpoint('xs', 's','m') {
table-layout: fixed;
}
}

.kbnDocViewer {
pre,
.kbnDocViewer__value {
display: inline-block;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
color: $euiColorFullShade;
.euiTableRowCell {
vertical-align: top;
padding-top: $euiSizeXS * .5;
}
.kbnDocViewer__field {
padding-top: $euiSizeS;
}

.kbnDocViewer__multifield_row:hover td {
background-color: transparent;
}

.kbnDocViewer__multifield_title {
font-family: $euiFontFamily;
}

.dscFieldName {
color: $euiColorDarkShade;
tr:first-child th {
border-bottom-color: transparent;
}
}

td,
pre {
font-family: $euiCodeFontFamily;
}
.kbnDocViewer__tableRow {
font-size: $euiFontSizeXS;
font-family: $euiCodeFontFamily;

tr:first-child td {
border-top-color: transparent;
.kbnDocViewer__buttons {
// Show all icons if one is focused,
&:focus-within {
.kbnDocViewer__actionButton {
opacity: 1;
}
}
}

tr:hover {
&:hover {
.kbnDocViewer__actionButton {
opacity: 1;
}
}
}

.kbnDocViewer__buttons,
.kbnDocViewer__field {
white-space: nowrap;
}
.kbnDocViewer__buttons {
width: 108px;
.kbnDocViewer__actionButton {
@include euiBreakpoint('m', 'l', 'xl') {
opacity: 0;
}

// Show all icons if one is focused,
&:focus-within {
.kbnDocViewer__actionButton {
&:focus {
opacity: 1;
}
}
}

.kbnDocViewer__field {
width: $euiSize * 10;
@include euiBreakpoint('xs', 's', 'm') {
width: $euiSize * 6;
dimaanj marked this conversation as resolved.
Show resolved Hide resolved
}
.kbnDocViewer__tableActionsCell,
.kbnDocViewer__tableFieldNameCell {
align-items: flex-start;
padding: $euiSizeXS;
}

.kbnDocViewer__actionButton {
@include euiBreakpoint('m', 'l', 'xl') {
opacity: 0;
}

&:focus {
opacity: 1;
}
.kbnDocViewer__value {
display: inline-block;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
line-height: $euiLineHeight;
color: $euiColorFullShade;
vertical-align: top;
}

.kbnDocViewer__warning {
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
@@ -0,0 +1,12 @@
.kbnDocViewer__fieldIcon {
padding-top: $euiSizeXS * 1.5;
}

.kbnDocViewer__fieldName {
line-height: $euiLineHeight;
padding: $euiSizeXS;
}

.kbnDocViewer__multiFieldBadge {
@include euiFont;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,81 @@
* Side Public License, v 1.
*/

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import React, { Fragment } from 'react';
import './field_name.scss';
import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FieldIcon, FieldIconProps } from '../../../../../kibana_react/public';
import { getFieldTypeName } from './field_type_name';
import { FieldMapping } from '../../doc_views/doc_views_types';
import { IndexPatternField } from '../../../../../data/public';

// properties fieldType and fieldName are provided in kbn_doc_view
// this should be changed when both components are deangularized
interface Props {
fieldName: string;
fieldType: string;
fieldMapping?: FieldMapping;
fieldMapping?: IndexPatternField;
fieldIconProps?: Omit<FieldIconProps, 'type'>;
scripted?: boolean;
className?: string;
}

export function FieldName({
fieldName,
fieldMapping,
fieldType,
fieldIconProps,
className,
scripted = false,
}: Props) {
const typeName = getFieldTypeName(fieldType);
const displayName =
fieldMapping && fieldMapping.displayName ? fieldMapping.displayName : fieldName;
const tooltip = displayName !== fieldName ? `${fieldName} (${displayName})` : fieldName;
const isMultiField = !!fieldMapping?.spec?.subType?.multi;

return (
<EuiFlexGroup className={className} alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
<Fragment>
<EuiFlexItem grow={false} className="kbnDocViewer__fieldIcon">
<FieldIcon type={fieldType} label={typeName} scripted={scripted} {...fieldIconProps} />
</EuiFlexItem>
<EuiFlexItem className="eui-textTruncate">
<EuiToolTip
position="top"
content={tooltip}
delay="long"
anchorClassName="eui-textTruncate"
>
<span>{displayName}</span>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>

<EuiFlexGroup wrap={true} gutterSize="none" responsive={false} alignItems="flexStart">
<EuiFlexItem className="kbnDocViewer__fieldName eui-textBreakAll" grow={false}>
<EuiToolTip
position="top"
content={tooltip}
delay="long"
anchorClassName="eui-textBreakAll"
>
<span>{displayName}</span>
</EuiToolTip>
</EuiFlexItem>

{isMultiField && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!

<EuiToolTip
position="top"
delay="long"
content={i18n.translate(
'discover.fieldChooser.discoverField.multiFieldTooltipContent',
{
defaultMessage: 'Multi-fields can have multiple values per field',
}
)}
>
<EuiBadge
title=""
className="kbnDocViewer__multiFieldBadge"
color="default"
data-test-subj={`tableDocViewRow-${fieldName}-multifieldBadge`}
>
<FormattedMessage
id="discover.fieldChooser.discoverField.multiField"
defaultMessage="multi-field"
/>
</EuiBadge>
</EuiToolTip>
)}
</EuiFlexGroup>
</Fragment>
);
}
Loading