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

feat: Add ability to set default theme for UI #2062

Merged
merged 4 commits into from
Aug 31, 2023

Conversation

Jamess-Lucass
Copy link
Contributor

resolves issue: #1952.

As part of this PR I changed the initial theme values from light to system which should better fit a default. eg.
ui/src/app/preferences/preferencesSlice.ts#L15 and ui/src/app/preferences/Preferences.tsx#L47.

Please let me know if you want this reverted back to light.

If this is accepted I can open a PR in flipt-io/docs to add this configuration value to https://www.flipt.io/docs/configuration/overview#general

@Jamess-Lucass Jamess-Lucass requested a review from a team as a code owner August 30, 2023 13:50
@markphelps
Copy link
Collaborator

Thanks @Jamess-Lucass !! Works great if user doesn't already have theme set (which is what we want)

FLIPT_UI_DEFAULT_THEME='system' ./bin/flipt

CleanShot 2023-08-30 at 13 27 58

Copy link
Contributor

@GeorgeMac GeorgeMac left a comment

Choose a reason for hiding this comment

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

This PR is looking great @Jamess-Lucass ! Just incase it isn't clear, we have a couple schema's around our configuration file which need to be valid. That is whats failing during CI.

--- FAIL: Test_JSONSchema (0.01s)
    schema_test.go:63: 
        	Error Trace:	/src/config/schema_test.go:63
        	Error:      	Should be true
        	Test:       	Test_JSONSchema
        	Messages:   	Schema is invalid
    schema_test.go:65: ui: Additional property default_theme is not allowed

These need to be updated to include your new string field.
Happy to give pointers if you're unfamiliar with either of these schema languages.

@Jamess-Lucass
Copy link
Contributor Author

This PR is looking great @Jamess-Lucass ! Just incase it isn't clear, we have a couple schema's around our configuration file which need to be valid. That is whats failing during CI.

--- FAIL: Test_JSONSchema (0.01s)
    schema_test.go:63: 
        	Error Trace:	/src/config/schema_test.go:63
        	Error:      	Should be true
        	Test:       	Test_JSONSchema
        	Messages:   	Schema is invalid
    schema_test.go:65: ui: Additional property default_theme is not allowed

These need to be updated to include your new string field. Happy to give pointers if you're unfamiliar with either of these schema languages.

Ahh, thanks for pointing me in that direction, I've made those changes and run schema_test.go locally and they're passing.

@markphelps markphelps enabled auto-merge (squash) August 31, 2023 13:10
@markphelps
Copy link
Collaborator

@all-contributors please add @Jamess-Lucass for code

@allcontributors
Copy link
Contributor

@markphelps

I've put up a pull request to add @Jamess-Lucass! 🎉

@markphelps
Copy link
Collaborator

Looks great @Jamess-Lucass !! thank you for the contribution!

@markphelps markphelps linked an issue Aug 31, 2023 that may be closed by this pull request
config/flipt.schema.cue Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #2062 (721b9e9) into main (a8ffa95) will increase coverage by 0.00%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2062   +/-   ##
=======================================
  Coverage   70.41%   70.41%           
=======================================
  Files          70       70           
  Lines        6820     6822    +2     
=======================================
+ Hits         4802     4804    +2     
  Misses       1741     1741           
  Partials      277      277           
Files Changed Coverage Δ
internal/config/config.go 87.00% <100.00%> (+0.03%) ⬆️
internal/config/ui.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

auto-merge was automatically disabled August 31, 2023 13:36

Head branch was pushed to by a user without write access

@markphelps markphelps enabled auto-merge (squash) August 31, 2023 13:42
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

awesome! thanks again!

@markphelps markphelps merged commit c082585 into flipt-io:main Aug 31, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FLI-538] feat: add an ENV variable to default theme
3 participants