From ce9b9a598b8981501878400655590c7df390ecf5 Mon Sep 17 00:00:00 2001 From: tristan Date: Mon, 6 Apr 2026 16:09:27 +0200 Subject: [PATCH] feat : add frontend dashboard types and service Co-Authored-By: Claude Sonnet 4.6 --- frontend/services/dashboard.ts | 13 +++++++++++++ frontend/services/dto/dashboard.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 frontend/services/dashboard.ts create mode 100644 frontend/services/dto/dashboard.ts 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 +}