Commit Graph

35 Commits

Author SHA1 Message Date
iterminate fa5891d073 Hide retired batteries by default, filter to show them 2026-04-14 20:09:56 -05:00
iterminate e4130bb329 Exclude retired batteries from dashboard warnings 2026-04-14 19:40:11 -05:00
iterminate 5d8fb5aa68 Make low battery summary card clickable to reveal which batteries 2026-04-14 19:05:38 -05:00
iterminate c7b7c24a7e Add needs-attention alerts, last charged, health %, quick charge, sortable columns 2026-04-14 18:49:07 -05:00
iterminate 270acc0430 Fix XSS, CSRF, input validation, and related security issues 2026-04-14 16:00:50 -05:00
iterminate cd3eb046d7 Collapse history sections to latest+modal; add charts and dashboard stats 2026-04-14 09:06:10 -05:00
iterminate 60a8d64fbc Add PWA icons and favicon from source image 2026-04-14 02:19:48 -05:00
iterminate d00695cd51 Device detail UI cleanup: battery icon, HA live % unknown state, remove redundant entity row 2026-04-14 01:55:29 -05:00
iterminate a9d0b3fc63 Replace datalist with custom autocomplete dropdown for HA entity field (mobile fix) 2026-04-14 01:38:42 -05:00
iterminate b6a3533fed HA improvements: entity overflow fix, live % fetch on device page, searchable entity dropdown 2026-04-14 01:17:53 -05:00
iterminate d7ba64a2f3 Track battery percentage history; skip poll write when value unchanged 2026-04-13 21:15:19 -05:00
iterminate 8c06478bca Add optional Home Assistant integration for battery percentage tracking 2026-04-13 20:10:23 -05:00
iterminate 9d2b1d0d51 Add Select all/Deselect all button to filter bar for mobile 2026-04-13 12:44:19 -05:00
iterminate 39b52a3fa4 Replace browser confirm() dialogs with custom modal; add live label preview on battery add form
- base.html: add CSS/HTML/JS for styled in-app confirmation modal (dark-mode compatible via CSS vars)
- device_list, battery_detail: convert onsubmit confirm() to declarative data-confirm attributes
- dashboard: convert bulk Delete/Install buttons to use modal helpers (submitWithAction pattern)
- app.py: pass brand_counts dict to battery_add template
- battery_add.html: show live "Will create: Brand 001 → Brand 003" preview as brand/quantity change
- tests: add two tests covering brand_counts server-side rendering
2026-04-13 09:53:21 -05:00
iterminate 3c2b2dc389 Add bulk Log Charged action to dashboard toolbar
Select multiple batteries, pick a date, and optionally increment charge
cycles for all of them in one shot. Reuses the existing bulk-action form
and POST /battery/bulk-action route; no new routes or migrations needed.
2026-04-13 09:30:56 -05:00
iterminate b1bc02e963 Three features: device dropdown filter, charge log history, unassign-all
- Device dropdowns (quick-assign, bulk install, assign page) now only show
  devices with free slots; full devices are excluded entirely
- New ChargeLog model tracks charge dates with optional cycle increment;
  battery detail page gets a Charge History card with add/delete rows
- Device list page gets per-device Unassign All button (with confirmation)
  via new POST /device/<id>/unassign-all route
2026-04-13 08:12:23 -05:00
iterminate 6597fcd4ac Sticky bulk toolbar on dashboard; anchor scroll on device unassign 2026-04-13 07:23:36 -05:00
iterminate 65596eee2b Add PWA support — installable as home screen app
Adds Web App Manifest, a minimal Service Worker, and Apple/Android meta
tags so the app can be added to a phone home screen and opens full-screen
in standalone mode (no browser chrome).

- static/manifest.json: name, short_name, display=standalone, icons
- static/sw.js: minimal SW served at /sw.js (root scope) via new Flask route
- static/icon-192.png, icon-512.png: generated by sbin/gen_icons.py (stdlib only)
- base.html: manifest link, theme-color, apple-mobile-web-app-* tags, SW registration
2026-04-13 04:28:11 -05:00
iterminate 2f8a8a2b77 Add capacity test history and chart to battery detail
- New CapacityTest model (battery_id FK CASCADE, mah, date, notes)
- DB migration: create capacity_test table, migrate existing single-test data
- Two new routes: add and delete capacity test records
- Battery.tested_capacity_mah/tested_date kept in sync with latest test
  so dashboard display requires no changes
- Battery detail: Capacity History card with sortable table, health %
  per reading, and a canvas line chart (shown when >= 2 records)
- Chart uses CSS variables for colors — works in light and dark mode
- Remove tested_capacity_mah/tested_date from Edit Details form
- 3 new acceptance tests (48 total)
2026-04-13 04:15:55 -05:00
iterminate 768f83f63a Add dark mode, simplify nav, and UI polish
- Dark mode via prefers-color-scheme: pure CSS, no JS, follows OS setting
- CSS custom properties for all colors; dark palette redefines variables
- Nav: brand is now a home link, Dashboard link removed, nowrap keeps
  it single-line on mobile; compact padding at 640px breakpoint
- Battery health % uses CSS classes (health-good/warn/bad) instead of
  inline Jinja colors — readable in both light and dark modes
- Stat card counts use CSS color variables for dark mode support
- Fix duplicate display:none on bulk toolbar
- input[type=date] added to themed input selector
2026-04-12 22:55:23 -05:00
iterminate 3bc897c1e5 Add device_type field, mobile-friendly improvements, and device filtering
- Device model: add device_type column (String 50, nullable)
- Device add/edit: type select with presets + custom entry
- Device detail: show type in info card; new Edit Device form
- Device list: Type column + client-side filter bar (type + text search)
- Mobile: card-style responsive tables on dashboard and device list,
  form-grid-2col collapse, larger tap targets, stacked form-actions,
  column picker viewport fix, filter bar full-width controls
- Assign page: larger radio touch targets (min-height 44px)
- 3 new acceptance tests for device_type (45 total)
2026-04-12 22:02:29 -05:00
iterminate b7e2d54bd2 Fix unassign from device detail redirecting to dashboard
Pass a 'next' hidden field from the device detail unassign form so the
route redirects back to the device page instead of the dashboard.
2026-04-12 21:11:44 -05:00
iterminate 0869ef3d5e Add bulk install-in-device from dashboard and unretire action
- Dashboard bulk toolbar: select batteries, pick a device, click 'Install
  in device'; confirms before moving already-installed batteries; enforces
  slot capacity and warns on brand mix
- Battery detail: 'Unretire Battery' button replaces 'Retire Battery' when
  battery is retired, restoring it to available status
- Tests: 3 new bulk-install-device tests (capacity block, move, success);
  42 total passing
2026-04-12 21:08:48 -05:00
iterminate 81e87d2fe2 Add inline assign from dashboard, specific battery picker on device, dynamic install rows
- Dashboard: replace Assign link with device dropdown + arrow button for
  quick inline assignment without leaving the page
- Device detail: replace hardcoded 4-row install form with 1 row + '+ Add
  brand' button that clones rows dynamically
- Device detail: add 'Install Specific Battery' card with dropdown of all
  available batteries (label, brand, size, notes) via new /device/<id>/install-one route
- Tests: 4 new acceptance tests covering dashboard quick-assign and
  install-one, including capacity enforcement on both paths (39 total)
2026-04-12 20:15:29 -05:00
iterminate 4ad29558b3 Add client-side filtering to dashboard
Filter bar with Status, Brand, Size, Storage Location dropdowns and text
search. Select-all and bulk toolbar respect visible rows so users can filter
to a group (e.g. a storage location) and bulk-action them in one step.
2026-04-12 15:58:45 -05:00
iterminate 5e87d5e898 Add column picker to dashboard with localStorage persistence
Optional columns: Chemistry, Capacity, Storage Location, Purchase Date,
Charge Cycles. Selection persists across page loads via localStorage.
2026-04-12 15:51:28 -05:00
iterminate 6384f6b589 Add bulk set field (Storage Location, Brand) to dashboard toolbar
Select batteries, choose field and value from toolbar, hit Apply.
Storage Location dropdown populated from existing locations.
2026-04-12 15:48:46 -05:00
iterminate a806a5b19a Add storage location field to bulk add form 2026-04-12 15:31:23 -05:00
iterminate 70abcfd0ac Add storage location field to battery with dynamic dropdown
Dropdown populated from existing distinct storage locations,
with 'New location...' option revealing a text input.
2026-04-12 15:22:02 -05:00
iterminate 5a7bbd46ab Add size, chemistry, capacity, purchase date to bulk add form
Shared metadata fields settable at creation time apply to all
batteries in the batch, avoiding per-battery detail page visits.
2026-04-12 15:15:07 -05:00
iterminate 604d7bb699 Add optional battery metadata fields
New nullable columns on Battery: size, chemistry, capacity_mah,
tested_capacity_mah, tested_date, charge_cycles, purchase_date.

Battery detail page shows all populated fields and a full edit form
with select dropdowns for size and chemistry (with Other fallback).
Capacity health % shown in green/orange/red when both nominal and
tested capacity are set. Dashboard gains a Size column.
2026-04-12 14:57:22 -05:00
iterminate 47e1059532 Replace datalist autocomplete with select dropdown for brand fields
datalist only shows suggestions when typing, not on click. Switched to
a <select> showing all known brands plus a 'New brand...' option that
reveals a text input for entering a new brand name.
2026-04-12 14:20:03 -05:00
iterminate 709e0d6119 Add brand autocomplete dropdown to battery add and device install forms
Uses HTML datalist populated from distinct brands in the battery table.
Removed autocomplete="off" which suppresses datalist in Chrome/Chromium.
2026-04-12 13:31:19 -05:00
iterminate 1f5234a3e9 Simplify battery management: bulk add, device-level auto-install, mass operations
- Replace single-battery add form with bulk add (brand + count, auto-generated labels)
- Add device-level install form: specify brand+qty pairs, system autoselects available batteries
- Add bulk actions on dashboard: retire, delete, unassign, change brand (checkbox multi-select)
- Keep per-battery assign route for special cases (e.g. known low-capacity battery)
- Remove unique constraint on Battery.label (labels are now auto-generated)
- Add *.snapshot to .gitignore for DB snapshot files
- Rewrite tests: 35 passing (11 new tests for bulk-add, device-install, bulk-actions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 12:57:10 -05:00
iterminate 6ea3eae981 Initial commit: Flask battery tracker app
- Flask + SQLAlchemy (MariaDB-compatible schema) battery tracking web app
- 40 pre-seeded batteries (Eneloop, BONAI, Energizer NiMH) across 5 devices
- Business rules: block retired assignment, brand-mix warnings, capacity checks
- Mobile-friendly Jinja2 templates with inline CSS
- waitress WSGI server via systemd user service (sbin/install-service.sh)
- SQLite → MariaDB migration script (migrate_to_mariadb.py)
- 26 passing acceptance tests (pytest + Flask test client)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 22:38:16 -05:00