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
+41 -41
View File
@@ -1,6 +1,12 @@
import { expect, test } from "@playwright/test"
import { api, apiPage, deleteAll } from "./utils/api"
import {
api,
apiPage,
createDashboard,
createFlow,
deleteAll,
} from "./utils/api"
/**
* A slider publishes what a *drag* leaves it on, not only what a tap picks.
@@ -20,56 +26,50 @@ test.describe.configure({ mode: "serial" })
test.beforeAll(async ({ browser }) => {
const page = await apiPage(browser)
const madeFlow = await api(page, `/flows/${flowName}`, {
method: "PUT",
data: {
name: flowName,
title: "Slider drag",
version: 1,
nodes: [
{
id: "level",
type: "python",
title: "Level",
requires: [{ name: "level", dtype: "float" }],
provides: [{ name: "echo", dtype: "float" }],
},
],
inputs: [{ spec: { name: "level", dtype: "float" }, initial: 0 }],
},
const madeFlow = await createFlow(page, {
name: flowName,
title: "Slider drag",
version: 1,
nodes: [
{
id: "level",
type: "python",
title: "Level",
requires: [{ name: "level", dtype: "float" }],
provides: [{ name: "echo", dtype: "float" }],
},
],
inputs: [{ spec: { name: "level", dtype: "float" }, initial: 0 }],
})
if (!madeFlow.ok())
throw new Error(`flow PUT ${madeFlow.status()}: ${await madeFlow.text()}`)
throw new Error(`flow POST ${madeFlow.status()}: ${await madeFlow.text()}`)
await api(page, `/flows/${flowName}/nodes/level/source`, {
method: "PUT",
data: { code: "def process(level=0.0):\n return {'echo': level}\n" },
})
// 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: "Slider drag",
version: 0,
widgets: [
{
id: "level",
type: "slider",
title: "Level",
layout: { lg: { x: 0, y: 0, w: 6, h: 3 } },
config: {
target: `${flowName}.level`,
dtype: "float",
min: 0,
max: 100,
step: 1,
},
const madeBoard = await createDashboard(page, {
name: dashboard,
title: "Slider drag",
version: 0,
widgets: [
{
id: "level",
type: "slider",
title: "Level",
layout: { lg: { x: 0, y: 0, w: 6, h: 3 } },
config: {
target: `${flowName}.level`,
dtype: "float",
min: 0,
max: 100,
step: 1,
},
],
},
},
],
})
if (!madeBoard.ok())
throw new Error(