History is kept by flow id: runs, cascades, rollups and events file the id in their flow column and nodes as <flow id>.<node>, the API answers flow plus flow_name and shows and takes nodes as <key>.<node>; events carry flow_id from the moment they are published; run queue items, the stage cache and cached curves keep ids and keys apart; endpoints, the brain graph, device bindings and search name the id to open
This commit is contained in:
@@ -77,6 +77,7 @@ class Binding:
|
||||
"""One port of a device, wired to a message by a device node."""
|
||||
|
||||
device: str
|
||||
#: The flow's key, which ``message`` is qualified with.
|
||||
flow: str
|
||||
node: str
|
||||
port: str
|
||||
@@ -88,6 +89,8 @@ class Binding:
|
||||
dtype: str
|
||||
#: Passed through to the device unread.
|
||||
config: dict[str, Any] = field(default_factory=dict)
|
||||
#: The flow's id, which is where wiring the port is edited.
|
||||
flow_id: str = ""
|
||||
|
||||
|
||||
class DeviceIo(BaseModel):
|
||||
@@ -102,7 +105,9 @@ class DeviceIo(BaseModel):
|
||||
class DeviceBinding(BaseModel):
|
||||
"""Where a port is wired: the device node holding it."""
|
||||
|
||||
#: The flow's key, and its id to open it by.
|
||||
flow: str
|
||||
flow_id: str = ""
|
||||
node: str
|
||||
port: str
|
||||
message: str
|
||||
@@ -129,6 +134,7 @@ def bindings_of(flow: FlowDef) -> list[Binding]:
|
||||
Binding(
|
||||
device=device,
|
||||
flow=flow.name,
|
||||
flow_id=flow.id,
|
||||
node=node.id,
|
||||
port=spec.port,
|
||||
message=qualify(flow.name, spec.name),
|
||||
@@ -145,9 +151,10 @@ class DeviceDef(BaseModel):
|
||||
|
||||
id: str
|
||||
title: str = ""
|
||||
#: Ordered. The first one is what the device opens after pairing, and the
|
||||
#: rail follows this order. A name that no longer resolves is a dashboard
|
||||
#: someone deleted, and the device skips it.
|
||||
#: Dashboard ids, ordered. The first one is what the device opens after
|
||||
#: pairing, and the rail follows this order. An id that no longer resolves
|
||||
#: is a dashboard someone deleted, and the device skips it. A dashboard from
|
||||
#: before ids has its key as its id, so a list from then still holds.
|
||||
dashboards: list[str] = Field(default_factory=list)
|
||||
#: Bigger controls, a bigger rail and no hover states, for a screen that is
|
||||
#: touched rather than pointed at. A fact about the screen, not about any
|
||||
@@ -513,6 +520,7 @@ class DeviceStore:
|
||||
(
|
||||
DeviceBinding(
|
||||
flow=b.flow,
|
||||
flow_id=b.flow_id,
|
||||
node=b.node,
|
||||
port=b.port,
|
||||
message=b.message,
|
||||
@@ -1013,7 +1021,7 @@ def dashboards_for(
|
||||
) -> list[DashboardDef]:
|
||||
"""The published documents this device shows, in rail order.
|
||||
|
||||
Published, since that is what a device draws. A name that no longer
|
||||
Published, since that is what a device draws. An id that no longer
|
||||
resolves is skipped, and a device that is gone shows nothing.
|
||||
|
||||
Handed back whole rather than walked here, because what a device may do
|
||||
@@ -1022,7 +1030,7 @@ def dashboards_for(
|
||||
"""
|
||||
if device is None:
|
||||
return []
|
||||
return [defn for name in device.dashboards if (defn := store.published(name))]
|
||||
return [defn for dash_id in device.dashboards if (defn := store.published(dash_id))]
|
||||
|
||||
|
||||
def messages_of(defn: DashboardDef) -> set[str]:
|
||||
|
||||
Reference in New Issue
Block a user