Skip to content

feat(v0.9.0): dashboard enrichi — BackupRun, stats API, KPIs, charts, i18n input#10

Merged
AlexArtaud-Dev merged 25 commits into
masterfrom
feature/v0.9.0
Jun 12, 2026
Merged

feat(v0.9.0): dashboard enrichi — BackupRun, stats API, KPIs, charts, i18n input#10
AlexArtaud-Dev merged 25 commits into
masterfrom
feature/v0.9.0

Conversation

@AlexArtaud-Dev

Copy link
Copy Markdown
Owner

Summary

  • BackupRun : tracking de chaque exécution (status, durée, taille, triggerType) + purge cron horaire
  • Stats API (GET /api/stats) : KPIs, période configurable (7j/30j/365j), runs récents par jour, derniers runs
  • Dashboard : 6 KPI cards, bar chart « Exécutions par jour » (groupé par mois sur 365j), donut « Résultats globaux », line chart taille + durée, mode live, filtre période
  • Tests : stats service (20), scheduler purge (4), runner triggerType (4), dashboard formatters (19)
  • i18n input : label/description du sélecteur HTTP REST passés par t() au lieu d'être hardcodés

Test plan

  • Lancer les backups manuels et vérifier que les BackupRun s'insèrent en base
  • Tester le dashboard avec les 3 périodes (7j / 30j / 365j) et le mode live
  • Vérifier le groupement mensuel sur 365j dans le chart « Exécutions par jour »
  • Passer la langue en FR et vérifier que le sélecteur input affiche les labels traduits
  • pnpm run test + pnpm run lint + pnpm exec tsc --noEmit → 0 erreurs

…tecture

Backend:
- Add IInputProvider + IOutputProvider interfaces with ProviderMeta, FileToArchive,
  ArchiveResult and OutputRow shared types in src/providers/
- Implement InputProviderRegistry and OutputProviderRegistry (self-registering
  pattern via OnModuleInit)
- Extract HTTP-REST fetch logic from BackupRunner into HttpRestInputProvider
- Extract mail send logic from BackupRunner into MailOutputProvider
- Add ProvidersModule with GET /api/providers endpoint exposing registered providers
- BackupRunner delegates to registries — adding a new provider only requires
  implementing the interface and registering in ProvidersModule

Frontend:
- Add frontend provider registry (input-registry.ts, output-registry.ts)
- Register http-rest and mail built-in providers in providers/index.ts
- Convert /input/http-rest/* static routes to /input/[type]/* dynamic routes
  that resolve components via the registry at runtime
- Input selector page (/input) is now fully data-driven from the registry
- providersService.list() added for GET /api/providers
… codes

Introduce OrbixException base class and domain-specific subclasses
(input, archive, output, vault, url-source). LogsWriter gains an
exception() helper that embeds the class name in the detail field for
easy tracing. Runner and providers now throw typed exceptions instead
of raw Error objects; catch blocks use logs.exception() for typed paths
and fall back to logs.error() for unexpected errors.
Add VaultDecryptionFailedException for corrupted vault payloads.
Update input.service test(), mail.service send(), vault.service
testEmail(), backup.scheduler cron catch, and vault.scheduler cron
catch to use OrbixException subclasses and logs.exception() consistently
across the entire backend. input.service test() now returns errorCode
for typed errors.
UX / Frontend
- Replace loading text with shadcn Skeleton components across all list and detail pages
- Add empty state cards (vault variable-set, contacts, templates)
- Fix loading state on settings page (ZIP info secondary loader)
- Add skeleton.tsx component with SkeletonListItems and SkeletonForm helpers

Backend robustness
- HTTP input: add 30s AbortController timeout on all fetch paths
- Archiver: destroy on error to release file handles
- Backup runner: path traversal guard on file/folder sources

Security
- RateLimitGuard: in-memory sliding window (20 req/min/IP) on auth endpoints
- Global JwtAuthGuard via APP_GUARD — all routes protected by default

Tests
- input.service.spec: add CRUD + test() coverage (mock fetchWithConfig)
- create-input.dto.spec: 9 validation tests
- create-backup.dto.spec: 12 validation tests (fix reflect-metadata import)

Documentation
- README.md: product facade with pipeline diagram, quick start, config table
- docs/architecture.md: system overview, module map, execution flow
- docs/modules.md: all modules with endpoints and field references
- docs/providers.md: provider pattern guide with SFTP and webhook examples
- docs/data-model.md: full Prisma schema reference

Docker
- docker-compose.prod.yml: healthcheck on the orbix service
- .env.example: documented comments for all variables
Formatting and style corrections applied by ESLint --fix on all modified files. No logic changes.
Sortie des champs smtpStatus* de VaultEntity vers une table VaultHealthCheck
dédiée (relation 1-1), migration Prisma, service et types backend mis à jour,
UI frontend adaptée (badge de statut, page email vault).
Composant <BackupPipeline /> avec renderer registry extensible : sources
groupées (file/folder), flèche fan-out SVG animée, panneau de détail par nœud.
Détails email enrichis (destinataires, compte SMTP, template, overrides).
Intégré dans la liste des backups et StepValidate.
Recurring : plusieurs règles (jours + heure) par backup, ordre jours
Lun→Sam→Dim. Le scheduler enregistre un CronJob par règle.
Interval : date de début (obligatoire, passée ou future) et date de fin
optionnelle ; le scheduler diffère ou arrête le job selon ces dates.
Migration de données transparente (ancien format scheduleConfig préservé).
…format

Remove stale smtpStatus* fields from VaultEntity, add VaultHealthCheck
section (1-1 relation, agnostic health check). Document scheduleConfig
shapes per scheduleType including new multi-rule recurring format.
- Prisma: add BackupRun model with indexes + relation on Backup
- BackupRunner: create run at start, update on success/error (size, filesCount, duration)
- BackupScheduler: pass triggerType scheduler/manual; purge cron every hour using backupRetentionDays
- StatsModule: GET /api/stats?period=7d|30d|365d with counts, recentRuns, lastRuns, nextScheduled, logsByLevel, errorsByDay
- Frontend: stats service + new dashboard with 6 KPI cards, 6 charts and last-runs table
- BackupRunner.run() accepts triggerType ('manual'|'scheduler'|'api'), creates BackupRun on start, updates on success/error
- BackupScheduler: purgeOldRuns() cron hourly, deletes BackupRun older than backupRetentionDays
- StatsService: periodStats (totalRuns, successRate, avgSizeBytes, avgDurationMs), UTC-safe date bucketing in fillRunDays/fillLogDays, finishedAt included in recentRunsRaw for duration calc
- VaultService: minor formatting
- KPI cards: icon left + title/value right layout, 2-row grid (3 cols), compact padding
- Exécutions par jour: monthly grouping for 365d period, fixed height h-[200px]
- Resultats globaux: remove self-start, flex-col fill, larger donut (180px), legend
- Taille/Duree charts: custom MetricTooltip (no concatenation), top margin for Y-axis
- Vault page: equal card heights via flex flex-1
- shadcn chart component added
…hboard formatters

- stats.service.spec.ts: counts, periodStats (rate/size/duration), UTC bucketing, lastRuns mapping (20 tests)
- backup.scheduler.spec.ts: purgeOldRuns cutoff date, retentionDays from settings, log on purge (4 tests)
- backup.runner.spec.ts: triggerType variants, BackupRun not created when backup missing (4 new tests)
- dashboard.utils.ts: extract formatSize/formatDuration/formatDay/formatMonth/groupByMonth from page.tsx
- dashboard.utils.test.ts: formatters + groupByMonth UTC safety (19 tests)
- docs/data-model.md: add BackupRun table with columns, indexes, purge cron note
# Conflicts:
#	backend/src/modules/backup/backup.scheduler.ts
#	backend/src/modules/vault/vault.service.ts
#	docs/data-model.md
providers/index.ts now stores i18n keys (input.type.httpRest,
input.typeDesc.httpRest) instead of hardcoded English strings.
input/page.tsx renders them with t() so the selector card
respects the active locale.
@AlexArtaud-Dev
AlexArtaud-Dev merged commit 980ae59 into master Jun 12, 2026
10 checks passed
@AlexArtaud-Dev
AlexArtaud-Dev deleted the feature/v0.9.0 branch June 12, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant