chore: add english comment

This commit is contained in:
jialin
2024-08-28 14:51:20 +08:00
parent 9a0aeb491a
commit 9bd6dedd90
28 changed files with 353 additions and 145 deletions
+15 -4
View File
@@ -1,23 +1,27 @@
@media screen and (max-width: 480px) {
/* 在小屏幕的时候可以有更好的体验 */
.umi-plugin-layout-container {
width: 100% !important;
}
.umi-plugin-layout-container > * {
border-radius: 0 !important;
}
}
.umi-plugin-layout-menu .anticon {
margin-right: 8px;
}
.umi-plugin-layout-menu .ant-dropdown-menu-item {
min-width: 160px;
}
.umi-plugin-layout-right {
display: flex !important;
height: 100%;
overflow: hidden;
}
.umi-plugin-layout-right .umi-plugin-layout-action {
display: flex;
align-items: center;
@@ -26,25 +30,32 @@
cursor: pointer;
transition: all 0.3s;
}
.umi-plugin-layout-right .umi-plugin-layout-action > i {
color: rgba(255, 255, 255, 0.85);
color: rgba(255, 255, 255, 85%);
vertical-align: middle;
}
.umi-plugin-layout-right .umi-plugin-layout-action:hover {
background: rgba(0, 0, 0, 0.025);
background: rgba(0, 0, 0, 2.5%);
}
.umi-plugin-layout-right .umi-plugin-layout-action.opened {
background: rgba(0, 0, 0, 0.025);
background: rgba(0, 0, 0, 2.5%);
}
.umi-plugin-layout-right .umi-plugin-layout-search {
padding: 0 12px;
}
.umi-plugin-layout-right .umi-plugin-layout-search:hover {
background: transparent;
}
.umi-plugin-layout-name {
margin-left: 8px;
}
.umi-plugin-layout-name.umi-plugin-layout-hide-avatar-img {
margin-left: 0;
}
-2
View File
@@ -1,6 +1,4 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import GpustackLogo from '@/assets/images/gpustack-logo.png';
import SmallLogo from '@/assets/images/small-logo-200x200.png';
import React from 'react';
+4 -5
View File
@@ -35,7 +35,7 @@ type InitialStateType = {
currentUser?: Global.UserInfo;
};
// 过滤出需要显示的路由, 这里的filterFn 指 不希望显示的层级
// Filter out the routes that need to be displayed, where filterFn indicates the levels that should not be shown
const filterRoutes = (
routes: IRoute[],
filterFn: (route: IRoute) => boolean
@@ -99,8 +99,6 @@ export default (props: any) => {
setInitialState: null
};
// initialState: InitialStateType
const { initialState, loading, setInitialState } = initialInfo;
const userConfig = {
@@ -189,6 +187,8 @@ export default (props: any) => {
const { location } = history;
console.log('onPageChange', userInfo, initialState);
// if user is not change password, redirect to change password page
if (
location.pathname !== loginPath &&
userInfo?.require_password_change
@@ -198,8 +198,7 @@ export default (props: any) => {
return;
}
// 如果没有登录,重定向到 login
// if user is not logged in, redirect to login page
if (!initialState?.currentUser && location.pathname !== loginPath) {
history.push(loginPath);
} else if (location.pathname === '/') {
-3
View File
@@ -1,6 +1,4 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import React from 'react';
import icons from './icons';
@@ -13,7 +11,6 @@ function formatIcon(name: string) {
}
export function patchRoutes({ routes, initialState }) {
console.log('patchRoutes99999', routes);
Object.keys(routes).forEach((key) => {
const { icon } = routes[key];
if (icon && typeof icon === 'string') {
-2
View File
@@ -1,5 +1,3 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import type { RunTimeLayoutConfig } from './types';
export interface IRuntimeConfig {
layout?: RunTimeLayoutConfig;
+3 -6
View File
@@ -1,8 +1,5 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
/// <reference types="@ant-design/pro-components" />
import type InitialStateType from '@@/plugin-initialState/@@initialState';
import '@ant-design/pro-components';
import type { HeaderProps, ProLayoutProps } from '@ant-design/pro-components';
type InitDataType = ReturnType<typeof InitialStateType>;
@@ -26,12 +23,12 @@ export type RunTimeLayoutConfig = (initData: InitDataType) => Omit<
loading: InitDataType['loading'];
initialState: InitDataType['initialState'];
setInitialState: InitDataType['setInitialState'];
},
}
) => JSX.Element)
| false;
rightRender?: (
initialState: InitDataType['initialState'],
setInitialState: InitDataType['setInitialState'],
runtimeConfig: RunTimeLayoutConfig,
runtimeConfig: RunTimeLayoutConfig
) => JSX.Element;
};