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:
@@ -54,16 +54,19 @@ class SearchEntry(BaseModel):
|
||||
"""
|
||||
|
||||
category: Category
|
||||
#: The id the frontend routes on. For an input or output, the qualified
|
||||
#: message, which is what the canvas names its label by. For a setting,
|
||||
#: ``<node>.<setting>``: a node id has no dot, so the node is what comes
|
||||
#: before the first one.
|
||||
#: What it is called: a flow's or dashboard's key, or the id of anything
|
||||
#: else. For an input or output, the qualified message, which is what the
|
||||
#: canvas names its label by. For a setting, ``<node>.<setting>``: a node
|
||||
#: id has no dot, so the node is what comes before the first one.
|
||||
name: str
|
||||
#: Human title, often empty — a flow is usually only its name.
|
||||
title: str = ""
|
||||
#: The flow a node, input or output sits in, or the dashboard a widget
|
||||
#: sits on.
|
||||
#: sits on, by key.
|
||||
parent: str = ""
|
||||
#: The id of the flow or dashboard opening it goes to: its own, or the one
|
||||
#: it sits in. Empty for everything else, whose ``name`` is its id.
|
||||
id: str = ""
|
||||
#: Node type, input dtype, widget type, channel kind.
|
||||
kind: str = ""
|
||||
#: What a setting is set to, as text. Only ever what ``setting_text`` lets
|
||||
@@ -159,13 +162,16 @@ def _build(
|
||||
flow = controller.store.read_flow(name, draft=True)
|
||||
except FlowNotFound:
|
||||
continue
|
||||
entries.append(SearchEntry(category="flow", name=flow.name, title=flow.title))
|
||||
entries.append(
|
||||
SearchEntry(category="flow", name=flow.name, title=flow.title, id=flow.id)
|
||||
)
|
||||
entries.extend(
|
||||
SearchEntry(
|
||||
category="node",
|
||||
name=node.id,
|
||||
title=node.title,
|
||||
parent=flow.name,
|
||||
id=flow.id,
|
||||
kind=node.type,
|
||||
)
|
||||
for node in flow.nodes
|
||||
@@ -184,6 +190,7 @@ def _build(
|
||||
category="setting",
|
||||
name=f"{node.id}.{key}",
|
||||
parent=flow.name,
|
||||
id=flow.id,
|
||||
kind=node.type,
|
||||
detail=text,
|
||||
)
|
||||
@@ -206,18 +213,22 @@ def _build(
|
||||
# The label the canvas draws: bare when it is the flow's own.
|
||||
title=message.removeprefix(f"{flow.name}."),
|
||||
parent=flow.name,
|
||||
id=flow.id,
|
||||
kind=kind,
|
||||
)
|
||||
)
|
||||
|
||||
for summary in dashboards.list():
|
||||
try:
|
||||
dashboard = dashboards.read(summary.name, draft=True)
|
||||
dashboard = dashboards.read(summary.id, draft=True)
|
||||
except DashboardNotFound:
|
||||
continue
|
||||
entries.append(
|
||||
SearchEntry(
|
||||
category="dashboard", name=dashboard.name, title=dashboard.title
|
||||
category="dashboard",
|
||||
name=dashboard.name,
|
||||
title=dashboard.title,
|
||||
id=dashboard.id,
|
||||
)
|
||||
)
|
||||
entries.extend(
|
||||
@@ -226,6 +237,7 @@ def _build(
|
||||
name=widget.id,
|
||||
title=widget.title,
|
||||
parent=dashboard.name,
|
||||
id=dashboard.id,
|
||||
kind=widget.type,
|
||||
)
|
||||
for widget in dashboard.widgets
|
||||
|
||||
Reference in New Issue
Block a user