Commit Graph
17 Commits
Author SHA1 Message Date
kawa 5bf152bcce feat(11-04): add client name links in printer_list.html and client_list.html
- printer_list.html: extract group_client_id from first printer in group;
  wrap client name in <a href="/clients/{id}"> when id present; Unassigned
  group renders as plain text (no dead link)
- client_list.html: wrap client name cell in <a href="/clients/{{ c.id }}">
2026-04-15 14:49:52 +02:00
kawa f3644790be feat(11-04): add GET /clients/{id} route and client_detail.html template
- Add client_detail route in pages.py with 404 on unknown client_id
- Build grouped dict {client.name: [printers]} for printer_list partial reuse
- Pass clients + driver_data for edit modal compatibility
- Create client_detail.html extending base.html, includes printer_list partial
2026-04-15 14:49:12 +02:00
kawa 7b948b68c3 feat(11-02): UIE-01 edit modal — Edit button per row, Pico dialog, E2E tests
- Create printer_edit_modal.html: native dialog with HTMX PATCH form, Alpine.js portEdited=true
- Update printer_list.html Actions td: include edit modal partial before Delete button
- Create tests/e2e/test_printer_edit.py: modal open/pre-fill and submit/list-update E2E tests
- Fix E2E row targeting to use locator(tr, has=a:has-text) for session-scoped server safety
2026-04-15 11:10:44 +02:00
kawa 3353f4546c feat(11-03): Alpine.js theme + i18n stores in base.html with top-right controls
- Add Alpine.store('theme') for Light/Dark/System cycling with localStorage persistence
- Add Alpine.store('i18n') with FR/EN translations for all static UI strings
- Add topbar with theme toggle button (:aria-label, @click cycle) and lang button
- Wrap main content in .main-wrapper + .topbar for layout structure
- Add .main-wrapper, .topbar, .topbar-controls styles to app.css
- Add test_theme_toggle_present integration test
- Fix test_dashboard_shows_recent_printers assertion (string now in i18n JS too)
2026-04-15 11:08:52 +02:00
kawa 3d2cdc4e77 feat(11-01): UIE-02 — dedicated Add Printer page at GET /printers/new
- Create imptune/templates/printers_new.html: full page extending base.html
  with plain <form action="/printers" method="post"> (no HTMX, browser follows 303)
  and inline driver upload sub-form
- Update imptune/templates/printers.html: remove inline Add Printer form,
  add <a href="/printers/new" role="button">Add Printer</a> link
- Add GET /printers/new route in imptune/api/pages.py (placed before /{printer_id})
- Change POST /printers to always return RedirectResponse(url='/printers', status_code=303)
- Update existing POST /printers tests to assert 303 + follow_redirects=False
- Update test_printer_form.py to check /printers/new instead of /printers (UIE-02 arch)
- UIE-02 tests GREEN; UIE-01/03 scaffolds remain RED (expected — not yet implemented)
2026-04-15 11:03:41 +02:00
kawa 72c6a98578 feat(09-01): add inline driver upload to printer form with OOB refresh
- Add id="printer-form-driver-select" to driver <select> (OOB swap target)
- Add sibling <form hx-post="/drivers/upload"> AFTER printer </form>,
  inside Alpine x-data div — avoids invalid nested form HTML
- Hidden <input name="caller" value="printer_form"> sentinel triggers OOB path
- Add hidden <div id="driver-list"> anchor for HTMX outerHTML swap target
- Create tests/test_printer_form.py with test_printer_form_has_inline_driver_upload
  asserting stable select id, caller sentinel, and non-nested upload form

Full non-e2e suite: 112 passed.
2026-04-13 10:51:46 +02:00
kawa 10ee09a5aa fix(09-01): resolve driver upload 500 and add HTMX OOB refresh path
- Import Form from fastapi for mixed multipart + form field support
- Add caller: str = Form('') parameter to upload_driver handler
- Capture new_driver from Driver.get_or_create() return tuple
- Branch on caller == 'printer_form' to emit OOB-enabled response
- Create partials/driver_upload_with_oob.html with primary driver_list
  include + hx-swap-oob select targeting id=printer-form-driver-select
- New driver is auto-selected via new_driver_id context variable

All 13 driver upload tests pass including 4 new OOB contract tests.
Full non-e2e suite: 111 passed.
2026-04-13 10:50:27 +02:00
kawa 68a2935af2 feat(09-03): add .ps1 script download routes and detail-page links
- Refactor install/uninstall/detect handlers into shared _*_response() helpers
- Add .ps1 route aliases: /scripts/install.ps1, /scripts/uninstall.ps1, /scripts/detect.ps1
- Add Scripts section to printer_detail.html inside {% if has_driver %} with 3 download links
- All 6 new tests green, full suite 106/106 passing
2026-04-13 10:48:43 +02:00
kawaandClaude Opus 4.6 67a1cd66ec chore: complete v1.0 milestone
Archive v1.0 MVP: 7 phases, 13 plans, 27/27 requirements.

- Archive roadmap to milestones/v1.0-ROADMAP.md
- Archive requirements to milestones/v1.0-REQUIREMENTS.md
- Move milestone audit into milestones/
- Create MILESTONES.md with v1.0 entry
- Evolve PROJECT.md: move shipped requirements to Validated,
  update Context with stack/LOC, log Key Decisions with outcomes
- Collapse ROADMAP.md to one-line milestone summary
- Update STATE.md to shipped status
- Back-fill stale requirements-completed frontmatter on
  02-01, 04-01, 05-01, 06-01 SUMMARY.md files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 09:47:37 +02:00
kawa 91910ad97d feat(07-01): wire dashboard data and add /packages listing page
- Dashboard queries 5 most recent Printer records and 5 most recent driver-assigned ones
- New /packages route lists printers with drivers, with intunewin/ninja download links
- packages.html template extends base.html with Pico grid table
- Dashboard printer/package items now link to detail pages
- Quick action buttons wired to real routes (removed aria-disabled)
2026-04-13 08:58:13 +02:00
kawa f96ea6fec9 feat(05-02): printer detail page with export buttons and command preview
- Update printer_detail() to pass install_cmd, uninstall_cmd, has_driver, has_icon to template
- Rewrite printer_detail.html with Intune Commands, Export, and Icon sections
- Show command strings with Alpine.js copy-to-clipboard buttons (install-cmd, uninstall-cmd)
- Show NinjaRMM ZIP and .intunewin download links when driver assigned
- Add HTMX icon upload form with #icon-status swap target
- Remove disabled placeholder Regenerate Package button
- Add TestCommandPreview class (4 tests) to test_packages.py
- All 94 tests pass
2026-04-10 15:06:45 +02:00
kawa 6bff8f3c0c feat(04-02): add render_uninstall and render_detect with Jinja2 templates
- render_uninstall(printer_name, driver_name, port_name): Remove-Printer/Driver/Port in safe order
- render_detect(printer_name): Get-Printer check with Write-Output + exit 0/1 Intune contract
- uninstall.ps1.j2: all Remove-* with -ErrorAction SilentlyContinue
- detect.ps1.j2: Intune detection contract template
2026-04-10 13:35:05 +02:00
kawa 8193e9dbbd feat(04-01): implement script_generator with install.ps1.j2 template
- Jinja2 Environment with FileSystemLoader, trim_blocks, lstrip_blocks
- render_install() with _duplex_map (LongEdge->TwoSidedLongEdge, ShortEdge->TwoSidedShortEdge)
- install.ps1.j2: WOW64 guard as first block (SCRPT-05)
- install.ps1.j2: SYSTEM/admin detection + UAC self-elevation (SCRPT-04)
- install.ps1.j2: pnputil two-step driver staging + Add-PrinterDriver (SCRPT-01)
- install.ps1.j2: idempotent port creation (Get-PrinterPort check)
- install.ps1.j2: idempotent printer creation (Get-Printer check)
- install.ps1.j2: Set-PrintConfiguration with duplex/color/paper/collate
- All 7 unit tests pass
2026-04-10 13:31:51 +02:00
kawa cad664c0f6 feat(03-02): implement printer detail page with driver info and regenerate placeholder
- Add GET /printers/{printer_id} route to pages.py with LEFT OUTER JOINs on Client and Driver
- Create printer_detail.html full-page template showing all config fields and driver info
- Display "No driver assigned" when driver FK is null
- Add disabled "Regenerate Package" button (Phase 4 placeholder)
- Make printer names in printer_list.html clickable links to detail page
2026-04-10 13:04:52 +02:00
kawa 356c2ee690 feat(03-01): implement printer and client CRUD with HTMX/Alpine.js UI
- imptune/api/printers.py: POST /printers (all form fields, checkbox->bool,
  FK resolution), DELETE /printers/{id}, grouped list renderer with LEFT JOIN
- imptune/api/clients.py: POST /clients with duplicate-name handling
- imptune/api/pages.py: GET /printers and GET /clients page routes
- imptune/main.py: register printers + clients routers; close db on shutdown
- imptune/db/database.py: close existing connection before re-init (test isolation)
- templates: printers.html, clients.html, printer_form.html (Alpine.js port
  auto-derivation), printer_list.html (grouped by client), client_list.html
- tests/conftest.py: close test-thread db connection in fixture teardown
- tests/test_printer_crud.py: updated to use list(select().where()) for DB
  queries (avoids Peewee thread-local cursor caching across test boundaries)

Auto-fix [Rule 1 - Bug]: DB test isolation — Peewee thread-local connections
persisted across tests causing stale DB reads; fixed via conftest teardown and
lifespan db.close() on shutdown.
2026-04-10 12:56:09 +02:00
kawa c648fc5793 feat(02-02): add driver upload endpoint with INF parsing and dedup
- POST /drivers/upload: validates ZIP, parses INF, persists via DriverStore + Peewee
- SHA256 dedup: get_or_create prevents duplicate Driver records
- GET /drivers route added to pages.py with driver_data context
- drivers.router registered in main.py
- drivers.html template with HTMX upload form
- partials/driver_list.html HTMX target with select dropdown and unused-file notice
- Fixed conftest client fixture to use context manager (triggers lifespan/init_db)
- [Rule 3] conftest: TestClient context manager required for lifespan trigger
- [Rule 1] drivers.py: dynamic DRIVERS_DIR read so monkeypatch works in tests
2026-04-10 12:02:00 +02:00
kawa bd4e132f82 feat(01-01): create Docker scaffold, FastAPI app shell, and sidebar templates
- Dockerfile with python:3.12-slim-bookworm, curl downloads Pico CSS, HTMX, Alpine.js at build time
- docker-compose.yml with imptune_data:/data named volume and restart policy
- requirements.txt with all phase 1-5 dependencies
- imptune/config.py loading DATA_DIR/PORT from env with DB_PATH and DRIVERS_DIR derived paths
- imptune/main.py: FastAPI app with StaticFiles mount, health+pages routers, startup dir creation
- imptune/api/health.py: GET /health returning {"status": "ok"}
- imptune/api/pages.py: GET / returning dashboard.html with sync def handler
- imptune/templates/base.html: data-theme="auto", sidebar with 5 nav sections, /static/ paths only
- imptune/templates/dashboard.html: quick actions + empty state recent activity
- imptune/static/app.css: sidebar layout, active link highlight, quick action buttons
2026-04-10 11:25:08 +02:00