-
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
[Embeddable Rebuild] [Controls] Add drag and drop to control group #188687
[Embeddable Rebuild] [Controls] Add drag and drop to control group #188687
Conversation
075c372
to
638a33e
Compare
/ci |
@@ -85,7 +88,7 @@ export function initControlsManager(initialControlPanelsState: ControlPanelsStat | |||
} | |||
|
|||
return { | |||
controlsInOrder$: controlsInOrder$ as PublishingSubject<Array<{ id: string; type: string }>>, | |||
controlsInOrder$, |
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.
I chose to make this a public BehaviorSubject
rather than adding a setter for the control order - this felt cleaner to me.
@@ -185,7 +185,7 @@ export const getTimesliderControlFactory = ( | |||
const viewModeSubject = | |||
getViewModeSubject(controlGroupApi) ?? new BehaviorSubject('view' as ViewMode); | |||
|
|||
const defaultControl = initializeDefaultControlApi(initialState); | |||
const defaultControl = initializeDefaultControlApi({ ...initialState, width: 'large' }); |
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.
The time slider should always have a width of large
- this value cannot be changed.
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.
Can you turn your comment into a comment in the code please
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.
Good call - done in 34ac226
.controlFrame__formControlLayout { | ||
opacity: 0; // hide dragged control, while control is dragged its replaced with ControlClone component | ||
} | ||
opacity: 0; // hide dragged control, while control is dragged its replaced with ControlClone component |
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.
I tested this on both the new control group (in the examples
plugin) and the old one (in the controls
plugin) - the more generic selector works in both cases. No need to target euiFormRow__labelWrapper
and controlFrame__formControlLayout
explicitly to hide the control when dragging.
Controls on Dashboard after this change:
Notice that, with this change, the control is still hidden on drag as expected
/ci |
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @Heenawter |
Pinging @elastic/kibana-presentation (Team:Presentation) |
@@ -186,3 +212,49 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA | |||
</EuiFlexItem> | |||
); | |||
}; | |||
|
|||
/** |
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.
How about putting ControlClone into its own 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.
Done in 1d0b5d2
@@ -102,6 +124,8 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA | |||
|
|||
return ( | |||
<EuiFlexItem | |||
ref={setNodeRef} | |||
style={style} | |||
grow={grow} | |||
data-control-id={api?.uuid} |
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.
uuid is now passed in. How about using uuid
instead of api?.uuid
? What is data-control-id
attribute used for?
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.
We use data-control-id
for pretty much all of our control functional tests (via the controls page object) - not sure why we chose to use this attribute instead of just data-test-subj
but this is legacy so not sure we want to change it. Replaced api.uuid
with uuid
in 22de169 though 👍
@@ -185,7 +185,7 @@ export const getTimesliderControlFactory = ( | |||
const viewModeSubject = | |||
getViewModeSubject(controlGroupApi) ?? new BehaviorSubject('view' as ViewMode); | |||
|
|||
const defaultControl = initializeDefaultControlApi(initialState); | |||
const defaultControl = initializeDefaultControlApi({ ...initialState, width: 'large' }); |
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.
Can you turn your comment into a comment in the code please
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.
LGTM, one step closer to being feature complete
code review, tested in chrome
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @Heenawter |
While reviewing #188687, I noticed that controls where still getting filtered by timeslider changes even when chaining was disabled or the control was to the left of the timeslider. This PR resolves this issue by only passing in timeslice from `chaining$` instead of `controlGroupFetch$`. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Note
This PR has no user-facing changes - minus one small style change (which is a small selector simplification and doesn't actually change anything), all work is contained in the
examples
plugin.This PR adds drag and drop to the refactored control group in the
examples
plugin.Checklist
For maintainers