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

[Manual Backport 2.x] Feat (core): Make theme settings user-specific and user-configurable (#5652) #6681

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Apr 29, 2024

Backport PR:

#5652

Description

  • feat (core): make theme UI settings client-side
  1. Add optional preferBrowserSetting to UISettings that should be defined client-side
  2. Make theme:darkMode and theme:version prefer browser settings
  3. Update UISettings client-side client to check localstorage for settings that prefer browser settings
  4. Refactor logos to be responsive to browser-defined theme mode
  5. Add a new startup script that handles theme/dark mode (injected as blocking script to head)
  6. Remove theme/mode-specific logic from injected Styles and Fonts (move logic to startup script instead, define all font-faces)
  7. Only inject theme values necessary for loading/error screens via startup
  8. Update branding metadata to pass the correct dark mode
  9. Add a new control for admin Enable user control. This setting is enabled as default. When this setting is disabled, admin can disable any user control and we will have the exact previous behavior.

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

…and user-configurable (opensearch-project#5652)

Backport PR:
opensearch-project#5652

From opensearch-project#5652

* feat (core): make theme UI settings client-side

1. Add optional `preferBrowserSetting` to UISettings that should be defined client-side
2. Make `theme:darkMode` and `theme:version` prefer browser settings
3. Update UISettings client-side client to check localstorage for settings that prefer browser settings
4. Refactor logos to be responsive to browser-defined theme mode
5. Add a new `startup` script that handles theme/dark mode (injected as blocking script to head)
6. Remove theme/mode-specific logic from injected Styles and Fonts (move logic to `startup` script instead, define all font-faces)
7. Only inject theme values necessary for loading/error screens via `startup`
8. Update branding metadata to pass the correct dark mode
9. Add a new control for admin  Enable user control. This setting is enabled as default. When this setting is disabled, admin can disable any user control and we will have the exact previous behavior.

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 22.41379% with 90 lines in your changes are missing coverage. Please review.

Project coverage is 67.75%. Comparing base (fcc06de) to head (7fb52a4).

Files Patch % Lines
...dvanced_settings/public/header_user_theme_menu.tsx 2.43% 40 Missing ⚠️
src/core/public/ui_settings/ui_settings_client.ts 13.63% 16 Missing and 3 partials ⚠️
src/legacy/ui/ui_render/ui_render_mixin.js 0.00% 18 Missing ⚠️
src/core/server/rendering/rendering_service.tsx 50.00% 0 Missing and 3 partials ⚠️
src/plugins/advanced_settings/public/plugin.ts 0.00% 3 Missing ⚠️
.../advanced_settings/public/register_nav_control.tsx 0.00% 3 Missing ⚠️
...s/public/management_app/components/field/field.tsx 75.00% 1 Missing and 1 partial ⚠️
src/core/public/osd_bootstrap.ts 66.66% 0 Missing and 1 partial ⚠️
...gs/public/management_app/lib/to_editable_config.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              2.x    #6681      +/-   ##
==========================================
- Coverage   67.82%   67.75%   -0.08%     
==========================================
  Files        3410     3411       +1     
  Lines       66751    66814      +63     
  Branches    10842    10849       +7     
==========================================
- Hits        45277    45270       -7     
- Misses      18840    18907      +67     
- Partials     2634     2637       +3     
Flag Coverage Δ
Linux_1 33.19% <5.26%> (-0.01%) ⬇️
Linux_2 55.64% <25.42%> (-0.08%) ⬇️
Linux_3 45.26% <18.75%> (-0.01%) ⬇️
Linux_4 35.02% <8.24%> (-0.05%) ⬇️
Windows_1 33.21% <5.26%> (-0.01%) ⬇️
Windows_2 55.60% <25.42%> (-0.08%) ⬇️
Windows_3 45.26% <18.75%> (-0.01%) ⬇️
Windows_4 35.02% <8.24%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ashwin-pc ashwin-pc merged commit 815d2bd into opensearch-project:2.x Apr 30, 2024
82 of 84 checks passed
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request May 7, 2024
…pecific and user-configurable (opensearch-project#5652) (opensearch-project#6681)"

This reverts commit 815d2bd.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
kavilla added a commit that referenced this pull request May 7, 2024
…pecific and user-configurable (#5652) (#6681)" (#6736)

This reverts commit 815d2bd.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
seraphjiang added a commit to seraphjiang/OpenSearch-Dashboards that referenced this pull request Jun 7, 2024
Signed-off-by: Huan Jiang <seraphjiang@gmail.com>
BionIT pushed a commit that referenced this pull request Jun 10, 2024
Signed-off-by: Huan Jiang <seraphjiang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants