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
+32 -31
View File
@@ -1,5 +1,11 @@
import { expect, type Page, test } from "@playwright/test"
import { api, apiPage, deleteAll } from "./utils/api"
import {
api,
apiPage,
createDashboard,
createFlow,
deleteAll,
} from "./utils/api"
/**
* The wall-panel widgets, on the page a panel actually opens.
@@ -39,31 +45,28 @@ test.beforeAll(async ({ browser }) => {
// One node that only declares: nothing consumes these, so publishing a value
// fills the panel without waking an engine run.
await api(page, `/flows/${flowName}`, {
method: "PUT",
data: {
name: flowName,
title: "Widgets",
version: 1,
nodes: [
{
id: "emit",
type: "python",
provides: [
{ name: "level", dtype: "float" },
{ name: "pv", dtype: "float" },
{ name: "grid", dtype: "float" },
{ name: "condition", dtype: "str" },
{ name: "days", dtype: "list", item: "record" },
{ name: "mode", dtype: "str" },
{ name: "lamp", dtype: "bool" },
{ name: "setpoint", dtype: "float" },
{ name: "idle", dtype: "float" },
{ name: "tint", dtype: "list", item: "float" },
],
},
],
},
await createFlow(page, {
name: flowName,
title: "Widgets",
version: 1,
nodes: [
{
id: "emit",
type: "python",
provides: [
{ name: "level", dtype: "float" },
{ name: "pv", dtype: "float" },
{ name: "grid", dtype: "float" },
{ name: "condition", dtype: "str" },
{ name: "days", dtype: "list", item: "record" },
{ name: "mode", dtype: "str" },
{ name: "lamp", dtype: "bool" },
{ name: "setpoint", dtype: "float" },
{ name: "idle", dtype: "float" },
{ name: "tint", dtype: "list", item: "float" },
],
},
],
})
// Saving writes a draft and moves the version on, so publish what is
// actually there rather than what it was a moment ago.
@@ -92,7 +95,7 @@ test.beforeAll(async ({ browser }) => {
])
const dashboard = await (
await api(page, `/dashboards/${dashboardName}`, { method: "POST" })
await createDashboard(page, { name: dashboardName })
).json()
// Two rows taller than the default panel: the tiles below already fill it,
// and a widget past the last row is clipped rather than drawn.
@@ -236,9 +239,7 @@ test.beforeAll(async ({ browser }) => {
data: { version: draft.version },
})
const stack = await (
await api(page, `/dashboards/${stackName}`, { method: "POST" })
).json()
const stack = await (await createDashboard(page, { name: stackName })).json()
stack.widgets = [
{
id: "split",
@@ -284,7 +285,7 @@ test.beforeAll(async ({ browser }) => {
})
const locked = await (
await api(page, `/dashboards/${lockedName}`, { method: "POST" })
await createDashboard(page, { name: lockedName })
).json()
locked.settings = { ...(locked.settings ?? {}), locked: { value: true } }
locked.widgets = [