-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Control Group] Add Button & Minimal Editor Settings #151161
[Control Group] Add Button & Minimal Editor Settings #151161
Conversation
…of control editor.
Pinging @elastic/kibana-presentation (Team:Presentation) |
@ThomThomson could the |
@andreadelrio that very much depends on how flexible we want this button to be. As I see it, there are currently two options to get this add dialog to show up:
Allowing
Do you think this third option would be used often? I think it might be better to ensure that the default design / location is ideal for the largest number of use-cases for consistency, but to leave that workaround using the API open and accessible. |
I agree. Let's leave it as-is then. Consumers that want to use the default design/location can opt for (1), otherwise they can do (2). |
Here is the default button design: Thanks for the guidance @andreadelrio! |
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.
Code review + tested new example + tested Maps timeslider. Everything worked great - just left one tiny nit about the new button 👍
<EuiButtonIcon | ||
size="s" | ||
iconSize="m" | ||
display="base" | ||
iconType={'plusInCircle'} | ||
onClick={() => controlGroup.openAddDataControlFlyout()} | ||
/> |
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.
nit: We should probably add an aria-label
here, since it's an icon-only button.
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.
Ah, good call! Added!
@@ -99,6 +100,10 @@ export const ControlEditor = ({ | |||
dataViews: { getIdsWithTitle, getDefaultId, get }, | |||
controls: { getControlFactory }, | |||
} = pluginServices.getServices(); | |||
|
|||
const { useEmbeddableSelector: select } = useControlGroupContainerContext(); | |||
const editorConfig = select((state) => state.componentState.editorConfig); |
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.
Don't need to change this in this PR, but we should probably structure all the different hide<...>
options list settings the same way... i.e. something like:
optionsListConfig: {
hideActionBar?: boolean,
hideExclude?: boolean,
...
}
I think that would be a whole lot cleaner than it currently is 👍
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 a good call - likely we should change that! Especially because it's only used via code. Might do that in a follow--up!
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.
Infrastructure UI (Hosts View) changes look good! We don't use the edit functionality at the moment and everything works as expected. It could be interesting for us to try the edit functionality maybe in the future.
…tonAndCustomizableEditor
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
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.
Functionality working great.. But in security solution, I am seeing a little lag ( see video below ). Since in your example it is running fine, it could be something I am doing wrong or maybe because of number of fields in the dataview mapping.
Screen.Recording.2023-02-23.at.13.26.35.mov
export interface ControlGroupSettings { | ||
showAddButton?: boolean; | ||
staticDataViewId?: string; | ||
editorConfig?: { |
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.
🥳
updateTitle={(newTitle) => (controlInput.title = newTitle)} | ||
updateWidth={(defaultControlWidth) => this.updateInput({ defaultControlWidth })} | ||
updateGrow={(defaultControlGrow: boolean) => this.updateInput({ defaultControlGrow })} | ||
onSave={(type) => { |
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.
nit
: should it be a useCallback
function?
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 think that useCallback
is not required in this case due to openAddDataControlFlyout
being an imperative function call and not a react component, so it gets rendered once as part of the useMountPoint
call, and is in a different react tree.
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.
kibana-gis changes LGTM
code review
Closes #151198
Summary
Adds an "add" button that shows up to the right of the Control Group if configured. Also adds a system for fetching settings from consumers, and adds settings that can hide or show pieces of the Control editor flyout.
Also adds an example showing how to use these new systems.