This is an automated email from the ASF dual-hosted git repository. jiafengzheng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris-manager.git
The following commit(s) were added to refs/heads/master by this push: new 533b267 [Fix] Fix the disk occupancy display error and initialize error (#40) 533b267 is described below commit 533b267c3d9009824c7871a29ca79fafc1b5b7c4 Author: zhengbowen <101616192+zhengbowe...@users.noreply.github.com> AuthorDate: Mon Apr 11 15:51:50 2022 +0800 [Fix] Fix the disk occupancy display error and initialize error (#40) --- frontend/src/common/common.data.ts | 2 +- frontend/src/hooks/use-auth.ts | 2 +- .../src/routes/cluster/components/liquid-fill-chart/index.tsx | 8 ++++---- frontend/src/routes/cluster/overview/index.tsx | 2 +- frontend/src/routes/initialize/auths/auth.tsx | 4 ++-- .../routes/initialize/auths/components/admin-user/admin-user.tsx | 2 +- frontend/src/routes/initialize/initialize-set-type.tsx | 6 +++--- frontend/src/routes/initialize/initialize.tsx | 4 ++-- frontend/src/routes/passport/login.tsx | 4 ++++ 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/frontend/src/common/common.data.ts b/frontend/src/common/common.data.ts index d3572e1..cda7ec7 100644 --- a/frontend/src/common/common.data.ts +++ b/frontend/src/common/common.data.ts @@ -92,5 +92,5 @@ export const FIRST_COLUMN_FIELD_TYPES = FIELD_TYPES.filter( export enum AuthTypeEnum { LDAP = 'ldap', - LOCAL = 'local', + STUDIO = 'studio', } diff --git a/frontend/src/hooks/use-auth.ts b/frontend/src/hooks/use-auth.ts index aef9988..7c79a1c 100644 --- a/frontend/src/hooks/use-auth.ts +++ b/frontend/src/hooks/use-auth.ts @@ -35,7 +35,7 @@ export function useAuth() { const res = await InitializeAPI.getInitProperties(); if (isSuccess(res)) { setInitStep(res.data.initStep); - setAuthType(res.data.auth_type === 'studio' ? AuthTypeEnum.LOCAL : AuthTypeEnum.LDAP); + setAuthType(res.data.auth_type === 'studio' ? AuthTypeEnum.STUDIO : AuthTypeEnum.LDAP); if (res.data.completed) { localStorage.setItem('initialized', 'true'); setInitialized(true); diff --git a/frontend/src/routes/cluster/components/liquid-fill-chart/index.tsx b/frontend/src/routes/cluster/components/liquid-fill-chart/index.tsx index b37b028..8962de0 100644 --- a/frontend/src/routes/cluster/components/liquid-fill-chart/index.tsx +++ b/frontend/src/routes/cluster/components/liquid-fill-chart/index.tsx @@ -19,7 +19,7 @@ import React from 'react'; import ReactEChartsCore from 'echarts-for-react/lib/core'; import * as echarts from 'echarts/core'; import 'echarts-liquidfill'; -import styles from './index.module.less' +import styles from './index.module.less'; interface LiquidFillChartProps { label?: string; @@ -39,7 +39,7 @@ export default function LiquidFillChart(props: LiquidFillChartProps) { series: [ { type: 'liquidFill', - data: [value], + data: [Number(value) / 100], radius: '150vw', backgroundStyle: { color: '#fff', @@ -62,8 +62,8 @@ export default function LiquidFillChart(props: LiquidFillChartProps) { }, waveAnimation: false, label: { - formatter: (param: any) => { - return (param.value * 100).toFixed(2) + '%'; + formatter: () => { + return Number(value).toFixed(2) + '%'; }, fontSize: 25, }, diff --git a/frontend/src/routes/cluster/overview/index.tsx b/frontend/src/routes/cluster/overview/index.tsx index aeb6215..49646b4 100644 --- a/frontend/src/routes/cluster/overview/index.tsx +++ b/frontend/src/routes/cluster/overview/index.tsx @@ -52,7 +52,7 @@ export default function ClusterOverview() { }, }); const getClusterInfo = useCallback( - (setStartLoading: boolean = false) => { + (setStartLoading = false) => { return runGetClusterInfo( Promise.all([ SpaceAPI.spaceGet(userInfo.space_id + '').then(res => { diff --git a/frontend/src/routes/initialize/auths/auth.tsx b/frontend/src/routes/initialize/auths/auth.tsx index e351d71..93b65d2 100644 --- a/frontend/src/routes/initialize/auths/auth.tsx +++ b/frontend/src/routes/initialize/auths/auth.tsx @@ -22,8 +22,8 @@ export function InitializeAuth() { return ( <> <Routes> - <Route path="local/*" element={<AuthLocal />} /> - <Route path="/" element={<Navigate replace to="local" />} /> + <Route path="studio/*" element={<AuthLocal />} /> + <Route path="/" element={<Navigate replace to="studio" />} /> </Routes> </> ); diff --git a/frontend/src/routes/initialize/auths/components/admin-user/admin-user.tsx b/frontend/src/routes/initialize/auths/components/admin-user/admin-user.tsx index 54db3ab..dd49c36 100644 --- a/frontend/src/routes/initialize/auths/components/admin-user/admin-user.tsx +++ b/frontend/src/routes/initialize/auths/components/admin-user/admin-user.tsx @@ -27,7 +27,7 @@ export function AdminUser() { const { username, ...params } = values; const res = await InitializeAPI.setAdmin({ ...params, name: username }); if (isSuccess(res)) { - navigate('/initialize/auth/local/finish'); + navigate('/initialize/auth/studio/finish'); } else { message.error(res.msg); } diff --git a/frontend/src/routes/initialize/initialize-set-type.tsx b/frontend/src/routes/initialize/initialize-set-type.tsx index 0effe93..4b072c4 100644 --- a/frontend/src/routes/initialize/initialize-set-type.tsx +++ b/frontend/src/routes/initialize/initialize-set-type.tsx @@ -24,12 +24,12 @@ import { InitializeAPI } from './initialize.api'; import styles from './initialize.less'; export function InitializeSetType() { - const [authType, setAuthType] = useState<AuthTypeEnum>(AuthTypeEnum.LOCAL); + const [authType, setAuthType] = useState<AuthTypeEnum>(AuthTypeEnum.STUDIO); const navigate = useNavigate(); async function handleSetAuthType() { const res = await InitializeAPI.setAuthType({ authType }); if (isSuccess(res)) { - navigate(authType); + navigate(`auth/${authType}`); } else { message.error(res.msg); } @@ -41,7 +41,7 @@ export function InitializeSetType() { <Card type="inner" title="管理用户"> <Radio.Group onChange={e => setAuthType(e.target.value)} value={authType}> <Space direction="vertical"> - <Radio value={AuthTypeEnum.LOCAL}>本地认证</Radio> + <Radio value={AuthTypeEnum.STUDIO}>本地认证</Radio> </Space> </Radio.Group> <p style={{ marginTop: 10 }}>注意,初始化选择好认证方式后不可再改变。</p> diff --git a/frontend/src/routes/initialize/initialize.tsx b/frontend/src/routes/initialize/initialize.tsx index b517e33..408ca0d 100644 --- a/frontend/src/routes/initialize/initialize.tsx +++ b/frontend/src/routes/initialize/initialize.tsx @@ -33,11 +33,11 @@ export function Initialize() { if (currentAuthType && initStep) { const feStep = initStep ? initStep - 1 : 1; let stepPage = ''; - if (currentAuthType === AuthTypeEnum.LOCAL) { + if (currentAuthType === AuthTypeEnum.STUDIO) { stepPage = LocalStepsEnum[feStep]; } if (initialized) { - if (currentAuthType === AuthTypeEnum.LOCAL) { + if (currentAuthType === AuthTypeEnum.STUDIO) { stepPage = LocalStepsEnum[feStep]; if (feStep === 1) { navigate('/space'); diff --git a/frontend/src/routes/passport/login.tsx b/frontend/src/routes/passport/login.tsx index 00a09f7..746f194 100644 --- a/frontend/src/routes/passport/login.tsx +++ b/frontend/src/routes/passport/login.tsx @@ -22,6 +22,7 @@ import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router'; import { useEffect } from 'react'; import { dorisAuthProvider } from '@src/components/auths/doris-auth-provider'; +import { useAuth } from '@src/hooks/use-auth'; export function Login() { const [form] = Form.useForm(); const { t } = useTranslation(); @@ -40,6 +41,9 @@ export function Login() { }); } + // check should switch to initialize page + useAuth(); + useEffect(() => { const login = dorisAuthProvider.checkLogin(); if (login) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org