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

System config theme #1636

Merged
merged 13 commits into from
Mar 22, 2024
Merged

System config theme #1636

merged 13 commits into from
Mar 22, 2024

Conversation

TJxiaobao
Copy link
Contributor

What's changed?

The drop-down box is implemented, but there is a problem with rendering
i need help

Checklist

  • I hereby agree to the terms of the HertzBeat CLA
  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@TJxiaobao TJxiaobao requested a review from tomsun28 March 12, 2024 09:13
Signed-off-by: tomsun28 <tomsun28@outlook.com>
@tomsun28 tomsun28 added enhancement New feature or request good first pull request Good for newcomers new feature labels Mar 12, 2024
@tomsun28 tomsun28 requested a review from ZY945 March 12, 2024 13:37
@tomsun28
Copy link
Contributor

hi, the new commit fix save theme prop has fix prop bing error.

After that, we need to trigger the actual switching of the page color theme after choosing to switch the theme.

@tomsun28
Copy link
Contributor

We can refer the alain switch theme button code https://github.com/ng-alain/delon/blob/master/packages/theme/theme-btn/theme-btn.component.ts

@TJxiaobao
Copy link
Contributor Author

Okay, I'll try it

@TJxiaobao
Copy link
Contributor Author

I need help.
I have now implemented the theme switching function, but I encountered a problem.
Because our theme switching function requires passing fields, the page will be refreshed every time when switching to save another theme. It is at this time that refreshing the page causes the theme to change back to the original default theme color. I also thought about and referred to some methods, but failed to solve this problem. Now I need some suggestions or some help. Thanks
如图:
image
image
image
image

@tomsun28
Copy link
Contributor

hi,主题信息持久化这个我想我们可以通过 localstorage 和 数据库来做,在之前的颜色主题切换中,主题颜色信息是被存储到了web localstorage的一个字段里面了,关于你切换主题后有马上刷新变回来,我感觉就是之前那个字段导致的,需要我们也去变更下那个。
还有就是我们可以在页面渲染的时候,StartupService 服务里面去主动拉取后端保持的主题配置,然后调用切换主题方法。

@hertzbeat
Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Hi, I think we can persist theme information through localstorage and database. In the previous color theme switching, the theme color information was stored in a field of web localstorage. Regarding the change that will be refreshed immediately after you switch the theme. Coming back, I feel that it was caused by the previous field, and we need to change that one too.
Also, when the page is rendered, we can actively pull the theme configuration maintained by the backend in the StartupService service, and then call the switching theme method.

@TJxiaobao
Copy link
Contributor Author

Okay, I'll try it

Copy link
Contributor

@tomsun28 tomsun28 left a comment

Choose a reason for hiding this comment

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

LGTM!

@TJxiaobao TJxiaobao merged commit d22ed89 into master Mar 22, 2024
2 checks passed
@TJxiaobao TJxiaobao deleted the system-config_theme branch March 22, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first pull request Good for newcomers new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] <support config ui theme in System Configuration>
3 participants