[Vis Editor] EUIfication of agg and agg-group directives#40866
[Vis Editor] EUIfication of agg and agg-group directives#40866maryia-lapata merged 63 commits intoelastic:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
For this PR When @chandlerprall maybe you have some ideas regarding how to fix that issue? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@cchaos is the title size ( I'm asking because of the comment in Optional Pie tab (#41901 (comment)). I think that titles on the Data tab and titles on optional tabs should be the same. |
💚 Build Succeeded |
|
@maryia-lapata I agree, they should be the same. I didn't realize they changed here too. Go ahead and make sure they're all |
@cchaos thanks. |
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
| "d3": "3.5.17", | ||
| "d3-cloud": "1.2.5", | ||
| "del": "^4.0.0", | ||
| "dragula": "3.7.2", |
| value => { | ||
| $scope.formIsTouched = value; | ||
| }, | ||
| true |
There was a problem hiding this comment.
This should be a boolean value (ngModelCtrl.$touched), so it does not really make sense making a deep object comparison here, we could just get rid of the true I think.
There was a problem hiding this comment.
You're right. Fixed.
|
|
||
| const [aggsState, setAggsState] = useReducer(aggGroupReducer, group, initAggsState); | ||
|
|
||
| const isGroupValid = Object.entries(aggsState).every(([, item]) => item.valid); |
There was a problem hiding this comment.
Let's use Object.values if we're only planning to use the value and not the key.
| setValidity(isGroupValid); | ||
| }, [isGroupValid]); | ||
|
|
||
| const onDragEnd = ({ source, destination }: any) => { |
There was a problem hiding this comment.
any ... 😔
I'll open an issue for EUI to properly export those types. Let's for now at least simply type { source: { index: number }; destination: {index: number} } as a local type in this file.
There was a problem hiding this comment.
Thank you.
I added a local type, but there is still an issue with TS, so I disabled TS for one line with comment.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| result: { index: number }; | ||
| provided: { index: number }; | ||
| } | ||
| const onDragEnd = ({ result, provided }: DragDropProps) => { |
There was a problem hiding this comment.
This shouldn't be functioning,
result and provided are separate arguments i.e. (result, provided) instead of ({ result, provided })
result doesn't have an index property on it, instead there is source.index and destination.index (destination could also be null or undefined).
provided has the shape:
{
announce: (message: string) => void
}
Getting the correct shapes here should remove the need for the @ts-ignore below
There was a problem hiding this comment.
That's my bad. Thank you for noticing and explanation.
💚 Build Succeeded |
timroes
left a comment
There was a problem hiding this comment.
Tested on Chrome Linux, seems to work fine. Code LGTM.
💚 Build Succeeded |
…2126) * Create default_editor_agg.tsx * Create default_editor_agg_group * Apply drag and drop * Remove unused dragula dependency * Remove old mocha tests * Add ts for state * Update functional tests * Update touched condition * Apply styles for accordion button content * Apply truncate for agg description * Remove unused styles * Separate common props * Move aggGroupNamesMap to agg_group.js * Update _sidebar.scss * Pass schemas prop * Prevent scroll bar and add space * Remove unused min from stats * Add OnAggParamsChange type * Show error as an icon * Update background color * Update title size * Remove Schema.deprecate since it's not used


Summary
EUIfication of
vis-editor-aggandvis-editor-agg-groupdirectives in Default Editor, Data tab.Part of #30922.
To bind React controls with AngularJS form and to have a proper validation flow, previously
ngModelwas created for eachDefaultEditorAggParamscomponent. This approach is left except thatngModelis created for eachDefaultEditorAggGroupcomponent only. Since we need that AngularJS form and React controls still work together, we cannot get rid ofngModel-approach until the main form (visualizeEditor) is migrated to React. Before that we need to migrate option tabs (#38273).This PR also includes:
indexPatternfromagg(agg.getIndexPattern()) instead of fromvis(vis.indexPattern) thereby getting rid ofvisprop inDefaultEditorAgg;draggable-*directives anddraguladependency since it isn't used anymore. For drag- and-drop functionality Eui components are used (EuiDragDropContext,EuiDroppable,EuiDraggable);agg_add.js,agg_params.js,agg_controls.js;keyboardMovedirective;aggGroupNameMaps;This PR also fixes #42054.
Screenshots:
Note:
Previously during dragging aggs, an opened agg accordion was collapsed at the moment of drag-and-drop, and agg accordion returned to the state before dragging started (opened/collapsed).
Now an opened agg accordion isn't collapsed at the moment of dragging since
EUIAccordion's closed/opened state isn't managed by code (elastic/eui#2130), just by clicking on the caret icon. So a user has to collapse an agg before dragging for convenience.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Documentation was added for features that require explanation or tutorialsFor maintainers
[ ] This was checked for breaking API changes and was labeled appropriately[ ] This includes a feature addition or change that requires a release note and was labeled appropriatelyDev-Docs
Schema.deprecateremovedThe
deprecateboolean flag onSchemawhen declaring schemas for visualizations has been removed.