feat: configurable unused images threshold with dashboard warning

- Add image_prune_threshold_mb setting (default 1024 MB)
- Add GET /api/docker/unused-images endpoint returning unused image count, size, and threshold status
- Dashboard shows amber warning banner when unused project images exceed threshold
- Banner links to settings page for pruning, shows count and human-readable size (MB/GB)
- Threshold configurable in Docker Image Cleanup section of settings
- DB migration + schema for image_prune_threshold_mb
This commit is contained in:
2026-04-05 14:34:48 +03:00
parent 0ddad87a9a
commit b0816502bf
12 changed files with 137 additions and 2 deletions
+6
View File
@@ -289,6 +289,12 @@ export function listProjectImages(projectId: string): Promise<LocalImage[]> {
return get<LocalImage[]>(`/api/projects/${projectId}/images`);
}
export function getUnusedImageStats(): Promise<{
total_size_mb: number; count: number; threshold_mb: number; exceeded: boolean;
}> {
return get<{ total_size_mb: number; count: number; threshold_mb: number; exceeded: boolean }>('/api/docker/unused-images');
}
export function pruneImages(): Promise<{ images_removed: number; space_reclaimed_mb: number }> {
return post<{ images_removed: number; space_reclaimed_mb: number }>('/api/docker/prune-images');
}
+5 -1
View File
@@ -30,7 +30,9 @@
"noProjects": "No projects yet.",
"addFirst": "Add your first project",
"loadFailed": "Failed to load dashboard",
"staleContainers": "Stale Containers"
"staleContainers": "Stale Containers",
"unusedImagesWarning": "Unused Docker images are taking up disk space",
"unusedImages": "unused images"
},
"projects": {
"title": "Projects",
@@ -257,6 +259,8 @@
"staleThresholdHelp": "Containers inactive for longer than this will be flagged as stale.",
"dockerCleanup": "Docker Image Cleanup",
"dockerCleanupHelp": "Remove unused Docker images belonging to your projects. Only images not used by active instances are removed.",
"pruneThreshold": "Warning Threshold (MB)",
"pruneThresholdHelp": "Show dashboard warning when unused project images exceed this size. 0 = disabled.",
"pruneImages": "Prune Unused Images",
"pruning": "Pruning...",
"pruneResult": "Removed {count} images, reclaimed {mb} MB",
+5 -1
View File
@@ -30,7 +30,9 @@
"noProjects": "Проектов пока нет.",
"addFirst": "Добавьте первый проект",
"loadFailed": "Не удалось загрузить панель",
"staleContainers": "Устаревшие контейнеры"
"staleContainers": "Устаревшие контейнеры",
"unusedImagesWarning": "Неиспользуемые Docker-образы занимают дисковое пространство",
"unusedImages": "неиспользуемых образов"
},
"projects": {
"title": "Проекты",
@@ -257,6 +259,8 @@
"staleThresholdHelp": "Контейнеры, неактивные дольше этого срока, будут помечены как устаревшие.",
"dockerCleanup": "Очистка Docker-образов",
"dockerCleanupHelp": "Удаление неиспользуемых Docker-образов ваших проектов. Удаляются только образы, не используемые активными экземплярами.",
"pruneThreshold": "Порог предупреждения (МБ)",
"pruneThresholdHelp": "Показывать предупреждение на дашборде, когда неиспользуемые образы превышают этот размер. 0 = отключено.",
"pruneImages": "Очистить неиспользуемые образы",
"pruning": "Очистка...",
"pruneResult": "Удалено {count} образов, освобождено {mb} МБ",
+1
View File
@@ -121,6 +121,7 @@ export interface Settings {
dns_provider: string;
has_cloudflare_api_token: boolean;
cloudflare_zone_id: string;
image_prune_threshold_mb: number;
proxy_provider: string;
traefik_entrypoint: string;
traefik_cert_resolver: string;