Skip to content

[Observability AI Assistant] Fix dark mode#179716

Merged
CoenWarmer merged 7 commits intoelastic:mainfrom
CoenWarmer:bug/assistant-dark-mode
Apr 2, 2024
Merged

[Observability AI Assistant] Fix dark mode#179716
CoenWarmer merged 7 commits intoelastic:mainfrom
CoenWarmer:bug/assistant-dark-mode

Conversation

@CoenWarmer
Copy link
Copy Markdown
Contributor

@CoenWarmer CoenWarmer commented Mar 29, 2024

Summary

This aims to correct dark mode rendering in both flyout and Conversation App.

Before:
Flyout - Dark Mode:
Screenshot 2024-03-29 at 22 11 03

Conversation UI - Dark Mode
Screenshot 2024-03-29 at 22 10 22

After:
Flyout - Dark Mode
Screenshot 2024-03-29 at 22 04 49

Flyout - Light Mode
Screenshot 2024-03-29 at 22 03 31

Conversation UI - Dark Mode
Screenshot 2024-03-29 at 22 03 46

Conversation UI - Light Mode
Screenshot 2024-03-29 at 22 03 59

@CoenWarmer CoenWarmer requested a review from a team March 29, 2024 21:12
@CoenWarmer CoenWarmer requested a review from a team as a code owner March 29, 2024 21:12
@botelastic botelastic bot added the Team:obs-knowledge DEPRECATED Former Obs Knowledge team. label Mar 29, 2024
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-knowledge-team (Team:obs-knowledge)

@ghost
Copy link
Copy Markdown

ghost commented Mar 29, 2024

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@CoenWarmer CoenWarmer added the release_note:skip Skip the PR/issue when compiling release notes label Mar 29, 2024
Comment on lines +108 to +111
core.theme.theme$.subscribe(async (theme) => {
const Component = await getEditLensConfiguration(core, deps, visualizationMap, datasourceMap);
const ConfigPanel = (
<EuiThemeProvider colorMode={theme.darkMode ? 'dark' : 'light'}>
Copy link
Copy Markdown
Contributor Author

@CoenWarmer CoenWarmer Mar 29, 2024

Choose a reason for hiding this comment

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

This is the change to get the embeddable to render correctly in dark mode when no container is passed (this particular code path).

If there is a different theming API or approach that is better suited for this use case, please lmk.

Copy link
Copy Markdown
Contributor

@stratoula stratoula Apr 2, 2024

Choose a reason for hiding this comment

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

Maybe is better to add this here https://github.com/elastic/kibana/blob/main/x-pack/plugins/lens/public/app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration.tsx#L226 instead of the action.

This dark mode inconsistency doesnt happen to dashboard or Discover. Are you wrapping the Obs AI assistant with the ThemeProvider? 🤔

Maybe you do and the problem happens because we are getting the component with the action I just wonder. If this is the case and we need to add the provider to Lens let's do it on the get_edit_lens_configuration instead

<EuiButtonIcon
data-test-subj="observabilityAiAssistantNewChatButtonButton"
iconType={EuiIconNewChat}
iconType="newChat"
Copy link
Copy Markdown
Contributor Author

@CoenWarmer CoenWarmer Mar 29, 2024

Choose a reason for hiding this comment

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

newChat icon is added to Eui and Eui upgrade is included in Kibana so we can get rid of our own implementation.

@CoenWarmer
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

};
onUpdate(newAttributes);
};
core.theme.theme$.subscribe(async (theme) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably want to avoid async here - if the getEditLensConfiguration call fails, there's no error handling (subscribe doesn't care what you return from the function)

core.theme.theme$.subscribe(async (theme) => {
const Component = await getEditLensConfiguration(core, deps, visualizationMap, datasourceMap);
const ConfigPanel = (
<EuiThemeProvider colorMode={theme.darkMode ? 'dark' : 'light'}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this for Lens to fix, or for us to fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ultimately it is for Lens to fix this as we don't own the code. This comment is aimed at the Lens team (or anyone feeling qualified to answer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stratoula already mentioned this I think, what I mean is that we're not wrapping wherever we mount the Lens component in a EuiThemeProvider

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we mount the edit lens component manually though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We do and possibly this can be fixed on the assistant too. But I am fine if the fix is applied to the lens side too. 👍

Copy link
Copy Markdown
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

looks great! Thanx Coen ❤️

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.4MB 1.4MB +93.0B
observabilityAIAssistantApp 141.0KB 140.4KB -609.0B
total -516.0B

History

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

@CoenWarmer CoenWarmer merged commit d73a8f8 into elastic:main Apr 2, 2024
@kibanamachine kibanamachine added v8.14.0 backport:skip This PR does not require backporting labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-knowledge DEPRECATED Former Obs Knowledge team. v8.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants