Panels become devices: per-device documents in the flow repo, a Devices tab

- flow/devices.py: DeviceDef in FLOWS_DIR/_devices/<id>.json, committed under
  the flow store's write lock, 409 on a stale version; nonces in DEVICES_FILE
  outside git; in-memory presence announced as device_status
- api/routes/devices.py: CRUD, pairing with an optional {name, board,
  firmware}, a pending list adopted without a code from the LAN only, unpair;
  /panels/pair, /panels/pair/{code} and GET /panels/{id} kept as aliases,
  PUT /panels/ gone
- _device_may replaces _panel_may, JWT claims unchanged
- panels.json moves into devices once at startup, then .migrated
- MCP list_devices, get_device; search category device
- Devices tab (list, detail with presence, pairing, ordered dashboards,
  touch, I/O), PanelsDialog removed, serialised optimistic saves
This commit is contained in:
Melvin Strobl
2026-10-16 15:48:36 +02:00
parent 3c0912a3fe
commit 28a565e501
56 changed files with 3539 additions and 2404 deletions
+42
View File
@@ -29,6 +29,8 @@ import { Route as ViewNameRouteImport } from './routes/view.$name'
import { Route as CanvasDashboardsNameRouteImport } from './routes/_canvas/dashboards/$name'
import { Route as CanvasFlowsFlowNameRouteImport } from './routes/_canvas/flows/$flowName'
import { Route as LayoutDashboardsIndexRouteImport } from './routes/_layout/dashboards/index'
import { Route as LayoutDevicesIndexRouteImport } from './routes/_layout/devices/index'
import { Route as LayoutDevicesIdRouteImport } from './routes/_layout/devices/$id'
import { Route as LayoutFlowsIndexRouteImport } from './routes/_layout/flows/index'
import { Route as LayoutRunsIndexRouteImport } from './routes/_layout/runs/index'
import { Route as LayoutRunsIdRouteImport } from './routes/_layout/runs/$id'
@@ -132,6 +134,16 @@ const LayoutDashboardsIndexRoute = LayoutDashboardsIndexRouteImport.update({
path: '/dashboards/',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutDevicesIndexRoute = LayoutDevicesIndexRouteImport.update({
id: '/devices/',
path: '/devices/',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutDevicesIdRoute = LayoutDevicesIdRouteImport.update({
id: '/devices/$id',
path: '/devices/$id',
getParentRoute: () => LayoutRoute,
} as any)
const LayoutFlowsIndexRoute = LayoutFlowsIndexRouteImport.update({
id: '/flows/',
path: '/flows/',
@@ -171,9 +183,11 @@ export interface FileRoutesByFullPath {
'/panel/': typeof PanelIndexRoute
'/dashboards/$name': typeof CanvasDashboardsNameRoute
'/flows/$flowName': typeof CanvasFlowsFlowNameRoute
'/devices/$id': typeof LayoutDevicesIdRoute
'/runs/$id': typeof LayoutRunsIdRoute
'/runs/new': typeof LayoutRunsNewRoute
'/dashboards/': typeof LayoutDashboardsIndexRoute
'/devices/': typeof LayoutDevicesIndexRoute
'/flows/': typeof LayoutFlowsIndexRoute
'/runs/': typeof LayoutRunsIndexRoute
}
@@ -195,9 +209,11 @@ export interface FileRoutesByTo {
'/panel': typeof PanelIndexRoute
'/dashboards/$name': typeof CanvasDashboardsNameRoute
'/flows/$flowName': typeof CanvasFlowsFlowNameRoute
'/devices/$id': typeof LayoutDevicesIdRoute
'/runs/$id': typeof LayoutRunsIdRoute
'/runs/new': typeof LayoutRunsNewRoute
'/dashboards': typeof LayoutDashboardsIndexRoute
'/devices': typeof LayoutDevicesIndexRoute
'/flows': typeof LayoutFlowsIndexRoute
'/runs': typeof LayoutRunsIndexRoute
}
@@ -222,9 +238,11 @@ export interface FileRoutesById {
'/panel/': typeof PanelIndexRoute
'/_canvas/dashboards/$name': typeof CanvasDashboardsNameRoute
'/_canvas/flows/$flowName': typeof CanvasFlowsFlowNameRoute
'/_layout/devices/$id': typeof LayoutDevicesIdRoute
'/_layout/runs/$id': typeof LayoutRunsIdRoute
'/_layout/runs/new': typeof LayoutRunsNewRoute
'/_layout/dashboards/': typeof LayoutDashboardsIndexRoute
'/_layout/devices/': typeof LayoutDevicesIndexRoute
'/_layout/flows/': typeof LayoutFlowsIndexRoute
'/_layout/runs/': typeof LayoutRunsIndexRoute
}
@@ -248,9 +266,11 @@ export interface FileRouteTypes {
| '/panel/'
| '/dashboards/$name'
| '/flows/$flowName'
| '/devices/$id'
| '/runs/$id'
| '/runs/new'
| '/dashboards/'
| '/devices/'
| '/flows/'
| '/runs/'
fileRoutesByTo: FileRoutesByTo
@@ -272,9 +292,11 @@ export interface FileRouteTypes {
| '/panel'
| '/dashboards/$name'
| '/flows/$flowName'
| '/devices/$id'
| '/runs/$id'
| '/runs/new'
| '/dashboards'
| '/devices'
| '/flows'
| '/runs'
id:
@@ -298,9 +320,11 @@ export interface FileRouteTypes {
| '/panel/'
| '/_canvas/dashboards/$name'
| '/_canvas/flows/$flowName'
| '/_layout/devices/$id'
| '/_layout/runs/$id'
| '/_layout/runs/new'
| '/_layout/dashboards/'
| '/_layout/devices/'
| '/_layout/flows/'
| '/_layout/runs/'
fileRoutesById: FileRoutesById
@@ -460,6 +484,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutDashboardsIndexRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/devices/': {
id: '/_layout/devices/'
path: '/devices'
fullPath: '/devices/'
preLoaderRoute: typeof LayoutDevicesIndexRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/devices/$id': {
id: '/_layout/devices/$id'
path: '/devices/$id'
fullPath: '/devices/$id'
preLoaderRoute: typeof LayoutDevicesIdRouteImport
parentRoute: typeof LayoutRoute
}
'/_layout/flows/': {
id: '/_layout/flows/'
path: '/flows'
@@ -512,9 +550,11 @@ interface LayoutRouteChildren {
LayoutSettingsRoute: typeof LayoutSettingsRoute
LayoutWorkersRoute: typeof LayoutWorkersRoute
LayoutIndexRoute: typeof LayoutIndexRoute
LayoutDevicesIdRoute: typeof LayoutDevicesIdRoute
LayoutRunsIdRoute: typeof LayoutRunsIdRoute
LayoutRunsNewRoute: typeof LayoutRunsNewRoute
LayoutDashboardsIndexRoute: typeof LayoutDashboardsIndexRoute
LayoutDevicesIndexRoute: typeof LayoutDevicesIndexRoute
LayoutFlowsIndexRoute: typeof LayoutFlowsIndexRoute
LayoutRunsIndexRoute: typeof LayoutRunsIndexRoute
}
@@ -527,9 +567,11 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutSettingsRoute: LayoutSettingsRoute,
LayoutWorkersRoute: LayoutWorkersRoute,
LayoutIndexRoute: LayoutIndexRoute,
LayoutDevicesIdRoute: LayoutDevicesIdRoute,
LayoutRunsIdRoute: LayoutRunsIdRoute,
LayoutRunsNewRoute: LayoutRunsNewRoute,
LayoutDashboardsIndexRoute: LayoutDashboardsIndexRoute,
LayoutDevicesIndexRoute: LayoutDevicesIndexRoute,
LayoutFlowsIndexRoute: LayoutFlowsIndexRoute,
LayoutRunsIndexRoute: LayoutRunsIndexRoute,
}