diff --git a/frontend/services/dashboard.ts b/frontend/services/dashboard.ts new file mode 100644 index 0000000..97f5d1c --- /dev/null +++ b/frontend/services/dashboard.ts @@ -0,0 +1,13 @@ +import type { DashboardResponse, EnvironmentHealth } from './dto/dashboard' + +export function getDashboard(): Promise { + return useApi().get('/dashboard', undefined, { + toast: false, + }) +} + +export function getEnvironmentHealth(envId: number): Promise { + return useApi().get(`/environments/${envId}/health`, undefined, { + toast: false, + }) +} diff --git a/frontend/services/dto/dashboard.ts b/frontend/services/dto/dashboard.ts new file mode 100644 index 0000000..1f2dcc1 --- /dev/null +++ b/frontend/services/dto/dashboard.ts @@ -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 +}