A cable can never be deleted: no button, no Delete key, no context menu - though the API supports it #3

Closed
opened 2026-11-08 06:05:41 +00:00 by jaylouisw · 1 comment
Owner

Ported from GitHub Jaylouisw/packetforge#86, filed before Forgejo became the source of truth.

Summary

A cable can be created through the UI but never removed. There is no Delete button in the link inspector, the Delete key does nothing while a cable is selected, and the right-click context menu (which does work for devices, per #16) is empty for cables.

The backend already supports it — DELETE /api/topologies/:id/links/:linkId exists and works. Only the frontend lacks the affordance.

Evidence

No UI path

Selecting a cable shows only read-only panels plus the length editor:

status:    Link: MC220L:eth0 ↔ HA-10.0.10.5:eth0
inspector: Inspect | Console | Simulate | LINK | Physical cable | Type | media |
           Media | 1000base-t | Rate | 1G | Duplex | full | Length | m | Set |
           State | up | ENDPOINTS | ...
buttons:   ['Inspect', 'Console', 'Simulate', 'Set', '▶ Send Ping']

There is no delete control in that list.

Delete key with the cable selected:

links 8 -> 8        (nothing removed)
status unchanged:   'Link: MC220L:eth0 ↔ HA-10.0.10.5:eth0'

Right-click on the cable:

context menu: {'display': 'none', 'items': []}

The #context-menu element exists (added for #16) but is only ever populated for devices, so for a link it stays hidden and empty.

The frontend simply has no code for it

$ grep -n "deleteLink\|removeLink\|delete.*link\|disconnect" web/app.js
1400:      const r = await api('DELETE', '/topologies/' + TOPO + '/devices/' + id);   <- devices only
1509:  ... 'reconnecting' : 'disconnected'          <- websocket state, unrelated

The only DELETE the UI issues is for a device. There is no link-deletion function at all.

But the server already has the route

server/index.js:361   // /links/:linkId
server/index.js:363   if (method === 'DELETE') {

So this is purely a missing UI control, not a missing capability.

Why this matters

Cabling is how a topology is built, and in a real lab half of all edits are repatching. Without removal, the only ways to correct a cable are:

  • delete and re-add a device at one end (which also destroys every other cable on it), or
  • restart the server and lose the entire in-memory topology (see the persistence gap), or
  • call the API by hand.

The third is what this test had to fall back on, which defeats the point of a GUI network simulator — and a user who mis-clicks a media type in the picker has no in-app way back.

It also makes the media picker one-way: choosing 10GBASE-SR when you meant a DAC cannot be undone, even though Length next to it can be edited.

Reproduced

  1. Create any cable (e.g. MC220L.eth0 ↔ HA.eth0, media 1000BASE-T).
  2. Click the cable to select it — status bar confirms Link: ....
  3. Try Delete. Try right-click. Try the inspector buttons.
  4. The cable remains; no error, no feedback.

Suggested fix

Mirror what devices already do:

  • Add a Delete cable / Disconnect button to the link inspector's LINK panel (the panel that already renders Media, Rate, Duplex, Length), calling the existing DELETE /topologies/:id/links/:linkId.
  • Honour Delete/Backspace when state.selectedLink is set, in the same keydown handler that deletes a selected device.
  • Populate #context-menu for links the way it is populated for devices, with Delete cable.
  • Because deleting a cable is destructive and cheap to get wrong, a confirm step (or an undo toast) is worth having — devices already benefit from being hard to remove by accident.

Notes

  • Found while correcting a real topology: the test had cabled MC220L → Home Assistant, which is wrong. There was no way in the UI to take that cable back out.
  • Related: #16 (same problem for devices, since fixed) — the fix there added the #context-menu element and a delete button; the link path was left behind.
> Ported from GitHub `Jaylouisw/packetforge#86`, filed before Forgejo became the source of truth. ## Summary A cable can be created through the UI but **never removed**. There is no Delete button in the link inspector, the `Delete` key does nothing while a cable is selected, and the right-click context menu (which does work for devices, per #16) is empty for cables. The backend already supports it — `DELETE /api/topologies/:id/links/:linkId` exists and works. Only the frontend lacks the affordance. ## Evidence ### No UI path Selecting a cable shows only read-only panels plus the length editor: ``` status: Link: MC220L:eth0 ↔ HA-10.0.10.5:eth0 inspector: Inspect | Console | Simulate | LINK | Physical cable | Type | media | Media | 1000base-t | Rate | 1G | Duplex | full | Length | m | Set | State | up | ENDPOINTS | ... buttons: ['Inspect', 'Console', 'Simulate', 'Set', '▶ Send Ping'] ``` There is no delete control in that list. **`Delete` key** with the cable selected: ``` links 8 -> 8 (nothing removed) status unchanged: 'Link: MC220L:eth0 ↔ HA-10.0.10.5:eth0' ``` **Right-click** on the cable: ``` context menu: {'display': 'none', 'items': []} ``` The `#context-menu` element exists (added for #16) but is only ever populated for devices, so for a link it stays hidden and empty. ### The frontend simply has no code for it ``` $ grep -n "deleteLink\|removeLink\|delete.*link\|disconnect" web/app.js 1400: const r = await api('DELETE', '/topologies/' + TOPO + '/devices/' + id); <- devices only 1509: ... 'reconnecting' : 'disconnected' <- websocket state, unrelated ``` The only `DELETE` the UI issues is for a **device**. There is no link-deletion function at all. ### But the server already has the route ``` server/index.js:361 // /links/:linkId server/index.js:363 if (method === 'DELETE') { ``` So this is purely a missing UI control, not a missing capability. ## Why this matters Cabling is how a topology is built, and in a real lab **half of all edits are repatching**. Without removal, the only ways to correct a cable are: - delete and re-add a device at one end (which also destroys every other cable on it), or - restart the server and lose the entire in-memory topology (see the persistence gap), or - call the API by hand. The third is what this test had to fall back on, which defeats the point of a GUI network simulator — and a user who mis-clicks a media type in the picker has no in-app way back. It also makes the media picker one-way: choosing `10GBASE-SR` when you meant a DAC cannot be undone, even though `Length` next to it can be edited. ## Reproduced 1. Create any cable (e.g. `MC220L.eth0 ↔ HA.eth0`, media `1000BASE-T`). 2. Click the cable to select it — status bar confirms `Link: ...`. 3. Try `Delete`. Try right-click. Try the inspector buttons. 4. The cable remains; no error, no feedback. ## Suggested fix Mirror what devices already do: - Add a **Delete cable** / **Disconnect** button to the link inspector's LINK panel (the panel that already renders `Media`, `Rate`, `Duplex`, `Length`), calling the existing `DELETE /topologies/:id/links/:linkId`. - Honour `Delete`/`Backspace` when `state.selectedLink` is set, in the same keydown handler that deletes a selected device. - Populate `#context-menu` for links the way it is populated for devices, with *Delete cable*. - Because deleting a cable is destructive and cheap to get wrong, a confirm step (or an undo toast) is worth having — devices already benefit from being hard to remove by accident. ## Notes - Found while correcting a real topology: the test had cabled `MC220L → Home Assistant`, which is wrong. There was no way in the UI to take that cable back out. - Related: #16 (same problem for devices, since fixed) — the fix there added the `#context-menu` element and a delete button; the link path was left behind.
Author
Owner

Fixed. A cable can be deleted from the link inspector, with the Delete key while a cable is selected, and from the context menu — test/cable-delete.test.js (17 checks) covers all three paths plus the DELETE /api/topologies/:id/links/:link call behind them.

The backend support was already there when this was filed; what was missing was every way of reaching it.

Fixed. A cable can be deleted from the link inspector, with the `Delete` key while a cable is selected, and from the context menu — `test/cable-delete.test.js` (17 checks) covers all three paths plus the `DELETE /api/topologies/:id/links/:link` call behind them. The backend support was already there when this was filed; what was missing was every way of reaching it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#3
No description provided.