-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
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 |
@@ -150,7 +150,6 @@ | |||
"d3": "3.5.17", | |||
"d3-cloud": "1.2.5", | |||
"del": "^4.0.0", | |||
"dragula": "3.7.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
value => { | ||
$scope.formIsTouched = value; | ||
}, | ||
true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use Object.values
if we're only planning to use the value and not the key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
setValidity(isGroupValid); | ||
}, [isGroupValid]); | ||
|
||
const onDragEnd = ({ source, destination }: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my bad. Thank you for noticing and explanation.
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-agg
andvis-editor-agg-group
directives in Default Editor, Data tab.Part of #30922.
To bind React controls with AngularJS form and to have a proper validation flow, previously
ngModel
was created for eachDefaultEditorAggParams
component. This approach is left except thatngModel
is created for eachDefaultEditorAggGroup
component 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:
indexPattern
fromagg
(agg.getIndexPattern()) instead of fromvis
(vis.indexPattern) thereby getting rid ofvis
prop inDefaultEditorAgg
;draggable-*
directives anddragula
dependency 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
;keyboardMove
directive;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.deprecate
removedThe
deprecate
boolean flag onSchema
when declaring schemas for visualizations has been removed.