From 9dcdb6b6e73d580c541f5a40a1a900402cb59926 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 25 Dec 2025 13:14:23 +0800 Subject: [PATCH] fix: reset userSettings first login --- src/atoms/settings.ts | 2 +- src/atoms/utils/index.ts | 15 ++++++++++ src/locales/en-US/models.ts | 3 +- src/locales/ja-JP/models.ts | 6 ++-- src/locales/ru-RU/models.ts | 6 ++-- src/locales/zh-CN/models.ts | 3 +- src/pages/_components/yaml-editor/editor.tsx | 1 + .../backends/components/backend-card.tsx | 16 ++++++++-- src/pages/llmodels/forms/basic.tsx | 29 ++++++++++--------- src/pages/login/components/password-form.tsx | 2 ++ 10 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/atoms/settings.ts b/src/atoms/settings.ts index 7bc1c24f..b067348b 100644 --- a/src/atoms/settings.ts +++ b/src/atoms/settings.ts @@ -11,7 +11,7 @@ type UserSettings = { hideAddResourceModal?: boolean; }; -const defaultSettings: UserSettings = { +export const defaultSettings: UserSettings = { theme: 'light', mode: 'auto', isDarkTheme: false, diff --git a/src/atoms/utils/index.ts b/src/atoms/utils/index.ts index 1cb6deab..5cb9391f 100644 --- a/src/atoms/utils/index.ts +++ b/src/atoms/utils/index.ts @@ -1,3 +1,4 @@ +import { defaultSettings } from '@/atoms/settings'; import { getDefaultStore } from 'jotai'; export const clearStorageUserSettings = () => { @@ -18,6 +19,20 @@ export const clearStorageUserSettings = () => { } }; +export const resetStorageUserSettings = () => { + try { + localStorage.setItem( + 'userSettings', + JSON.stringify({ + ...defaultSettings, + colorPrimary: undefined + }) + ); + } catch (error) { + console.log('Error clearing user settings:', error); + } +}; + export const clearAtomStorage = (atom: any) => { if (!atom) { return; diff --git a/src/locales/en-US/models.ts b/src/locales/en-US/models.ts index 1b69f1b5..ccedb2ea 100644 --- a/src/locales/en-US/models.ts +++ b/src/locales/en-US/models.ts @@ -271,5 +271,6 @@ export default { 'models.form.backendVersions.tips': `To use more versions, go to the {link} page and edit the backend to add versions.`, 'models.catalog.nogpus.tips': 'No compatible GPUs are available in the selected cluster for this model.', - 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.` + 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.`, + 'models.form.readyWorkers': 'workers ready' }; diff --git a/src/locales/ja-JP/models.ts b/src/locales/ja-JP/models.ts index 10c51f8e..fb6be85c 100644 --- a/src/locales/ja-JP/models.ts +++ b/src/locales/ja-JP/models.ts @@ -271,7 +271,8 @@ export default { 'models.form.backendVersions.tips': `To use more versions, go to the {link} page and edit the backend to add versions.`, 'models.catalog.nogpus.tips': 'No compatible GPUs are available in the selected cluster for this model.', - 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.` + 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.`, + 'models.form.readyWorkers': 'workers ready' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== @@ -365,5 +366,6 @@ export default { // 71.'models.accessSettings.allowedUsers.tips': 'Only designated users can access the model.', // 72. 'models.form.backendVersions.tips': `To use more versions, go to the {link} page and edit the backend to add versions.`, // 73. 'models.catalog.nogpus.tips': 'No compatible GPUs are available in the selected cluster for this model.', -// 74. 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.` +// 74. 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.`, +// 75. 'models.form.readyWorkers': 'workers ready' // ========== End of To-Do List ========== diff --git a/src/locales/ru-RU/models.ts b/src/locales/ru-RU/models.ts index ee7b2509..e76a8b39 100644 --- a/src/locales/ru-RU/models.ts +++ b/src/locales/ru-RU/models.ts @@ -276,7 +276,8 @@ export default { 'models.form.backendVersions.tips': `To use more versions, go to the {link} page and edit the backend to add versions.`, 'models.catalog.nogpus.tips': 'No compatible GPUs are available in the selected cluster for this model.', - 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.` + 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.`, + 'models.form.readyWorkers': 'workers ready' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== @@ -285,5 +286,6 @@ export default { // 3. 'models.accessSettings.allowedUsers.tips': 'Only designated users can access the model.', // 4. 'models.form.backendVersions.tips': `To use more versions, go to the {link} page and edit the backend to add versions.`, // 5. 'models.catalog.nogpus.tips': 'No compatible GPUs are available in the selected cluster for this model.', -// 6. 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.` +// 6. 'models.form.modelfile.notfound': `The model file path you specified does not exist on the GPUStack server. It's recommended to place the model file at the same path on both the GPUStack server and GPUStack workers. This helps GPUStack make better decisions.`, +// 7. 'models.form.readyWorkers': 'workers ready' // ========== End of To-Do List ========== diff --git a/src/locales/zh-CN/models.ts b/src/locales/zh-CN/models.ts index 671fcfe7..6f3e2950 100644 --- a/src/locales/zh-CN/models.ts +++ b/src/locales/zh-CN/models.ts @@ -255,5 +255,6 @@ export default { 'models.form.backendVersions.tips': `如需使用更多版本,请前往{link}页面并编辑对应的后端以添加版本。`, 'models.catalog.nogpus.tips': '所选集群中没有兼容该模型的 GPU。', 'models.form.modelfile.notfound': - '你指定的模型文件路径在 GPUStack 服务器上不存在。建议在 GPUStack 服务器和 GPUStack 节点上使用相同的模型文件路径,这有助于 GPUStack 做出更优的调度与决策。' + '你指定的模型文件路径在 GPUStack 服务器上不存在。建议在 GPUStack 服务器和 GPUStack 节点上使用相同的模型文件路径,这有助于 GPUStack 做出更优的调度与决策。', + 'models.form.readyWorkers': '节点就绪' }; diff --git a/src/pages/_components/yaml-editor/editor.tsx b/src/pages/_components/yaml-editor/editor.tsx index ec9aa68d..4da6f7d5 100644 --- a/src/pages/_components/yaml-editor/editor.tsx +++ b/src/pages/_components/yaml-editor/editor.tsx @@ -46,6 +46,7 @@ const EditorInner: React.FC = forwardRef((props, ref) => { const yamlUri = monaco.Uri.parse(path); configureMonacoYaml(monaco, { + hover: false, schemas: [ { uri: 'http://example.com/schema-name.json', diff --git a/src/pages/backends/components/backend-card.tsx b/src/pages/backends/components/backend-card.tsx index 42c814fa..03972848 100644 --- a/src/pages/backends/components/backend-card.tsx +++ b/src/pages/backends/components/backend-card.tsx @@ -18,6 +18,15 @@ import { } from '../config'; import { ListItem } from '../config/types'; +const StyledCard = styled(Card)` + &:hover { + .operations { + background-color: var(--ant-color-fill-tertiary); + border-radius: var(--ant-border-radius); + } + } +`; + const TagInner = styled(Tag)` display: flex; align-items: center; @@ -33,6 +42,7 @@ const Header = styled.div` display: flex; align-items: center; justify-content: space-between; + height: 24px; width: 100%; .title { display: flex; @@ -187,7 +197,7 @@ const BackendCard: React.FC = ({ data, onSelect }) => { }; return ( - = ({ data, onSelect }) => { header={
{renderIcon()}
- + = ({ data, onSelect }) => { {renderFrameworks()} - + ); }; diff --git a/src/pages/llmodels/forms/basic.tsx b/src/pages/llmodels/forms/basic.tsx index 1b453ebf..f39f1452 100644 --- a/src/pages/llmodels/forms/basic.tsx +++ b/src/pages/llmodels/forms/basic.tsx @@ -27,7 +27,7 @@ const ClusterOption = styled.span` width: 100%; flex-direction: column; border-bottom: 1px solid var(--ant-color-split); - gap: 8px; + gap: 4px; .label { display: flex; align-items: center; @@ -39,8 +39,8 @@ const ClusterOption = styled.span` } .dot { display: flex; - width: 8px; - height: 8px; + width: 6px; + height: 6px; background-color: var(--ant-color-warning); border-radius: 50%; &.ready { @@ -54,11 +54,12 @@ const ClusterOption = styled.span` padding: 2px 0px; border-radius: 4px; font-weight: 400; - gap: 12px; + gap: 8px; } .s-dot { width: 4px; height: 4px; + margin: 0 4px; background-color: var(--ant-color-text-quaternary); border-radius: 50%; } @@ -128,16 +129,18 @@ const BasicForm: React.FC = (props) => { 0 ? 'ready' : ''}`} > - - {intl.formatMessage({ id: 'resources.nodes' })}: - - {data.ready_workers} / {data.workers} + + + {intl.formatMessage({ id: 'resources.nodes' })}: + + {data.ready_workers}/{data.workers} + + + + + GPUs: + {data.gpus} - - - - GPUs: - {data.gpus} diff --git a/src/pages/login/components/password-form.tsx b/src/pages/login/components/password-form.tsx index 8c32d588..83f95031 100644 --- a/src/pages/login/components/password-form.tsx +++ b/src/pages/login/components/password-form.tsx @@ -1,4 +1,5 @@ import { initialPasswordAtom, userAtom } from '@/atoms/user'; +import { resetStorageUserSettings } from '@/atoms/utils'; import SealInput from '@/components/seal-form/seal-input'; import { PasswordReg } from '@/config'; import { @@ -43,6 +44,7 @@ const PasswordForm: React.FC = () => { }); setInitialPassword(''); // Reset first login flag + resetStorageUserSettings(); writeState(IS_FIRST_LOGIN, null); gotoDefaultPage(userInfo); message.success(intl.formatMessage({ id: 'common.message.success' }));