From 764d3e07400854b333583b2efaa1c9eae18ae5e1 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2026 02:06:14 +0000 Subject: dashboard: a node's menu on a right-click, and going to its dashboard A right press on a node started dragging it, as any press did: the map took hold of the pointer, so the right-click went to the map and the node's menu didn't open, and letting go put the node in focus. The right button now opens the node's menu alone. Its entry for the node's dashboard is `go to its dashboard`, greyed where the node publishes none (and on this node's own), its tooltip saying where it goes or why not. --- docs/dashboard.md | 5 +++-- src/api/dashboard/dashboard.html | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/dashboard.md b/docs/dashboard.md index 2b205b6..2966c79 100644 --- a/docs/dashboard.md +++ b/docs/dashboard.md @@ -242,8 +242,9 @@ measured. Tor alone, or plain `http` from an `https` page; the node allows this page's origin as a member's dashboard (`--cors-origins` for others). Subscriptions are kept in the browser, and handed over with the rest. -* **Right-click a node**: its menu: subscribing, and opening its dashboard. -* **Open a node's dashboard** (its menu): in this page, where the node publishes one +* **Right-click a node**: its menu: subscribing to its links (or not), and `go to its + dashboard`, greyed where the node publishes none, and on this node's own. +* **Go to a node's dashboard** (its menu): in this page, where the node publishes one (`--dashboard-url`, in the member list; e.g. behind a reverse proxy, [`operations.md`](operations.md)). A token from this node goes along, reading the member list only, for five minutes, enough for the map: where the browser has no diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index 3789bb1..c4e6276 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -353,7 +353,7 @@ drag to pan, wheel or pinch to zoom, turn with two fingers; drag a node to move it, middle-click it to pin it there or let it go, double-click it to subscribe to its links (or not), right-click it for its - dashboard + menu (subscribing, its dashboard) @@ -1516,7 +1516,12 @@ function renderGraph() { style: "fill-opacity: var(" + (shown ? "--halo-focused" : "--halo-hovered") + ")" })); } const pressed = element => { - element.addEventListener("pointerdown", event => { event.stopPropagation(); drag(event, id); }); + // The right button opens its menu: no drag, whose holding the pointer on the map + // would take the right-click from the node. + element.addEventListener("pointerdown", event => { + event.stopPropagation(); + if (event.button !== 2) drag(event, id); + }); element.addEventListener("contextmenu", event => { event.preventDefault(); nodeMenu(id, event.clientX, event.clientY); @@ -2771,7 +2776,9 @@ async function read(url, signal, opened, event) { } } } -// A node's menu (right-click): subscribing to its links, or no longer; its dashboard. +// A node's menu (right-click): subscribing to its links, or no longer; going to its +// dashboard, greyed where it publishes none (`--dashboard-url`), and on this node's own, +// which is here. function nodeMenu(id, x, y) { const menu = document.getElementById("node-menu"); const member = state.graph.members[id] || {}; @@ -2784,8 +2791,10 @@ function nodeMenu(id, x, y) { menu.replaceChildren( item(subscriptions.has(id) ? "unsubscribe" : "subscribe to its links", !member.self, () => toggleSubscription(id)), - item(member.dashboard ? "open its dashboard" : "no dashboard published", !member.self && !!member.dashboard, - () => openDashboard(id))); + item("go to its dashboard", !member.self && !!member.dashboard, () => openDashboard(id))); + const goto = menu.lastElementChild; + goto.title = member.self ? "this node's: here" : member.dashboard ? member.dashboard.split("#")[0] + : "it publishes no dashboard (--dashboard-url)"; menu.hidden = false; menu.style.left = Math.min(x, innerWidth - menu.offsetWidth - 8) + "px"; menu.style.top = Math.min(y, innerHeight - menu.offsetHeight - 8) + "px"; -- cgit v1.3.1