feat(dashboard): add statistics API and enhance homepage dashboard cards
- Add Query and DataResponse interfaces to common API module - Implement getDashboardStatistics API endpoint for fetching dashboard metrics - Update TopCardList component to display real dashboard data with dynamic values - Replace hardcoded dashboard metrics with actual API response data - Add support for calculating and displaying weekly growth rates for spaces and users - Update dashboard card labels and descriptions for models, spaces, users, and apps - Add "Rebuild Graph" button translation to knowledge graph card (en/zh) - Add appCount and userCount translation keys for dashboard display - Fix dashboard metric key naming consistency (total_apps_runs → total_running_apps) - Update dashboard descriptions to reflect weekly comparisons instead of daily - Improve data binding between API response and UI components for real-time statistics
This commit is contained in:
@@ -1 +1,33 @@
|
||||
import { request } from "@/utils/request";
|
||||
// 列表查询参数
|
||||
export interface Query {
|
||||
page?: number;
|
||||
pagesize?: number;
|
||||
orderby?: string;
|
||||
desc?: boolean;
|
||||
keywords?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export interface DataResponse {
|
||||
total_models: Number;
|
||||
total_llm: Number;
|
||||
total_embedding: Number;
|
||||
model_week_growth_rate: Number;
|
||||
active_workspaces: Number;
|
||||
new_workspaces_this_week: Number;
|
||||
workspace_week_growth_rate: Number;
|
||||
total_users: Number;
|
||||
new_users_this_week: Number;
|
||||
user_week_growth_rate: Number;
|
||||
running_apps: Number;
|
||||
new_apps_this_week: Number;
|
||||
app_week_growth_rate: Number
|
||||
}
|
||||
// 首页数据统计
|
||||
export const getDashboardData = `/home-page/workspaces`
|
||||
|
||||
// 首页数据看板统计
|
||||
export const getDashboardStatistics = async () => {
|
||||
const response = await request.get(`/home-page/statistics`);
|
||||
return response as DataResponse;
|
||||
};
|
||||
Reference in New Issue
Block a user