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

[Vis Editor] EUIfication of agg and agg-group directives #40866

Merged
merged 63 commits into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
bc31967
Create default_editor_agg.tsx
maryia-lapata Jul 8, 2019
9f4f5df
Create default_editor_agg_group
maryia-lapata Jul 10, 2019
e9a2403
Apply drag and drop
maryia-lapata Jul 10, 2019
e6e6559
Remove unused files
maryia-lapata Jul 10, 2019
d5cf2c9
Remove unused dragula dependency
maryia-lapata Jul 10, 2019
7ce703c
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 11, 2019
492a339
Refactoring
maryia-lapata Jul 11, 2019
2458e9d
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 12, 2019
8120251
Remove old mocha tests
maryia-lapata Jul 12, 2019
7713f2d
Add ts for state
maryia-lapata Jul 12, 2019
17b3b54
Update functional tests
maryia-lapata Jul 12, 2019
12b1882
Update touched condition
maryia-lapata Jul 15, 2019
1df5189
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 15, 2019
bc3ef56
Update visualize_page.js
maryia-lapata Jul 15, 2019
08f8f22
Move touched logic to function
maryia-lapata Jul 15, 2019
32b0d05
Apply styles for accordion button content
maryia-lapata Jul 15, 2019
faa5c68
Remove class
maryia-lapata Jul 15, 2019
ded8708
Apply truncate for agg description
maryia-lapata Jul 15, 2019
6ffca2e
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 16, 2019
54d7998
Fix merge conflict
maryia-lapata Jul 16, 2019
d60a0ef
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 16, 2019
6e93f0a
Fix file path
maryia-lapata Jul 16, 2019
b48dca9
TS for aggGroupNameMaps
maryia-lapata Jul 16, 2019
8b63d64
Remove unused styles
maryia-lapata Jul 16, 2019
074b085
Separate common props
maryia-lapata Jul 16, 2019
03248d0
Replace useState to useReducer
maryia-lapata Jul 16, 2019
6ba84c3
Update functional tests
maryia-lapata Jul 16, 2019
8917966
Fix touched state after applying changes
maryia-lapata Jul 17, 2019
025d2ec
Remove unused styles
maryia-lapata Jul 17, 2019
a25ccff
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 17, 2019
7ab46ed
Update functional tests
maryia-lapata Jul 17, 2019
803983a
Update css selector
maryia-lapata Jul 17, 2019
432ffb7
Fix draggable item
maryia-lapata Jul 17, 2019
d39cbff
Move aggGroupNamesMap to agg_group.js
maryia-lapata Jul 17, 2019
f51e8ca
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 18, 2019
29d037e
Apply styles
maryia-lapata Jul 18, 2019
7d2afd9
Update _sidebar.scss
maryia-lapata Jul 18, 2019
6e30540
Fix code review comments
maryia-lapata Jul 18, 2019
932e24f
Pass schemas prop
maryia-lapata Jul 18, 2019
e070170
Update default_editor_agg_group.tsx
maryia-lapata Jul 19, 2019
5be9c02
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 19, 2019
de148de
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 19, 2019
1b57194
Prevent scroll bar and add space
maryia-lapata Jul 19, 2019
84f520d
Remove unused min from stats
maryia-lapata Jul 19, 2019
75b8359
Merge branch 'master' of github.com:elastic/kibana into vis-editor-agg
sulemanof Jul 22, 2019
a1f3a61
Add OnAggParamsChange type
sulemanof Jul 23, 2019
ca1ee81
Merge remote-tracking branch 'upstream/master' into vis-editor-agg
sulemanof Jul 23, 2019
c1b575b
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 23, 2019
87d6391
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 24, 2019
3a522e5
Remove unnecessary styles
maryia-lapata Jul 24, 2019
0a52f9d
Update snapshot and change title size
maryia-lapata Jul 24, 2019
4e37c7a
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 24, 2019
25d5118
Show error as an icon
maryia-lapata Jul 24, 2019
ed2426f
Update background color
maryia-lapata Jul 25, 2019
b1bfa53
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 25, 2019
20ee812
Update title size
maryia-lapata Jul 25, 2019
5dd42db
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 26, 2019
187fa64
Fix code review comments
maryia-lapata Jul 26, 2019
d290f6a
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 26, 2019
56b631d
FIx TS
maryia-lapata Jul 26, 2019
de12321
Merge branch 'master' into vis-editor-agg
maryia-lapata Jul 29, 2019
c228d8d
Update TS
maryia-lapata Jul 29, 2019
2346bc0
Remove Schema.deprecate since it's not used
maryia-lapata Jul 29, 2019
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"del": "^4.0.0",
"dragula": "3.7.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

"elasticsearch": "^16.2.0",
"elasticsearch-browser": "^16.2.0",
"encode-uri-query": "1.0.1",
Expand Down
15 changes: 0 additions & 15 deletions src/legacy/core_plugins/kibana/public/management/_hacks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ kbn-management-objects-view {
.ace_editor { height: 300px; }
}

// SASSTODO: These are some dragula settings.
.gu-handle {
cursor: move;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}

.gu-mirror,
.gu-mirror .gu-handle {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}

// Hack because the management wrapper is flat HTML and needs a class
.mgtPage__body {
max-width: map-get($euiBreakpoints, 'xl');
Expand Down
184 changes: 94 additions & 90 deletions src/legacy/ui/public/agg_types/controls/date_ranges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
EuiLink,
EuiSpacer,
EuiText,
EuiFormRow,
} from '@elastic/eui';
import dateMath from '@elastic/datemath';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down Expand Up @@ -110,96 +111,99 @@ function DateRangesParamEditor({
);

return (
<>
<EuiText size="xs">
<EuiLink href={getDocLink('date.dateMath')} target="_blank" rel="noopener">
<FormattedMessage
id="common.ui.aggTypes.dateRanges.acceptedDateFormatsLinkText"
defaultMessage="Acceptable date formats"
/>
</EuiLink>
</EuiText>
<EuiSpacer size="s" />

{ranges.map(({ from, to, id }) => {
const deleteBtnTitle = i18n.translate(
'common.ui.aggTypes.dateRanges.removeRangeButtonAriaLabel',
{
defaultMessage: 'Remove the range of {from} to {to}',
values: { from: from || FROM_PLACEHOLDER, to: to || TO_PLACEHOLDER },
}
);
const areBothEmpty = !from && !to;

return (
<Fragment key={id}>
<EuiFlexGroup responsive={false} gutterSize="s" alignItems="center">
<EuiFlexItem>
<EuiFieldText
aria-label={i18n.translate('common.ui.aggTypes.dateRanges.fromColumnLabel', {
defaultMessage: 'From',
description: 'Beginning of a date range, e.g. *From* 2018-02-26 To 2018-02-28',
})}
compressed
fullWidth={true}
isInvalid={areBothEmpty || !validateDateMath(from)}
placeholder={FROM_PLACEHOLDER}
value={from || ''}
onChange={ev => onChangeRange(id, 'from', ev.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIcon type="sortRight" color="subdued" />
</EuiFlexItem>
<EuiFlexItem>
<EuiFieldText
aria-label={i18n.translate('common.ui.aggTypes.dateRanges.toColumnLabel', {
defaultMessage: 'To',
description: 'End of a date range, e.g. From 2018-02-26 *To* 2018-02-28',
})}
compressed
fullWidth={true}
isInvalid={areBothEmpty || !validateDateMath(to)}
placeholder={TO_PLACEHOLDER}
value={to || ''}
onChange={ev => onChangeRange(id, 'to', ev.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
title={deleteBtnTitle}
aria-label={deleteBtnTitle}
disabled={value.length === 1}
color="danger"
iconType="trash"
onClick={() => onRemoveRange(id)}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xs" />
</Fragment>
);
})}

{hasInvalidRange && (
<EuiFormErrorText>
<FormattedMessage
id="common.ui.aggTypes.dateRanges.errorMessage"
defaultMessage="Each range should have at least one valid date."
/>
</EuiFormErrorText>
)}

<EuiSpacer size="s" />
<EuiFlexItem>
<EuiButtonEmpty iconType="plusInCircleFilled" onClick={onAddRange} size="xs">
<FormattedMessage
id="common.ui.aggTypes.dateRanges.addRangeButtonLabel"
defaultMessage="Add range"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</>
<EuiFormRow compressed>
<>
<EuiText size="xs">
<EuiLink href={getDocLink('date.dateMath')} target="_blank" rel="noopener">
<FormattedMessage
id="common.ui.aggTypes.dateRanges.acceptedDateFormatsLinkText"
defaultMessage="Acceptable date formats"
/>
</EuiLink>
</EuiText>
<EuiSpacer size="s" />

{ranges.map(({ from, to, id }) => {
const deleteBtnTitle = i18n.translate(
'common.ui.aggTypes.dateRanges.removeRangeButtonAriaLabel',
{
defaultMessage: 'Remove the range of {from} to {to}',
values: { from: from || FROM_PLACEHOLDER, to: to || TO_PLACEHOLDER },
}
);
const areBothEmpty = !from && !to;

return (
<Fragment key={id}>
<EuiFlexGroup responsive={false} gutterSize="s" alignItems="center">
<EuiFlexItem>
<EuiFieldText
aria-label={i18n.translate('common.ui.aggTypes.dateRanges.fromColumnLabel', {
defaultMessage: 'From',
description:
'Beginning of a date range, e.g. *From* 2018-02-26 To 2018-02-28',
})}
compressed
fullWidth={true}
isInvalid={areBothEmpty || !validateDateMath(from)}
placeholder={FROM_PLACEHOLDER}
value={from || ''}
onChange={ev => onChangeRange(id, 'from', ev.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIcon type="sortRight" color="subdued" />
</EuiFlexItem>
<EuiFlexItem>
<EuiFieldText
aria-label={i18n.translate('common.ui.aggTypes.dateRanges.toColumnLabel', {
defaultMessage: 'To',
description: 'End of a date range, e.g. From 2018-02-26 *To* 2018-02-28',
})}
compressed
fullWidth={true}
isInvalid={areBothEmpty || !validateDateMath(to)}
placeholder={TO_PLACEHOLDER}
value={to || ''}
onChange={ev => onChangeRange(id, 'to', ev.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
title={deleteBtnTitle}
aria-label={deleteBtnTitle}
disabled={value.length === 1}
color="danger"
iconType="trash"
onClick={() => onRemoveRange(id)}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xs" />
</Fragment>
);
})}

{hasInvalidRange && (
<EuiFormErrorText>
<FormattedMessage
id="common.ui.aggTypes.dateRanges.errorMessage"
defaultMessage="Each range should have at least one valid date."
/>
</EuiFormErrorText>
)}

<EuiSpacer size="s" />
<EuiFlexItem>
<EuiButtonEmpty iconType="plusInCircleFilled" onClick={onAddRange} size="xs">
<FormattedMessage
id="common.ui.aggTypes.dateRanges.addRangeButtonLabel"
defaultMessage="Add range"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</>
</EuiFormRow>
);
}

Expand Down
137 changes: 70 additions & 67 deletions src/legacy/ui/public/agg_types/controls/ranges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EuiIcon,
EuiSpacer,
EuiButtonEmpty,
EuiFormRow,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -88,75 +89,77 @@ function RangesParamEditor({ agg, value = [], setValue }: AggParamEditorProps<Ra
);

return (
<>
{ranges.map(({ from, to, id }) => {
const deleteBtnTitle = i18n.translate(
'common.ui.aggTypes.ranges.removeRangeButtonAriaLabel',
{
defaultMessage: 'Remove the range of {from} to {to}',
values: {
from: isEmpty(from) ? FROM_PLACEHOLDER : from,
to: isEmpty(to) ? TO_PLACEHOLDER : to,
},
}
);
<EuiFormRow compressed>
<>
{ranges.map(({ from, to, id }) => {
const deleteBtnTitle = i18n.translate(
'common.ui.aggTypes.ranges.removeRangeButtonAriaLabel',
{
defaultMessage: 'Remove the range of {from} to {to}',
values: {
from: isEmpty(from) ? FROM_PLACEHOLDER : from,
to: isEmpty(to) ? TO_PLACEHOLDER : to,
},
}
);

return (
<Fragment key={id}>
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem>
<EuiFieldNumber
aria-label={i18n.translate('common.ui.aggTypes.ranges.fromLabel', {
defaultMessage: 'From',
})}
value={isEmpty(from) ? '' : from}
placeholder={FROM_PLACEHOLDER}
onChange={ev => onChangeRange(id, 'from', ev.target.value)}
fullWidth={true}
compressed={true}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIcon type="sortRight" color="subdued" />
</EuiFlexItem>
<EuiFlexItem>
<EuiFieldNumber
aria-label={i18n.translate('common.ui.aggTypes.ranges.toLabel', {
defaultMessage: 'To',
})}
value={isEmpty(to) ? '' : to}
placeholder={TO_PLACEHOLDER}
onChange={ev => onChangeRange(id, 'to', ev.target.value)}
fullWidth={true}
compressed={true}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
title={deleteBtnTitle}
aria-label={deleteBtnTitle}
disabled={value.length === 1}
color="danger"
iconType="trash"
onClick={() => onRemoveRange(id)}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xs" />
</Fragment>
);
})}
return (
<Fragment key={id}>
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem>
<EuiFieldNumber
aria-label={i18n.translate('common.ui.aggTypes.ranges.fromLabel', {
defaultMessage: 'From',
})}
value={isEmpty(from) ? '' : from}
placeholder={FROM_PLACEHOLDER}
onChange={ev => onChangeRange(id, 'from', ev.target.value)}
fullWidth={true}
compressed={true}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIcon type="sortRight" color="subdued" />
</EuiFlexItem>
<EuiFlexItem>
<EuiFieldNumber
aria-label={i18n.translate('common.ui.aggTypes.ranges.toLabel', {
defaultMessage: 'To',
})}
value={isEmpty(to) ? '' : to}
placeholder={TO_PLACEHOLDER}
onChange={ev => onChangeRange(id, 'to', ev.target.value)}
fullWidth={true}
compressed={true}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
title={deleteBtnTitle}
aria-label={deleteBtnTitle}
disabled={value.length === 1}
color="danger"
iconType="trash"
onClick={() => onRemoveRange(id)}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xs" />
</Fragment>
);
})}

<EuiSpacer size="s" />
<EuiFlexItem>
<EuiButtonEmpty iconType="plusInCircleFilled" onClick={onAddRange} size="xs">
<FormattedMessage
id="common.ui.aggTypes.ranges.addRangeButtonLabel"
defaultMessage="Add range"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</>
<EuiSpacer size="s" />
<EuiFlexItem>
<EuiButtonEmpty iconType="plusInCircleFilled" onClick={onAddRange} size="xs">
<FormattedMessage
id="common.ui.aggTypes.ranges.addRangeButtonLabel"
defaultMessage="Add range"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</>
</EuiFormRow>
);
}

Expand Down
9 changes: 8 additions & 1 deletion src/legacy/ui/public/vis/agg_configs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@
* under the License.
*/

export type AggConfigs = any;
import { IndexedArray } from '../indexed_array';
import { AggConfig } from './agg_config';

export interface AggConfigs extends IndexedArray<AggConfig> {
bySchemaGroup: {
[key: string]: AggConfig[];
};
}
Loading