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
@@ -385,6 +385,8 @@ export function DashboardEditor({
edit: boolean
}) {
const [draft, setDraft] = useState<Dashboard>(dashboard)
// What the API, the routes and the devices know it by; never edited.
const id = dashboard.id!
const [selected, setSelected] = useState<string | null>(null)
// The face a round dashboard shows: the widget picked, or the one last
// picked or paged to once its settings are put away.
@@ -403,9 +405,9 @@ export function DashboardEditor({
const root = useCanvasRoot(draft)
const navigate = useNavigate()
const queryClient = useQueryClient()
const save = useSaveDashboard(dashboard.name)
const publish = usePublishDashboard(dashboard.name)
const discard = useDiscardDashboardDraft(dashboard.name)
const save = useSaveDashboard(id)
const publish = usePublishDashboard(id)
const discard = useDiscardDashboardDraft(id)
const [discardOpen, setDiscardOpen] = useState(false)
const { showSuccessToast, showErrorToast } = useCustomToast()
const copied = useCopiedWidget()
@@ -484,8 +486,7 @@ export function DashboardEditor({
}
const remove = useMutation({
mutationFn: () =>
DashboardsService.deleteDashboard({ dashboardId: draft.name }),
mutationFn: () => DashboardsService.deleteDashboard({ dashboardId: id }),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: dashboardKeys.all })
navigate({ to: "/dashboards" })
@@ -590,7 +591,7 @@ export function DashboardEditor({
(devices?.data ?? []).find(
(device) =>
(device.dashboards ?? []).length > 1 &&
(device.dashboards ?? []).includes(draft.name),
(device.dashboards ?? []).includes(id),
)?.dashboards ?? null
// A round face has no room for one: a panel swipes between those instead.
const hasRail = Boolean(railDashboards) && !stacked && !round
@@ -598,13 +599,13 @@ export function DashboardEditor({
railDashboards && !round ? (
<PanelRail
dashboards={railDashboards}
current={draft.name}
current={id}
horizontal={stacked}
// Editing one dashboard of a panel and editing its neighbour are the
// same job, so the rail keeps whichever mode this one is in.
linkFor={(name) => ({
to: "/dashboards/$name",
params: { name },
linkFor={(other) => ({
to: "/dashboards/$id",
params: { id: other },
search: edit ? { edit: true } : {},
})}
/>
@@ -675,8 +676,8 @@ export function DashboardEditor({
setSelected(null)
setSettingsOpen(false)
navigate({
to: "/dashboards/$name",
params: { name: draft.name },
to: "/dashboards/$id",
params: { id },
search: next ? { edit: true } : {},
})
}
@@ -685,7 +686,7 @@ export function DashboardEditor({
const pickable = (widget: WidgetDef, grip = false) => (
<Pickable
widget={widget}
dashboard={draft.name}
dashboard={id}
grip={grip}
selected={widget.id === selected}
onPick={() => {
@@ -985,7 +986,7 @@ export function DashboardEditor({
asChild
>
<a
href={appPath(`/view/${draft.name}`)}
href={appPath(`/view/${id}`)}
target="_blank"
rel="noreferrer"
>