Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

fix(canvas): keep zone and group descriptions on save

Pouzor4ef0cdc73fba
diff --git a/backend/app/db/database.py b/backend/app/db/database.py
index 443dd67..00e9184 100644
--- a/backend/app/db/database.py
+++ b/backend/app/db/database.py
@@ -513,6 +513,9 @@ async def init_db() -> None:
# in what order. Seeded from the row further down, once the backfill
# has had its say — see `_seed_node_views`.
("nodes.display_view", "ALTER TABLE nodes ADD COLUMN display_view JSON"),
+ # A zone or a group describes no device, so it has no inventory row to
+ # keep its text on. Furniture keeps it here instead — see `Node.description`.
+ ("nodes.description", "ALTER TABLE nodes ADD COLUMN description TEXT"),
):
await _try_migrate(conn, sql, label=label)
# 3.3.x — the inventory row owns the device's rack modelisation: the
@@ -591,6 +594,7 @@ _NODE_COLUMNS_SQL = (
"container_mode BOOLEAN,"
"custom_colors JSON,"
"custom_icon VARCHAR,"
+ "description TEXT,"
"show_port_numbers BOOLEAN,"
"width FLOAT,"
"height FLOAT,"
@@ -604,7 +608,7 @@ _NODE_COLUMNS_SQL = (
_NODE_KEPT = (
"id, type, label, design_id, device_id, display_view, pos_x, pos_y, parent_id, container_mode, "
- "custom_colors, custom_icon, show_port_numbers, width, height, bottom_handles, "
+ "custom_colors, custom_icon, description, show_port_numbers, width, height, bottom_handles, "
"top_handles, left_handles, right_handles, created_at, updated_at"
)
diff --git a/backend/app/db/models.py b/backend/app/db/models.py
index 611f23f..f54209e 100644
--- a/backend/app/db/models.py
+++ b/backend/app/db/models.py
@@ -64,6 +64,11 @@ class Node(Base):
container_mode: Mapped[bool] = mapped_column(Boolean, default=False)
custom_colors: Mapped[dict[str, Any] | None] = mapped_column(JSON, nullable=True)
custom_icon: Mapped[str | None] = mapped_column(String, nullable=True)
+ # What this piece of canvas furniture is for, in the user's words. Furniture
+ # (group / groupRect / text) draws no device, so it has no inventory row to
+ # carry a `notes` field — this column is that text's only home. NULL on every
+ # node that does draw a device: its notes belong to the inventory row.
+ description: Mapped[str | None] = mapped_column(Text, nullable=True)
show_port_numbers: Mapped[bool] = mapped_column(Boolean, default=False)
width: Mapped[float | None] = mapped_column(Float, nullable=True)
height: Mapped[float | None] = mapped_column(Float, nullable=True)
diff --git a/backend/app/schemas/canvas.py b/backend/app/schemas/canvas.py
index 4c2164c..fff826a 100644
--- a/backend/app/schemas/canvas.py
+++ b/backend/app/schemas/canvas.py
@@ -31,6 +31,9 @@ class NodeSave(BaseModel):
check_target: str | None = None
services: list[Any] = []
notes: str | None = None
+ # Canvas furniture only: the zone or group's own description. Furniture has no
+ # inventory row, so this is the one place the text can live.
+ description: str | None = None
parent_id: str | None = None
container_mode: bool = False
custom_colors: dict[str, Any] | None = None
diff --git a/backend/app/schemas/nodes.py b/backend/app/schemas/nodes.py
index bead9c4..38834ed 100644
--- a/backend/app/schemas/nodes.py
+++ b/backend/app/schemas/nodes.py
@@ -16,6 +16,9 @@ class NodeBase(BaseModel):
check_target: str | None = None
services: list[Any] = []
notes: str | None = None
+ # Canvas furniture only (group / groupRect / text): what the zone or group is
+ # for. A node that draws a device keeps its text on the inventory row instead.
+ description: str | None = None
pos_x: float = 0
pos_y: float = 0
parent_id: str | None = None
@@ -61,6 +64,7 @@ class NodeUpdate(BaseModel):
check_target: str | None = None
services: list[Any] | None = None
notes: str | None = None
+ description: str | None = None
pos_x: float | None = None
pos_y: float | None = None
parent_id: str | None = None
diff --git a/backend/app/services/inventory_sync.py b/backend/app/services/inventory_sync.py
index 85a283e..0eb04b8 100644
--- a/backend/app/services/inventory_sync.py
+++ b/backend/app/services/inventory_sync.py
@@ -581,6 +581,11 @@ async def link_facts(
node.device_id = None
return None
+ # A node that draws a device has no description of its own — what it is for
+ # is written on the inventory row, as `notes`. Clearing here keeps the two
+ # from becoming rival fields for the same text.
+ node.description = None
+
device = None
if node.device_id:
device = await db.get(InventoryDevice, node.device_id)
diff --git a/backend/tests/migrations/test_legacy_node_columns.py b/backend/tests/migrations/test_legacy_node_columns.py
index 8514b9c..150ef5e 100644
--- a/backend/tests/migrations/test_legacy_node_columns.py
+++ b/backend/tests/migrations/test_legacy_node_columns.py
@@ -421,3 +421,71 @@ async def test_the_newest_backup_that_still_has_the_columns_is_the_one_read(db_3
{"port": 443, "protocol": "tcp", "service_name": "https"}
]
await engine.dispose()
+
+
+async def test_a_furniture_description_survives_the_column_drop(db_320, monkeypatch):
+ """The rebuild copies a fixed column list — `description` has to be on it.
+
+ `_drop_legacy_node_columns` recreates `nodes` from `_NODE_COLUMNS_SQL` /
+ `_NODE_KEPT`. A column missing from those two strings is silently lost on the
+ boot that finally drops the legacy ones, which is exactly the boot a user who
+ wrote a zone description in the meantime would not expect to lose it.
+ """
+ db_path, engine = db_320
+ await _build_320(engine)
+
+ real_link_facts = inventory_sync.link_facts
+
+ async def link_facts(db, node, facts, **kwargs):
+ if node.id == "n2":
+ raise IntegrityError("boom", None, Exception("UNIQUE constraint failed"))
+ return await real_link_facts(db, node, facts, **kwargs)
+
+ monkeypatch.setattr(inventory_sync, "link_facts", link_facts)
+
+ # First boot: the backfill cannot finish, so the legacy columns stay.
+ await database.init_db()
+
+ check = create_async_engine(f"sqlite+aiosqlite:///{db_path}")
+ try:
+ async with check.begin() as conn:
+ cols = {c[1] for c in (await conn.exec_driver_sql("PRAGMA table_info(nodes)")).fetchall()}
+ assert "description" in cols
+ assert "status" in cols # legacy still there
+ # The user describes a piece of furniture.
+ await conn.exec_driver_sql(
+ "UPDATE nodes SET description = 'Behind the garage door.' WHERE id = 'n3'"
+ )
+
+ # Second boot: the backfill succeeds and the legacy columns finally go.
+ monkeypatch.setattr(inventory_sync, "link_facts", real_link_facts)
+ await database.init_db()
+
+ async with check.begin() as conn:
+ cols = {c[1] for c in (await conn.exec_driver_sql("PRAGMA table_info(nodes)")).fetchall()}
+ assert "status" not in cols
+ assert "description" in cols
+ kept = (await conn.exec_driver_sql(
+ "SELECT description FROM nodes WHERE id = 'n3'"
+ )).scalar()
+ assert kept == "Behind the garage door."
+ finally:
+ await check.dispose()
+ await engine.dispose()
+
+
+async def test_the_description_column_is_added_once_and_is_idempotent(db_320):
+ db_path, engine = db_320
+ await _build_320(engine)
+
+ await database.init_db()
+ await database.init_db()
+
+ check = create_async_engine(f"sqlite+aiosqlite:///{db_path}")
+ try:
+ async with check.begin() as conn:
+ info = (await conn.exec_driver_sql("PRAGMA table_info(nodes)")).fetchall()
+ assert [c[1] for c in info].count("description") == 1
+ finally:
+ await check.dispose()
+ await engine.dispose()
diff --git a/backend/tests/test_canvas.py b/backend/tests/test_canvas.py
index 48bacaf..ce3c378 100644
--- a/backend/tests/test_canvas.py
+++ b/backend/tests/test_canvas.py
@@ -740,3 +740,56 @@ async def test_save_canvas_keeps_a_real_parent(client: AsyncClient, headers: dic
saved = {n["label"]: n for n in (await client.get("/api/v1/canvas", headers=headers)).json()["nodes"]}
assert saved["pihole"]["parent_id"] == host["id"]
+
+
+# ── furniture descriptions ───────────────────────────────────────────────────
+
+async def test_save_canvas_keeps_zone_and_group_descriptions(client: AsyncClient, headers: dict):
+ # Regression: a zone's and a group's description used to ride on `notes`,
+ # which the save routes to the inventory row. Furniture has no such row, so
+ # the text was dropped without an error. It lives on `nodes.description` now.
+ zone = node_payload(type="groupRect", label="Garage", description="Everything behind the garage door.")
+ group = node_payload(type="group", label="Cluster", description="The three Proxmox boxes.")
+
+ res = await client.post(
+ "/api/v1/canvas/save", json={"nodes": [zone, group], "edges": [], "viewport": {}}, headers=headers
+ )
+ assert res.status_code == 200
+
+ saved = {n["label"]: n for n in (await client.get("/api/v1/canvas", headers=headers)).json()["nodes"]}
+ assert saved["Garage"]["description"] == "Everything behind the garage door."
+ assert saved["Cluster"]["description"] == "The three Proxmox boxes."
+
+
+async def test_save_canvas_edits_a_furniture_description(client: AsyncClient, headers: dict):
+ zone = node_payload(type="groupRect", label="Garage", description="First take.")
+ await client.post("/api/v1/canvas/save", json={"nodes": [zone], "edges": [], "viewport": {}}, headers=headers)
+
+ zone["description"] = "Second take."
+ await client.post("/api/v1/canvas/save", json={"nodes": [zone], "edges": [], "viewport": {}}, headers=headers)
+
+ saved = (await client.get("/api/v1/canvas", headers=headers)).json()["nodes"]
+ assert saved[0]["description"] == "Second take."
+
+
+async def test_save_canvas_clears_a_furniture_description(client: AsyncClient, headers: dict):
+ zone = node_payload(type="groupRect", label="Garage", description="Written once.")
+ await client.post("/api/v1/canvas/save", json={"nodes": [zone], "edges": [], "viewport": {}}, headers=headers)
+
+ zone["description"] = ""
+ await client.post("/api/v1/canvas/save", json={"nodes": [zone], "edges": [], "viewport": {}}, headers=headers)
+
+ saved = (await client.get("/api/v1/canvas", headers=headers)).json()["nodes"]
+ assert saved[0]["description"] == ""
+
+
+async def test_save_canvas_drops_a_description_on_a_device_node(client: AsyncClient, headers: dict):
+ # A node that draws a device keeps its text on the inventory row, as `notes`.
+ # `description` is furniture-only, so it is cleared rather than shadowing it.
+ n = node_payload(type="nas", label="nas-01", ip="192.168.1.20", notes="Backs up nightly.", description="Not here.")
+
+ await client.post("/api/v1/canvas/save", json={"nodes": [n], "edges": [], "viewport": {}}, headers=headers)
+
+ saved = (await client.get("/api/v1/canvas", headers=headers)).json()["nodes"][0]
+ assert saved["description"] is None
+ assert saved["notes"] == "Backs up nightly."
diff --git a/backend/tests/test_nodes.py b/backend/tests/test_nodes.py
index a211488..d1fe57a 100644
--- a/backend/tests/test_nodes.py
+++ b/backend/tests/test_nodes.py
@@ -441,3 +441,49 @@ async def test_update_node_self_parent_leaves_a_real_parent_alone(client: AsyncC
assert res.status_code == 200
assert res.json()["parent_id"] == host_id
+
+
+# ── furniture descriptions ───────────────────────────────────────────────────
+
+async def test_create_and_update_a_group_description(client: AsyncClient, headers: dict):
+ create = await client.post(
+ "/api/v1/nodes",
+ json={"type": "group", "label": "Cluster", "description": "The three Proxmox boxes."},
+ headers=headers,
+ )
+ assert create.status_code == 201
+ assert create.json()["description"] == "The three Proxmox boxes."
+ node_id = create.json()["id"]
+
+ res = await client.patch(f"/api/v1/nodes/{node_id}", json={"description": "Now four."}, headers=headers)
+ assert res.status_code == 200
+ assert res.json()["description"] == "Now four."
+ assert (await client.get(f"/api/v1/nodes/{node_id}", headers=headers)).json()["description"] == "Now four."
+
+
+async def test_update_a_zone_description_leaves_the_label_alone(client: AsyncClient, headers: dict):
+ create = await client.post("/api/v1/nodes", json={"type": "groupRect", "label": "Garage"}, headers=headers)
+ node_id = create.json()["id"]
+
+ res = await client.patch(f"/api/v1/nodes/{node_id}", json={"description": "Behind the door."}, headers=headers)
+ assert res.json()["label"] == "Garage"
+ assert res.json()["description"] == "Behind the door."
+
+
+async def test_a_device_node_never_keeps_a_description(client: AsyncClient, headers: dict):
+ # `description` is furniture-only: a node that draws a device writes what it
+ # is for to the inventory row, as `notes`.
+ create = await client.post(
+ "/api/v1/nodes",
+ json={"type": "nas", "label": "nas-01", "ip": "192.168.1.20", "description": "Not here."},
+ headers=headers,
+ )
+ assert create.json()["description"] is None
+
+ res = await client.patch(
+ f"/api/v1/nodes/{create.json()['id']}",
+ json={"description": "Still not here.", "notes": "Backs up nightly."},
+ headers=headers,
+ )
+ assert res.json()["description"] is None
+ assert res.json()["notes"] == "Backs up nightly."
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 929916d..2fb7f39 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -588,6 +588,7 @@ export default function App() {
position: getCenteredPosition(360, 240),
data: {
label: data.label,
+ description: data.description,
type: 'groupRect',
status: 'unknown',
services: [],
@@ -622,6 +623,7 @@ export default function App() {
const existing = nodes.find((n) => n.id === editingGroupRectId)
updateNode(editingGroupRectId, {
label: data.label,
+ description: data.description,
custom_colors: {
...existing?.data.custom_colors,
border: data.border_color,
@@ -1330,6 +1332,9 @@ export default function App() {
const rc = n.data.custom_colors ?? {}
return {
label: n.data.label,
+ // `notes` is where a zone description used to try to live; read it
+ // as a fallback so a canvas loaded before the fix still shows it.
+ description: n.data.description ?? n.data.notes ?? '',
font: rc.font ?? 'inter',
text_color: rc.text_color ?? '#e6edf3',
text_position: rc.text_position ?? 'top-left',
diff --git a/frontend/src/components/modals/GroupRectModal.tsx b/frontend/src/components/modals/GroupRectModal.tsx
index 7c32298..ceebdcc 100644
--- a/frontend/src/components/modals/GroupRectModal.tsx
+++ b/frontend/src/components/modals/GroupRectModal.tsx
@@ -16,6 +16,8 @@ export type LabelPosition = 'inside' | 'outside'
export interface GroupRectFormData {
label: string
+ /** What the zone is for. Saved on the node, not on any inventory row. */
+ description: string
font: string
text_color: string
text_position: TextPosition
@@ -60,6 +62,7 @@ const BORDER_WIDTHS: { value: number; label: string }[] = [
const DEFAULT_FORM: GroupRectFormData = {
label: '',
+ description: '',
font: 'inter',
text_color: '#e6edf3',
text_position: 'top-left',
@@ -178,6 +181,19 @@ export function GroupRectModal({
/>
</div>
+ {/* Description */}
+ <div className="flex flex-col gap-1.5">
+ <Label className="text-xs text-muted-foreground" htmlFor="zone-description">Description</Label>
+ <textarea
+ id="zone-description"
+ value={form.description}
+ onChange={(e) => set('description', e.target.value)}
+ placeholder="What is in this zone, and what it is for…"
+ rows={3}
+ className={`bg-[#21262d] border border-[#30363d] text-sm resize-y px-2 py-1.5 text-foreground placeholder:text-muted-foreground/40 focus:outline-none focus:border-[#00d4ff]/50 ${modalStyles['modal-radius']}`}
+ />
+ </div>
+
{/* Font */}
<div className="flex flex-col gap-1.5">
<Label className="text-xs text-muted-foreground">Font</Label>
diff --git a/frontend/src/components/modals/NodeModal.tsx b/frontend/src/components/modals/NodeModal.tsx
index f5ab6ae..7172ed2 100644
--- a/frontend/src/components/modals/NodeModal.tsx
+++ b/frontend/src/components/modals/NodeModal.tsx
@@ -14,7 +14,7 @@ import { ICON_REGISTRY, NODE_TYPE_DEFAULT_ICONS, isBrandIconKey, brandIconSlug,
import { IconPickerPanel } from './IconPickerPanel'
import { MAX_HANDLES, MIN_HANDLES, clampHandles, sideDefault, handleCountField, type Side } from '@/utils/handleUtils'
import { isValidParentNode } from '@/utils/virtualEdgeParent'
-import { NODE_TYPE_GROUPS } from '@/utils/nodeTypeGroups'
+import { NODE_TYPE_GROUPS, isFurnitureType } from '@/utils/nodeTypeGroups'
// Maps a side to its per-type default field on NodeTypeStyle.
const SIDE_STYLE_KEY: Record<Side, keyof NodeTypeStyle> = {
@@ -134,6 +134,9 @@ export function NodeModal({ open, onClose, onSubmit, initial, title = 'Add Node'
const [form, setForm] = useState<Partial<NodeData>>(merged)
const [iconPickerOpen, setIconPickerOpen] = useState(false)
const [labelError, setLabelError] = useState(false)
+ // Canvas furniture: an annotation, not a device. It has no inventory row, so
+ // its text is a `description` on the node rather than the device's `notes`.
+ const isFurniture = isFurnitureType(form.type)
const resolvedNodeColors = resolveNodeColors({ type: form.type ?? 'generic', custom_colors: form.custom_colors })
const showServicesEnabled = form.custom_colors?.show_services === true
const hasAppearanceOverrides = Boolean(
@@ -424,13 +427,15 @@ export function NodeModal({ open, onClose, onSubmit, initial, title = 'Add Node'
</button>
</div>
)}
- {/* Notes */}
+ {/* Notes — or, for canvas furniture, its description.
+ Furniture draws no device, so it has no inventory row to keep
+ `notes` on; its text lives on the node's own `description`. */}
<div className="flex flex-col gap-1.5">
- <Label className="text-xs text-muted-foreground">Notes</Label>
+ <Label className="text-xs text-muted-foreground">{isFurniture ? 'Description' : 'Notes'}</Label>
<Textarea
- value={form.notes ?? ''}
- onChange={(e) => set('notes', e.target.value)}
- placeholder="Optional notes"
+ value={(isFurniture ? form.description : form.notes) ?? ''}
+ onChange={(e) => set(isFurniture ? 'description' : 'notes', e.target.value)}
+ placeholder={isFurniture ? 'What this is for' : 'Optional notes'}
rows={3}
className={`bg-[#21262d] border-[#30363d] text-sm resize-y min-h-16 ${modalStyles['modal-radius']}`}
/>
diff --git a/frontend/src/components/modals/__tests__/GroupRectModal.test.tsx b/frontend/src/components/modals/__tests__/GroupRectModal.test.tsx
index 7757a48..7317a04 100644
--- a/frontend/src/components/modals/__tests__/GroupRectModal.test.tsx
+++ b/frontend/src/components/modals/__tests__/GroupRectModal.test.tsx
@@ -451,4 +451,33 @@ describe('GroupRectModal — subnet import', () => {
expect(onSubmit).toHaveBeenCalledOnce()
})
})
+ describe('description', () => {
+ it('renders an empty description field by default', () => {
+ render(<GroupRectModal open onClose={vi.fn()} onSubmit={vi.fn()} />)
+ expect((screen.getByLabelText('Description') as HTMLTextAreaElement).value).toBe('')
+ })
+
+ it('seeds the field from initial', () => {
+ render(
+ <GroupRectModal
+ open
+ onClose={vi.fn()}
+ onSubmit={vi.fn()}
+ initial={{ label: 'Garage', description: 'Behind the door.' }}
+ />
+ )
+ expect((screen.getByLabelText('Description') as HTMLTextAreaElement).value).toBe('Behind the door.')
+ })
+
+ it('submits what was typed', () => {
+ const onSubmit = vi.fn()
+ render(<GroupRectModal open onClose={vi.fn()} onSubmit={onSubmit} />)
+ fireEvent.change(screen.getByPlaceholderText('Zone name…'), { target: { value: 'Garage' } })
+ fireEvent.change(screen.getByLabelText('Description'), { target: { value: 'Behind the door.' } })
+ fireEvent.click(screen.getByText('Add'))
+
+ const submitted = onSubmit.mock.calls[0][0] as GroupRectFormData
+ expect(submitted.description).toBe('Behind the door.')
+ })
+ })
})
diff --git a/frontend/src/components/modals/__tests__/NodeModal.test.tsx b/frontend/src/components/modals/__tests__/NodeModal.test.tsx
index e01b6df..b22a622 100644
--- a/frontend/src/components/modals/__tests__/NodeModal.test.tsx
+++ b/frontend/src/components/modals/__tests__/NodeModal.test.tsx
@@ -613,4 +613,27 @@ describe('NodeModal', () => {
fireEvent.click(screen.getByRole('button', { name: 'Add' }))
expect((onSubmit.mock.calls[0][0] as Partial<NodeData>).check_method).toBe('none')
})
+ // ── Furniture: Description, not Notes ─────────────────────────────────
+
+ it('labels the free-text field Notes for a device node', () => {
+ renderModal({ initial: BASE })
+ expect(screen.getByText('Notes')).toBeDefined()
+ expect(screen.queryByText('Description')).toBeNull()
+ })
+
+ it('labels it Description for a zone, and submits it as description', () => {
+ const { onSubmit } = renderModal({ initial: { type: 'groupRect', label: 'Garage', services: [] } })
+ expect(screen.getByText('Description')).toBeDefined()
+ fireEvent.change(screen.getByPlaceholderText('What this is for'), { target: { value: 'Behind the door.' } })
+ fireEvent.click(screen.getByRole('button', { name: 'Add' }))
+
+ const data = onSubmit.mock.calls[0][0] as Partial<NodeData>
+ expect(data.description).toBe('Behind the door.')
+ expect(data.notes).toBeUndefined()
+ })
+
+ it('seeds the field from an existing group description', () => {
+ renderModal({ initial: { type: 'group', label: 'Cluster', description: 'Three boxes.', services: [] } })
+ expect((screen.getByPlaceholderText('What this is for') as HTMLTextAreaElement).value).toBe('Three boxes.')
+ })
})
diff --git a/frontend/src/components/panels/DetailPanel.tsx b/frontend/src/components/panels/DetailPanel.tsx
index 3c10762..73546ae 100644
--- a/frontend/src/components/panels/DetailPanel.tsx
+++ b/frontend/src/components/panels/DetailPanel.tsx
@@ -64,7 +64,7 @@ export function DetailPanel({ onEdit, onOpenInventory }: DetailPanelProps) {
nodes={nodes}
onUngroup={() => { ungroup(node.id) }}
onRemoveChild={(id) => { snapshotHistory(); removeFromGroup(node.id, id) }}
- onChangeDescription={(value) => updateNode(node.id, { notes: value })}
+ onChangeDescription={(value) => updateNode(node.id, { description: value })}
onSnapshotBeforeEdit={snapshotHistory}
onToggleBorder={() => {
snapshotHistory()
@@ -483,10 +483,12 @@ function GroupDetailPanel({ node, nodes, onUngroup, onRemoveChild, onChangeDescr
const offlineCount = children.filter((n) => n.data.status === 'offline').length
const showBorder = node.data.custom_colors?.show_border !== false
- // Description reuses data.notes, which already round-trips to the backend.
- // Controlled + committed on every keystroke so ANY save path (incl. Ctrl+S,
- // which never blurs the field) captures it. History is snapshotted once at the
- // start of an edit session so the whole edit is a single undo step.
+ // The description lives on `data.description`, the node's own column — a group
+ // draws no device, so it has no inventory row to keep `notes` on, and the text
+ // used to be dropped on save. Controlled + committed on every keystroke so ANY
+ // save path (incl. Ctrl+S, which never blurs the field) captures it. History is
+ // snapshotted once at the start of an edit session so the whole edit is a
+ // single undo step.
const snappedRef = useRef(false)
const handleDescriptionChange = (value: string) => {
if (!snappedRef.current) {
@@ -528,7 +530,7 @@ function GroupDetailPanel({ node, nodes, onUngroup, onRemoveChild, onChangeDescr
</label>
<textarea
id="group-description"
- value={node.data.notes ?? ''}
+ value={node.data.description ?? node.data.notes ?? ''}
onFocus={() => { snappedRef.current = false }}
onChange={(e) => handleDescriptionChange(e.target.value)}
placeholder="Add a description for this group…"
diff --git a/frontend/src/components/panels/__tests__/GroupPanels.test.tsx b/frontend/src/components/panels/__tests__/GroupPanels.test.tsx
index ca73963..a64a06d 100644
--- a/frontend/src/components/panels/__tests__/GroupPanels.test.tsx
+++ b/frontend/src/components/panels/__tests__/GroupPanels.test.tsx
@@ -244,7 +244,7 @@ describe('GroupDetailPanel', () => {
expect(snapshotHistory).toHaveBeenCalled()
})
- it('renders the existing group description from notes', () => {
+ it('still renders a description left on the legacy notes field', () => {
const group = makeGroupNode()
group.data = { ...group.data, notes: 'Critical DMZ hosts' } as typeof group.data
setupStore({ nodes: [group], selectedNodeId: 'g1', selectedNodeIds: ['g1'] })
@@ -258,7 +258,23 @@ describe('GroupDetailPanel', () => {
setupStore({ nodes: [group], selectedNodeId: 'g1', selectedNodeIds: ['g1'], updateNode })
renderPanel()
fireEvent.change(screen.getByLabelText('Description'), { target: { value: 'New notes' } })
- expect(updateNode).toHaveBeenCalledWith('g1', { notes: 'New notes' })
+ expect(updateNode).toHaveBeenCalledWith('g1', { description: 'New notes' })
+ })
+
+ it('renders the description from its own field', () => {
+ const group = makeGroupNode()
+ group.data = { ...group.data, description: 'Critical DMZ hosts' } as typeof group.data
+ setupStore({ nodes: [group], selectedNodeId: 'g1', selectedNodeIds: ['g1'] })
+ renderPanel()
+ expect((screen.getByLabelText('Description') as HTMLTextAreaElement).value).toBe('Critical DMZ hosts')
+ })
+
+ it('prefers description over the legacy notes field', () => {
+ const group = makeGroupNode()
+ group.data = { ...group.data, description: 'The real one', notes: 'The old one' } as typeof group.data
+ setupStore({ nodes: [group], selectedNodeId: 'g1', selectedNodeIds: ['g1'] })
+ renderPanel()
+ expect((screen.getByLabelText('Description') as HTMLTextAreaElement).value).toBe('The real one')
})
it('snapshots history once at the start of an edit, not on every keystroke', () => {
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index 912292d..cb36ec4 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -214,6 +214,14 @@ export interface NodeData extends Record<string, unknown> {
updated_at?: string
response_time_ms?: number
notes?: string
+ /**
+ * Canvas furniture only (`group` / `groupRect` / `text`): what the zone or
+ * group is for, in the user's words. Furniture draws no device, so it has
+ * no inventory row to keep a `notes` field on — this is that text's only
+ * home, and it saves with the canvas. Always null on a node that does draw
+ * a device; its notes belong to the inventory row.
+ */
+ description?: string | null
cpu_count?: number
cpu_model?: string
ram_gb?: number
diff --git a/frontend/src/utils/__tests__/canvasSerializer.test.ts b/frontend/src/utils/__tests__/canvasSerializer.test.ts
index 423276a..b9bd924 100644
--- a/frontend/src/utils/__tests__/canvasSerializer.test.ts
+++ b/frontend/src/utils/__tests__/canvasSerializer.test.ts
@@ -597,3 +597,41 @@ describe('migrateClusterHandles', () => {
expect(out.edges[0].sourceHandle).toBe('bottom')
})
})
+
+// ── Furniture descriptions ───────────────────────────────────────────────────
+
+describe('furniture descriptions', () => {
+ it('serializes a zone description', () => {
+ const zone = makeRfNode({
+ data: { label: 'Garage', type: 'groupRect', status: 'unknown', services: [], description: 'Behind the door.' },
+ })
+ const out = serializeNode(zone)
+ expect(out.description).toBe('Behind the door.')
+ // A zone still carries no device notes — it draws nothing physical.
+ expect(out.notes).toBeNull()
+ })
+
+ it('serializes a group description', () => {
+ const group = makeRfNode({
+ data: { label: 'Cluster', type: 'group', status: 'unknown', services: [], description: 'Three Proxmox boxes.' },
+ })
+ expect(serializeNode(group).description).toBe('Three Proxmox boxes.')
+ })
+
+ it('sends null when a zone has no description', () => {
+ const zone = makeRfNode({ data: { label: 'Garage', type: 'groupRect', status: 'unknown', services: [] } })
+ expect(serializeNode(zone).description).toBeNull()
+ })
+
+ it('round-trips a zone description through the API shape', () => {
+ const api = makeApiNode({ type: 'groupRect', label: 'Garage', description: 'Behind the door.' })
+ const node = deserializeApiNode(api, new Map())
+ expect(node.data.description).toBe('Behind the door.')
+ })
+
+ it('round-trips a group description through the API shape', () => {
+ const api = makeApiNode({ type: 'group', label: 'Cluster', description: 'Three Proxmox boxes.' })
+ const node = deserializeApiNode(api, new Map())
+ expect(node.data.description).toBe('Three Proxmox boxes.')
+ })
+})
diff --git a/frontend/src/utils/__tests__/standaloneStorageDevices.test.ts b/frontend/src/utils/__tests__/standaloneStorageDevices.test.ts
index abcbad9..16e514b 100644
--- a/frontend/src/utils/__tests__/standaloneStorageDevices.test.ts
+++ b/frontend/src/utils/__tests__/standaloneStorageDevices.test.ts
@@ -231,3 +231,43 @@ describe('a canvas stored in the pre-split shape', () => {
expect(stored(design.id).devices).toHaveLength(1)
})
})
+
+describe('furniture descriptions', () => {
+ it('keeps a zone description whole through a save and load', () => {
+ saveCanvas('d1', {
+ nodes: [node('z1', { type: 'groupRect', description: 'Behind the garage door.' })],
+ edges: [],
+ })
+
+ const loaded = loadCanvas('d1')
+ expect(loaded?.nodes[0].data.description).toBe('Behind the garage door.')
+ // Furniture draws no device, so it still mints no inventory row.
+ expect(stored('d1').devices ?? []).toHaveLength(0)
+ })
+
+ it('hoists a description saved under the legacy notes field', () => {
+ // Standalone kept furniture whole, so a canvas saved before the description
+ // had a field of its own still carries the text as `notes`.
+ saveCanvas('d1', { nodes: [node('z1', { type: 'groupRect', notes: 'Written before the fix.' })], edges: [] })
+
+ const loaded = loadCanvas('d1')
+ expect(loaded?.nodes[0].data.description).toBe('Written before the fix.')
+ })
+
+ it('leaves a real description alone when notes is also set', () => {
+ saveCanvas('d1', {
+ nodes: [node('z1', { type: 'groupRect', description: 'The real one', notes: 'The old one' })],
+ edges: [],
+ })
+
+ expect(loadCanvas('d1')?.nodes[0].data.description).toBe('The real one')
+ })
+
+ it('never hoists notes on a node that draws a device', () => {
+ saveCanvas('d1', { nodes: [node('n1', { ip: '10.0.0.5', notes: 'Backs up nightly.' })], edges: [] })
+
+ const loaded = loadCanvas('d1')
+ expect(loaded?.nodes[0].data.description).toBeUndefined()
+ expect(loaded?.nodes[0].data.notes).toBe('Backs up nightly.')
+ })
+})
diff --git a/frontend/src/utils/canvasSerializer.ts b/frontend/src/utils/canvasSerializer.ts
index 2bdbb7f..4061c35 100644
--- a/frontend/src/utils/canvasSerializer.ts
+++ b/frontend/src/utils/canvasSerializer.ts
@@ -23,6 +23,7 @@ export interface ApiNode extends Record<string, unknown> {
check_method?: string | null
check_target?: string | null
notes?: string | null
+ description?: string | null
parent_id?: string | null
container_mode?: boolean
custom_colors?: Record<string, unknown> | null
@@ -96,6 +97,8 @@ export function serializeNode(
check_target: null,
services: [],
notes: null,
+ // Furniture has no inventory row, so its own text lives on the node.
+ description: n.data.description ?? null,
parent_id: n.data.parent_id ?? null,
container_mode: false,
custom_icon: null,
@@ -135,6 +138,8 @@ export function serializeNode(
check_target: n.data.check_target ?? null,
services: n.data.services ?? [],
notes: n.data.notes ?? null,
+ // Only furniture keeps one; the backend clears it on a node drawing a device.
+ description: n.data.description ?? null,
parent_id: n.data.parent_id ?? null,
container_mode: n.data.container_mode ?? false,
// Stash collapse state inside the custom_colors blob so the backend's
diff --git a/frontend/src/utils/nodeTypeGroups.ts b/frontend/src/utils/nodeTypeGroups.ts
index fb08aa7..f6b7144 100644
--- a/frontend/src/utils/nodeTypeGroups.ts
+++ b/frontend/src/utils/nodeTypeGroups.ts
@@ -23,3 +23,17 @@ export const NODE_TYPE_GROUPS: { label: string; types: NodeType[] }[] = [
export const DEVICE_TYPE_GROUPS: { label: string; types: NodeType[] }[] = NODE_TYPE_GROUPS.map((g) =>
g.types.includes('groupRect') ? { ...g, types: g.types.filter((t) => t !== 'groupRect') } : g
)
+
+/**
+ * Canvas furniture: an annotation, not a device.
+ *
+ * These draw nothing physical, so they never get a Device Inventory row — which
+ * is why their own text lives on the node (`NodeData.description`) rather than
+ * in the row's `notes`. Mirrors `FURNITURE_TYPES` in
+ * `backend/app/services/inventory_sync.py`.
+ */
+export const FURNITURE_TYPES: ReadonlySet<string> = new Set(['group', 'groupRect', 'text'])
+
+export function isFurnitureType(type: string | null | undefined): boolean {
+ return FURNITURE_TYPES.has(type ?? '')
+}
diff --git a/frontend/src/utils/standaloneStorage.ts b/frontend/src/utils/standaloneStorage.ts
index 154753d..824fd34 100644
--- a/frontend/src/utils/standaloneStorage.ts
+++ b/frontend/src/utils/standaloneStorage.ts
@@ -26,6 +26,7 @@ import type {
} from '@/types'
import type { ThemeId } from '@/utils/themes'
import { generateUUID } from '@/utils/uuid'
+import { FURNITURE_TYPES } from '@/utils/nodeTypeGroups'
const DESIGNS_KEY = 'homelable_designs'
const LEGACY_CANVAS_KEY = 'homelable_canvas'
@@ -62,8 +63,6 @@ export interface StandaloneCanvas {
// image, so they are disabled in standalone mode (see homelable/CLAUDE.md ADR).
}
-/** Node types that draw nothing physical, so they never get an inventory row. */
-const FURNITURE_TYPES = new Set(['group', 'groupRect', 'text'])
/**
* Device fields the inventory row owns — everything a node no longer keeps.
@@ -160,6 +159,24 @@ function hydrateDevices(data: StandaloneCanvas): StandaloneCanvas {
}
}
+/**
+ * Move a furniture description off the field it used to ride on.
+ *
+ * A zone's or group's description was written to `data.notes` before it had a
+ * column of its own. Standalone kept furniture whole, so that text is still in
+ * localStorage under the old name — hoist it once on load rather than lose it.
+ */
+function hoistFurnitureDescriptions(data: StandaloneCanvas): StandaloneCanvas {
+ return {
+ ...data,
+ nodes: data.nodes.map((n) => {
+ if (!FURNITURE_TYPES.has(n.data.type)) return n
+ if (n.data.description != null || n.data.notes == null) return n
+ return { ...n, data: { ...n.data, description: n.data.notes } } as Node<NodeData>
+ }),
+ }
+}
+
function readJSON<T>(key: string): T | null {
try {
const raw = localStorage.getItem(key)
@@ -290,7 +307,7 @@ export function saveRackCanvas(designId: string, data: StandaloneRackCanvas): vo
/** Load a design's canvas. Returns null when the design has never been saved. */
export function loadCanvas(designId: string): StandaloneCanvas | null {
const stored = readJSON<StandaloneCanvas>(canvasKey(designId))
- return stored ? hydrateDevices(stored) : null
+ return stored ? hoistFurnitureDescriptions(hydrateDevices(stored)) : null
}
export function saveCanvas(designId: string, data: StandaloneCanvas): void {
diff --git a/frontend/src/utils/subnet.ts b/frontend/src/utils/subnet.ts
index 8baea8c..8e4b957 100644
--- a/frontend/src/utils/subnet.ts
+++ b/frontend/src/utils/subnet.ts
@@ -6,6 +6,8 @@
* the modal can say why instead of silently matching nothing.
*/
+import { FURNITURE_TYPES } from '@/utils/nodeTypeGroups'
+
/** A parsed CIDR: the network address as a 32-bit int, plus the prefix length. */
export interface ParsedCidr {
base: number
@@ -91,7 +93,6 @@ export function ipInSubnet(ip: string | null | undefined, cidr: string): boolean
* be canvas furniture (which describes nothing physical and so has no IP worth
* matching), and must have an IP inside the range.
*/
-const FURNITURE_TYPES = new Set(['groupRect', 'group', 'text'])
export function isZoneSubnetCandidate(
node: { id: string; parentId?: string; data: { type: string; ip?: string } },