feat(admin): Storage panel on admin dashboard — MinIO admin API integration #334

Open
opened 2026-04-26 13:03:54 +02:00 by marcel · 0 comments
Owner

Context

The admin dashboard (#324) intentionally excludes a Storage panel in v1 because the required data is not available from the database and would require new MinIO admin API integration. This issue tracks that follow-on work.

The backend currently uses the standard AWS S3 client (object put/get only). File sizes are not stored in the Document entity. Storage metrics require the MinIO admin API (DataUsageInfo), which is a separate client.

What this adds

A Storage panel on the admin dashboard (/admin) with:

  • Total bytes stored in the archive-documents bucket
  • Total object count (includes documents, thumbnails, and any derived artifacts — more than just the documents table count)
  • Orphaned objects — objects present in MinIO with no matching document record in the database (data integrity signal)

Why orphaned objects matter

When a document is deleted or an upload fails mid-way, the file object may remain in MinIO. The database is unaware of these. The only way to detect them is to cross-reference MinIO object keys against the documents table. This is a data integrity concern that has no DB-side solution.

Implementation notes

  • New MinioAdminClient bean (or equivalent) configured alongside the existing MinioConfig
  • AdminDashboardService (from #324) gains a getStorageStats() method that calls the MinIO admin API
  • If the MinIO admin API is unreachable, the Storage panel degrades gracefully (same pattern as the OCR panel in #324 — panel shows unavailable, rest of dashboard loads)
  • AdminDashboardDTO gains a storage section:
    storage: {
      totalBytes: Long,
      totalObjects: Integer,
      orphanedObjects: Integer   // objects in MinIO with no document record
    }
    
  • Orphan calculation: list all object keys in the bucket, cross-reference against documents.file_path (or equivalent key field)

Non-goals

  • No automatic cleanup of orphaned objects in v1 — display only
  • No per-user or per-document storage breakdown

Acceptance criteria

  • Storage panel visible on /admin dashboard alongside Activity, OCR, and Invites panels
  • Shows total bytes, total object count, and orphaned object count
  • Panel degrades gracefully if MinIO admin API is unreachable
  • Orphan count links to a list or is actionable in a future issue

Depends on

  • #324 (admin dashboard must be delivered first — this panel slots into it)
## Context The admin dashboard (#324) intentionally excludes a Storage panel in v1 because the required data is not available from the database and would require new MinIO admin API integration. This issue tracks that follow-on work. The backend currently uses the standard AWS S3 client (object put/get only). File sizes are not stored in the `Document` entity. Storage metrics require the MinIO admin API (`DataUsageInfo`), which is a separate client. ## What this adds A **Storage panel** on the admin dashboard (`/admin`) with: - Total bytes stored in the `archive-documents` bucket - Total object count (includes documents, thumbnails, and any derived artifacts — more than just the `documents` table count) - **Orphaned objects** — objects present in MinIO with no matching document record in the database (data integrity signal) ## Why orphaned objects matter When a document is deleted or an upload fails mid-way, the file object may remain in MinIO. The database is unaware of these. The only way to detect them is to cross-reference MinIO object keys against the `documents` table. This is a data integrity concern that has no DB-side solution. ## Implementation notes - New `MinioAdminClient` bean (or equivalent) configured alongside the existing `MinioConfig` - `AdminDashboardService` (from #324) gains a `getStorageStats()` method that calls the MinIO admin API - If the MinIO admin API is unreachable, the Storage panel degrades gracefully (same pattern as the OCR panel in #324 — panel shows unavailable, rest of dashboard loads) - `AdminDashboardDTO` gains a `storage` section: ``` storage: { totalBytes: Long, totalObjects: Integer, orphanedObjects: Integer // objects in MinIO with no document record } ``` - Orphan calculation: list all object keys in the bucket, cross-reference against `documents.file_path` (or equivalent key field) ## Non-goals - No automatic cleanup of orphaned objects in v1 — display only - No per-user or per-document storage breakdown ## Acceptance criteria - [ ] Storage panel visible on `/admin` dashboard alongside Activity, OCR, and Invites panels - [ ] Shows total bytes, total object count, and orphaned object count - [ ] Panel degrades gracefully if MinIO admin API is unreachable - [ ] Orphan count links to a list or is actionable in a future issue ## Depends on - #324 (admin dashboard must be delivered first — this panel slots into it)
marcel added the P3-laterfeatureui labels 2026-04-26 13:03:59 +02:00
Sign in to join this conversation.
No Label P3-later feature ui
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#334