feat(web): the environments page is a map of your machines #39445
Mergedjuliusmarmingemerged 11 commits into
main fromrefs/pull/39445/headmerged by juliusmarminge View on GitHubtanstack-source added labelsfeature
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- @@ -0,0 +371,21 @@371+ CLIENT.width + SPINE_GAP / 2,372+ cardX,373+ centerOf(edge.to),374+ ),375+ arrow: null,376+ badge: null,377+ });378+ }379+380+ // Shorter spans take the inner lanes, so brackets nest instead of crossing.381+ const span = (link: FleetLinkEdge) => Math.abs(centerOf(link.to) - centerOf(link.from));382+ sameColumn383+ .toSorted((left, right) => span(left) - span(right) || (left.id < right.id ? -1 : 1))384+ .forEach((link, lane) => {385+ const laneX = cardRight + LANE_FIRST + lane * LANE_STEP;386+ const fromY = centerOf(link.from) - PORT_OFFSET;387+ const toY = centerOf(link.to) + PORT_OFFSET;388+ edges.set(link.id, {389+ d: elbowPath(cardRight, fromY, laneX, cardRight, toY),390+ arrow: { x: cardRight, y: toY, dir: -1 },391+ badge: { x: laneX, y: (fromY + toY) / 2 },@@ -0,0 +438,21 @@438+ }439+ return best?.id ?? null;440+}441+442+export interface FleetViewTransform {443+ readonly x: number;444+ readonly y: number;445+ readonly scale: number;446+}447+448+const FLEET_MIN_SCALE = 0.3;449+const FLEET_MAX_SCALE = 2;450+451+/** Centers the whole map in the viewport, shrinking to fit but never enlarging past 1:1. */452+export function fitFleetLayout(453+ layout: Pick<FleetLayout, "width" | "height">,454+ viewport: { readonly width: number; readonly height: number },455+ padding = 32,456+): FleetViewTransform {457+ const scale = Math.max(458+ FLEET_MIN_SCALE,@@ -0,0 +312,21 @@312+ left >= 0 &&313+ top >= 0 &&314+ left + rect.width * shown.scale <= size.width &&315+ top + rect.height * shown.scale <= size.height;316+ if (inside) return current;317+ return {318+ key: shapeKey,319+ view: {320+ scale: shown.scale,321+ x: size.width / 2 - (rect.x + rect.width / 2) * shown.scale,322+ y: size.height / 2 - (rect.y + rect.height / 2) * shown.scale,323+ },324+ };325+ });326+ };327+328+ const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {329+ if (event.button !== 0 || view === null) return;330+ if ((event.target as Element).closest("[data-fleet-item],[data-fleet-controls]")) return;331+ drag.current = { x: event.clientX, y: event.clientY, origin: view, moved: false };332+ event.currentTarget.setPointerCapture(event.pointerId);@@ -0,0 +322,21 @@322+ y: size.height / 2 - (rect.y + rect.height / 2) * shown.scale,323+ },324+ };325+ });326+ };327+328+ const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {329+ if (event.button !== 0 || view === null) return;330+ if ((event.target as Element).closest("[data-fleet-item],[data-fleet-controls]")) return;331+ drag.current = { x: event.clientX, y: event.clientY, origin: view, moved: false };332+ event.currentTarget.setPointerCapture(event.pointerId);333+ };334+ const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {335+ const current = drag.current;336+ if (current === null) return;337+ const dx = event.clientX - current.x;338+ const dy = event.clientY - current.y;339+ if (!current.moved && Math.hypot(dx, dy) < 4) return;340+ if (!current.moved) setDragging(true);341+ current.moved = true;342+ setView({ ...current.origin, x: current.origin.x + dx, y: current.origin.y + dy });@@ -0,0 +759,21 @@759+ environments,760+ selection,761+ onSelect,762+}: Omit<FleetSceneProps, "layout"> & { readonly hosts: ReadonlyArray<EnvironmentHost> }) {763+ const links = graph.edges.filter(isLinkEdge);764+ const node =765+ selection?.kind === "node" ? graph.nodes.find((entry) => entry.id === selection.id) : undefined;766+ const edge =767+ selection?.kind === "edge" ? links.find((entry) => entry.id === selection.id) : undefined;768+ const labelOf = (id: string) => graph.nodes.find((entry) => entry.id === id)?.label ?? "";769+ return (770+ <div className="min-h-36 px-3 py-3 text-xs sm:px-4">771+ {edge ? (772+ <LinkDetails773+ key={edge.id}774+ edge={edge}775+ sourceLabel={labelOf(edge.from)}776+ targetLabel={labelOf(edge.to)}777+ onSelect={onSelect}778+ />779+ ) : node ? (@@ -0,0 +772,21 @@772+ <LinkDetails773+ key={edge.id}774+ edge={edge}775+ sourceLabel={labelOf(edge.from)}776+ targetLabel={labelOf(edge.to)}777+ onSelect={onSelect}778+ />779+ ) : node ? (780+ <NodeDetails781+ node={node}782+ graph={graph}783+ links={links}784+ environments={environments}785+ canHostLinks={hosts.some(786+ (host) => fleetEnvironmentNodeId(host.environmentId) === node.id,787+ )}788+ onSelect={onSelect}789+ />790+ ) : links.length === 0 &&791+ !graph.nodes.some((n) => n.kind === "environment" && n.outgoing === "loading") ? (792+ <NoLinksYet hosts={hosts} />@@ -0,0 +896,21 @@896+ <div className="grid gap-x-8 gap-y-3 sm:grid-cols-3">897+ <ul className="space-y-1.5" aria-label={gt("Access a link grants")}>898+ {ACCESS_LEVELS.map((access) => (899+ <li key={access} className={row}>900+ <AccessMeter access={access} className="text-foreground/80" />901+ {m(accessConfig[access].label)}902+ </li>903+ ))}904+ </ul>905+ <ul className="space-y-1.5" aria-label={gt("How a link is doing")}>906+ <li className={row}>907+ <LineSample className="text-foreground/70" />908+ {gt("Reachable")}909+ </li>910+ <li className={row}>911+ <LineSample className="text-warning" />912+ {gt("Expires within days")}913+ </li>914+ <li className={row}>915+ <LineSample className="text-muted-foreground" dash="5 4" />916+ {gt("Not answering")}@@ -0,0 +1057,21 @@1057+ ? gt("Loading linked environments…")1058+ : null;1059+ return (1060+ <div>1061+ <InspectorHeading1062+ detail={1063+ node.kind === "target"1064+ ? gt("Known only through a link")1065+ : [1066+ node.machine ? m(ENVIRONMENT_MACHINE_KIND_LABELS[node.machine]) : null,1067+ environment ? connectionStatusTitle(environment.connection, m) : null,1068+ ]1069+ .filter((part) => part !== null)1070+ .join(", ")1071+ }1072+ >1073+ {node.label}1074+ </InspectorHeading>1075+ {note ? <p className="mb-2 max-w-xl text-muted-foreground">{note}</p> : null}1076+ <div className="grid gap-x-8 gap-y-3 sm:grid-cols-2">1077+ {node.kind === "environment" && node.outgoing === "loaded" ? (@@ -0,0 +25,21 @@25+ const roomForMap = useMediaQuery("md");26+ const [view, setView] = useState<LinkedEnvironmentsView>("list");27+ // The toggle moves between section headers with the view, so the pressed side takes focus back.28+ const [toggled, setToggled] = useState(false);29+ if (hosts.length === 0) return null;30+ const shown = roomForMap ? view : "list";31+ const viewToggle = roomForMap ? (32+ <ToggleGroup33+ aria-label={gt("Show linked environments as")}34+ value={[shown]}35+ onValueChange={(next) => {36+ const value = next[0];37+ if (value !== "list" && value !== "map") return;38+ setView(value);39+ setToggled(true);40+ }}41+ >42+ <Toggle value="list" autoFocus={toggled && shown === "list"}>43+ {gt("List", { $context: "view switch: show items as a list" })}44+ </Toggle>45+ <Toggle value="map" autoFocus={toggled && shown === "map"}>
Pushed266869c
- @@ -0,0 +446,21 @@446+ arrow: { x: cardRight, y: toY, dir: -1 },447+ badge: placeBadge(bracketX, (fromY + toY) / 2),448+ });449+ });450+451+ // A machine in one environment's bay that a second environment also links to.452+ for (const link of links) {453+ if (environmentIds.has(link.to) || inLane.has(link.id)) continue;454+ const target = nodes.get(link.to)!;455+ const fromY = centerOf(link.from) - PORT_OFFSET;456+ const toY = target.y + target.height / 2;457+ const endX = target.x - ARROW_LENGTH;458+ const reach = Math.max(40, (endX - cardRight) / 2);459+ edges.set(link.id, {460+ d: `M${cardRight} ${fromY}C${cardRight + reach} ${fromY} ${endX - reach} ${toY} ${endX} ${toY}`,461+ arrow: { x: target.x, y: toY, dir: 1 },462+ badge: placeBadge((cardRight + target.x) / 2, (fromY + toY) / 2),463+ });464+ }465+466+ return { nodes, edges, lanes, width, height };@@ -0,0 +551,21 @@551+ const focus = hover ?? selection;552+ const lit = focus === null ? null : fleetNeighborhood(graph, focus);553+ const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));554+ const environmentById = new Map(555+ environments.map((environment) => [556+ fleetEnvironmentNodeId(environment.environmentId),557+ environment,558+ ]),559+ );560+ const links = graph.edges.filter(isLinkEdge);561+ const tabStop = layout.nodes.has(roving) ? roving : FLEET_CLIENT_NODE_ID;562+ const isSelected = (kind: FleetFocus["kind"], id: string) =>563+ selection?.kind === kind && selection.id === id;564+ const fade = (dimmed: boolean) =>565+ cn(566+ "transition-opacity duration-150 motion-reduce:transition-none",567+ dimmed && "opacity-45 forced-colors:opacity-60",568+ );569+ const laneLit = (lane: FleetLane) =>570+ lit === null ||571+ (lit.nodes.has(lane.parentId) && lane.memberIds.some((id) => lit.nodes.has(id)));
Pushedc546559
- @@ -208,3 +213,4 @@208213209214 // Omit machines saved over other routes; onboarding selection must not add a T3 Connect route.210215 const isVisibleEnvironment = (environmentId: EnvironmentId) =>216+ (only === undefined || environmentId === only) &&@@ -119,4 +122,4 @@119122 return keys;120123 })();121124 const [savedBackendMode, setSavedBackendMode] = useState<"remote" | "ssh">("remote");122- const [savedBackendHost, setSavedBackendHost] = useState("");125+ const [savedBackendHost, setSavedBackendHost] = useState(initialHost);@@ -0,0 +400,21 @@400+ it("draws the same map whatever order links arrive in", () => {401+ const forward = build([environment("a", [...vms(7), link("x"), link("y")])]);402+ const backward = build([environment("a", [link("y"), link("x"), ...vms(7).toReversed()])]);403+ const lay = (graph: ReturnType<typeof build>) => {404+ const layout = layoutFleetGraph(graph, fleetStacks(graph, new Set()));405+ return [...layout.nodes].toSorted(([left], [right]) => (left < right ? -1 : 1));406+ };407+ expect(lay(backward)).toEqual(lay(forward));408+ });409+410+ it("gives a link between two drawn machines, or into another host's bay, an access badge", () => {411+ const graph = build([412+ environment("a", [link("b"), link("x")]),413+ environment("b", [link("a"), link("x")]),414+ ]);415+ const layout = layoutFleetGraph(graph);416+ const badge = (from: string, to: string) =>417+ layout.links.get(`link:${node(from)}>${node(to)}`)!.badge;418+ expect(badge("a", "x")).toBeNull();419+ // Many links into one bay step their badges down; the map must still contain them.420+ const shared = build([environment("a", vms(4)), environment("b", [...vms(4), link("a")])]);@@ -0,0 +773,21 @@773+ arrow: { x: target.x, y: toY, dir: 1 },774+ // Beside the target, clear of the brackets between environments.775+ badge: placeBadge(target.x - ARROW_LENGTH - BADGE.width, toY),776+ });777+ }778+779+ // A badge stepped below its neighbours can end up past the last machine.780+ const badgeBottom = Math.max(0, ...badges.map((badge) => badge.y + BADGE.height / 2));781+ return {782+ nodes,783+ stacks: stackGeometry,784+ routes,785+ links: linkGeometry,786+ handles,787+ columns: [788+ { id: "client", x: 0 },789+ ...(hosts.length > 0 ? [{ id: "environments" as const, x: cardX }] : []),790+ ...(bayOf.size > 0 ? [{ id: "targets" as const, x: bayX }] : []),791+ ],792+ width,793+ height: Math.max(height, badgeBottom),@@ -0,0 +865,21 @@865+}866+867+/** How tall the canvas wants to be at this width: the fitted map plus padding, within bounds. */868+export function fleetCanvasHeight(869+ layout: Pick<FleetLayout, "width" | "height">,870+ width: number,871+ bounds: { readonly min: number; readonly max: number },872+): number {873+ const scale = Math.min(FLEET_FIT_MAX_SCALE, fitScale(width, layout.width));874+ const wanted = Math.ceil(layout.height * scale + FLEET_FIT_PADDING * 2);875+ return Math.max(bounds.min, Math.min(bounds.max, wanted));876+}877+878+/** Zooms by `factor`, keeping the map point under `anchor` where it is. */879+export function zoomFleetView(880+ view: FleetViewTransform,881+ factor: number,882+ anchor: FleetPoint,883+): FleetViewTransform {884+ // A fit of a very large setup can sit below the manual minimum; zooming out must not jump up.885+ const floor = Math.min(FLEET_MIN_SCALE, view.scale);@@ -0,0 +175,21 @@175+ case "standby":176+ return gt("Standby", { $context: "a network route that is saved but not carrying traffic" });177+ case "trying":178+ return gt("Connecting");179+ case "down":180+ return gt("Not connected");181+ case "idle":182+ return gt("Not in use");183+ case "refused":184+ return gt("Sign-in refused");185+ case "offered":186+ return gt("Not added");187+ }188+}189+190+/** Asks T3 Connect for the account's machines once, as the list's own rows do on mount. */191+function useConnectMachines() {192+ const discovery = useAtomValue(relayEnvironmentDiscovery.stateValueAtom);193+ const refresh = useAtomCommand(relayEnvironmentDiscovery.refresh, { reportFailure: false });194+ const discoverIfUnasked = useEffectEvent(() => {195+ if (hasCloudPublicConfig() && !discovery.listed && !discovery.refreshing) void refresh();@@ -0,0 +401,21 @@401+ const [width, setWidth] = useState<number | null>(null);402+ // A view the user set by hand holds until the map's shape changes; otherwise it fits itself.403+ const [manual, setManual] = useState<{404+ readonly key: string;405+ readonly view: FleetViewTransform;406+ /** Set by the buttons and keys, whose jump is eased; a drag or pinch tracks the hand. */407+ readonly glide: boolean;408+ } | null>(null);409+ const [dragging, setDragging] = useState(false);410+ const drag = useRef<{411+ readonly pointerId: number;412+ readonly key: string;413+ readonly x: number;414+ readonly y: number;415+ readonly origin: FleetViewTransform;416+ moved: boolean;417+ } | null>(null);418+ // The canvas is as tall as the fitted map wants, so the height never feeds back into the fit.419+ const size =420+ width === null ? null : { width, height: fleetCanvasHeight(layout, width, CANVAS_HEIGHT) };421+ const held = manual?.key === shapeKey ? manual : null;@@ -0,0 +783,21 @@783+ const rect = next === null ? undefined : focusRects.get(next);784+ if (next === null || rect === undefined) return;785+ event.currentTarget786+ .querySelector<HTMLElement>(`[data-fleet-node="${CSS.escape(next)}"]`)787+ ?.focus({ preventScroll: true });788+ onReveal(rect);789+ };790+791+ const focusProps = (target: FleetFocus, rect: FleetRect, label: string) => ({792+ type: "button" as const,793+ "data-fleet-item": "",794+ "data-fleet-node": target.id,795+ "aria-label": label,796+ "aria-pressed": isSelected(target.kind, target.id),797+ tabIndex: target.id === tabStop ? 0 : -1,798+ style: { left: rect.x, top: rect.y, width: rect.width, height: rect.height },799+ onClick: () => onSelect(isSelected(target.kind, target.id) ? null : target),800+ onFocus: () => {801+ setRoving(target.id);802+ setHover(target);803+ },@@ -0,0 +834,21 @@834+ if (current === null || current.pointerId !== event.pointerId) return;835+ if (!current.moved && Math.hypot(event.clientX - current.x, event.clientY - current.y) < 4) {836+ return;837+ }838+ current.moved = true;839+ const point = toScene(event);840+ if (point === null) return;841+ const over = document842+ .elementFromPoint(event.clientX, event.clientY)843+ ?.closest<HTMLElement>("[data-fleet-node]")?.dataset.fleetNode;844+ const overId =845+ over !== undefined && fleetLinkOffer(graph, sourceId, over).kind === "link" ? over : null;846+ setLinkDrag({ sourceId, ...point, overId });847+ },848+ onPointerUp: (event: PointerEvent<HTMLButtonElement>) => {849+ const current = handleDrag.current;850+ if (current === null || current.pointerId !== event.pointerId) return;851+ handleDrag.current = null;852+ if (!current.moved) return;853+ swallowClick.current = true;854+ const overId = linkDrag?.overId ?? null;@@ -0,0 +202,21 @@202+ const machines = graph.nodes.length - 1;203+ const canLink = reading.some((entry) => entry.linking === "ready");204+ return (205+ <div className={SECTION}>206+ <Heading207+ detail={208+ !settled209+ ? gt("Loading links…")210+ : attention > 0211+ ? gt(212+ "{count, plural, one {# link needs attention.} other {# links need attention.}}",213+ { count: attention },214+ )215+ : null216+ }217+ >218+ {settled && readable219+ ? gt(220+ "{machines, plural, one {# machine} other {# machines}}, {links, plural, =0 {no links} one {# link} other {# links}}",221+ { machines, links: links.length },222+ )
Pushedf744337
- @@ -0,0 +741,21 @@741+ if (item.kind !== "target" || hostId !== null) continue;742+ item.incoming.forEach((link, index) => {743+ entryY.set(744+ link.id,745+ itemY + size.height / 2 + (index - (item.incoming.length - 1) / 2) * ENTRY_PITCH,746+ );747+ });748+ }749+ // Links between environments arrive above the centre from above and below it from below.750+ // The longest takes the entry nearest the centre, so two arriving together never cross.751+ const between = links.filter((link) => hostIndex.has(link.to));752+ const reach = (link: FleetLinkEdge) => Math.abs(indexOf(link.to) - indexOf(link.from));753+ for (const host of hosts) {754+ for (const side of [-1, 1]) {755+ const arriving = between756+ .filter(757+ (link) =>758+ link.to === host.id && Math.sign(indexOf(link.to) - indexOf(link.from)) === -side,759+ )760+ .toSorted((left, right) => reach(right) - reach(left) || (left.id < right.id ? -1 : 1));761+ const pitch = Math.min(HOST_ENTRY.pitch, HOST_ENTRY.reach / Math.max(1, arriving.length - 1));
Pushed9194a33
- @@ -1844,0 +1877,21 @@1877+ <EnvironmentsMap1878+ footerId={searchableSetting("linked-environments").id}1879+ onAddEnvironment={openAddEnvironment}1880+ renderSavedEnvironment={(environment) =>1881+ listedEnvironments.some(1882+ (listed) => listed.environmentId === environment.environmentId,1883+ ) ? (1884+ <SavedBackendListRow1885+ key={environment.environmentId}1886+ environment={environment}1887+ initialRoutesOpen1888+ removingEnvironmentId={removingSavedEnvironmentId}1889+ onSetEnabled={handleSetSavedBackendEnabled}1890+ onRemove={handleRemoveSavedBackend}1891+ onAddRoute={openAddRoute}1892+ />1893+ ) : null1894+ }1895+ renderConnectMachine={(environmentId) => (1896+ <CloudRemoteEnvironmentRows1897+ only={environmentId}@@ -0,0 +651,21 @@651+ target: { kind: "address", address: target.address },652+ };653+ }654+ return {655+ ...base,656+ path: target.kind === "environment" && target.mintable ? "code-less" : "pairing-code",657+ target: { kind: "machine", environmentId: target.environmentId },658+ };659+}660+661+/** Some of a stack's linked machines do not answer: its card grows a line to say how many do. */662+export const fleetStackPartial = (stack: FleetStack) =>663+ stack.kind === "targets" && stack.reachable < stack.memberIds.length;664+665+/** Changes exactly when the layout would: membership, labels, routes, wiring and open stacks. */666+export function fleetShapeKey(graph: FleetGraph, stacks: ReadonlyArray<FleetStack>): string {667+ return [668+ ...graph.nodes.map((node) => `${node.kind}\u0000${node.id}\u0000${node.label}`),669+ ...graph.edges.map((edge) =>670+ edge.kind === "link" ? `${edge.id}\u0000${edge.link.access}` : edge.id,671+ ),@@ -0,0 +1726,21 @@1726+ targetId: string | null,1727+): FleetLinkAction | null {1728+ const byId = new Map(graph.nodes.map((node) => [node.id, node]));1729+ const source = byId.get(sourceId);1730+ if (source?.kind !== "environment" || source.linking !== "ready") return null;1731+ const sourceEnvironmentId = source.environmentId;1732+ const batch = (picked: Iterable<string>): FleetLinkAction | null => {1733+ const environmentIds = new Set<EnvironmentId>();1734+ const machineIds: string[] = [];1735+ let known = false;1736+ for (const id of picked) {1737+ const node = byId.get(id);1738+ if (node === undefined || node.kind === "client" || node.id === source.id) continue;1739+ if (!environmentIds.has(node.environmentId)) machineIds.push(node.id);1740+ environmentIds.add(node.environmentId);1741+ known ||= node.kind !== "target";1742+ }1743+ if (environmentIds.size === 0) return null;1744+ // One such machine is the single flow's, which asks for its code.1745+ return known || machineIds.length < 21746+ ? { kind: "batch", sourceEnvironmentId, environmentIds: [...environmentIds] }@@ -0,0 +1905,21 @@1905+ const { size } = from;1906+ if (from.held?.undo?.key === input.key) {1907+ const { held } = from.held.undo;1908+ // With no view held before, a stale entry eases the scene back to the fit.1909+ return held === null1910+ ? { key: "", view: from.view, height: size.height, glide: true, undo: null }1911+ : { ...held, glide: true };1912+ }1913+ const padding = fleetFitPadding(size.width);1914+ const top = from.face.y * from.view.scale + from.view.y;1915+ const scale = Math.min(from.view.scale, fitScale(size.width, stack.rect.width, padding));1916+ const view =1917+ scale < from.view.scale1918+ ? { scale, x: padding - stack.face.x * scale, y: top - stack.face.y * scale }1919+ : {1920+ scale,1921+ x: from.view.x + (from.face.x - stack.face.x) * scale,1922+ y: from.view.y + (from.face.y - stack.face.y) * scale,1923+ };1924+ const wanted = Math.ceil(view.y + layout.height * scale + padding);1925+ const opened = stack.rect.height > stack.face.height;@@ -0,0 +831,21 @@831+ const endDrag = (event: PointerEvent<HTMLDivElement>, cancelled: boolean) => {832+ const current = drag.current;833+ if (current === null || current.pointerId !== event.pointerId) return;834+ drag.current = null;835+ setDragging(false);836+ setBox(null);837+ if (cancelled) return;838+ if (!current.moved) {839+ if (current.mode === "pan") onSelect(null);840+ return;841+ }842+ if (current.mode !== "box" || current.key !== layoutKey) return;843+ const drawn = boxAt(current, event);844+ const { origin } = current;845+ onTick(846+ fleetNodesInBox(layout, {847+ x: (drawn.x - origin.x) / origin.scale,848+ y: (drawn.y - origin.y) / origin.scale,849+ width: drawn.width / origin.scale,850+ height: drawn.height / origin.scale,851+ }),@@ -0,0 +1009,21 @@1009+ backgroundPosition: `${view.x}px ${view.y}px`,1010+ }1011+ }1012+ onPointerDown={onPointerDown}1013+ onPointerMove={onPointerMove}1014+ onPointerUp={(event) => endDrag(event, false)}1015+ onPointerCancel={(event) => endDrag(event, true)}1016+ onLostPointerCapture={(event) => endDrag(event, true)}1017+ onKeyDown={onKeyDown}1018+ >1019+ {view === null ? null : (1020+ <div1021+ data-fleet-scene1022+ className="absolute top-0 left-0 origin-top-left in-data-dragging:will-change-transform in-data-glide:transition-transform in-data-glide:duration-200 in-data-glide:ease-out motion-reduce:transition-none"1023+ style={{1024+ width: layout.width,1025+ height: layout.height,1026+ transform: `translate(${view.x}px, ${view.y}px) scale(${view.scale})`,1027+ }}1028+ >1029+ <FleetScene {...scene} layout={layout} matches={matches} onReveal={reveal} />
Sign in to join this conversation.





Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
Walkthrough
The Connections settings page adds a responsive map and list view for environments. The map displays routes and links and supports navigation, selection, and link actions. Single and batch linking flows can optionally create reverse links. Translation catalogs and remote-access documentation are updated.
Changes: Environment map and linking
apps/web/src/components/settings/environmentsMap.logic.ts,apps/web/src/components/settings/environmentsMap.logic.test.tsapps/web/src/components/settings/EnvironmentsMap.tsx,apps/web/src/components/settings/EnvironmentsMapDetails.tsx,apps/web/src/state/peerLinks.ts,apps/web/src/state/session.ts,apps/web/src/state/environments.ts,packages/client-runtime/src/linkRequest.tspackages/client-runtime/src/linkBatch.ts,packages/client-runtime/src/linkBatch.test.ts,apps/web/src/components/settings/LinkedEnvironmentsSettings.tsx,apps/web/src/components/settings/LinkSeveralEnvironments.tsxapps/web/src/components/settings/ConnectionsSettings.tsx,apps/web/src/components/settings/AddEnvironmentDialog.tsx,apps/web/src/components/settings/SavedEnvironmentRows.tsx,apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx,apps/web/src/state/environments.tspackages/client-runtime/src/connection/routes.ts,packages/client-runtime/src/connection/routes.test.ts,apps/web/src/i18n/translations/*.json,apps/mobile/src/i18n/translations/*.json,docs/user/remote-access.mdEstimated code review effort: 4 (Complex) | ~60 minutes
Change: Feature
Sequence Diagram(s)#
Possibly related issues
Suggested reviewers:
maria-rcksMerge Risk:
Low · previous review
be5baThe environments map and reciprocal linking work as intended in the main flows. A few edge cases remain: link-back could replace a working reverse link created at the same moment, some map and keyboard interactions are rough, and the guide omits one prerequisite for code-free linking. These are worth tidying but do not block merging.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: the Environments settings page becomes a map of machines. The changeset adds an EnvironmentsMap view with a Map/List toggle, which matches the title. The title uses the conventional commit format with a clear scope. It is short and specific.
Full details: Description check
Explanation
The description follows the template sections (Problem, Change, Scope, Verification) with substantive content in each. It explains the problem, the map view and its link behavior, the scope as maintainer-requested feature work, and the tests and checks run. It also lists exclusions and unverified areas. The template asks for a bug fix. This PR is a feature, and the Scope section says so and links the related beta PRs. The Verification section gives specific tests and states what was not checked. The description is long and dense, and the template asks for before/after screenshots for UI changes. The author supplied captures, though they predate later changes and the author notes this. The description is mostly complete, so it passes.
Finishing Touches
Generate unit tests (beta)