Files
bonaminandClaude Opus 5.5 d5c4400fde 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>
2026-11-14 18:56:59 +02:00

61 lines
3.5 KiB
Python

"""Module manifest — see core/modules/model.py and APPS_PLATFORM §4."""
from core.modules.model import ConfigField, DeviceApp, Limit, Module, Mount, Perm
# Back to the sign-in screen after this many idle minutes (shared screens; 0 = never). Used by
# the terminal from step 3.1c.
AUTO_SIGN_OUT = ConfigField('auto_sign_out_minutes', 'int', default=0, choices=(0, 2, 5, 10, 30, 60))
# A kitchen screen's settings (plan step 3.2a). They were the KDS page's localStorage settings
# (manager_dashboard KdsPage.jsx, `xenia_kds_settings_v2`); now they belong to the device, are
# edited on the Devices page or on the screen (PATCH /api/devices/me/config), and the screen
# reads them from GET /api/kds/context. prep_zone_id also scopes the backend: a KDS device
# with a zone only ever gets that zone's orders (routers/kds.py).
KDS_CONFIG = (
ConfigField('prep_zone_id', 'ref', default=None, choices_from='prep_zones', group='zone'),
# board
ConfigField('card_width', 'int', default=272, min=200, max=800, group='board'),
ConfigField('font_scale', 'int', default=100, min=60, max=200, group='board'),
ConfigField('font_weight', 'int', default=600, choices=(300, 400, 500, 600, 700, 800), group='board'),
ConfigField('batch_mode', 'enum', default='merged', choices=('merged', 'grouped', 'split'), group='board'),
ConfigField('group_items', 'enum', default='off',
choices=('off', 'floating', 'right_sidebar', 'left_sidebar', 'topbar_button'), group='board'),
ConfigField('group_by_course', 'bool', default=False, group='board'),
ConfigField('combine_modifiers', 'bool', default=False, group='board'),
ConfigField('categories_as_filters', 'bool', default=True, group='board'),
# how late an order is: minutes and colours
ConfigField('age_warning_minutes', 'int', default=5, min=1, max=120, group='age'),
ConfigField('age_late_minutes', 'int', default=10, min=2, max=120, after='age_warning_minutes', group='age'),
ConfigField('age_flash_minutes', 'int', default=15, min=3, max=120, after='age_late_minutes', group='age'),
ConfigField('flash_late', 'bool', default=True, group='age'),
ConfigField('colour_fresh', 'color', default='#34b56a', group='age'),
ConfigField('colour_warning', 'color', default='#f0a52a', group='age'),
ConfigField('colour_late', 'color', default='#e8513f', group='age'),
ConfigField('colour_done', 'color', default='#3d4757', group='age'),
# behaviour
ConfigField('triple_state', 'bool', default=False, group='behaviour'),
ConfigField('sound', 'bool', default=True, group='behaviour'),
ConfigField('notify_order_complete', 'bool', default=False, group='behaviour'),
ConfigField('notify_item_complete', 'bool', default=False, group='behaviour'),
ConfigField('refresh_seconds', 'int', default=30, choices=(10, 15, 20, 30, 45, 60, 90, 120), group='behaviour'),
AUTO_SIGN_OUT,
)
MODULE = Module(
key='kds',
kind='app',
name='Kitchen display',
description='Screens in the kitchen or bar showing orders to prepare.',
depends=('ordering',),
permissions=(
Perm('kds.access', 'Use the kitchen display', roles=('owner', 'store_manager', 'chef', 'assistant_chef')),
Perm('kds.bump', 'Mark items ready', roles=('owner', 'store_manager', 'chef', 'assistant_chef')),
),
limits=(
Limit('devices', 'Number of kitchen screens', free=0, licensed_default=1),
),
device_app=DeviceApp(login_modes=('pin', 'tap', 'password'), scope=('kds.*',), config=KDS_CONFIG),
routers=(
Mount('routers.kds', '/api/kds'),
),
)