[ML] Data Frames: Fixes aggregation item overflow. (#37068) (#37165)

Fixes an issue where long field names would overflow the aggregation item of the pivot config list. This fix was already done for the group-by-items, now brought over to aggregations too.
This commit is contained in:
Walter Rafelsberger 2019-05-26 12:04:12 +02:00 committed by GitHub
parent 64e1f5a4ba
commit 35050f513b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 70 additions and 58 deletions

View file

@ -1 +1,2 @@
@import 'components/aggregation_list/index';
@import 'components/group_by_list/index';

View file

@ -4,11 +4,19 @@ exports[`Data Frame: <AggLabelForm /> Date histogram aggregation 1`] = `
<EuiFlexGroup
alignItems="center"
gutterSize="s"
responsive={false}
>
<EuiFlexItem>
the-group-by-agg-name
<EuiFlexItem
className="mlAggregationLabel--text"
>
<span
className="eui-textTruncate"
>
the-group-by-agg-name
</span>
</EuiFlexItem>
<EuiFlexItem
className="mlGroupByLabel--button"
grow={false}
>
<EuiPopover
@ -47,6 +55,7 @@ exports[`Data Frame: <AggLabelForm /> Date histogram aggregation 1`] = `
</EuiPopover>
</EuiFlexItem>
<EuiFlexItem
className="mlGroupByLabel--button"
grow={false}
>
<EuiButtonIcon

View file

@ -7,24 +7,20 @@ exports[`Data Frame: <AggListForm /> Minimal initialization 1`] = `
hasShadow={false}
paddingSize="s"
>
<EuiFlexGroup>
<EuiFlexItem>
<AggLabelForm
deleteHandler={[Function]}
item={
Object {
"agg": "avg",
"aggName": "the-group-by-agg-name",
"dropDownName": "the-group-by-drop-down-name",
"field": "the-field",
}
}
onChange={[Function]}
options={Object {}}
otherAggNames={Array []}
/>
</EuiFlexItem>
</EuiFlexGroup>
<AggLabelForm
deleteHandler={[Function]}
item={
Object {
"agg": "avg",
"aggName": "the-group-by-agg-name",
"dropDownName": "the-group-by-drop-down-name",
"field": "the-field",
}
}
onChange={[Function]}
options={Object {}}
otherAggNames={Array []}
/>
</EuiPanel>
<EuiSpacer
size="s"

View file

@ -7,7 +7,11 @@ exports[`Data Frame: <AggListSummary /> Minimal initialization 1`] = `
hasShadow={false}
paddingSize="s"
>
the-agg
<div
className="eui-textTruncate"
>
the-agg
</div>
</EuiPanel>
<EuiSpacer
size="s"

View file

@ -0,0 +1,7 @@
.mlAggregationLabel--button {
width: $euiSizeL;
}
.mlAggregationLabel--text {
min-width: 0;
}

View file

@ -0,0 +1 @@
@import './aggregation_label_form';

View file

@ -37,9 +37,11 @@ export const AggLabelForm: React.SFC<Props> = ({
}
return (
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>{item.aggName}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem className="mlAggregationLabel--text">
<span className="eui-textTruncate">{item.aggName}</span>
</EuiFlexItem>
<EuiFlexItem grow={false} className="mlGroupByLabel--button">
<EuiPopover
id="mlFormPopover"
ownFocus
@ -64,7 +66,7 @@ export const AggLabelForm: React.SFC<Props> = ({
/>
</EuiPopover>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} className="mlGroupByLabel--button">
<EuiButtonIcon
aria-label={i18n.translate('xpack.ml.dataframe.aggLabelForm.deleteItemAriaLabel', {
defaultMessage: 'Delete item',

View file

@ -6,7 +6,7 @@
import React, { Fragment } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiSpacer } from '@elastic/eui';
import { EuiPanel, EuiSpacer } from '@elastic/eui';
import { AggName, PivotAggsConfig, PivotAggsConfigDict } from '../../common';
@ -28,17 +28,13 @@ export const AggListForm: React.SFC<ListProps> = ({ deleteHandler, list, onChang
return (
<Fragment key={aggName}>
<EuiPanel paddingSize="s">
<EuiFlexGroup>
<EuiFlexItem>
<AggLabelForm
deleteHandler={deleteHandler}
item={list[aggName]}
onChange={item => onChange(aggName, item)}
otherAggNames={otherAggNames}
options={options}
/>
</EuiFlexItem>
</EuiFlexGroup>
<AggLabelForm
deleteHandler={deleteHandler}
item={list[aggName]}
onChange={item => onChange(aggName, item)}
otherAggNames={otherAggNames}
options={options}
/>
</EuiPanel>
{listKeys.length > 0 && <EuiSpacer size="s" />}
</Fragment>

View file

@ -20,7 +20,9 @@ export const AggListSummary: React.SFC<AggListSummaryProps> = ({ list }) => {
<EuiForm>
{aggNames.map((aggName: AggName) => (
<Fragment key={aggName}>
<EuiPanel paddingSize="s">{aggName}</EuiPanel>
<EuiPanel paddingSize="s">
<div className="eui-textTruncate">{aggName}</div>
</EuiPanel>
{aggNames.length > 0 && <EuiSpacer size="s" />}
</Fragment>
))}

View file

@ -10,7 +10,7 @@ exports[`Data Frame: <GroupByLabelForm /> Date histogram aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-group-by-agg-name
</span>
@ -20,7 +20,7 @@ exports[`Data Frame: <GroupByLabelForm /> Date histogram aggregation 1`] = `
grow={false}
>
<EuiTextColor
className="mlGroupByLabel__text"
className="eui-textTruncate"
color="subdued"
>
1m
@ -93,7 +93,7 @@ exports[`Data Frame: <GroupByLabelForm /> Histogram aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-group-by-agg-name
</span>
@ -103,7 +103,7 @@ exports[`Data Frame: <GroupByLabelForm /> Histogram aggregation 1`] = `
grow={false}
>
<EuiTextColor
className="mlGroupByLabel__text"
className="eui-textTruncate"
color="subdued"
>
100
@ -176,7 +176,7 @@ exports[`Data Frame: <GroupByLabelForm /> Terms aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-group-by-agg-name
</span>

View file

@ -10,7 +10,7 @@ exports[`Data Frame: <GroupByLabelSummary /> Date histogram aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-options-data-id
</span>
@ -20,7 +20,7 @@ exports[`Data Frame: <GroupByLabelSummary /> Date histogram aggregation 1`] = `
grow={false}
>
<EuiTextColor
className="mlGroupByLabel__text"
className="eui-textTruncate"
color="subdued"
>
1m
@ -39,7 +39,7 @@ exports[`Data Frame: <GroupByLabelSummary /> Histogram aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-options-data-id
</span>
@ -49,7 +49,7 @@ exports[`Data Frame: <GroupByLabelSummary /> Histogram aggregation 1`] = `
grow={false}
>
<EuiTextColor
className="mlGroupByLabel__text"
className="eui-textTruncate"
color="subdued"
>
100
@ -68,7 +68,7 @@ exports[`Data Frame: <GroupByLabelSummary /> Terms aggregation 1`] = `
className="mlGroupByLabel--text"
>
<span
className="mlGroupByLabel__text"
className="eui-textTruncate"
>
the-options-data-id
</span>

View file

@ -9,9 +9,3 @@
.mlGroupByLabel--interval {
max-width: 25%;
}
.mlGroupByLabel__text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

View file

@ -53,11 +53,11 @@ export const GroupByLabelForm: React.SFC<Props> = ({
return (
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem className="mlGroupByLabel--text">
<span className="mlGroupByLabel__text">{item.aggName}</span>
<span className="eui-textTruncate">{item.aggName}</span>
</EuiFlexItem>
{interval !== undefined && (
<EuiFlexItem grow={false} className="mlGroupByLabel--text mlGroupByLabel--interval">
<EuiTextColor color="subdued" className="mlGroupByLabel__text">
<EuiTextColor color="subdued" className="eui-textTruncate">
{interval}
</EuiTextColor>
</EuiFlexItem>

View file

@ -27,11 +27,11 @@ export const GroupByLabelSummary: React.SFC<Props> = ({ item, optionsDataId }) =
return (
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem className="mlGroupByLabel--text">
<span className="mlGroupByLabel__text">{optionsDataId}</span>
<span className="eui-textTruncate">{optionsDataId}</span>
</EuiFlexItem>
{interval !== undefined && (
<EuiFlexItem grow={false} className="mlGroupByLabel--text mlGroupByLabel--interval">
<EuiTextColor color="subdued" className="mlGroupByLabel__text">
<EuiTextColor color="subdued" className="eui-textTruncate">
{interval}
</EuiTextColor>
</EuiFlexItem>