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

Fix/UI settings overrides #6730

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

joshuarrrr
Copy link
Member

Description

There are a couple different fixes here, which can be viewed separately by looking at the separate commits. But the root cause of #6704 was primarily the fact that the implementation of getOverridesOrDefault assumed the wrong object shape for the overrides property, when it tried to access a value property instead of just the value itself. Note that the existing unit test also had this same error.

Because the ui_render_mixin is an old legacy .js file, there's not much help from typescript, so I also added some enforcement to make sure we're always sending boolean values to the template.

Additionally, I realized that the validation for the theme:version setting was not correct, and needed updating to match our current themes.

Finally, as requested, I updated the new user theme controls to be deactivated by default.

No changelog necessary, as the previous PR this fixes has not yet been released.

Future work

@AMoo-Miki @manasvinibs - The past discussion and this TODO comment seem to indicate that we don't actually want to maintain support for these overrides long term. But even if we do, I don't think the schema definition for overrides makes much sense:

overrides: schema.object({}, { unknowns: 'allow' }),

We probably want users to be aware of if they specify invalid overrides and not silently ignore (which is what was happening with an incorrectly set value in @BionIT 's configuration.

Issues Resolved

Fixes #6704

Screenshot

Testing the changes

The linked issue only surfaced when deploying https://future.playground.opensearch.org/ , and only when not yet authenticated, because the configuration file specified overrides such as:

uiSettings:
  overrides:
    'theme:darkMode': false

To validate these fixes, test with authentication enabled, a non-authenticated user, and theme UI Settings overrides.

Changelog

  • skip

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

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

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.51%. Comparing base (f74eb24) to head (1c328d5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6730      +/-   ##
==========================================
- Coverage   67.55%   67.51%   -0.05%     
==========================================
  Files        3428     3428              
  Lines       67341    67341              
  Branches    10995    10995              
==========================================
- Hits        45494    45463      -31     
- Misses      19177    19204      +27     
- Partials     2670     2674       +4     
Flag Coverage Δ
Linux_1 33.04% <0.00%> (ø)
Linux_2 55.13% <100.00%> (ø)
Linux_3 45.17% <0.00%> (+0.01%) ⬆️
Linux_4 34.73% <0.00%> (ø)
Windows_1 ?
Windows_2 ?
Windows_3 ?
Windows_4 ?

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.

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

Thanks for these changes Josh!

@ashwin-pc
Copy link
Member

@joshuarrrr Dont we want a changelog entry for this change?

@joshuarrrr
Copy link
Member Author

@joshuarrrr Dont we want a changelog entry for this change?

Well... originally I was thinking no, in terms of fixing the new theme controls, which haven't yet been released. But now I'm remembering that this was actually a latent bug in the UI settings client, so I'll add a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Startup fails with theme overrides
5 participants