Frontend addresses flows and dashboards by id: routes /flows/$flowId, /dashboards/$id and /view/$id, query keys, saves, lists, device pickers, search, brain and endpoint links and generated results dashboards go by id, while live values, issues, pauses and message names keep the key; tabs take the title from the document; creating uses POST and opens the issued id; the flow and dashboard panels show key and id with a copy button and a served HTTP or WebSocket node shows its hook URL under the flow id; specs create by POST and ids.spec.ts exercises issued ids

This commit is contained in:
2026-11-02 19:57:43 +01:00
parent fd637e0f1e
commit fa15522cb0
65 changed files with 1380 additions and 784 deletions
+51 -51
View File
@@ -1,6 +1,12 @@
import { expect, type Page, test } from "@playwright/test"
import { api, apiPage, deleteAll } from "./utils/api"
import {
api,
apiPage,
createDashboard,
createFlow,
deleteAll,
} from "./utils/api"
/**
* A colour disc sends once, at the end of the gesture.
@@ -27,27 +33,24 @@ test.beforeAll(async ({ browser }) => {
// A node that only declares: nothing consumes the message, so a publish
// reaches the graph without waking an engine run. The widget is what is
// under test, not a flow.
const madeFlow = await api(page, `/flows/${flowName}`, {
method: "PUT",
data: {
name: flowName,
title: "Colour drag",
version: 1,
nodes: [
{
id: "lamp",
type: "python",
provides: [
{ name: "tint", dtype: "list", item: "float" },
{ name: "rgb", dtype: "list", item: "int" },
{ name: "hex", dtype: "str" },
],
},
],
},
const madeFlow = await createFlow(page, {
name: flowName,
title: "Colour drag",
version: 1,
nodes: [
{
id: "lamp",
type: "python",
provides: [
{ name: "tint", dtype: "list", item: "float" },
{ name: "rgb", dtype: "list", item: "int" },
{ name: "hex", dtype: "str" },
],
},
],
})
if (!madeFlow.ok())
throw new Error(`flow PUT ${madeFlow.status()}: ${await madeFlow.text()}`)
throw new Error(`flow POST ${madeFlow.status()}: ${await madeFlow.text()}`)
const flow = await (await api(page, `/flows/${flowName}?draft=true`)).json()
await api(page, `/flows/${flowName}/publish`, {
method: "POST",
@@ -65,38 +68,35 @@ test.beforeAll(async ({ browser }) => {
}
// A leftover from a run that failed before its teardown would answer the
// create with a version conflict.
// create with a conflict.
await api(page, `/dashboards/${dashboard}`, { method: "DELETE" })
const madeBoard = await api(page, `/dashboards/${dashboard}`, {
method: "PUT",
data: {
name: dashboard,
title: "Colour drag",
version: 0,
widgets: [
{
id: "tint",
type: "color",
title: "Tint",
layout: { lg: { x: 0, y: 0, w: 6, h: 4 } },
config: { target, dtype: "list", format: "hsv" },
},
{
id: "rgb",
type: "color",
title: "RGB",
layout: { lg: { x: 6, y: 0, w: 3, h: 4 } },
config: { target: `${flowName}.rgb`, dtype: "list", format: "rgb" },
},
{
id: "hex",
type: "color",
title: "Hex",
layout: { lg: { x: 9, y: 0, w: 3, h: 4 } },
config: { target: `${flowName}.hex`, dtype: "str", format: "hex" },
},
],
},
const madeBoard = await createDashboard(page, {
name: dashboard,
title: "Colour drag",
version: 0,
widgets: [
{
id: "tint",
type: "color",
title: "Tint",
layout: { lg: { x: 0, y: 0, w: 6, h: 4 } },
config: { target, dtype: "list", format: "hsv" },
},
{
id: "rgb",
type: "color",
title: "RGB",
layout: { lg: { x: 6, y: 0, w: 3, h: 4 } },
config: { target: `${flowName}.rgb`, dtype: "list", format: "rgb" },
},
{
id: "hex",
type: "color",
title: "Hex",
layout: { lg: { x: 9, y: 0, w: 3, h: 4 } },
config: { target: `${flowName}.hex`, dtype: "str", format: "hex" },
},
],
})
if (!madeBoard.ok())
throw new Error(