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:
co-authored by
Claude Opus 5.5
parent
a9d453c9d9
commit
ad76200d3d
@@ -4,6 +4,8 @@ import { useState } from "react"
|
||||
|
||||
import type { MessageInfo, SettingDef, WidgetDef } from "@/client"
|
||||
import { DEFAULT_RANGE, RANGES } from "@/components/Common/RangePicker"
|
||||
import { screensOf } from "@/components/Devices/ports"
|
||||
import { devicesQueryOptions } from "@/components/Devices/queries"
|
||||
import {
|
||||
FieldLabel,
|
||||
InfoTip,
|
||||
@@ -1934,6 +1936,16 @@ export function DashboardPanel({
|
||||
const background = settingOf(dashboard, "background")
|
||||
const paletteSetting = settingOf(dashboard, "palette")
|
||||
const palette = parsePalette(paletteSetting.value)
|
||||
const { data: devices } = useQuery({
|
||||
...devicesQueryOptions(),
|
||||
enabled: open,
|
||||
})
|
||||
// The screens devices reported come first and take the place of a named
|
||||
// preset of the same size: that is the screen this is drawn for.
|
||||
const presets = [...screensOf(devices?.data), ...CANVAS_PRESETS].filter(
|
||||
(preset, index, all) =>
|
||||
all.findIndex((one) => sizeKey(one) === sizeKey(preset)) === index,
|
||||
)
|
||||
|
||||
/** Settings are a map, so one of them changing rewrites the whole of it. */
|
||||
const setSetting = (name: SettingName, setting: SettingDef) =>
|
||||
@@ -2012,7 +2024,7 @@ export function DashboardPanel({
|
||||
>
|
||||
<Select
|
||||
value={
|
||||
CANVAS_PRESETS.some(
|
||||
presets.some(
|
||||
(preset) =>
|
||||
sizeKey(preset) ===
|
||||
sizeKey({ ...canvas, shape: dashboard.shape }),
|
||||
@@ -2021,7 +2033,7 @@ export function DashboardPanel({
|
||||
: ""
|
||||
}
|
||||
onValueChange={(value) => {
|
||||
const preset = CANVAS_PRESETS.find(
|
||||
const preset = presets.find(
|
||||
(candidate) => sizeKey(candidate) === value,
|
||||
)
|
||||
if (preset)
|
||||
@@ -2037,7 +2049,7 @@ export function DashboardPanel({
|
||||
<SelectValue placeholder="Custom" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{CANVAS_PRESETS.map((preset) => (
|
||||
{presets.map((preset) => (
|
||||
<SelectItem key={sizeKey(preset)} value={sizeKey(preset)}>
|
||||
{preset.label} — {preset.width}×{preset.height}
|
||||
</SelectItem>
|
||||
|
||||
Reference in New Issue
Block a user