Capability report: PUT /devices/{id}/report, a Capabilities section, offline devices degraded

A device reports its board, screen, camera and ports from its own
credential (16 KB, schema 1, replacing the last report), and the flows
are validated against it again. The node panel turns a reported port's
config schema into a form, a reported screen is a canvas preset and a
touch screen's first report turns Touch friendly on. An offline device
node is degraded: amber on the canvas, a warning on Home, never a fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138N7k5PT4dcR1iEqXaaQ9k
This commit is contained in:
Melvin Strobl
2026-10-16 17:37:49 +02:00
co-authored by Claude Opus 5.5
parent a9d453c9d9
commit ad76200d3d
28 changed files with 820 additions and 129 deletions
+24 -4
View File
@@ -77,6 +77,8 @@ const STATUS_STYLES = {
},
running: { dot: "bg-primary animate-pulse", label: "Running" },
success: { dot: "bg-status-success", label: "Last run succeeded" },
// Works, if not as it should: a device that is offline. Not a fault.
warning: { dot: "bg-status-warning", label: "Degraded" },
error: { dot: "bg-destructive", label: "Something went wrong" },
} as const
@@ -86,6 +88,8 @@ export type FlowNodeData = {
typeLabel: string
isPlugin?: boolean
issueText: string
/** Why the node is degraded, if it is: amber, never a fault. */
warningText?: string
/** Open the logs at this node's own lines. */
onShowLogs?: (nodeId: string) => void
[key: string]: unknown
@@ -126,8 +130,15 @@ function PortHandles({
}
function FlowNodeComponent({ data, selected }: NodeProps) {
const { definition, flow, typeLabel, isPlugin, issueText, onShowLogs } =
data as FlowNodeData
const {
definition,
flow,
typeLabel,
isPlugin,
issueText,
warningText,
onShowLogs,
} = data as FlowNodeData
const nodeId = `${flow}.${definition.id}`
const live = useNodeStatus(nodeId)
const emits = useNodeEmits(nodeId)
@@ -174,7 +185,12 @@ function FlowNodeComponent({ data, selected }: NodeProps) {
.join("\n")
.split("\n")
const problem = [...new Set(lines)].join("\n")
const status = problem ? "error" : live?.status
const warning = problem ? "" : (warningText ?? "")
const status = problem
? "error"
: warning && live?.status !== "running"
? "warning"
: live?.status
const running = status === "running"
const style = STATUS_STYLES[status as keyof typeof STATUS_STYLES]
// Failed at some point, fine as of the last run. It gets no dot and no
@@ -209,6 +225,7 @@ function FlowNodeComponent({ data, selected }: NodeProps) {
// Selection wins the border when it is both — the dot is the status
// channel, and it is still red underneath.
problem && "border-destructive",
status === "warning" && "border-status-warning",
selected && "border-primary shadow-e2",
)}
>
@@ -318,7 +335,10 @@ function FlowNodeComponent({ data, selected }: NodeProps) {
/>
</TooltipTrigger>
<TooltipContent className="max-h-60 max-w-xs overflow-y-auto whitespace-pre-line break-words">
{problem || live?.detail || style.label}
{problem ||
(status === "warning" ? warning : "") ||
live?.detail ||
style.label}
</TooltipContent>
</Tooltip>
) : null}