feat: dashboard & report APIs with real DB stats
Backend: - Add /dashboard/stats API (data_sources, tables, columns, labeled, sensitive, projects) - Add /dashboard/distribution API (level/cat/source distribution, project progress, heatmap) - Add /reports/stats API (total/auto/manual/reviewed counts + level distribution) - Fix report download: add template relationship to ClassificationProject - All stats computed from real DB queries Frontend: - Dashboard.vue: replace all hardcoded data with API-driven computed charts - Report.vue: replace all hardcoded data with API-driven charts - Add dashboard.ts and report.ts API clients
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import request from './request'
|
||||
|
||||
export interface DashboardStats {
|
||||
data_sources: number
|
||||
tables: number
|
||||
columns: number
|
||||
labeled: number
|
||||
sensitive: number
|
||||
projects: number
|
||||
}
|
||||
|
||||
export interface LevelDistItem {
|
||||
name: string
|
||||
code: string
|
||||
color: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface CategoryDistItem {
|
||||
name: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface SourceDistItem {
|
||||
source: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface ProjectProgressItem {
|
||||
id: number
|
||||
name: string
|
||||
status: string
|
||||
progress: number
|
||||
planned_end: string | null
|
||||
}
|
||||
|
||||
export interface HeatmapItem {
|
||||
source_name: string
|
||||
level_code: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface DashboardDistribution {
|
||||
level_distribution: LevelDistItem[]
|
||||
category_distribution: CategoryDistItem[]
|
||||
source_distribution: SourceDistItem[]
|
||||
project_progress: ProjectProgressItem[]
|
||||
heatmap: HeatmapItem[]
|
||||
}
|
||||
|
||||
export function getDashboardStats() {
|
||||
return request.get('/dashboard/stats')
|
||||
}
|
||||
|
||||
export function getDashboardDistribution() {
|
||||
return request.get('/dashboard/distribution')
|
||||
}
|
||||
Reference in New Issue
Block a user