Split dashboard.rs god-class into domain-specific controllers #9

Closed
opened 2026-02-09 21:03:14 +00:00 by mik-tf · 1 comment
Owner

Problem

src/controllers/dashboard.rs is a 7,810-line god-class containing 44+ handlers spanning 6 different domains. This violates separation of concerns and makes it extremely difficult to maintain, test, or reason about individual domains.

Current Structure

All of these handlers live in a single file:

Domain Handlers Lines (approx)
Resource Provider 16 handlers ~2,000
Application Provider 8 handlers ~1,200
Service Provider 13 handlers ~1,800
User/Profile 6 handlers ~800
Dashboard Overview 3 handlers ~400
Wallet/Orders 4 handlers ~600

Target Structure

Split into 6 focused controller files:

src/controllers/
├── dashboard/
│   ├── mod.rs              # Re-exports + shared helpers
│   ├── overview.rs          # Dashboard home, activity feed
│   ├── resource_provider.rs # Nodes, earnings, statistics
│   ├── app_provider.rs      # Apps, deployments, customers
│   ├── service_provider.rs  # Services, requests, SLAs
│   ├── user.rs              # Profile, rentals, bookings
│   └── wallet.rs            # Balance, transactions, staking

Implementation Notes

  • This is a pure refactor — no behavior changes
  • Move handlers as-is (including their current fixture bypasses)
  • Update src/routes/mod.rs to import from new module paths
  • Shared types/helpers go in mod.rs
  • Each file should have its own use imports
  • Ensure all existing tests still pass

Acceptance Criteria

  • dashboard.rs is replaced by dashboard/ module directory
  • Each domain controller is under 1,500 lines
  • All routes still resolve correctly
  • No behavior changes — all pages render identically
  • Code compiles and all tests pass

Dependencies

  • Depends on: #8 (architecture plan)
  • Blocks: #10, #11, #12, #13 (all rewiring issues)
## Problem `src/controllers/dashboard.rs` is a 7,810-line god-class containing 44+ handlers spanning 6 different domains. This violates separation of concerns and makes it extremely difficult to maintain, test, or reason about individual domains. ## Current Structure All of these handlers live in a single file: | Domain | Handlers | Lines (approx) | |--------|----------|----------------| | Resource Provider | 16 handlers | ~2,000 | | Application Provider | 8 handlers | ~1,200 | | Service Provider | 13 handlers | ~1,800 | | User/Profile | 6 handlers | ~800 | | Dashboard Overview | 3 handlers | ~400 | | Wallet/Orders | 4 handlers | ~600 | ## Target Structure Split into 6 focused controller files: ``` src/controllers/ ├── dashboard/ │ ├── mod.rs # Re-exports + shared helpers │ ├── overview.rs # Dashboard home, activity feed │ ├── resource_provider.rs # Nodes, earnings, statistics │ ├── app_provider.rs # Apps, deployments, customers │ ├── service_provider.rs # Services, requests, SLAs │ ├── user.rs # Profile, rentals, bookings │ └── wallet.rs # Balance, transactions, staking ``` ## Implementation Notes - This is a **pure refactor** — no behavior changes - Move handlers as-is (including their current fixture bypasses) - Update `src/routes/mod.rs` to import from new module paths - Shared types/helpers go in `mod.rs` - Each file should have its own `use` imports - Ensure all existing tests still pass ## Acceptance Criteria - [ ] `dashboard.rs` is replaced by `dashboard/` module directory - [ ] Each domain controller is under 1,500 lines - [ ] All routes still resolve correctly - [ ] No behavior changes — all pages render identically - [ ] Code compiles and all tests pass ## Dependencies - Depends on: #8 (architecture plan) - Blocks: #10, #11, #12, #13 (all rewiring issues)
Author
Owner

Split 7810-line dashboard.rs into 8 domain controllers (commit c9d212a)

Split 7810-line dashboard.rs into 8 domain controllers (commit c9d212a)
Commenting is not possible because the repository is archived.
No description provided.