feat(backend): KDS settings as device config, zone enforced for kitchen screens, KDS-only API (platform-v2 3.2a)

- KDS manifest: 23 typed settings (prep zone, board, waiting-time minutes and colours,
  behaviour) replacing the KDS page's localStorage settings.
- ConfigField: colour type, "after" ordering (warning < late < flash), groups for the
  manager's dialogs, ".none" text for an empty ref choice.
- routers/kds.py: a KDS device gets only its zone's orders, prints to its zone by default
  and signs waiter messages with its zone/name. New GET /api/kds/context and
  POST /api/kds/orders/{id}/retry-print so the screen never leaves its kds.* scope.
  Unused v1 /items and /items/{id}/status endpoints removed (D-21).
- PATCH /api/devices/me/config: a screen changes its own settings when the signed-in
  person holds core.devices.manage.
- Manager Devices dialogs: settings in sections, colour pickers, "All zones".
- Tests: test_kds_device.py, colour/ordered fields; terminal.mjs scope + zone checks;
  manager.mjs settings sections; stack.mjs detaches the non-LAN network before the
  restart check (one flaky 403).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 18:56:59 +02:00
co-authored by Claude Opus 5.5
parent c24cb72640
commit d5c4400fde
17 changed files with 762 additions and 140 deletions
+9 -1
View File
@@ -1,7 +1,7 @@
// Pure logic of the platform pages (plan steps 2.6c, 2.6d, 2.6e).
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { configInitial, configValue, deviceStatus, deviceUsage, hasRoom, linkTargets, normalizeCode, refOptions } from '../src/pages/platform/devicesLogic.js'
import { configGroups, configInitial, configValue, deviceStatus, deviceUsage, hasRoom, linkTargets, normalizeCode, refOptions } from '../src/pages/platform/devicesLogic.js'
import { moduleState, stoppedBy } from '../src/pages/platform/modulesLogic.js'
import {
approvalState, approvalTarget, canEndSession, canGive, diff, differsFromRole, editorGroups, permLabelKey, resetToRole,
@@ -136,3 +136,11 @@ test('device settings: starting values, typed values, ref options (3.1a)', () =>
assert.deepEqual(refOptions(fields[2], { devices }), [{ value: '1', label: 'Till' }])
assert.deepEqual(refOptions(fields[2], { devices, selfId: 1 }), [])
})
test('config fields in sections, in the order their groups first appear (3.2a)', () => {
const f = (key, group) => ({ key, type: 'bool', default: false, group })
const groups = configGroups([f('zone', 'zone'), f('w', 'board'), f('c', 'age'), f('s', 'board'), f('auto', undefined)])
assert.deepEqual(groups.map(g => [g.group, g.fields.map(x => x.key)]),
[['zone', ['zone']], ['board', ['w', 's']], ['age', ['c']], [null, ['auto']]])
assert.equal(configValue({ type: 'color' }, '#aabbcc'), '#aabbcc')
})