Rewire Dashboard Overview and User section to ServiceProvider traits #11

Closed
opened 2026-02-09 21:03:40 +00:00 by mik-tf · 2 comments
Owner

Problem

The Dashboard Overview and User section handlers bypass ServiceProvider and use direct fixture instantiation. The dashboard home page shows empty charts, no activity feed, and the user section shows rentals loading forever.

Affected Handlers

Dashboard Overview

  • index / dashboard_home — Main dashboard page with summary cards and charts
  • dashboard_activity_api — Activity feed data
  • user_dashboard_data_api Already fixed

User Section

  • user_section — User profile/rentals page
  • user_rentals_api — Slice rentals list
  • user_bookings_api — Booking history
  • user_profile_update — Profile edit handler
  • user_ssh_keys_api — SSH key management

Current Bypass Pattern

// These create fixture-only service instances
let user_service = UserService::builder().build();
let rp_service = ResourceProviderService::builder().build();
let orders = OrderService::builder().build();

Solution

Replace all builder pattern instantiations with ServiceProvider trait calls:

// Use injected ServiceProvider
let apps = services.app_provider.get_applications(&user_id).await?;
let nodes = services.resource_provider.get_nodes(&user_id).await?;
let orders = services.orders.get_orders(&user_id).await?;

Acceptance Criteria

  • Dashboard home shows summary counts from real data
  • Activity feed populated with recent actions
  • User section shows active rentals from hero_osis
  • Booking history displays correctly
  • Profile editing works end-to-end
  • Zero UserService::builder() calls remain in these handlers

Dependencies

  • Depends on: #9 (split dashboard.rs)
  • Can be done in parallel with: #10, #12, #13
## Problem The Dashboard Overview and User section handlers bypass ServiceProvider and use direct fixture instantiation. The dashboard home page shows empty charts, no activity feed, and the user section shows rentals loading forever. ## Affected Handlers ### Dashboard Overview - `index` / `dashboard_home` — Main dashboard page with summary cards and charts - `dashboard_activity_api` — Activity feed data - `user_dashboard_data_api` — ✅ Already fixed ### User Section - `user_section` — User profile/rentals page - `user_rentals_api` — Slice rentals list - `user_bookings_api` — Booking history - `user_profile_update` — Profile edit handler - `user_ssh_keys_api` — SSH key management ## Current Bypass Pattern ```rust // These create fixture-only service instances let user_service = UserService::builder().build(); let rp_service = ResourceProviderService::builder().build(); let orders = OrderService::builder().build(); ``` ## Solution Replace all builder pattern instantiations with ServiceProvider trait calls: ```rust // Use injected ServiceProvider let apps = services.app_provider.get_applications(&user_id).await?; let nodes = services.resource_provider.get_nodes(&user_id).await?; let orders = services.orders.get_orders(&user_id).await?; ``` ## Acceptance Criteria - [ ] Dashboard home shows summary counts from real data - [ ] Activity feed populated with recent actions - [ ] User section shows active rentals from hero_osis - [ ] Booking history displays correctly - [ ] Profile editing works end-to-end - [ ] Zero `UserService::builder()` calls remain in these handlers ## Dependencies - Depends on: #9 (split dashboard.rs) - Can be done in parallel with: #10, #12, #13
Author
Owner

Rewired activities + SSH keys to ServiceProvider. Added services param to 9 handlers (commit b28bfbc).

Rewired activities + SSH keys to ServiceProvider. Added services param to 9 handlers (commit b28bfbc).
Author
Owner

Reopened — remaining work

Remaining bypasses in dashboard/user.rs:

  • 2x CurrencyService::new() (utility, keep)
  • 2x UserService::builder() (get_applications, calculate_metrics)
  • 1x SessionManager (infrastructure, keep)
  • 9x UserPersistence (load/save user data, notification settings)
  • 3x SliceRentalService::builder() (get_user_slice_rentals)

Remaining in dashboard/overview.rs:

  • 1x CurrencyService::new() (utility, keep)
  • 1x UserService::builder() (calculate_metrics)

Remaining in dashboard/mod.rs:

  • 5x UserPersistence (load/create user data, get apps)
  • 2x SessionManager (infrastructure, keep)

Depends on #26, #27

## Reopened — remaining work Remaining bypasses in dashboard/user.rs: - 2x `CurrencyService::new()` (utility, keep) - 2x `UserService::builder()` (get_applications, calculate_metrics) - 1x `SessionManager` (infrastructure, keep) - 9x `UserPersistence` (load/save user data, notification settings) - 3x `SliceRentalService::builder()` (get_user_slice_rentals) Remaining in dashboard/overview.rs: - 1x `CurrencyService::new()` (utility, keep) - 1x `UserService::builder()` (calculate_metrics) Remaining in dashboard/mod.rs: - 5x `UserPersistence` (load/create user data, get apps) - 2x `SessionManager` (infrastructure, keep) Depends on #26, #27
Commenting is not possible because the repository is archived.
No description provided.