diff --git a/frontend/src/pages/Deploy/Application/List/index.tsx b/frontend/src/pages/Deploy/Application/List/index.tsx index dc47c20c..2d4d5a87 100644 --- a/frontend/src/pages/Deploy/Application/List/index.tsx +++ b/frontend/src/pages/Deploy/Application/List/index.tsx @@ -7,7 +7,7 @@ import { PythonOutlined, } from '@ant-design/icons'; import { getApplicationPage } from './service'; -import type { Application, ApplicationQuery } from './types'; +import type { Application, ApplicationQuery, ApplicationPage } from './types'; import { DevelopmentLanguageTypeEnum } from './types'; import { getEnabledCategories } from '../Category/service'; import type { ApplicationCategoryResponse } from '../Category/types'; @@ -61,15 +61,16 @@ const ApplicationList: React.FC = () => { }, []); // 包装 fetchFn,同时更新统计数据 - const fetchData = async (query: ApplicationQuery) => { - const result = await getApplicationPage(query); - // 更新统计 - const all = result.content || []; + const fetchData = async (query: ApplicationQuery): Promise => { + const result = await getApplicationPage(query) as ApplicationPage; + + // 使用后端返回的统计数据 setStats({ - total: all.length, - enabled: all.filter((item) => item.enabled).length, - disabled: all.filter((item) => !item.enabled).length, + total: result.totalElements || 0, + enabled: result.enabledCount || 0, + disabled: result.disabledCount || 0, }); + return result; }; diff --git a/frontend/src/pages/Deploy/Application/List/types.ts b/frontend/src/pages/Deploy/Application/List/types.ts index bb8f4725..1b170086 100644 --- a/frontend/src/pages/Deploy/Application/List/types.ts +++ b/frontend/src/pages/Deploy/Application/List/types.ts @@ -1,4 +1,5 @@ import type {BaseQuery} from '@/types/base'; +import type {Page} from '@/types/base'; import {ExternalSystemResponse} from "@/pages/Resource/External/List/types"; import {BaseResponse} from "@/types/base"; import type {ApplicationCategoryResponse} from "../Category/types"; @@ -75,3 +76,9 @@ export interface DevelopmentLanguageType { code: string; name: string; } + +// 应用分页响应(包含统计信息) +export interface ApplicationPage extends Page { + enabledCount: number; // 已启用应用总数 + disabledCount: number; // 已禁用应用总数 +}