fix: backend framework options
This commit is contained in:
@@ -4,7 +4,7 @@ import { modelCategoriesMap } from '@/pages/llmodels/config';
|
||||
import { convertFileSize } from '@/utils';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Col, Row, Table } from 'antd';
|
||||
import { memo, useContext } from 'react';
|
||||
import { useContext } from 'react';
|
||||
import { DashboardContext } from '../config/dashboard-context';
|
||||
|
||||
const NACategories = [
|
||||
@@ -96,4 +96,4 @@ const ActiveTable = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(ActiveTable);
|
||||
export default ActiveTable;
|
||||
|
||||
@@ -74,4 +74,4 @@ const Overview: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(Overview);
|
||||
export default Overview;
|
||||
|
||||
@@ -2,7 +2,7 @@ import LineChart from '@/components/echarts/line-chart';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
const TypeKeyMap = {
|
||||
cpu: {
|
||||
@@ -106,4 +106,4 @@ const UtilizationOvertime: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(UtilizationOvertime);
|
||||
export default UtilizationOvertime;
|
||||
|
||||
@@ -12,9 +12,13 @@ import { DashboardProps } from './config/types';
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [loadingStatus, setLoadingStatus] = useState({
|
||||
loading: false,
|
||||
loadend: false
|
||||
});
|
||||
const [data, setData] = useState<DashboardProps>({} as DashboardProps);
|
||||
const { fetchAll, clusterList, workerList } = useClusterList();
|
||||
const { fetchAll, clusterList, workerList, clustersAtom, workersAtom } =
|
||||
useClusterList();
|
||||
|
||||
const { noResourceResult } = useNoResourceResult({
|
||||
loadend: true,
|
||||
@@ -47,16 +51,22 @@ const Dashboard: React.FC = () => {
|
||||
|
||||
const initData = useMemoizedFn(async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
setLoadingStatus({
|
||||
loading: true,
|
||||
loadend: false
|
||||
});
|
||||
const { hasClusters, hasWorkers } = await fetchAll();
|
||||
if (!hasClusters || !hasWorkers) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
await fetchDashboardData();
|
||||
setLoading(false);
|
||||
} catch (error) {
|
||||
setLoading(false);
|
||||
// ignore
|
||||
} finally {
|
||||
setLoadingStatus({
|
||||
loading: false,
|
||||
loadend: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,11 +79,11 @@ const Dashboard: React.FC = () => {
|
||||
value={{ ...data, fetchData: fetchDashboardData, clusterList }}
|
||||
>
|
||||
<PageBox>
|
||||
<Spin spinning={loading} style={{ minHeight: 300 }}>
|
||||
{(!clusterList.length || !workerList.length) && !loading ? (
|
||||
noResourceResult
|
||||
) : loading ? null : (
|
||||
<Spin spinning={loadingStatus.loading} style={{ minHeight: 300 }}>
|
||||
{workersAtom.length > 0 && clustersAtom.length > 0 ? (
|
||||
<DashboardInner />
|
||||
) : loadingStatus.loading || !loadingStatus.loadend ? null : (
|
||||
noResourceResult
|
||||
)}
|
||||
</Spin>
|
||||
</PageBox>
|
||||
|
||||
Reference in New Issue
Block a user