Skip to content
Permalink
Browse files
[Fix] Fix the disk occupancy display error and initialize error (#40)
  • Loading branch information
zhengbowen01 committed Apr 11, 2022
1 parent 2e10f8f commit 533b267c3d9009824c7871a29ca79fafc1b5b7c4
Showing 9 changed files with 19 additions and 15 deletions.
@@ -92,5 +92,5 @@ export const FIRST_COLUMN_FIELD_TYPES = FIELD_TYPES.filter(

export enum AuthTypeEnum {
LDAP = 'ldap',
LOCAL = 'local',
STUDIO = 'studio',
}
@@ -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);
@@ -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,
},
@@ -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 => {
@@ -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>
</>
);
@@ -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);
}
@@ -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>
@@ -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');
@@ -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) {

0 comments on commit 533b267

Please sign in to comment.