feat(webui): internet sharing UI — exit-offer toggle + peer route-via selector

CellNetwork page (CellPanel):
- Internet Sharing section below service toggles
- Toggle: 'Offer my internet to <cell>' (calls PUT /api/cells/<n>/exit-offer)
- Read-only indicator: whether remote cell offers internet back
- Contextual hints explaining what each party needs to do next

Peers page:
- Fetches connected cells on mount
- Edit modal: Internet Exit dropdown (route-via) showing all connected cells
  with ✓ marker for cells that have offered internet
- Warning if selected cell hasn't offered internet yet
- On save, calls PUT /api/peers/<n>/route-via only when value changed
- Table badge shows 'via <cell>' for peers with active routing

api.js:
- cellLinkAPI.setExitOffer(cellName, offered)
- peerRegistryAPI.setRouteVia(peerName, viaCell)

Tests (vitest + @testing-library/react):
- 19 new frontend tests in src/__tests__/
  - CellNetworkInternetSharing.test.jsx (10 tests)
  - PeersRouteVia.test.jsx (9 tests)
- make test-webui target runs them via docker node:18-alpine

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 23:07:50 -04:00
parent 8ea834e108
commit 94957abd23
9 changed files with 395 additions and 5 deletions
+4
View File
@@ -147,6 +147,8 @@ export const peerRegistryAPI = {
registerPeer: (data) => api.post('/api/peers/register', data),
unregisterPeer: (peerName) => api.delete(`/api/peers/${peerName}/unregister`),
updatePeerIP: (peerName, data) => api.put(`/api/peers/${peerName}/update-ip`, data),
setRouteVia: (peerName, viaCell) =>
api.put(`/api/peers/${peerName}/route-via`, { via_cell: viaCell }),
};
// Auth API
@@ -281,6 +283,8 @@ export const cellLinkAPI = {
getPermissions: (cellName) => api.get(`/api/cells/${cellName}/permissions`),
updatePermissions: (cellName, inbound, outbound) =>
api.put(`/api/cells/${cellName}/permissions`, { inbound, outbound }),
setExitOffer: (cellName, offered) =>
api.put(`/api/cells/${cellName}/exit-offer`, { exit_offered: offered }),
getServices: () => api.get('/api/cells/services'),
};