meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[FEAT] - Remove/purge node from Map (and database)

Open kokoshell opened this issue 6 months ago • 2 comments

Hi Yeraze, At this moment node removal/purge is deeply hidden into Messages -> Actions -> Purge Data ... It is really annoying to delete/purge a node in this hidden way .... We should provide a possibility to interactively remove/purge a node from the map itsef .... What about instead of redundant info with Hops and Altitude to put two buttons : Delete and Purge ? Best regards, Kokoshell

Image

kokoshell avatar May 23 '26 21:05 kokoshell

Thanks for the feature request, @kokoshell! This is a good UX improvement — the current workflow (Messages → Actions → Purge Data) is buried and not intuitive for map-centric users.

This is well-aligned with the project's goals. Here's my proposed implementation plan:


Implementation Plan: Node Delete/Purge from Map Popup

Overview

Add Delete and Purge from Device action buttons directly to the map node popup, gated behind the existing messages:write permission. The backend API already supports both operations; this is purely a frontend change.

What "Delete" vs "Purge" means

  • Delete (DELETE /api/messages/nodes/:nodeNum) — removes the node and all its data (messages, telemetry, traceroutes, position history) from the local MeshMonitor database only. The device is unaffected.
  • Purge from Device (POST /api/messages/nodes/:nodeNum/purge-from-device) — sends a removeNode admin command to the Meshtastic device and deletes from the local database.

Changes Required

1. src/components/MapNodePopupContent.tsx

Add two optional callback props:

onDeleteNode?: () => void;
onPurgeNodeFromDevice?: () => void;

In the Info tab, after the existing "More Details" button, add a danger-zone section (shown only when hasPermission('messages', 'write') and the node is not the current node):

[🗑️ Delete from DB]   [⚠️ Purge from Device]

The buttons will use a new node-popup-btn-danger CSS class for visual distinction (red/warning styling).

2. src/components/NodesTab.tsx (lines ~2111–2126)

Wire up two new handler functions passed to MapNodePopupContent:

  • handlePopupDeleteNode(nodeNum, sourceId) — calls DELETE /api/messages/nodes/:nodeNum with confirmation dialog, shows success/error toast, refreshes node list
  • handlePopupPurgeFromDevice(nodeNum, sourceId) — calls POST /api/messages/nodes/:nodeNum/purge-from-device with a stronger confirmation dialog ("This will remove the node from the device"), shows success/error toast, refreshes node list

Both handlers close the popup on success.

3. src/styles/nodes.css

Add .node-popup-btn-danger variant for the red/warning styling of the destructive action buttons.

UX Notes

  • I'm not proposing to remove Hops or Altitude — those are useful spatial context when looking at a map. The buttons will be added as extra actions below the existing info, not replacing existing fields.
  • Both operations require a browser confirmation dialog before execution (matching existing behavior elsewhere in the app).
  • The buttons only appear when the user has messages:write permission — read-only users won't see them.
  • You cannot delete/purge your own node (the current device) from the popup.

@Yeraze — does this plan look good? I can proceed with implementation once you give the go-ahead.


Generated by Claude Code

Yeraze avatar May 23 '26 21:05 Yeraze

Hi, for me it looks excellent ! Wait for others opinion ?

kokoshell avatar May 25 '26 14:05 kokoshell