Skip to content
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

[drilldown] fix Darktheme is missing from add drilldowns panel #147270

Merged
merged 6 commits into from Jan 10, 2023

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Dec 8, 2022

Fixes #147147

Replaces #147151. Thanks for the tip @Dosant

PR passes theme$ to toMountPoint

Screen Shot 2022-12-06 at 4 54 49 PM

@nreese nreese added release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Feature:Drilldowns Embeddable panel Drilldowns auto-backport Deprecated: Automatically backport this PR after it's merged v8.6.0 v8.7.0 labels Dec 8, 2022
@nreese nreese marked this pull request as ready for review December 8, 2022 16:48
@nreese nreese requested a review from a team as a code owner December 8, 2022 16:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@Heenawter Heenawter self-requested a review December 8, 2022 16:50
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and it looks like the dashboard dropdown is still being given the light theme:

image

@nreese
Copy link
Contributor Author

nreese commented Dec 8, 2022

Tested locally and it looks like the dashboard dropdown is still being given the light theme:

Thanks. I have resolved this with 78b1b97

@nreese nreese requested a review from Heenawter December 8, 2022 20:04
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review + tested locally - LGTM 👍

@nreese
Copy link
Contributor Author

nreese commented Dec 14, 2022

@elasticmachine merge upstream

this.ReactCollectConfig = (props) => <CollectConfigContainer {...props} params={this.params} />;
constructor(protected readonly params: Params, theme: ThemeServiceStart) {
this.ReactCollectConfig = (props) => (
<KibanaThemeProvider theme$={theme.theme$}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have the same issue in x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx and x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx

We introduced these uiToReact and reactToUi conversions because we wanted our APIs to be React agnostic, but I wonder if in 2 years this opinion has changed it is better to just use plain React.

Then it a way to fix this and simplify is to remove intermediate non-react conversion steps.

@vadimkibana, wdyt?

Of course we can also fix this theming issue by re-wrapping each instance in KibanaThemeProvider or do it inside reactToUiComponent helper and pass theme.theme$ there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We introduced these uiToReact and reactToUi conversions because we wanted our APIs to be React agnostic, but I wonder if in 2 years this opinion has changed it is better to just use plain React.

+1 to remove these conversions and just use plain react.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to just use plain react.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 as well for using React directly without breaking the React context. Historically at Kibana there was a trend to abstract everything away from a rendering library, e.g. keep Kibana agnostic to the view implementation. But in general, I believe, we are reversing this to simplify code everywhere.

@nreese maybe in ui_actions where UiComponent is required you could also allow for React.FunctionalComponent as well, and then we don't need this conversion and drilldown configurator can check if the thing is already a React component, then just use it directly.

@Dosant Dosant self-requested a review December 15, 2022 10:24
@nreese
Copy link
Contributor Author

nreese commented Jan 10, 2023

#148037 has merged and removes UiComponent. #148037 resolves the dark theme issues within the drill down panel. I have aborted changes made in x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/abstract_dashboard_drilldown.tsx since the are no longer needed.

I am removing 8.6 label since #148037 is only merged into 8.7. I would rather leave this issue unresolved in 8.6 and resolve cleanly in 8.7, then have less clean solution in for 8.6 that adds additional ThemeProviders wrappers that then have to be clean-up again in 8.7

@nreese nreese added backport:skip This commit does not require backporting and removed v8.6.0 auto-backport Deprecated: Automatically backport this PR after it's merged labels Jan 10, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dashboardEnhanced 15.2KB 15.3KB +48.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese merged commit 26b2274 into elastic:main Jan 10, 2023
jennypavlova pushed a commit to jennypavlova/kibana that referenced this pull request Jan 13, 2023
…ic#147270)

Fixes elastic#147147

Replaces elastic#147151. Thanks for the
tip @Dosant

PR passes theme$ to toMountPoint

<img width="400" alt="Screen Shot 2022-12-06 at 4 54 49 PM"
src="https://user-images.githubusercontent.com/373691/206051509-207c39f6-125d-46f9-baab-87a5a96a6541.png">

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Drilldowns Embeddable panel Drilldowns release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Darktheme is missing from add drilldowns panel
8 participants