feat : add frontend dashboard types and service
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
frontend/services/dashboard.ts
Normal file
13
frontend/services/dashboard.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import type { DashboardResponse, EnvironmentHealth } from './dto/dashboard'
|
||||||
|
|
||||||
|
export function getDashboard(): Promise<DashboardResponse> {
|
||||||
|
return useApi().get<DashboardResponse>('/dashboard', undefined, {
|
||||||
|
toast: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEnvironmentHealth(envId: number): Promise<EnvironmentHealth> {
|
||||||
|
return useApi().get<EnvironmentHealth>(`/environments/${envId}/health`, undefined, {
|
||||||
|
toast: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
27
frontend/services/dto/dashboard.ts
Normal file
27
frontend/services/dto/dashboard.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
type DashboardEnvironment = {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
status: string
|
||||||
|
version: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type DashboardApplication = {
|
||||||
|
name: string
|
||||||
|
slug: string
|
||||||
|
giteaUrl?: string
|
||||||
|
environments: DashboardEnvironment[]
|
||||||
|
}
|
||||||
|
|
||||||
|
type DashboardResponse = {
|
||||||
|
applications: DashboardApplication[]
|
||||||
|
}
|
||||||
|
|
||||||
|
type EnvironmentHealth = {
|
||||||
|
status: string
|
||||||
|
version: string
|
||||||
|
startedAt: string
|
||||||
|
cpuPercent: number
|
||||||
|
memoryUsage: string
|
||||||
|
memoryLimit: string
|
||||||
|
memoryPercent: number
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user