This is an automated email from the ASF dual-hosted git repository.
zqr10159 pushed a commit to branch 2.0.0
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/2.0.0 by this push:
new 4ef6e7e23d fix(web-next): keep legacy default theme dark
4ef6e7e23d is described below
commit 4ef6e7e23dacdbef5528a000e719297b21e90bf6
Author: Logic <[email protected]>
AuthorDate: Wed Jun 3 19:29:12 2026 +0800
fix(web-next): keep legacy default theme dark
---
web-next/lib/setting-config/view-model.test.ts | 4 ++--
web-next/lib/setting-config/view-model.ts | 2 +-
web-next/lib/workbench-theme.test.ts | 12 ++++++------
web-next/lib/workbench-theme.ts | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/web-next/lib/setting-config/view-model.test.ts
b/web-next/lib/setting-config/view-model.test.ts
index 9d88abc852..77ef49228b 100644
--- a/web-next/lib/setting-config/view-model.test.ts
+++ b/web-next/lib/setting-config/view-model.test.ts
@@ -100,12 +100,12 @@ describe('setting config view model', () => {
expect(normalizeSystemConfigLocale('zh-CN')).toBe('zh_CN');
expect(normalizeSystemConfigLocale('ja-JP')).toBe('ja_JP');
expect(normalizeSystemConfigTheme('dark')).toBe('dark-ops');
- expect(normalizeSystemConfigTheme('default')).toBe('light-ops');
+ expect(normalizeSystemConfigTheme('default')).toBe('dark-ops');
expect(normalizeSystemConfigTheme('compact')).toBe('compact');
});
it('resolves translated locale and theme labels for supported values', () =>
{
expect(resolveSystemLocaleLabel('pt-BR', t)).toBe('Portuguese(pt_BR)');
- expect(resolveSystemThemeLabel('default', t)).toBe('Default theme');
+ expect(resolveSystemThemeLabel('default', t)).toBe('Dark theme');
});
});
diff --git a/web-next/lib/setting-config/view-model.ts
b/web-next/lib/setting-config/view-model.ts
index 49994a39c5..54187b5b7d 100644
--- a/web-next/lib/setting-config/view-model.ts
+++ b/web-next/lib/setting-config/view-model.ts
@@ -34,7 +34,7 @@ export function normalizeSystemConfigLocale(locale?: string |
null) {
export function normalizeSystemConfigTheme(theme?: string | null) {
if (!theme) return 'dark-ops';
- if (theme === 'light-ops' || theme === 'default') return 'light-ops';
+ if (theme === 'light-ops') return 'light-ops';
if (theme === 'compact') return 'compact';
return 'dark-ops';
}
diff --git a/web-next/lib/workbench-theme.test.ts
b/web-next/lib/workbench-theme.test.ts
index e65b2c59c7..c9241775db 100644
--- a/web-next/lib/workbench-theme.test.ts
+++ b/web-next/lib/workbench-theme.test.ts
@@ -11,15 +11,15 @@ describe('workbench theme helpers', () => {
it('normalizes supported theme aliases into the shared theme set', () => {
expect(normalizeWorkbenchTheme('dark-ops')).toBe('dark-ops');
expect(normalizeWorkbenchTheme('light-ops')).toBe('light-ops');
- expect(normalizeWorkbenchTheme('default')).toBe('light-ops');
+ expect(normalizeWorkbenchTheme('default')).toBe('dark-ops');
expect(normalizeWorkbenchTheme('compact')).toBe('compact');
expect(normalizeWorkbenchTheme('unknown')).toBe('dark-ops');
expect(normalizeWorkbenchTheme(null)).toBe('dark-ops');
});
- it('reads the stored theme with a dark-ops fallback', () => {
+ it('treats legacy default storage as the dark workbench fallback', () => {
expect(readWorkbenchTheme({ getItem: () => 'compact' })).toBe('compact');
- expect(readWorkbenchTheme({ getItem: () => 'default' })).toBe('light-ops');
+ expect(readWorkbenchTheme({ getItem: () => 'default' })).toBe('dark-ops');
expect(readWorkbenchTheme({ getItem: () => null })).toBe('dark-ops');
});
@@ -34,9 +34,9 @@ describe('workbench theme helpers', () => {
storage
});
- expect(theme).toBe('light-ops');
- expect(setAttribute).toHaveBeenCalledWith('data-theme', 'light-ops');
- expect(storage.setItem).toHaveBeenCalledWith('theme', 'light-ops');
+ expect(theme).toBe('dark-ops');
+ expect(setAttribute).toHaveBeenCalledWith('data-theme', 'dark-ops');
+ expect(storage.setItem).toHaveBeenCalledWith('theme', 'dark-ops');
});
it('bootstraps the stored theme into the current document', () => {
diff --git a/web-next/lib/workbench-theme.ts b/web-next/lib/workbench-theme.ts
index 910303a2b5..971eb3cae2 100644
--- a/web-next/lib/workbench-theme.ts
+++ b/web-next/lib/workbench-theme.ts
@@ -7,7 +7,7 @@ type DocumentLike = Pick<Document, 'documentElement' | 'body'>;
type LocationLike = Pick<Location, 'reload'>;
export function normalizeWorkbenchTheme(theme?: string | null): WorkbenchTheme
{
- if (theme === 'light-ops' || theme === 'default') {
+ if (theme === 'light-ops') {
return 'light-ops';
}
if (theme === 'compact') {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]