diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md index 1a212ac..d18b41e 100644 --- a/.planning/REQUIREMENTS.md +++ b/.planning/REQUIREMENTS.md @@ -9,8 +9,8 @@ - [x] **SITE-01**: Operator can create a site with name, coordinates (lat/lng), address, elevation, and notes - [x] **SITE-02**: Operator can edit and delete sites -- [ ] **SITE-03**: Operator can assign devices to a site (single and bulk assignment) -- [ ] **SITE-04**: Operator can remove a device from a site (device returns to "unassigned") +- [x] **SITE-03**: Operator can assign devices to a site (single and bulk assignment) +- [x] **SITE-04**: Operator can remove a device from a site (device returns to "unassigned") - [x] **SITE-05**: Devices without a site assignment continue to work normally in all existing views - [x] **SITE-06**: Sites are tenant-scoped — each tenant manages their own sites independently @@ -96,8 +96,8 @@ |-------------|-------|--------| | SITE-01 | Phase 11 | Complete | | SITE-02 | Phase 11 | Complete | -| SITE-03 | Phase 11 | Pending | -| SITE-04 | Phase 11 | Pending | +| SITE-03 | Phase 11 | Complete | +| SITE-04 | Phase 11 | Complete | | SITE-05 | Phase 11 | Complete | | SITE-06 | Phase 11 | Complete | | DASH-01 | Phase 11 | Complete | diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index b6ed4d3..0b6cf71 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -34,7 +34,7 @@ v9.7 transforms TOD from a flat device list into a site-aware fleet management p - Integer phases (11, 12, 13): Planned milestone work - Decimal phases (11.1, 11.2): Urgent insertions (marked with INSERTED) -- [ ] **Phase 11: Site Data Model + Foundation** - Sites CRUD, device assignment, site list with health rollup +- [x] **Phase 11: Site Data Model + Foundation** - Sites CRUD, device assignment, site list with health rollup (completed 2026-03-19) - [ ] **Phase 12: Per-Client Wireless Collection** - Poller extension to collect registration table and per-interface RF stats - [ ] **Phase 13: Link Discovery + Registration Ingestion** - Backend NATS consumer, MAC resolution, AP-CPE link state machine - [ ] **Phase 14: Site Dashboard + Sector Views + Wireless UI** - Site detail page, sector-centric view, per-station wireless tables @@ -52,7 +52,7 @@ v9.7 transforms TOD from a flat device list into a site-aware fleet management p 3. Site list page shows all tenant sites with device count, online percentage, and alert count 4. Devices without a site assignment work identically in all existing views (device list, device detail, remote access, config backup) 5. Sites are tenant-scoped — one tenant cannot see or modify another tenant's sites -**Plans:** 2/3 plans executed +**Plans:** 3/3 plans complete Plans: - [ ] 11-01-PLAN.md — Backend data model, migration, service, and REST API for sites @@ -126,7 +126,7 @@ Plans: | Category | Requirements | Phase | Count | |----------|-------------|-------|-------| -| Sites | SITE-01, SITE-02, SITE-03, SITE-04, SITE-05, SITE-06 | 11 | 2/3 | In Progress| | DASH-01 | 11 | 1 | +| Sites | SITE-01, SITE-02, SITE-03, SITE-04, SITE-05, SITE-06 | 11 | 3/3 | Complete | 2026-03-19 | DASH-01 | 11 | 1 | | Site Dashboard | DASH-02, DASH-03, DASH-04 | 14 | 3 | | Sectors | SECT-01, SECT-02, SECT-03 | 14 | 3 | | Wireless Collection | WRCL-01, WRCL-02, WRCL-03, WRCL-04, WRCL-05, WRCL-06 | 12 | 6 | diff --git a/.planning/STATE.md b/.planning/STATE.md index 224776f..f370cb6 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -2,14 +2,14 @@ gsd_state_version: 1.0 milestone: v9.7 milestone_name: Tower & Site Management -status: unknown -stopped_at: Completed 11-02-PLAN.md -last_updated: "2026-03-19T02:47:05Z" +status: phase-complete +stopped_at: Completed 11-03-PLAN.md +last_updated: "2026-03-19T02:53:16Z" progress: total_phases: 5 - completed_phases: 0 + completed_phases: 1 total_plans: 3 - completed_plans: 2 + completed_plans: 3 --- # Project State @@ -23,8 +23,8 @@ See: .planning/PROJECT.md (updated 2026-03-18) ## Current Position -Phase: 11 (site-data-model-foundation) — EXECUTING -Plan: 3 of 3 +Phase: 11 (site-data-model-foundation) — COMPLETE +Plan: 3 of 3 (all complete) ## Performance Metrics @@ -44,6 +44,7 @@ Plan: 3 of 3 | Phase 11 P01 | 3min | 2 tasks | 9 files | | Phase 11 P02 | 6min | 3 tasks | 8 files | +| Phase 11 P03 | 3min | 2 tasks | 5 files | ### Decisions @@ -55,6 +56,8 @@ Decisions are logged in PROJECT.md Key Decisions table. - [Phase 11]: alert_count set to 0 with TODO -- alert_events integration deferred to avoid coupling - [Phase 11]: Site detail page kept minimal (info + stats) -- full dashboard deferred to Phase 14 - [Phase 11]: Used Dialog for delete confirmation (no AlertDialog component in UI library) +- [Phase 11]: Site column placed after Model in fleet table for logical grouping +- [Phase 11]: Viewers see site name text, operators get Select dropdown for assignment ### Pending Todos @@ -68,6 +71,6 @@ None yet. ## Session Continuity -Last session: 2026-03-19T02:47:05Z -Stopped at: Completed 11-02-PLAN.md +Last session: 2026-03-19T02:53:16Z +Stopped at: Completed 11-03-PLAN.md (Phase 11 complete) Resume file: None diff --git a/.planning/phases/11-site-data-model-foundation/11-03-SUMMARY.md b/.planning/phases/11-site-data-model-foundation/11-03-SUMMARY.md new file mode 100644 index 0000000..bc4e2e6 --- /dev/null +++ b/.planning/phases/11-site-data-model-foundation/11-03-SUMMARY.md @@ -0,0 +1,108 @@ +--- +phase: 11-site-data-model-foundation +plan: 03 +subsystem: ui, api +tags: [react, tanstack-router, tanstack-query, tailwind, lucide, pydantic, sqlalchemy] + +# Dependency graph +requires: + - phase: 11-site-data-model-foundation plan 01 + provides: Sites CRUD API with device assignment endpoints + - phase: 11-site-data-model-foundation plan 02 + provides: sitesApi frontend client and site routes +provides: + - Site column in fleet table with clickable site name links + - Multi-select bulk assign devices to sites from fleet list + - Site selector dropdown on device detail page (assign/unassign) + - DeviceResponse includes site_id and site_name fields (backend + frontend) +affects: [14-site-dashboard] + +# Tech tracking +tech-stack: + added: [] + patterns: + - "Bulk assign uses dialog with site select and mutation invalidation" + - "Multi-select checkboxes with Set state and select-all toggle" + +key-files: + created: [] + modified: + - backend/app/schemas/device.py + - backend/app/services/device.py + - frontend/src/lib/api.ts + - frontend/src/components/fleet/FleetTable.tsx + - frontend/src/routes/_authenticated/tenants/$tenantId/devices/$deviceId.tsx + +key-decisions: + - "Site column placed after Model column for logical grouping of device identity fields" + - "Viewers see site name as text, operators get a Select dropdown for assignment" + +patterns-established: + - "Multi-select pattern: checkbox column + Set state + action bar with bulk operation" + +requirements-completed: [SITE-03, SITE-04, SITE-05] + +# Metrics +duration: 3min +completed: 2026-03-19 +--- + +# Phase 11 Plan 03: Device-Site Assignment UI Summary + +**Site column in fleet table with multi-select bulk assign, site selector on device detail, and DeviceResponse site fields** + +## Performance + +- **Duration:** 3 min +- **Started:** 2026-03-19T02:49:59Z +- **Completed:** 2026-03-19T02:53:16Z +- **Tasks:** 2 +- **Files modified:** 5 + +## Accomplishments +- DeviceResponse now includes site_id and site_name on backend and frontend +- Fleet table has checkbox column for multi-select with bulk "Assign to site" action +- Fleet table has Site column showing clickable site name links (or "--" for unassigned) +- Device detail page has site selector dropdown for assign/change/remove site + +## Task Commits + +Each task was committed atomically: + +1. **Task 1: Add site_id and site_name to DeviceResponse** - `ddb2b3e` (feat) +2. **Task 2: Add Site column, multi-select bulk assign, and site selector** - `98e328c` (feat) + +## Files Created/Modified +- `backend/app/schemas/device.py` - Added site_id and site_name optional fields to DeviceResponse +- `backend/app/services/device.py` - Added site fields to _build_device_response, selectinload(Device.site) to eager loading +- `frontend/src/lib/api.ts` - Added site_id and site_name to DeviceResponse interface +- `frontend/src/components/fleet/FleetTable.tsx` - Checkbox column, Site column, multi-select state, bulk assign dialog +- `frontend/src/routes/_authenticated/tenants/$tenantId/devices/$deviceId.tsx` - Site selector dropdown with assign/unassign mutation + +## Decisions Made +- Site column placed after Model column for logical grouping of device identity fields +- Viewers see site name as plain text; operators get a Select dropdown for changing assignment +- Bulk assign uses a Dialog component with site selector and mutation pattern + +## Deviations from Plan + +None - plan executed exactly as written. + +## Issues Encountered +None + +## User Setup Required +None - no external service configuration required. + +## Next Phase Readiness +- Device-site relationship fully wired end-to-end (backend model, API, frontend views) +- Site detail page ready for Phase 14 dashboard expansion with device list +- All site management features operational: CRUD, assign, unassign, bulk assign + +## Self-Check: PASSED + +All 5 modified files verified on disk. Both task commits (ddb2b3e, 98e328c) verified in git log. + +--- +*Phase: 11-site-data-model-foundation* +*Completed: 2026-03-19*