Repository navigation
fix(settings): 转发可指定/编辑主机;SSH config 主机可编辑;修正菜单锚定与连接池重指 - #175
Conversation
…menus
Three gaps made "my new host cannot carry a forward" unavoidable:
1. The add-forward form had no host field. `define` tagged whichever machine
happened to be connected, so a host that was not connected yet could never
be given a tunnel. The form now lists saved machines (current one marked
当前, default) and sends `machineId`; the route validates it against the
registry (unknown id = 404) and still defaults to the active machine when
the field is absent. Defining for a non-connected host is allowed — it
becomes startable once that host connects — while starting still refuses
to tunnel through the wrong connection.
2. An existing forward could only be deleted and re-added. Each row now has
编辑: the form is prefilled, 添加转发 becomes 保存修改 (+ 取消), and
`POST /forwards {action:'update'}` accepts a partial patch for direction,
ports, target and owning host. A LIVE tunnel keeps its old bind, so the
client stops it, patches the record and starts it again; the route also
refuses bind changes on an active forward (409) while still allowing the
自动重连 toggle. While editing, the picked row stays identifiable (tinted
row, left accent, 编辑中 badge), the form scrolls into view, and the
highlight clears on save/cancel.
3. A host added to ~/.ssh/config rendered as a probe-only row: only SAVED
machines had the `...` menu, so a new host had no edit entry and no place
to type its login password. The discovered row now exposes the same `...`
menu (编辑 opens the machine form prefilled as an alias: useSshConfig +
openssh backend, password field included). The entry no longer changes
shape after the first save.
The `...` menu also has to OPEN AT THE BUTTON. DSH 0.2.2-alpha.2 replaced the
old `getAnchorRect` prop with CSS anchors (`anchorRef` / `anchorPoint`), and a
menu given only the old rect is silently placed elsewhere — which is why the
编辑/删除 popup (and the explorer's right-click menu) appeared away from the
pointer. Both APIs are passed now (a host ignores the one it does not know),
the settings menu is right-aligned under its trigger and returns focus to it;
the explorer menu is pointer-anchored with `contextual` spacing.
Saving an EDITED machine now re-points the live pool. The settings save path
used to write the registry only; the pool keeps the target it was APPLIED with
and forwards.start()/rw_* dial through it, so after changing a machine's host
the page showed the new address while 启动 still connected to the old one
("ssh: connect to host <old>: Host is down"). A save of the CURRENT machine now
runs applyActiveMachine (setTarget keeps the live connection when no identity
field changed) and reports `poolWarning` if re-pointing fails; saving a standby
machine never hijacks the active connection.
Supporting changes: the machine editor is keyed on explicit `formOpen` state
(a new record has no id yet). A host half that predates these fields cannot be
trusted: the old `define` silently tags the active machine and the old
`update` stores only autoStart. The client compares what it asked for with
what came back, removes a mis-attached definition / restores the previous
forward, and asks for a restart instead of showing a silent success.
Tests: route tests for host validation, forward editing (including the 409
while running) and the pool re-point (RED without the fix: the pool stayed on
the old address), plus real-render UI tests for the host select, forward
editing/restart, the edited-row highlight, the discovered-host menu, menu
anchoring and both stale-host guards. READMEs updated (zh/en).
|
验证完成:1550 tests / 1527 pass / 0 fail / 23 skipped;CI 与 Agent native/PTC(0.2.0/0.2.1/0.2.2)、macOS、Windows 全绿。首次运行两个 native 失败在 对“菜单同时传新旧两套 anchor”做了独立核对:本机 0.2.1-rc.5 的宿主 Menu 只解构 服务端校验也确认到位: 新增 7 条 UI 用例带 24 处真实点击/输入,不是读 props 的假绿。 感谢 @Blz-Galaxy 把四个问题一次讲清楚,并且把“未连接主机也能先存转发”的边界也考虑进去了。 |
flymysql
left a comment
There was a problem hiding this comment.
服务端校验、运行中 bind 保护、连接池重指范围与兼容旧宿主的菜单锚定都已核对,测试为真实交互。approve.
这是什么
Fixes #174
修复转发无法指定主机、SSH config 新主机无法编辑设密码、「…」菜单不贴按钮、编辑当前机器后连接池仍连旧地址;并支持编辑已有转发。
改动
验证
新增 forwards-host-ui / forwards-lifecycle / machine-edit-pool 用例(池回归测试未修复时失败)。全量:1550 用例,1537 通过,0 失败,12 跳过,1 cancelled(既有 fake-ssh-host-key)。node check.mjs 通过;README 双语同步。