Files
ImpTune/.planning/phases/07-dashboard-nav-polish/07-01-SUMMARY.md
T
2026-04-15 17:57:12 +02:00

81 lines
3.6 KiB
Markdown

---
phase: 07-dashboard-nav-polish
plan: 01
subsystem: web-ui
tags: [dashboard, navigation, packages, integration]
one_liner: "Wired dashboard to live DB queries and added /packages listing page closing two visible integration gaps"
dependency_graph:
requires:
- "imptune/db/models.py (Printer, Client, Driver)"
- "imptune/templates/base.html (nav link /packages)"
- "Existing /printers/{id}/packages/intunewin and /ninja endpoints"
provides:
- "GET /packages route rendering printers with drivers"
- "Dashboard recent_printers and recent_packages live queries"
- "packages.html template"
affects:
- "imptune/api/pages.py (dashboard + new packages_page)"
- "imptune/templates/dashboard.html (clickable links, quick actions)"
tech_stack:
added: []
patterns:
- "Deferred imports inside route bodies"
- "list(Model.select()...) wrapper over Peewee queries"
- "LEFT_OUTER joins on Client + Driver with switch(Printer)"
key_files:
created:
- "imptune/templates/packages.html"
- ".planning/phases/07-dashboard-nav-polish/07-01-SUMMARY.md"
modified:
- "imptune/api/pages.py"
- "imptune/templates/dashboard.html"
- "tests/test_static.py"
decisions:
- "packages_page follows printers_page join pattern (LEFT_OUTER Client + Driver, switch, list wrapper)"
- "Empty-state message shown when no driver-assigned printers exist; filter via Printer.driver.is_null(False)"
- "Dashboard list items are anchor tags linking to /printers/{id} detail"
metrics:
duration_min: 1
tasks_completed: 2
files_touched: 4
tests_added: 3
tests_total: 99
completed_at: "2026-04-13"
---
# Phase 7 Plan 1: Dashboard and Packages Wire-Up Summary
Closed two visible integration gaps: the /packages nav link previously returned 404 and the dashboard was rendering hard-coded empty lists despite real records in the database.
## What Was Built
- **New `/packages` route** in `imptune/api/pages.py` mirroring the `printers_page` join pattern; filters to printers where `driver IS NOT NULL` and renders the new `packages.html` template.
- **`packages.html` template** extending `base.html`, showing a Pico grid table with printer name (linked to detail page), client, driver filename, and direct download links for `.intunewin` and NinjaRMM ZIP packages.
- **Dashboard live queries**: `recent_printers = Printer.select().order_by(created_at desc).limit(5)` and `recent_packages` filtered to driver-assigned printers only.
- **Dashboard UX polish**: list items are now anchors to `/printers/{id}`; quick-action buttons (New Printer / Upload Driver / Export Package) are wired to real routes with `aria-disabled` removed.
- **Three integration tests** in `tests/test_static.py` proving /packages returns 200, dashboard shows real printer names, and the recent packages section includes only driver-assigned printers.
## Verification
- Full test suite: `python -m pytest tests/`**99 passed, 0 failed**
- TDD flow: RED commit (8cf47f5) → GREEN commit (91910ad)
- All three new tests failed as expected before the implementation landed and pass after.
## Deviations from Plan
None — plan executed exactly as written.
## Commits
- `8cf47f5` test(07-01): add failing tests for /packages route and dashboard data
- `91910ad` feat(07-01): wire dashboard data and add /packages listing page
## Self-Check: PASSED
- FOUND: imptune/templates/packages.html
- FOUND: imptune/api/pages.py (packages_page route present)
- FOUND: imptune/templates/dashboard.html (clickable links + wired quick actions)
- FOUND: tests/test_static.py (3 new tests)
- FOUND commit: 8cf47f5
- FOUND commit: 91910ad