122480cd46
Brings in the A4 (millimetre) report designer alongside the existing matrix editor, migrates the frontend from react-scripts to Vite/Vitest, and fixes four defects found while using the A4 band tools. Layout — layout.js now implements the standard banded-report model: everything prints where it was drawn, and a band growing per data row is the only thing that moves anything. Previously `paginate` re-flowed every band from the top margin, so a band placed halfway down the page previewed at the top, and `header` was treated as a page header and hoisted above the statics drawn before it. A header is a COLUMN header: it prints in place and repeats only on a continuation page. Statics now take part too — one drawn below a band keeps its drawn gap as that band grows, and follows onto the next page rather than vanishing when pushed past the bottom margin. The displacement is keyed on the band's design bottom, not on an instance's laid-out y: every row of a band shares one design position, so keying on the instance measured the gap from row 1 and let the static overlap rows 2..n. Band children — a child's x is relative to its band, as its y already was. layout() emitted it raw, so a field printed measured from the paper edge instead of the band's left margin. Instances now carry bandX. Band placement — a band's x comes from the page margins, so creation takes only the click's Y (the factory's x was being overwritten by the spread order) and dragging is locked to the vertical axis. Bands render as a strip, with top/bottom rules only, matching the matrix editor. fromApiReport reflows on load so reports saved with a stray x straighten themselves. Matrix bands are constrained to vertical too. Drag lifecycle — useElementDrag re-subscribed its document listeners on every render during a drag, because the effect depended on an unmemoized onDrag. Each re-subscribe removed the mouseup listener before adding the next, measured as add/remove/add/remove/add across two mousemoves, and a release landing in that gap was lost: the element kept following the cursor until the next click. Snapping made it routine, since a held guide stops x/y changing and leaves the guide overlay's render sitting between the move and the release. onDrag and dragData now go through refs so the effect depends on [isDragging] alone. Note: the matrix editor has no test coverage, so its band constraint is verified by reading only. The A4 suite is 201 passing tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
67 lines
1.4 KiB
YAML
67 lines
1.4 KiB
YAML
services:
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: scales
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
backend:
|
|
build: ./backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
SECRET_KEY: ${SECRET_KEY}
|
|
DEBUG: "False"
|
|
ALLOWED_HOSTS: ${ALLOWED_HOSTS}
|
|
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS}
|
|
DB_NAME: scales
|
|
DB_USER: postgres
|
|
DB_PASSWORD: ${DB_PASSWORD}
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
ports:
|
|
- "8101:8000"
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
args:
|
|
VITE_API_URL: ${VITE_API_URL}
|
|
VITE_SERIAL_URL: ${VITE_SERIAL_URL}
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8100:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
serial_bridge:
|
|
build:
|
|
context: .
|
|
dockerfile: serial_bridge/Dockerfile
|
|
restart: unless-stopped
|
|
environment:
|
|
HOST: "0.0.0.0"
|
|
COM_PORT: /tmp/vcom_read
|
|
BAUD_RATE: ${BAUD_RATE:-9600}
|
|
TEST_DATA_TYPE: ${TEST_DATA_TYPE:-scales}
|
|
SCALES_MIN: ${SCALES_MIN:-5000}
|
|
SCALES_MAX: ${SCALES_MAX:-20000}
|
|
DEBUG: "False"
|
|
ports:
|
|
- "8102:5000"
|
|
|
|
volumes:
|
|
postgres_data:
|