-
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] Refactor control editing + creation #187606
[Embeddable Rebuild] [Controls] Refactor control editing + creation #187606
Conversation
22044c0
to
609a2f2
Compare
/ci |
/ci |
.controlPanel--label { | ||
@include euiTextTruncate; | ||
background-color: transparent; | ||
border-radius: $euiBorderRadius; | ||
margin-left: 0 !important; | ||
padding-left: 0 !important; | ||
} |
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 fixes a style error where the truncation was happening before the max-width
applied, so labels were getting cut off too early on the "small" control size. I also verified that the truncation now happens at the same point that it does for the old controls, so there should be no visual changes from the user's perspective once the React controls are officially swapped in Dashboard.
Before | After | Legacy |
---|---|---|
<EuiToolTip | ||
anchorClassName="controlPanel--labelWrapper" | ||
content={panelTitle || defaultPanelTitle} | ||
> | ||
<EuiFormLabel className="controlPanel--label"> | ||
{panelTitle || defaultPanelTitle} | ||
</EuiFormLabel> | ||
</EuiToolTip> |
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 accidentally forgot to include the tooltip when initially building this, but we need it for when things get truncated.
@@ -22,6 +22,7 @@ | |||
} | |||
|
|||
.rangeSliderAnchor__fieldNumber { | |||
min-width: auto !important; |
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.
…ld_controls_add-creation_2024-07-03
…github.com:heenawter/kibana into embeddableRebuild_controls_add-creation_2024-07-03
/ci |
CustomOptionsComponent: ({ stateManager, setControlEditorValid }) => { | ||
const step = useStateFromPublishingSubject(stateManager.step); | ||
CustomOptionsComponent: ({ initialState, updateState, setControlEditorValid }) => { | ||
const [step, setStep] = useState(initialState.step ?? 1); |
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 default to 1
needs to happen here too, specifically for creation.
/ci |
examples/controls_example/public/react_controls/data_controls/data_control_editor.test.tsx
Outdated
Show resolved
Hide resolved
examples/controls_example/public/react_controls/data_controls/initialize_data_control.tsx
Outdated
Show resolved
Hide resolved
examples/controls_example/public/react_controls/data_controls/initialize_data_control.tsx
Outdated
Show resolved
Hide resolved
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
code review, tested in chrome
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.
Thanks for the screenshots! That was super helpful.
…ld_controls_add-creation_2024-07-03
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
cc @Heenawter |
Closes #187504
Summary
This PR changes how control creation/editing is handled in the new system by changing from a state manager to an explicit
initialState
+updateState
callback structure. Unfortunately, thestateManager
system really only works if we had inline creation for controls - since we don't have that, the embeddable (and hence thestateManager
) doesn't exist until after the editor is saved. Therefore, especially with respect to the custom options component, we had no way of knowing what keys thestateManager
should include when trying to create a new control. The new system isn't quite as clean IMO, but it works better for our current goals with this refactor. We can revisit thestateManager
idea once controls support inline editing 👍This PR also fixes a few visual bugs, noted below.
Checklist
For maintainers