fix: reset userSettings first login
This commit is contained in:
@@ -11,7 +11,7 @@ type UserSettings = {
|
||||
hideAddResourceModal?: boolean;
|
||||
};
|
||||
|
||||
const defaultSettings: UserSettings = {
|
||||
export const defaultSettings: UserSettings = {
|
||||
theme: 'light',
|
||||
mode: 'auto',
|
||||
isDarkTheme: false,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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'
|
||||
};
|
||||
|
||||
@@ -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 ==========
|
||||
|
||||
@@ -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 ==========
|
||||
|
||||
@@ -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': '节点就绪'
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@ const EditorInner: React.FC<ViewerProps> = forwardRef((props, ref) => {
|
||||
const yamlUri = monaco.Uri.parse(path);
|
||||
|
||||
configureMonacoYaml(monaco, {
|
||||
hover: false,
|
||||
schemas: [
|
||||
{
|
||||
uri: 'http://example.com/schema-name.json',
|
||||
|
||||
@@ -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<BackendCardProps> = ({ data, onSelect }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
<StyledCard
|
||||
onClick={handleClick}
|
||||
clickable={true}
|
||||
hoverable={true}
|
||||
@@ -197,7 +207,7 @@ const BackendCard: React.FC<BackendCardProps> = ({ data, onSelect }) => {
|
||||
header={
|
||||
<Header>
|
||||
<div className="title">{renderIcon()}</div>
|
||||
<span onClick={onClick}>
|
||||
<span onClick={onClick} className="operations">
|
||||
<DropDownActions
|
||||
menu={{
|
||||
items: actions,
|
||||
@@ -230,7 +240,7 @@ const BackendCard: React.FC<BackendCardProps> = ({ data, onSelect }) => {
|
||||
</CardName>
|
||||
{renderFrameworks()}
|
||||
</Content>
|
||||
</Card>
|
||||
</StyledCard>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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<BasicFormProps> = (props) => {
|
||||
<span
|
||||
className={`dot ${data.ready_workers > 0 ? 'ready' : ''}`}
|
||||
></span>
|
||||
<span className="flex-center gap-4 text-tertiary">
|
||||
<span>{intl.formatMessage({ id: 'resources.nodes' })}:</span>
|
||||
<span>
|
||||
{data.ready_workers} / {data.workers}
|
||||
<span className="flex-center gap-8">
|
||||
<span className="flex-center gap-4 text-tertiary">
|
||||
<span>{intl.formatMessage({ id: 'resources.nodes' })}:</span>
|
||||
<span>
|
||||
{data.ready_workers}/{data.workers}
|
||||
</span>
|
||||
</span>
|
||||
<span className="s-dot"></span>
|
||||
<span className="flex-center gap-4 text-tertiary">
|
||||
<span>GPUs:</span>
|
||||
<span>{data.gpus}</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className="s-dot"></span>
|
||||
<span className="flex-center gap-4 text-tertiary">
|
||||
<span>GPUs:</span>
|
||||
<span>{data.gpus}</span>
|
||||
</span>
|
||||
</span>
|
||||
</ClusterOption>
|
||||
|
||||
@@ -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' }));
|
||||
|
||||
Reference in New Issue
Block a user