diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index 40feda87f..9f25783d0 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -1569,6 +1569,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.refs.trackingSet": "{branch} now tracks {upstream}", "desktop.refs.trackingStopped": "{branch} no longer tracks a remote branch", "desktop.remote.advanced": "Advanced", + "desktop.remote.advancedSummary": "Connect timeout {timeout} · Keep-alive {keepAlive}", "desktop.remote.auth.agent": "SSH agent", "desktop.remote.auth.auto": "Auto", "desktop.remote.auth.password": "Password", @@ -1577,25 +1578,29 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.authenticationHelp": "Auto: as your SSH config and ssh-agent decide. SSH agent: only keys held by ssh-agent. Private key: only the key file you choose; its passphrase is asked when connecting. Password: asked when connecting. Lithe never saves an answer.", "desktop.remote.auto": "Automatic ({value})", "desktop.remote.browse.anchorUnusable": "Cannot prepare the local folder that stands for remote workspaces: {path}", - "desktop.remote.browse.back": "Back", - "desktop.remote.browse.connected": "Connected to {name}", + "desktop.remote.browse.back": "Choose Later", + "desktop.remote.browse.connected": "Connected", "desktop.remote.browse.denied": "The host account is not allowed to open this folder.", - "desktop.remote.browse.empty": "This folder has no subfolders.", + "desktop.remote.browse.disconnect": "Disconnect", + "desktop.remote.browse.empty": "This folder is empty.", + "desktop.remote.browse.enterHint": "Double-click to open", "desktop.remote.browse.folders": "Folders", + "desktop.remote.browse.git": "Git", + "desktop.remote.browse.go": "Go", + "desktop.remote.browse.home": "~ Home", "desktop.remote.browse.lost": "The connection to the host closed. Connect again to choose a folder.", "desktop.remote.browse.notFound": "The folder does not exist on the host.", - "desktop.remote.browse.open": "Open", + "desktop.remote.browse.open": "Open {name}", "desktop.remote.browse.openFailed": "Cannot open the folder: {reason}", "desktop.remote.browse.opening": "Opening…", "desktop.remote.browse.path": "Folder path", "desktop.remote.browse.pathInvalid": "Enter an absolute path of the host, such as /home/user/project or ~/project.", "desktop.remote.browse.pathPlaceholder": "/home/user/project or ~/project", "desktop.remote.browse.readFailed": "Cannot list the folder: {reason}", - "desktop.remote.browse.recent": "Recent Folders", - "desktop.remote.browse.refresh": "Refresh", + "desktop.remote.browse.shortcuts": "Frequent", "desktop.remote.browse.skipped": "Entries not listed because they could not be read: {count}", - "desktop.remote.browse.target": "Opens {path}", - "desktop.remote.browse.up": "Parent Folder", + "desktop.remote.browse.title": "Choose a Folder on {name}", + "desktop.remote.browse.up": "Parent folder", "desktop.remote.cancel": "Cancel", "desktop.remote.choose": "Choose File…", "desktop.remote.chooseFailed": "Cannot open the file picker: {reason}", @@ -1685,31 +1690,58 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.import": "Import", "desktop.remote.import.apply": "Import", "desktop.remote.import.applying": "Importing…", + "desktop.remote.import.column.alias": "Host Alias", + "desktop.remote.import.column.group": "Group", + "desktop.remote.import.column.host": "Host", + "desktop.remote.import.column.resolved": "Effective Value (ssh -G)", + "desktop.remote.import.column.result": "Result", "desktop.remote.import.count": "{count} host(s) to import", + "desktop.remote.import.details": "Show Settings", "desktop.remote.import.done": "Imported {count} host(s)", "desktop.remote.import.empty": "No hosts found here.", "desktop.remote.import.failed": "Could not import: {reason}", - "desktop.remote.import.footer": "{count} chosen", - "desktop.remote.import.from": "From {path}", + "desktop.remote.import.field.authentication": "Sign-in method", + "desktop.remote.import.field.imported": "✓ Imported", + "desktop.remote.import.field.skipped": "Not imported", + "desktop.remote.import.fill": "Color, group only", + "desktop.remote.import.footer": "Imports {count} host(s)", + "desktop.remote.import.footerGroups": "Imports {count} host(s) and creates {groupCount} group(s) ({groups})", + "desktop.remote.import.jumpFor": "ProxyJump of {hosts}", "desktop.remote.import.keepColors": "Keep colors", "desktop.remote.import.keepGroups": "Keep groups", "desktop.remote.import.motty": "From Motty…", + "desktop.remote.import.mottyFound": "Found {hosts} host(s), {groups} group(s) · data format {format}", + "desktop.remote.import.mottyHelp": "Reads {path}. Motty's vault is never opened, so no password or key is read; nothing is written to Motty's files.", "desktop.remote.import.mottyMissing": "Motty's configuration was not found on this computer.", + "desktop.remote.import.mottyNote": "Read only; Motty's data is not changed", "desktop.remote.import.mottyTooLarge": "Motty's configuration is too large to read.", "desktop.remote.import.mottyUnreadable": "Motty's configuration could not be read.", "desktop.remote.import.mottyUnsupported": "This version of Motty's configuration is not supported.", "desktop.remote.import.none": "No hosts found", + "desktop.remote.import.patternNote": "Wildcard, not a single host", + "desktop.remote.import.reload": "Read Again", + "desktop.remote.import.skip.command": "The jump route runs a command", + "desktop.remote.import.skip.extraKey": "Only the first key file is imported", + "desktop.remote.import.skip.invalid": "Lithe does not accept this value", + "desktop.remote.import.skip.kerberos": "Left to the SSH configuration", + "desktop.remote.import.skip.noSetting": "Lithe has no such setting", + "desktop.remote.import.skip.protocol": "Not an SSH setting", + "desktop.remote.import.skip.secret": "In Motty's vault, which is never read", "desktop.remote.import.source.motty": "Motty", - "desktop.remote.import.source.ssh": "~/.ssh/config", + "desktop.remote.import.source.ssh": "SSH Config", "desktop.remote.import.ssh": "From ~/.ssh/config…", + "desktop.remote.import.sshHelp": "Reads {files}. The effective value is what `ssh -G` resolves each alias to; the import saves the alias, so OpenSSH keeps resolving it.", + "desktop.remote.import.sshNote": "Reads ~/.ssh/config (with Include), read only", "desktop.remote.import.status.exists": "Already saved", + "desktop.remote.import.status.existsAs": "Already saved ({name})", "desktop.remote.import.status.importable": "Ready", "desktop.remote.import.status.invalid": "Invalid", "desktop.remote.import.status.partial": "Partial", - "desktop.remote.import.status.pattern": "Pattern", + "desktop.remote.import.status.pattern": "Skipped · Pattern", "desktop.remote.import.status.unreadable": "Unreadable", "desktop.remote.import.status.unsupported": "Not SSH", - "desktop.remote.import.title": "Import Hosts", + "desktop.remote.import.titleMotty": "Import from Motty", + "desktop.remote.import.titleSsh": "Import from SSH Config", "desktop.remote.keepAlive": "Keep-Alive (s)", "desktop.remote.keepAliveHelp": "How often OpenSSH checks that the server still answers (ServerAliveInterval), so a dropped network is noticed.", "desktop.remote.keepAlivePlaceholder": "Auto (SSH config)", @@ -1734,13 +1766,20 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.probe.diskSpace": "{available} free of {total}", "desktop.remote.probe.error": "Cannot test the connection: {reason}", "desktop.remote.probe.failed": "The connection failed.", + "desktop.remote.probe.hideOutput": "Hide", + "desktop.remote.probe.hint.authentication": "Check the user name; the password method asks when connecting. If the server only allows keys, set Authentication to “{method}”.", + "desktop.remote.probe.hint.hostKey": "Connecting shows the host’s fingerprint for you to confirm. If it changed, check with the host’s administrator before updating known_hosts.", + "desktop.remote.probe.hint.unreachable": "Check the host and the port. If the host can only be reached through another one, add that one as a jump host.", "desktop.remote.probe.hostKeyRejected": "The host key was not accepted: it was declined, or it differs from the one in known_hosts.", "desktop.remote.probe.hostName": "Host name", + "desktop.remote.probe.hostNameTag": "Host {name}", "desktop.remote.probe.memory": "Memory", + "desktop.remote.probe.memoryTag": "Memory {size}", "desktop.remote.probe.noSSH": "No ssh client found. Install the OpenSSH client first.", "desktop.remote.probe.os": "System", "desktop.remote.probe.unreachable": "Cannot reach the host: check the host, the port and the network.", "desktop.remote.probe.unsupported": "Connected to {system} {machine}, but Lithe’s remote server does not run there yet: only x86_64 and arm64 Linux are supported.", + "desktop.remote.probe.usable": ". This host can be used for remote development.", "desktop.remote.proxyJump": "Proxy Jump", "desktop.remote.proxyJumpHelp": "Hosts to connect through first, as OpenSSH ProxyJump: [user@]host[:port], several separated by commas.", "desktop.remote.proxyJumpPlaceholder": "None (or SSH config)", @@ -1805,12 +1844,15 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.title": "Remote Development", "desktop.remote.titleWith": "Remote Development › {crumb}", "desktop.remote.trust.back": "Back", - "desktop.remote.trust.body": "Do you trust the authors of {folder} on {name}? A trusted folder can run its own code, such as tasks and build tool wrappers.", + "desktop.remote.trust.body": "Once trusted, Lithe runs the folder's build scripts, language servers, Git hooks and debug adapters on the host. Trust it only if you trust that code. Trusting a local folder does not carry over to the host, and other folders on the same host are trusted separately.", + "desktop.remote.trust.choice": "{choice}: ", "desktop.remote.trust.failed": "Could not save the decision: {reason}", + "desktop.remote.trust.full": "everything works.", + "desktop.remote.trust.local": "Trust decisions are kept on this computer only", "desktop.remote.trust.parent": "Trust all folders in {parent}", - "desktop.remote.trust.safe": "In safe mode the folder is only read: nothing in it runs until you trust it.", + "desktop.remote.trust.safe": "browse and edit files; builds, language servers, Git and debugging do not start.", "desktop.remote.trust.safeOpen": "Open in Safe Mode", - "desktop.remote.trust.title": "Trust this folder?", + "desktop.remote.trust.title": "Trust This Remote Folder?", "desktop.remote.trust.trustOpen": "Trust and Open", "desktop.remote.unavailable": "There is no preference folder to keep connections in.", "desktop.remote.ungrouped": "Ungrouped", @@ -5155,6 +5197,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.refs.trackingSet": "{branch} 现在跟踪 {upstream}", "desktop.refs.trackingStopped": "{branch} 不再跟踪远程分支", "desktop.remote.advanced": "高级", + "desktop.remote.advancedSummary": "连接超时 {timeout} · 保活间隔 {keepAlive}", "desktop.remote.auth.agent": "SSH Agent", "desktop.remote.auth.auto": "自动", "desktop.remote.auth.password": "密码", @@ -5163,25 +5206,29 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.authenticationHelp": "自动:按 SSH 配置和 ssh-agent 决定。SSH Agent:只用 ssh-agent 里的密钥。私钥文件:只用选定的私钥,口令在连接时询问。密码:在连接时询问。Lithe 不保存任何回答。", "desktop.remote.auto": "自动({value})", "desktop.remote.browse.anchorUnusable": "无法准备代表远程工作区的本地文件夹:{path}", - "desktop.remote.browse.back": "返回", - "desktop.remote.browse.connected": "已连接到 {name}", + "desktop.remote.browse.back": "稍后再选", + "desktop.remote.browse.connected": "已连接", "desktop.remote.browse.denied": "主机账户无权打开此文件夹。", - "desktop.remote.browse.empty": "此文件夹没有子文件夹。", + "desktop.remote.browse.disconnect": "断开", + "desktop.remote.browse.empty": "此文件夹是空的。", + "desktop.remote.browse.enterHint": "双击进入", "desktop.remote.browse.folders": "文件夹", + "desktop.remote.browse.git": "Git", + "desktop.remote.browse.go": "前往", + "desktop.remote.browse.home": "~ 主目录", "desktop.remote.browse.lost": "与主机的连接已断开。请重新连接后再选择文件夹。", "desktop.remote.browse.notFound": "主机上不存在此文件夹。", - "desktop.remote.browse.open": "打开", + "desktop.remote.browse.open": "打开 {name}", "desktop.remote.browse.openFailed": "无法打开文件夹:{reason}", "desktop.remote.browse.opening": "正在打开…", "desktop.remote.browse.path": "文件夹路径", "desktop.remote.browse.pathInvalid": "请输入主机上的绝对路径,例如 /home/user/project 或 ~/project。", "desktop.remote.browse.pathPlaceholder": "/home/user/project 或 ~/project", "desktop.remote.browse.readFailed": "无法列出文件夹:{reason}", - "desktop.remote.browse.recent": "最近的文件夹", - "desktop.remote.browse.refresh": "刷新", + "desktop.remote.browse.shortcuts": "常用", "desktop.remote.browse.skipped": "有 {count} 个条目无法读取,未列出。", - "desktop.remote.browse.target": "将打开 {path}", - "desktop.remote.browse.up": "上级文件夹", + "desktop.remote.browse.title": "选择 {name} 上的文件夹", + "desktop.remote.browse.up": "上一级", "desktop.remote.cancel": "取消", "desktop.remote.choose": "选择文件…", "desktop.remote.chooseFailed": "无法打开文件选择器:{reason}", @@ -5271,31 +5318,58 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.import": "导入", "desktop.remote.import.apply": "导入", "desktop.remote.import.applying": "正在导入…", + "desktop.remote.import.column.alias": "Host 别名", + "desktop.remote.import.column.group": "分组", + "desktop.remote.import.column.host": "主机", + "desktop.remote.import.column.resolved": "生效值(ssh -G)", + "desktop.remote.import.column.result": "结果", "desktop.remote.import.count": "可导入 {count} 台主机", + "desktop.remote.import.details": "显示设置项", "desktop.remote.import.done": "已导入 {count} 台主机", "desktop.remote.import.empty": "这里没有主机。", "desktop.remote.import.failed": "无法导入:{reason}", - "desktop.remote.import.footer": "已选择 {count} 台", - "desktop.remote.import.from": "来自 {path}", + "desktop.remote.import.field.authentication": "身份验证方式", + "desktop.remote.import.field.imported": "✓ 导入", + "desktop.remote.import.field.skipped": "不导入", + "desktop.remote.import.fill": "只补颜色和分组", + "desktop.remote.import.footer": "将导入 {count} 个连接", + "desktop.remote.import.footerGroups": "将导入 {count} 个连接、新建 {groupCount} 个分组({groups})", + "desktop.remote.import.jumpFor": "作为 {hosts} 的 ProxyJump", "desktop.remote.import.keepColors": "保留颜色", "desktop.remote.import.keepGroups": "保留分组", "desktop.remote.import.motty": "从 Motty 导入…", + "desktop.remote.import.mottyFound": "找到 {hosts} 台主机、{groups} 个分组 · 数据格式 {format}", + "desktop.remote.import.mottyHelp": "读取 {path}。不会打开 Motty 的密钥库,因此不读取任何密码或密钥;也不会写入 Motty 的文件。", "desktop.remote.import.mottyMissing": "在本机没有找到 Motty 的配置。", + "desktop.remote.import.mottyNote": "只读读取,不修改 Motty 的数据", "desktop.remote.import.mottyTooLarge": "Motty 的配置过大,无法读取。", "desktop.remote.import.mottyUnreadable": "无法读取 Motty 的配置。", "desktop.remote.import.mottyUnsupported": "不支持这个版本的 Motty 配置。", "desktop.remote.import.none": "没有找到主机", + "desktop.remote.import.patternNote": "通配符,不是具体主机", + "desktop.remote.import.reload": "重新读取", + "desktop.remote.import.skip.command": "跳板路由会运行命令", + "desktop.remote.import.skip.extraKey": "只导入第一个密钥文件", + "desktop.remote.import.skip.invalid": "Lithe 不接受这个值", + "desktop.remote.import.skip.kerberos": "交给 SSH 配置处理", + "desktop.remote.import.skip.noSetting": "Lithe 没有对应设置", + "desktop.remote.import.skip.protocol": "不是 SSH 的设置", + "desktop.remote.import.skip.secret": "在 Motty 的密钥库里,不会读取", "desktop.remote.import.source.motty": "Motty", - "desktop.remote.import.source.ssh": "~/.ssh/config", + "desktop.remote.import.source.ssh": "SSH 配置", "desktop.remote.import.ssh": "从 ~/.ssh/config 导入…", + "desktop.remote.import.sshHelp": "读取 {files}。生效值是 `ssh -G` 对每个别名解析出的结果;导入保存的是别名,之后仍由 OpenSSH 解析。", + "desktop.remote.import.sshNote": "读取 ~/.ssh/config(含 Include),只读", "desktop.remote.import.status.exists": "已存在", + "desktop.remote.import.status.existsAs": "已存在({name})", "desktop.remote.import.status.importable": "可导入", "desktop.remote.import.status.invalid": "无效", "desktop.remote.import.status.partial": "部分导入", - "desktop.remote.import.status.pattern": "通配规则", + "desktop.remote.import.status.pattern": "跳过 · 通配符", "desktop.remote.import.status.unreadable": "无法读取", "desktop.remote.import.status.unsupported": "非 SSH", - "desktop.remote.import.title": "导入主机", + "desktop.remote.import.titleMotty": "从 Motty 导入", + "desktop.remote.import.titleSsh": "从 SSH 配置导入", "desktop.remote.keepAlive": "保活间隔(秒)", "desktop.remote.keepAliveHelp": "OpenSSH 每隔多久确认一次服务器仍有响应(ServerAliveInterval),以便发现网络已断开。", "desktop.remote.keepAlivePlaceholder": "自动(SSH 配置)", @@ -5320,13 +5394,20 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.probe.diskSpace": "可用 {available},共 {total}", "desktop.remote.probe.error": "无法测试连接:{reason}", "desktop.remote.probe.failed": "连接失败。", + "desktop.remote.probe.hideOutput": "收起", + "desktop.remote.probe.hint.authentication": "检查用户名是否正确;密码方式会在连接时询问。若服务器只允许密钥,把身份验证改成“{method}”。", + "desktop.remote.probe.hint.hostKey": "连接时会显示主机指纹请你确认;如果指纹变了,先向主机管理员核实,再更新 known_hosts。", + "desktop.remote.probe.hint.unreachable": "检查主机和端口;如果只能经另一台主机访问,把它加为跳板机。", "desktop.remote.probe.hostKeyRejected": "主机密钥没有通过验证:你拒绝了它,或者它与 known_hosts 里记录的不一致。", "desktop.remote.probe.hostName": "主机名", + "desktop.remote.probe.hostNameTag": "主机名 {name}", "desktop.remote.probe.memory": "内存", + "desktop.remote.probe.memoryTag": "内存 {size}", "desktop.remote.probe.noSSH": "找不到 ssh 客户端,请先安装 OpenSSH 客户端。", "desktop.remote.probe.os": "系统", "desktop.remote.probe.unreachable": "无法连接到主机:请检查主机、端口和网络。", "desktop.remote.probe.unsupported": "已连接到 {system} {machine},但 Lithe 远程服务目前不支持该平台:只支持 x86_64 和 arm64 的 Linux。", + "desktop.remote.probe.usable": ",这台主机可以用于远程开发。", "desktop.remote.proxyJump": "跳板机", "desktop.remote.proxyJumpHelp": "先经过这些主机再连接,等同 OpenSSH 的 ProxyJump:[用户@]主机[:端口],多个用逗号分隔。", "desktop.remote.proxyJumpPlaceholder": "无(或按 SSH 配置)", @@ -5391,12 +5472,15 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.remote.title": "远程开发", "desktop.remote.titleWith": "远程开发 › {crumb}", "desktop.remote.trust.back": "返回", - "desktop.remote.trust.body": "你信任 {name} 上 {folder} 的作者吗?受信任的文件夹可以运行其中的代码,例如任务和构建工具包装脚本。", + "desktop.remote.trust.body": "信任后,Lithe 会在远端运行这个文件夹里的构建脚本、语言服务器、Git 钩子和调试适配器。只在你相信这些代码时才信任。本机文件夹的信任不会带到远端;同一主机的其他文件夹需要单独信任。", + "desktop.remote.trust.choice": "{choice}:", "desktop.remote.trust.failed": "无法保存决定:{reason}", + "desktop.remote.trust.full": "完整功能。", + "desktop.remote.trust.local": "信任记录只保存在本机", "desktop.remote.trust.parent": "信任 {parent} 下的所有文件夹", - "desktop.remote.trust.safe": "在安全模式下只读取文件夹,信任之前不会运行其中的任何代码。", + "desktop.remote.trust.safe": "可以浏览和编辑文件;不启动构建、语言服务器、Git 和调试。", "desktop.remote.trust.safeOpen": "以安全模式打开", - "desktop.remote.trust.title": "信任此文件夹吗?", + "desktop.remote.trust.title": "信任这个远程文件夹吗?", "desktop.remote.trust.trustOpen": "信任并打开", "desktop.remote.unavailable": "没有可以保存连接的偏好设置目录。", "desktop.remote.ungrouped": "未分组", diff --git a/desktop/internal/workbench/remote.go b/desktop/internal/workbench/remote.go index 6bd28e112..85cb1a687 100644 --- a/desktop/internal/workbench/remote.go +++ b/desktop/internal/workbench/remote.go @@ -174,7 +174,6 @@ func (a *App) openRemote(surface actionSurface) { r.form.clear() a.performed("remote.connections.open", surface) a.loadRemote(remoteLoadSelectFirst, "") - a.loadRemoteImportCounts() } // closeRemote closes the window, stopping a running test or connection and ending the session a @@ -220,6 +219,9 @@ func (a *App) loadRemote(how remoteLoad, id string) { if err != nil { a.operationFailed("remote_connections_read", documentLogError(err)) r.readErr = remoteReadFailure(a.language(), source, err) + } else { + // The counts leave out the hosts already saved, so they follow every reread. + a.loadRemoteImportCounts() } switch how { case remoteLoadKeepForm: @@ -337,6 +339,9 @@ func (r *remoteState) editingForm() bool { // newRemote starts a new connection; Cancel goes back to the one selected before. func (a *App) newRemote() { r := &a.remote + if !a.leaveRemoteFlows() { + return + } a.performed("remote.connection.new", surfaceButton) if r.selected != "" { r.previous = r.selected @@ -637,6 +642,7 @@ func (a *App) editRemote(site string, edit core.RemoteConnectionEdit) { } r.loaded = true r.setSource(after) + a.loadRemoteImportCounts() if edit.Remove != nil { r.selectFirst() return diff --git a/desktop/internal/workbench/remote_browse.go b/desktop/internal/workbench/remote_browse.go index adbd7afd4..48380b8c6 100644 --- a/desktop/internal/workbench/remote_browse.go +++ b/desktop/internal/workbench/remote_browse.go @@ -8,6 +8,7 @@ import ( "slices" "strconv" "strings" + "sync" "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" @@ -34,17 +35,21 @@ type remoteBrowser struct { name string connection core.SSHConnection // recent are the connection's recent folders, latest first. - recent []string - recentList ui.ListState + recent []string // path is what the path field holds. dir is the folder listed last, or tried last when it - // could not be listed; folders are its subfolders' names, links to folders among them. + // could not be listed; folders are its subfolders' names, links to folders among them, and + // files the names of its other entries, shown greyed. path ui.Field dir string folders []string + files []string // skipped counts the entries whose names the host could not send. skipped uint32 - list ui.ListState - loading bool + // repositories are the folders among folders holding a .git entry, found after the listing + // shows; the list tags them Git. + repositories map[string]bool + list ui.ListState + loading bool // listing counts the listings, so that only the latest applies. listing uint64 // readErr is why dir could not be listed; err why the folder could not be opened. @@ -175,6 +180,20 @@ func (a *App) leaveRemoteBrowser() { } } +// leaveRemoteFlows ends the folder, trust or import page the window shows, so the list beside it +// can show another connection. It reports false, leaving them, while one of them is opening a +// folder or saving an import. +func (a *App) leaveRemoteFlows() bool { + r := &a.remote + if (r.trust != nil && r.trust.deciding) || (r.browser != nil && r.browser.opening) || (r.importer != nil && r.importer.applying) { + return false + } + r.trust = nil + r.importer = nil + a.leaveRemoteBrowser() + return true +} + // backFromRemoteBrowser is Back: the session ends and the form shows again. func (a *App) backFromRemoteBrowser() { if a.remote.browser == nil { @@ -203,7 +222,7 @@ func (a *App) listRemoteFolder(dir string) { // log-exempt: 用户取消:已换了文件夹、返回或关闭窗口,不再应用列出结果。 return } - b.loading, b.folders, b.skipped, b.list = false, nil, 0, ui.ListState{} + b.loading, b.folders, b.files, b.skipped, b.repositories, b.list = false, nil, nil, 0, nil, ui.ListState{} if err != nil { a.operationFailed("remote_read_dir", remoteLogError(err)) if remoteConnectionClosed(err) { @@ -215,20 +234,69 @@ func (a *App) listRemoteFolder(dir string) { b.readErr = remoteReadDirFailureText(a.language(), err) return } - b.folders, b.skipped = remoteFolders(directory), directory.SkippedNonUTF8 + b.folders, b.files, b.skipped = remoteEntryNames(directory, true), remoteEntryNames(directory, false), directory.SkippedNonUTF8 + a.markRemoteRepositories(b) + } + }) +} + +// remoteRepositoryChecks bounds how many of a folder's subfolders are looked into for .git, and +// remoteRepositoryParallel how many of those looks run at once over the session. +const ( + remoteRepositoryChecks = 64 + remoteRepositoryParallel = 8 +) + +// markRemoteRepositories looks for a .git entry, a folder or a worktree's file, in the first +// subfolders of the folder b lists, so the list can tag Git repositories once the names show. +// A subfolder whose .git cannot be read stays untagged: the tag is a hint, and the listing +// already reports a lost session. +func (a *App) markRemoteRepositories(b *remoteBrowser) { + names := slices.Clone(b.folders[:min(len(b.folders), remoteRepositoryChecks)]) + if len(names) == 0 { + return + } + listing, generation, kernel, session, dir := b.listing, a.remote.generation, a.kernel, b.session.ID, b.dir + a.background(nil, remoteReadDirTimeout, func(ctx context.Context) func(*App) { + found := make([]bool, len(names)) + var wait sync.WaitGroup + slots := make(chan struct{}, remoteRepositoryParallel) + for i, name := range names { + wait.Add(1) + slots <- struct{}{} + go func() { + defer func() { <-slots; wait.Done() }() + _, err := kernel.RemoteStat(ctx, session, path.Join(dir, name, ".git")) + found[i] = err == nil + }() + } + wait.Wait() + return func(a *App) { + r := &a.remote + if !r.open || r.generation != generation || r.browser != b || b.listing != listing { + // log-exempt: 用户取消:已换了文件夹、返回或关闭窗口,不再标记 Git 仓库。 + return + } + b.repositories = map[string]bool{} + for i, name := range names { + if found[i] { + b.repositories[name] = true + } + } } }) } -// remoteFolders are the names of directory's folders and links to folders, hidden ones last. -func remoteFolders(directory core.RemoteDirectory) []string { - var folders []string +// remoteEntryNames are the names of directory's folders and links to folders when folders is +// set, or of its other entries, hidden ones last. +func remoteEntryNames(directory core.RemoteDirectory, folders bool) []string { + var names []string for _, entry := range directory.Entries { - if entry.Metadata.IsDirectory() { - folders = append(folders, entry.Name) + if entry.Metadata.IsDirectory() == folders { + names = append(names, entry.Name) } } - slices.SortStableFunc(folders, func(x, y string) int { + slices.SortStableFunc(names, func(x, y string) int { hiddenX, hiddenY := strings.HasPrefix(x, "."), strings.HasPrefix(y, ".") if hiddenX != hiddenY { if hiddenX { @@ -238,7 +306,7 @@ func remoteFolders(directory core.RemoteDirectory) []string { } return cmp.Compare(strings.ToLower(x), strings.ToLower(y)) }) - return folders + return names } // remoteReadDirFailureText says why a host folder could not be listed. diff --git a/desktop/internal/workbench/remote_browse_view.go b/desktop/internal/workbench/remote_browse_view.go index cdf71237e..fa1945f97 100644 --- a/desktop/internal/workbench/remote_browse_view.go +++ b/desktop/internal/workbench/remote_browse_view.go @@ -1,61 +1,53 @@ package workbench import ( + "path" + "strconv" + "strings" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/ui" ) -// This file draws the folder browser of remote_browse.go in the Remote Development window. +// This file draws the folder browser of remote_browse.go in the Remote Development window's page. -const ( - // remoteRecentWidth is the width of the connection's recent folders beside the folder list. - remoteRecentWidth = 260 - // remoteFolderRowHeight is the height of a folder's row. - remoteFolderRowHeight = 26 -) +// remoteFolderRowHeight is the height of a row of the folder list. +const remoteFolderRowHeight = 34 -// remoteBrowserView declares the browser: the connection, the path of the folder shown with the -// button to its parent, the connection's recent folders and the folder's subfolders. A click -// selects a subfolder for Open; a double click or Enter lists it. +// remoteBrowserView declares the browser: the connected host, the path field, the folders used +// often, the path of the folder shown and its entries. A click selects a subfolder for Open; a +// double click or Enter lists it. Files show greyed, as what the folder holds. func (a *App) remoteBrowserView(c ui.C, b *remoteBrowser) { language := a.language() k := c.Part("browser") - ui.Column(k).Fill().Pad(16).Gap(10).Children(func() { - ui.Row(k.Part("connected")).FillWidth().Gap(8).Items(ui.Center).Children(func() { - ui.Icon(k, icons.Server).Size(16, 16).Shrink(0).Color(a.colors.Success) - ui.Text(k, i18n.SharedFormat(language, "desktop.remote.browse.connected", map[string]string{"name": b.name})).Weight(gfx.WeightSemibold).Ellipsis().Shrink(1).MinWidth(0) - ui.Text(k, remoteAddress(b.connection)).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) - }) - pathLabel := i18n.Shared(language, "desktop.remote.browse.path") - ui.Row(k.Part("path")).FillWidth().Gap(6).Items(ui.Center).Children(func() { - if a.gitIconButton(k.Part("up"), i18n.Shared(language, "desktop.remote.browse.up"), icons.ArrowUp, false, b.opening || b.dir == "/" || b.dir == "") { - c.After(a.upRemoteFolder) - } - if ui.TextField(k.Part("field"), &b.path, pathLabel, i18n.Shared(language, "desktop.remote.browse.pathPlaceholder")).Grow(1).MinWidth(0).Disabled(b.opening).Submitted() { + ui.Column(k).Fill().Gap(12).PadSides(20, 24, 16, 24).Children(func() { + a.remoteBrowserHead(k.Part("head"), language, b) + ui.Row(k).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) + ui.Row(k.Part("path")).FillWidth().Gap(8).Items(ui.Center).Children(func() { + if ui.TextField(k.Part("field"), &b.path, i18n.Shared(language, "desktop.remote.browse.path"), i18n.Shared(language, "desktop.remote.browse.pathPlaceholder")). + Grow(1).MinWidth(0).Disabled(b.opening).Submitted() { c.After(a.goRemoteFolder) } - if a.gitIconButton(k.Part("refresh"), i18n.Shared(language, "desktop.remote.browse.refresh"), icons.RefreshCw, false, b.opening || b.loading || b.dir == "") { - c.After(func() { - if b := a.remote.browser; b != nil { - a.performed("remote.browse.refresh", surfaceButton) - a.listRemoteFolder(b.dir) - } - }) + if ui.Button(k.Part("go"), i18n.Shared(language, "desktop.remote.browse.go")).Outline().Shrink(0).Disabled(b.opening).Clicked() { + c.After(a.goRemoteFolder) } }) + a.remoteFolderShortcuts(k.Part("shortcuts"), language, b) + a.remoteFolderCrumbs(k.Part("crumbs"), b) if b.readErr != "" { a.remoteNotice(k.Part("read"), icons.CircleAlert, a.theme.Danger, b.readErr) } if b.err != "" { a.remoteNotice(k.Part("error"), icons.CircleX, a.theme.Danger, b.err) } - ui.Row(k.Part("lists")).FillWidth().Grow(1).Shrink(1).MinHeight(0).Gap(0). - Border(1, a.colors.Line).Radius(a.theme.Metrics.RadiusItem()).Children(func() { - if len(b.recent) > 0 { - a.remoteRecentFolders(k.Part("recent"), b) - ui.Column(k).Width(1).FillHeight().Shrink(0).Background(a.colors.Line) + ui.Column(k.Part("entries")).FillWidth().Grow(1).Shrink(1).MinHeight(0). + Border(1, a.colors.Line).Radius(a.theme.Metrics.RadiusItem()).Clip().Children(func() { + if b.dir != "" && b.dir != "/" { + a.remoteFolderUp(k.Part("up"), language, b) + ui.Row(k).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) } a.remoteFolderList(k.Part("folders"), b) }) @@ -65,103 +57,211 @@ func (a *App) remoteBrowserView(c ui.C, b *remoteBrowser) { }) } -// remoteRecentFolders declares the folders opened over the connection before; choosing one lists -// it. -func (a *App) remoteRecentFolders(c ui.C, b *remoteBrowser) { - title := i18n.Shared(a.language(), "desktop.remote.browse.recent") - ui.Column(c).Width(remoteRecentWidth).FillHeight().Shrink(0).Children(func() { - ui.Row(c.Part("header")).FillWidth().Height(panelHeaderHeight).Shrink(0).Items(ui.Center).PadX(10).Children(func() { - ui.Text(c, title).FontSize(a.theme.Metrics.FontSizeS).Weight(gfx.WeightSemibold).Color(a.colors.Subtle).Ellipsis() +// remoteBrowserHead declares the page's head: the host's mark, which host the folder is chosen +// on, that it is connected, its address and system, and Disconnect. +func (a *App) remoteBrowserHead(c ui.C, language i18n.Language, b *remoteBrowser) { + r := &a.remote + mark, system := "", "" + var color core.RemoteConnectionColor + if entry := r.entry(b.entryID); entry != nil { + outcome := r.probedOutcome(entry.Connection) + mark, color = remoteSystemMark(outcome), entry.Color + system = remoteSystemLine(outcome) + } + ui.Row(c).FillWidth().Items(ui.Center).Gap(14).Children(func() { + a.remoteTile(c.Part("tile"), mark, b.name, color, remoteHeroTile, 15) + ui.Column(c).Grow(1).Basis(0).MinWidth(0).Gap(5).Children(func() { + ui.Text(c, i18n.SharedFormat(language, "desktop.remote.browse.title", map[string]string{"name": b.name})). + FontSize(16).Weight(gfx.WeightSemibold).Ellipsis().Shrink(1).MinWidth(0) + ui.Row(c.Part("state")).FillWidth().Gap(8).Items(ui.Center).Children(func() { + a.remoteStatusPill(c.Part("live"), i18n.Shared(language, "desktop.remote.browse.connected"), a.colors.Success) + ui.Text(c, remoteAddress(b.connection)).Mono().FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) + if system != "" { + ui.Text(c, system).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) + } + }) }) - b.recentList.Label = func(row int) string { - if row < 0 || row >= len(b.recent) { - return "" + if ui.Button(c.Part("disconnect"), i18n.Shared(language, "desktop.remote.browse.disconnect")).Outline().Shrink(0).Disabled(b.opening).Clicked() { + c.After(a.backFromRemoteBrowser) + } + }) +} + +// remoteSystemLine is the tested host's system and processor, such as "Ubuntu 24.04 LTS x86_64", +// or "" for a host never tested. +func remoteSystemLine(outcome *remoteProbeOutcome) string { + if outcome == nil || outcome.err != nil || outcome.result.Host == nil { + return "" + } + host := outcome.result.Host + system := strings.TrimSpace(host.Details.OperatingSystem) + if system == "" { + system = strings.TrimSpace(host.System) + } + return strings.TrimSpace(system + " " + strings.TrimSpace(host.Machine)) +} + +// remoteFolderShortcuts declares the folders used often: the account's home folder and those +// opened over the connection before. Choosing one lists it. +func (a *App) remoteFolderShortcuts(c ui.C, language i18n.Language, b *remoteBrowser) { + home := b.session.HomeDirectory + type shortcut struct{ label, dir string } + var shortcuts []shortcut + if path.IsAbs(home) { + shortcuts = append(shortcuts, shortcut{i18n.Shared(language, "desktop.remote.browse.home"), path.Clean(home)}) + } + for _, folder := range b.recent { + if dir, ok := remoteFolderPath(folder, home); ok { + shortcuts = append(shortcuts, shortcut{remoteHomeRelative(dir, home), dir}) + } + } + if len(shortcuts) == 0 { + return + } + ui.Row(c).FillWidth().Gap(6).Items(ui.Center).Children(func() { + ui.Text(c, i18n.Shared(language, "desktop.remote.browse.shortcuts")).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Shrink(0) + for i, item := range shortcuts { + sc := c.Part("shortcut" + strconv.Itoa(i)) + if ui.Button(sc, item.label).Ghost().Small().Radius(12).Background(a.colors.Hover).Shrink(1).MinWidth(0).Tooltip(item.dir).Disabled(b.opening).Clicked() { + dir := item.dir + c.After(func() { + a.performed("remote.browse.recent", surfaceButton) + a.listRemoteFolder(dir) + }) } - return b.recent[row] } - ui.List(c.Part("rows"), &b.recentList, len(b.recent), func(row ui.ListRow) { - folder := b.recent[row.Index] - rc := row.C - row.Element.Height(remoteFolderRowHeight).PadX(10).Gap(8).Items(ui.Center).Hover(ui.Look{}.Background(a.colors.Hover)) - row.Element.Children(func() { - ui.Icon(rc, icons.Clock).Size(14, 14).Shrink(0).Color(a.colors.Subtle) - ui.Text(rc, folder).Ellipsis().Shrink(1).MinWidth(0) - }) - }).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Label(title) - if b.recentList.Changed() { - if at := b.recentList.Selected(); at >= 0 && at < len(b.recent) && !b.opening { - folder := b.recent[at] + }) +} + +// remoteHomeRelative writes dir under home with a leading ~. +func remoteHomeRelative(dir, home string) string { + home = path.Clean(home) + switch { + case !path.IsAbs(home) || home == "/": + return dir + case dir == home: + return "~" + case strings.HasPrefix(dir, home+"/"): + return "~" + dir[len(home):] + } + return dir +} + +// remoteFolderCrumbs declares the path of the folder shown, a button for each folder above it. +func (a *App) remoteFolderCrumbs(c ui.C, b *remoteBrowser) { + if b.dir == "" { + return + } + parts := strings.Split(strings.Trim(b.dir, "/"), "/") + if b.dir == "/" { + parts = nil + } + ui.Row(c).FillWidth().Gap(2).Items(ui.Center).Children(func() { + crumb := func(i int, label, dir string) { + if i == len(parts) { + ui.Text(c, label).FontSize(a.theme.Metrics.FontSizeS).Weight(gfx.WeightSemibold).Ellipsis().Shrink(1).MinWidth(0) + return + } + if ui.Button(c.Part("crumb"+strconv.Itoa(i)), label).Ghost().Small().Shrink(1).MinWidth(0).Disabled(b.opening).Clicked() { c.After(func() { - if dir, ok := remoteFolderPath(folder, ""); ok { - a.performed("remote.browse.recent", surfaceButton) - a.listRemoteFolder(dir) - } + a.performed("remote.browse.crumb", surfaceButton) + a.listRemoteFolder(dir) }) } } + crumb(0, "/", "/") + for i, part := range parts { + ui.Icon(c, icons.ChevronRight).Size(12, 12).Shrink(0).Color(a.colors.Subtle) + crumb(i+1, part, "/"+strings.Join(parts[:i+1], "/")) + } }) } -// remoteFolderList declares the subfolders of the folder shown. +// remoteFolderUp declares the row that lists the parent of the folder shown. +func (a *App) remoteFolderUp(c ui.C, language i18n.Language, b *remoteBrowser) { + label := i18n.Shared(language, "desktop.remote.browse.up") + row := ui.Row(c).FillWidth().Height(30).Shrink(0).PadX(12).Gap(8).Items(ui.Center). + Hit(ui.ID(c), label).Hover(ui.Look{}.Background(a.colors.Hover)) + row.Children(func() { + ui.Icon(c, icons.ArrowUp).Size(14, 14).Shrink(0).Color(a.colors.Subtle) + ui.Text(c, label).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle) + }) + if row.Clicked() && !b.opening { + c.After(a.upRemoteFolder) + } +} + +// remoteFolderList declares the entries of the folder shown: its subfolders, then its files. func (a *App) remoteFolderList(c ui.C, b *remoteBrowser) { language := a.language() title := i18n.Shared(language, "desktop.remote.browse.folders") - ui.Column(c).Grow(1).Shrink(1).MinWidth(0).FillHeight().Children(func() { - if b.loading || len(b.folders) == 0 { - text := i18n.Shared(language, "desktop.remote.browse.empty") - switch { - case b.loading: - text = i18n.Shared(language, "native.loading") - case b.readErr != "": - text = "" - } - ui.Row(c.Part("empty")).FillWidth().Pad(10).Children(func() { - ui.Paragraph(c, text, 2).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle) - }) - return + count := len(b.folders) + len(b.files) + if b.loading || count == 0 { + text := i18n.Shared(language, "desktop.remote.browse.empty") + switch { + case b.loading: + text = i18n.Shared(language, "native.loading") + case b.readErr != "": + text = "" } - b.list.Label = func(row int) string { - if row < 0 || row >= len(b.folders) { - return "" - } + ui.Row(c.Part("empty")).FillWidth().Pad(12).Children(func() { + ui.Paragraph(c, text, 2).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle) + }) + return + } + hint := i18n.Shared(language, "desktop.remote.browse.enterHint") + b.list.Label = func(row int) string { + switch { + case row >= 0 && row < len(b.folders): return b.folders[row] + case row >= len(b.folders) && row < len(b.folders)+len(b.files): + return b.files[row-len(b.folders)] } - ui.List(c.Part("rows"), &b.list, len(b.folders), func(row ui.ListRow) { - name := b.folders[row.Index] - rc := row.C - row.Element.Height(remoteFolderRowHeight).PadX(10).Gap(8).Items(ui.Center).Hover(ui.Look{}.Background(a.colors.Hover)) + return "" + } + ui.List(c.Part("rows"), &b.list, count, func(row ui.ListRow) { + rc := row.C + row.Element.Height(remoteFolderRowHeight).PadX(12).Gap(10).Items(ui.Center).Hover(ui.Look{}.Background(a.colors.Hover)) + if row.Index >= len(b.folders) { + name := b.files[row.Index-len(b.folders)] row.Element.Children(func() { - ui.Icon(rc, icons.Folder).Size(14, 14).Shrink(0).Color(a.colors.Subtle) - ui.Text(rc, name).Ellipsis().Shrink(1).MinWidth(0) - }) - }).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Label(title) - if at, ok := b.list.Submitted(); ok && at >= 0 && at < len(b.folders) && !b.opening { - dir := b.dir + "/" + b.folders[at] - c.After(func() { - if dir, ok := remoteFolderPath(dir, ""); ok { - a.performed("remote.browse.enter", surfaceButton) - a.listRemoteFolder(dir) - } + ui.Icon(rc, icons.File).Size(15, 15).Shrink(0).Color(a.colors.Subtle.WithAlpha(0.7)) + ui.Text(rc, name).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) }) + return } - }) + name := b.folders[row.Index] + row.Element.Children(func() { + ui.Icon(rc, icons.Folder).Size(15, 15).Shrink(0).Color(a.colors.Subtle) + ui.Text(rc, name).Ellipsis().Grow(1).Shrink(1).MinWidth(0) + if b.repositories[name] { + a.remoteTag(rc.Part("git"), i18n.Shared(language, "desktop.remote.browse.git"), a.colors.Subtle) + } + ui.Text(rc, hint).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Shrink(0) + }) + }).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Label(title) + if at, ok := b.list.Submitted(); ok && at >= 0 && at < len(b.folders) && !b.opening { + dir := path.Join(b.dir, b.folders[at]) + c.After(func() { + a.performed("remote.browse.enter", surfaceButton) + a.listRemoteFolder(dir) + }) + } } -// remoteBrowserFooter declares the folder Open opens, Back and Open. +// remoteBrowserFooter declares Choose Later, which ends the session, and Open, naming the folder +// it opens. func (a *App) remoteBrowserFooter(c ui.C, b *remoteBrowser) { language := a.language() - if target := b.target(); target != "" { - ui.Text(c, i18n.SharedFormat(language, "desktop.remote.browse.target", map[string]string{"path": target})).Ellipsis().Shrink(1).MinWidth(0).Color(a.colors.Subtle) - } ui.Spacer(c) if ui.Button(c.Part("back"), i18n.Shared(language, "desktop.remote.browse.back")).Outline().Disabled(b.opening).Clicked() { c.After(a.backFromRemoteBrowser) } - label := i18n.Shared(language, "desktop.remote.browse.open") - if b.opening { - label = i18n.Shared(language, "desktop.remote.browse.opening") + label := i18n.Shared(language, "desktop.remote.browse.opening") + if !b.opening { + label = i18n.SharedFormat(language, "desktop.remote.browse.open", map[string]string{"name": path.Base(b.target())}) } - if ui.Button(c.Part("open"), label).Disabled(!b.openable()).Clicked() { + if ui.Button(c.Part("open"), label).Disabled(!b.openable()).Tooltip(b.target()).Clicked() { c.After(a.openRemoteFolder) } } diff --git a/desktop/internal/workbench/remote_connections_visual_test.go b/desktop/internal/workbench/remote_connections_visual_test.go index 35b0ef738..6b01f240c 100644 --- a/desktop/internal/workbench/remote_connections_visual_test.go +++ b/desktop/internal/workbench/remote_connections_visual_test.go @@ -180,9 +180,17 @@ func TestVisualRemoteConnections(t *testing.T) { r.selectEntry(buildBox) h.app.editSelectedRemote() r.result = refused + r.form.advanced.Open = false r.log.Open = true shot("test-failed") + // A test that connects shows what the host is, with OpenSSH's output folded. + connected := probed + connected.Diagnostics = "debug1: Authentication succeeded (publickey)." + r.result = &remoteProbeOutcome{result: connected, at: h.app.now()} + r.log.Open = false + shot("test-ok") + // Connecting runs the steps on the page, with OpenSSH's questions under the step that // asks them. r.selectEntry(buildBox) @@ -209,7 +217,8 @@ func TestVisualRemoteConnections(t *testing.T) { // The first time a folder opens, the window asks whether to trust it. parent := "/home/dev" - r.trust = &remoteTrustPrompt{browser: &remoteBrowser{name: "Build box"}, dir: "/home/dev/project", trust: remoteconn.Trust{ + r.selectEntry(buildBox) + r.trust = &remoteTrustPrompt{browser: &remoteBrowser{entryID: buildBox, name: "Build box", connection: r.entry(buildBox).Connection}, dir: "/home/dev/project", trust: remoteconn.Trust{ State: core.RemoteWorkspaceTrustState{WorkspaceTrust: &core.RemoteWorkspaceTrustOf{ State: core.WorkspaceTrustUnset, Workspace: "/home/dev/project", OfferedLocation: &parent, }}, @@ -218,17 +227,52 @@ func TestVisualRemoteConnections(t *testing.T) { r.trust = nil r.importer = &remoteImporter{source: remoteImportMotty, keepGroups: true, keepColors: true, - motty: core.RemoteMottyHosts{Database: "~/Library/Application Support/Motty/config.db", Groups: []string{"Production", "Lab"}, + motty: core.RemoteMottyHosts{Database: "~/Library/Application Support/Motty/config.db", Format: "28", Groups: []string{"Production", "Staging", "Lab"}, Candidates: []core.RemoteMottyCandidate{ - {Key: "1", Name: "Build box", Address: "dev@build.example:2222", Color: core.RemoteConnectionRed, Group: "Production", Status: core.RemoteImportExists, ExistingID: buildBox}, - {Key: "2", Name: "Staging DB", Address: "postgres@db.staging.example", Color: core.RemoteConnectionBlue, Group: "Production", Status: core.RemoteImportable}, - {Key: "3", Name: "GPU node", Address: "ml@gpu-07.lab.example", Color: core.RemoteConnectionPurple, Group: "Lab", Status: core.RemoteImportPartial}, + {Key: "1", Name: "Build box", Address: "dev@build.example:2222", System: "ubuntu", Color: core.RemoteConnectionRed, Group: "Production", Status: core.RemoteImportExists, ExistingID: buildBox}, + {Key: "2", Name: "Staging DB", Address: "postgres@db.staging.example", System: "debian", Color: core.RemoteConnectionBlue, Group: "Staging", Status: core.RemoteImportable}, + {Key: "3", Name: "GPU node", Address: "ml@gpu-07.lab.example", System: "ubuntu", Color: core.RemoteConnectionPurple, Group: "Lab", Status: core.RemoteImportPartial, + Fields: []core.RemoteMottyField{ + {Motty: "label", Value: "GPU node", Lithe: "name"}, + {Motty: "address", Value: "gpu-07.lab.example", Lithe: "host"}, + {Motty: "user", Value: "ml", Lithe: "user"}, + {Motty: "ssh_options.identity_files", Value: "~/.ssh/lab_ed25519", Lithe: "identityFile"}, + {Motty: "ssh_options.server_alive_interval", Value: "30", Lithe: "keepAliveSeconds"}, + {Motty: "credential", Skip: core.RemoteMottySkipSecret}, + {Motty: "ssh_options.forward_agent", Value: "true", Skip: core.RemoteMottySkipNoSetting}, + }}, {Key: "4", Name: "Router", Address: "admin@192.0.2.1", Group: "Lab", Status: core.RemoteImportUnsupported}, }}, - mottyChosen: []bool{true, true, true, false}, + mottyChosen: []bool{true, true, true, false}, opened: "3", } shot("import") + + r.importer = &remoteImporter{source: remoteImportSSH, + ssh: core.RemoteSSHConfigHosts{Files: []string{"~/.ssh/config", "~/.ssh/config.d/lab"}, Hosts: []core.RemoteSSHConfigHost{ + {Alias: "build", Status: core.RemoteImportExists, ExistingID: buildBox, ExistingName: "Build box", + Resolved: &core.RemoteResolvedHost{HostName: "build.example", User: "dev", Port: 2222}}, + {Alias: "bastion", Status: core.RemoteImportable, UsedAsJumpBy: []string{"gpu"}, + Resolved: &core.RemoteResolvedHost{HostName: "bastion.example", User: "ops", Port: 22}}, + {Alias: "gpu", Status: core.RemoteImportable, + Resolved: &core.RemoteResolvedHost{HostName: "gpu-07.lab.example", User: "ml", Port: 22, ProxyJump: "bastion"}}, + {Alias: "*.internal", Status: core.RemoteImportPattern}, + }}, + sshChosen: []bool{false, true, true, false}, + } + shot("import-ssh") r.importer = nil + + // Once connected, the page lists the host's folders to open one. + r.selectEntry(buildBox) + browser := &remoteBrowser{entryID: buildBox, name: "Build box", connection: r.entry(buildBox).Connection, + recent: []string{"/home/dev/src/lithe", "/srv/ci/workspace"}, + dir: "/home/dev/src", folders: []string{"lithe", "lithe-core-rust", "scratch"}, files: []string{"README.txt"}, + repositories: map[string]bool{"lithe": true, "lithe-core-rust": true}, + session: core.RemoteSession{HomeDirectory: "/home/dev"}} + browser.path.SetText("/home/dev/src") + r.browser = browser + shot("folder") + r.browser = nil h.app.closeRemote() h.settleChain() }) diff --git a/desktop/internal/workbench/remote_detail_view.go b/desktop/internal/workbench/remote_detail_view.go index 195850e10..850f6dfd9 100644 --- a/desktop/internal/workbench/remote_detail_view.go +++ b/desktop/internal/workbench/remote_detail_view.go @@ -31,7 +31,7 @@ func (a *App) remotePage(c ui.C, language i18n.Language) { entry := r.entry(r.selected) switch { case r.editing: - a.remoteFormPage(c, language, entry) + a.remoteFormPage(c, language) case entry != nil: a.remoteOverview(c, language, *entry) case r.loading && !r.loaded: @@ -355,41 +355,114 @@ func (a *App) remoteHostGrid(c ui.C, language i18n.Language, host core.RemotePro }) } -// remoteOutcomeBox declares how a test ended: green with the host when it connected, red with -// why it did not, and OpenSSH's own words under it. +// remoteOutcomeBox declares how a test ended: green with the host in short tags when it +// connected, red with why it did not and what to check, and OpenSSH's own words under the box, +// which its link shows or hides. func (a *App) remoteOutcomeBox(c ui.C, language i18n.Language, outcome *remoteProbeOutcome) { + r := &a.remote small := a.theme.Metrics.FontSizeS connected := outcome.err == nil && outcome.result.Status == core.RemoteProbeConnected - tint, icon := a.theme.Danger, icons.CircleX - text := remoteFailureText(language, outcome) + tint, icon := a.theme.Danger, icons.X if connected { - tint, icon = a.colors.Success, icons.CircleCheck - var system, machine string - if host := outcome.result.Host; host != nil { - system, machine = host.System, host.Machine - } - text = i18n.SharedFormat(language, "desktop.remote.probe.connected", map[string]string{"system": system, "machine": machine}) + tint, icon = a.colors.Success, icons.Check } else if outcome.err == nil && outcome.result.Status == core.RemoteProbeUnsupportedPlatform { tint, icon = a.colors.Warning, icons.CircleAlert } - ui.Column(c).FillWidth().Gap(10).Pad(12).Radius(6).Background(tint.WithAlpha(0.08)).Stroke(1, tint.WithAlpha(0.35)).Children(func() { - ui.Row(c).FillWidth().Gap(8).Items(ui.Start).Children(func() { - ui.Icon(c, icon).Size(16, 16).Shrink(0).Color(tint) - ui.Paragraph(c, text, 6).Weight(gfx.WeightMedium).Grow(1).MinWidth(0) + diagnostics := strings.TrimSpace(outcome.result.Diagnostics) + ui.Column(c).FillWidth().Gap(8).Children(func() { + k := c.Part("box") + ui.Column(k).FillWidth().Gap(6).PadSides(10, 14, 10, 12).Radius(6).Background(tint.WithAlpha(0.08)).Stroke(1, tint.WithAlpha(0.35)).Children(func() { + ui.Row(k).FillWidth().Gap(8).Items(ui.Start).Children(func() { + ui.Icon(k, icon).Size(14, 14).Shrink(0).Color(tint).MarginTop(2) + if connected { + var system, machine string + if host := outcome.result.Host; host != nil { + system, machine = host.System, host.Machine + } + line := k.Part("line") + ui.Row(line).Grow(1).MinWidth(0).Items(ui.Center).Children(func() { + ui.Text(line, i18n.SharedFormat(language, "desktop.remote.probe.connected", map[string]string{"system": system, "machine": machine})). + Weight(gfx.WeightSemibold).Color(tint).Shrink(0) + ui.Text(line, i18n.Shared(language, "desktop.remote.probe.usable")).Color(tint).Ellipsis().MinWidth(0) + }) + } else { + ui.Paragraph(k, remoteFailureText(language, outcome), 4).Weight(gfx.WeightMedium).Color(tint).Grow(1).MinWidth(0) + } + if diagnostics != "" { + label := i18n.Shared(language, "desktop.remote.diagnostics") + if r.log.Open { + label = i18n.Shared(language, "desktop.remote.probe.hideOutput") + } + if ui.Button(k.Part("output"), label).Link().Clicked() { + c.After(func() { r.log.Open = !r.log.Open }) + } + } + }) + if connected && outcome.result.Host != nil { + a.remoteHostTags(k.Part("tags"), language, *outcome.result.Host) + } else if hint := remoteFailureHint(language, outcome); hint != "" { + ui.Paragraph(k.Part("hint"), hint, 4).FontSize(small).Color(tint).MarginLeft(22) + } }) - if connected && outcome.result.Host != nil { - a.remoteHostGrid(c.Part("grid"), language, *outcome.result.Host) - } - if diagnostics := strings.TrimSpace(outcome.result.Diagnostics); diagnostics != "" && !connected { - ui.Collapsible(c.Part("diagnostics"), &a.remote.log, i18n.Shared(language, "desktop.remote.diagnostics"), func() { - ui.Column(c).FillWidth().Pad(10).Radius(4).Background(a.colors.Hover).Children(func() { - ui.Paragraph(c.Part("log"), diagnostics, 12).Mono().FontSize(small).Color(a.colors.Subtle) + if diagnostics != "" && r.log.Open { + l := c.Part("log") + ui.Scroll(l).FillWidth().MaxHeight(180).Children(func() { + ui.Column(l).FillWidth().PadSides(10, 12, 10, 12).Radius(6).Background(a.colors.Hover).Stroke(1, a.colors.Line).Children(func() { + ui.Paragraph(l.Part("text"), diagnostics, 40).Mono().FontSize(small).Color(a.colors.Subtle) }) }) } }) } +// remoteHostTags declares what a test found on the host as short tags in one wrapped line: +// system, host name, cores, memory and the home folder's disk. +func (a *App) remoteHostTags(c ui.C, language i18n.Language, host core.RemoteProbedHost) { + details := host.Details + var tags []string + if system := strings.TrimSpace(details.OperatingSystem); system != "" { + tags = append(tags, system) + } + if name := strings.TrimSpace(details.HostName); name != "" { + tags = append(tags, i18n.SharedFormat(language, "desktop.remote.probe.hostNameTag", map[string]string{"name": name})) + } + if details.CPUCount > 0 { + tags = append(tags, i18n.SharedFormat(language, "desktop.remote.host.cores", map[string]string{"count": strconv.FormatUint(uint64(details.CPUCount), 10)})) + } + if details.MemoryBytes > 0 { + tags = append(tags, i18n.SharedFormat(language, "desktop.remote.probe.memoryTag", map[string]string{"size": memorySize(language, details.MemoryBytes)})) + } + if details.DiskTotalBytes > 0 { + tags = append(tags, i18n.SharedFormat(language, "desktop.remote.probe.diskSpace", map[string]string{ + "available": memorySize(language, details.DiskAvailableBytes), "total": memorySize(language, details.DiskTotalBytes)})) + } + if len(tags) == 0 { + return + } + ui.Flow(c).FillWidth().Gap(6).MarginLeft(22).Children(func() { + for index, tag := range tags { + a.remoteTag(c.KeyInt(index), tag, a.colors.Subtle) + } + }) +} + +// remoteFailureHint says what to check after a test that did not connect, and is "" when there +// is nothing more to say than why it failed. +func remoteFailureHint(language i18n.Language, outcome *remoteProbeOutcome) string { + if outcome.err != nil { + return "" + } + switch outcome.result.Status { + case core.RemoteProbeAuthenticationFailed: + return i18n.SharedFormat(language, "desktop.remote.probe.hint.authentication", map[string]string{"method": i18n.Shared(language, "desktop.remote.auth.privateKey")}) + case core.RemoteProbeHostKeyRejected: + return i18n.Shared(language, "desktop.remote.probe.hint.hostKey") + case core.RemoteProbeUnreachable: + return i18n.Shared(language, "desktop.remote.probe.hint.unreachable") + } + return "" +} + // remoteEffectiveSection declares what OpenSSH will use to reach the host, as `ssh -G` resolves // it, and where each value comes from. func (a *App) remoteEffectiveSection(c ui.C, language i18n.Language, entry core.SavedRemoteConnection) { @@ -477,19 +550,15 @@ func remoteSourceName(language i18n.Language, source core.RemoteSettingSource) s } // remoteFormPage declares the form that edits a connection or makes a new one, and the outcome -// of its test. -func (a *App) remoteFormPage(c ui.C, language i18n.Language, entry *core.SavedRemoteConnection) { +// of its test. The window's title names the connection the form edits. +func (a *App) remoteFormPage(c ui.C, language i18n.Language) { r := &a.remote - title := i18n.Shared(language, "desktop.remote.newConnection") - if entry != nil { - title = i18n.SharedFormat(language, "desktop.remote.editTitle", map[string]string{"name": entry.Name}) - } ui.Scroll(c.Part("form")).Fill().Children(func() { ui.Column(c).FillWidth().Gap(16).PadSides(18, 24, 24, 24).Children(func() { - ui.Text(c, title).FontSize(16).Weight(gfx.WeightSemibold).Ellipsis().MinWidth(0) a.remoteNotices(c) - // The test runs from the footer; its outcome goes over the fields, where it is seen - // without scrolling the form. + a.remoteFields(c) + // The test runs from the footer; its outcome goes under the fields, the advanced ones + // included, as the last thing the form says about the connection. switch { case r.probe != nil: ui.Row(c.Part("testing")).FillWidth().Items(ui.Center).Gap(8).Pad(12).Radius(6).Stroke(1, a.colors.Line).Children(func() { @@ -499,7 +568,6 @@ func (a *App) remoteFormPage(c ui.C, language i18n.Language, entry *core.SavedRe case r.result != nil: a.remoteOutcomeBox(c.Part("outcome"), language, r.result) } - a.remoteFields(c) }) }) } diff --git a/desktop/internal/workbench/remote_import.go b/desktop/internal/workbench/remote_import.go index db4fd2cf6..db53eea2c 100644 --- a/desktop/internal/workbench/remote_import.go +++ b/desktop/internal/workbench/remote_import.go @@ -43,6 +43,8 @@ type remoteImporter struct { keepColors bool applying bool err string + // opened is the Key of the Motty host whose settings show, or "". + opened string } // remoteMottyChoosable says whether a Motty host can be chosen: to import, or to give the saved @@ -55,7 +57,7 @@ func remoteMottyChoosable(status core.RemoteImportStatus) bool { func (a *App) openRemoteImport(source remoteImportSource) { r := &a.remote r.importMenu = false - if !r.open || !r.editable() || r.saving || r.connect != nil || r.browser != nil { + if !r.open || !r.editable() || r.saving || r.connect != nil || !a.leaveRemoteFlows() { return } a.performed("remote.import.open", surfaceButton) @@ -202,6 +204,7 @@ func (a *App) applyRemoteImport() { a.operationRejected("remote_import_apply", "not_committed") } r.setSource(after) + a.loadRemoteImportCounts() if r.importer == m { r.importer = nil } @@ -248,32 +251,40 @@ func remoteMottyUnavailableText(language i18n.Language, unavailable core.RemoteM return i18n.Shared(language, "desktop.remote.import.mottyUnreadable") } -// remoteImportView declares the import: where it reads, what it keeps, and the hosts. +// remoteImportView declares the import: the source switch with what it reads, Motty's summary +// with what an import keeps, and the hosts as a table. func (a *App) remoteImportView(c ui.C, language i18n.Language, m *remoteImporter) { small := a.theme.Metrics.FontSizeS - ui.Column(c).Fill().Gap(12).PadSides(18, 24, 12, 24).Children(func() { - ui.Row(c.Part("head")).FillWidth().Items(ui.Center).Gap(12).Children(func() { - ui.Text(c, i18n.Shared(language, "desktop.remote.import.title")).FontSize(16).Weight(gfx.WeightSemibold).Grow(1).MinWidth(0).Ellipsis() + ui.Column(c).Fill().Gap(14).PadSides(18, 22, 12, 22).Children(func() { + ui.Row(c.Part("head")).FillWidth().Items(ui.Center).Gap(10).Children(func() { ui.Choice(c.Part("source"), &m.source, []remoteImportSource{remoteImportMotty, remoteImportSSH}, func(source remoteImportSource) string { if source == remoteImportSSH { return i18n.Shared(language, "desktop.remote.import.source.ssh") } return i18n.Shared(language, "desktop.remote.import.source.motty") - }) + }).Disabled(m.applying) + note := i18n.Shared(language, "desktop.remote.import.mottyNote") + help := "" + if m.motty.Database != "" { + help = i18n.SharedFormat(language, "desktop.remote.import.mottyHelp", map[string]string{"path": m.motty.Database}) + } + if m.source == remoteImportSSH { + note = i18n.Shared(language, "desktop.remote.import.sshNote") + help = "" + if len(m.ssh.Files) > 0 { + help = i18n.SharedFormat(language, "desktop.remote.import.sshHelp", map[string]string{"files": strings.Join(m.ssh.Files, ", ")}) + } + } + ui.Text(c, note).FontSize(small).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) + if help != "" { + a.remoteHelp(c.Part("note"), help) + } + ui.Spacer(c) + if ui.Button(c.Part("reload"), i18n.Shared(language, "desktop.remote.import.reload")).Link().Small().Disabled(m.loading || m.applying).Clicked() { + source := m.source + c.After(func() { a.openRemoteImport(source) }) + } }) - from := m.motty.Database - if m.source == remoteImportSSH { - from = strings.Join(m.ssh.Files, ", ") - } - if from != "" { - ui.Text(c, i18n.SharedFormat(language, "desktop.remote.import.from", map[string]string{"path": from})).FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) - } - if m.source == remoteImportMotty && m.motty.Unavailable == "" && len(m.motty.Candidates) > 0 { - ui.Row(c.Part("keep")).FillWidth().Gap(18).Children(func() { - ui.Checkbox(c.Part("groups"), &m.keepGroups, i18n.Shared(language, "desktop.remote.import.keepGroups")).Disabled(m.applying) - ui.Checkbox(c.Part("colors"), &m.keepColors, i18n.Shared(language, "desktop.remote.import.keepColors")).Disabled(m.applying) - }) - } if m.err != "" { a.remoteNotice(c.Part("error"), icons.CircleX, a.theme.Danger, m.err) } @@ -288,84 +299,320 @@ func (a *App) remoteImportView(c ui.C, language i18n.Language, m *remoteImporter a.remoteNotice(c.Part("ssh-error"), icons.CircleX, a.theme.Danger, m.sshErr) case m.source == remoteImportMotty && len(m.motty.Candidates) == 0, m.source == remoteImportSSH && len(m.ssh.Hosts) == 0: a.remoteNotice(c.Part("empty"), icons.Info, a.colors.Subtle, i18n.Shared(language, "desktop.remote.import.empty")) + case m.source == remoteImportSSH: + a.remoteSSHImportTable(c.Part("ssh"), language, m) default: - a.remoteImportList(c.Part("hosts"), language, m) + a.remoteMottySummary(c.Part("summary"), language, m) + a.remoteMottyImportTable(c.Part("motty"), language, m) } }) } -// remoteImportList declares the hosts of the source shown, each with its box. -func (a *App) remoteImportList(c ui.C, language i18n.Language, m *remoteImporter) { - type item struct { - name, address, system string - color core.RemoteConnectionColor - status core.RemoteImportStatus - chosen *bool - choosable bool - detail string - } - var items []item - if m.source == remoteImportSSH { - for index, host := range m.ssh.Hosts { - address := "" - if resolved := host.Resolved; resolved != nil { - address = remoteAddress(core.SSHConnection{Host: resolved.HostName, User: resolved.User, Port: resolved.Port}) +// remoteMottySummary declares what Motty's database holds, and whether the import keeps its +// groups and colors. +func (a *App) remoteMottySummary(c ui.C, language i18n.Language, m *remoteImporter) { + small := a.theme.Metrics.FontSizeS + ui.Row(c).FillWidth().Items(ui.Center).Gap(10).PadSides(10, 12, 10, 12).Radius(8).Background(a.colors.Hover).Stroke(1, a.colors.Line).Children(func() { + ui.Row(c.Part("mark")).Size(24, 24).Shrink(0).Center().Radius(5).Background(gfx.RGB24(0x111111)).Children(func() { + ui.Text(c, "M").FontSize(12).Weight(gfx.WeightBold).Color(gfx.RGB24(0xFFFFFF)) + }) + ui.Text(c, i18n.SharedFormat(language, "desktop.remote.import.mottyFound", map[string]string{ + "hosts": strconv.Itoa(len(m.motty.Candidates)), "groups": strconv.Itoa(len(m.motty.Groups)), "format": m.motty.Format, + })).FontSize(small).Ellipsis().Shrink(1).MinWidth(0) + ui.Spacer(c) + ui.Checkbox(c.Part("groups"), &m.keepGroups, i18n.Shared(language, "desktop.remote.import.keepGroups")).Disabled(m.applying) + ui.Checkbox(c.Part("colors"), &m.keepColors, i18n.Shared(language, "desktop.remote.import.keepColors")).Disabled(m.applying) + }) +} + +// remoteImportHeader declares a table's column names over a line; a width of 0 grows. +func (a *App) remoteImportHeader(c ui.C, lead, trail float32, columns []string, widths []float32) { + ui.Row(c).FillWidth().Height(30).Shrink(0).Items(ui.Center).Gap(10).PadX(10).Children(func() { + ui.Row(c.Part("lead")).Width(lead).Shrink(0) + for index, column := range columns { + cell := ui.Text(c.KeyInt(index), column).FontSize(a.theme.Metrics.FontSizeS).Weight(gfx.WeightMedium).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + if widths[index] == 0 { + cell.Grow(1).Basis(0) + } else { + cell.Width(widths[index]).Shrink(0) } - detail := host.ExistingName - items = append(items, item{name: host.Alias, address: address, status: host.Status, chosen: &m.sshChosen[index], choosable: remoteImportable(host.Status), detail: detail}) } - } else { - for index, candidate := range m.motty.Candidates { - items = append(items, item{name: candidate.Name, address: candidate.Address, system: candidate.System, color: candidate.Color, status: candidate.Status, - chosen: &m.mottyChosen[index], choosable: remoteMottyChoosable(candidate.Status)}) + if trail > 0 { + ui.Row(c.Part("trail")).Width(trail).Shrink(0) } + }) + ui.Row(c.Part("line")).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) +} + +// remoteImportTag declares what an import does with a host, tinted by it. +func (a *App) remoteImportTag(c ui.C, text string, status core.RemoteImportStatus) { + color := a.colors.Subtle + switch status { + case core.RemoteImportable: + color = a.colors.Success + case core.RemoteImportPartial: + color = a.colors.Warning + case core.RemoteImportInvalid, core.RemoteImportUnreadable: + color = a.theme.Danger } + a.remoteTag(c, text, color) +} + +// remoteTag declares a small rounded tag tinted with color. +func (a *App) remoteTag(c ui.C, text string, color gfx.Color) { + ui.Row(c).Shrink(0).Height(20).Items(ui.Center).PadX(8).Radius(10).Background(color.WithAlpha(0.13)).Children(func() { + ui.Text(c, text).FontSize(a.theme.Metrics.FontSizeS).Color(color).Ellipsis().MinWidth(0) + }) +} + +// remoteSSHImportTable declares the Host names of ~/.ssh/config: each alias, what `ssh -G` +// resolves it to, and what the import does with it. +func (a *App) remoteSSHImportTable(c ui.C, language i18n.Language, m *remoteImporter) { small := a.theme.Metrics.FontSizeS - ui.Scroll(c).FillWidth().Grow(1).Basis(0).MinHeight(0).Radius(6).Stroke(1, a.colors.Line).Children(func() { - ui.Column(c).FillWidth().Children(func() { - for index, host := range items { - k := c.KeyInt(index) - if index > 0 { + widths := []float32{140, 0, 170} + ui.Column(c).FillWidth().Grow(1).Basis(0).MinHeight(0).Children(func() { + a.remoteImportHeader(c.Part("header"), 22, 0, []string{ + i18n.Shared(language, "desktop.remote.import.column.alias"), + i18n.Shared(language, "desktop.remote.import.column.resolved"), + i18n.Shared(language, "desktop.remote.import.column.result"), + }, widths) + ui.Scroll(c.Part("rows")).FillWidth().Grow(1).Basis(0).MinHeight(0).Children(func() { + ui.Column(c).FillWidth().Children(func() { + for index, host := range m.ssh.Hosts { + k := c.KeyInt(index) + choosable := remoteImportable(host.Status) + color := a.colors.Text + if !choosable { + color = a.colors.Subtle + } + ui.Row(k).FillWidth().MinHeight(38).Items(ui.Center).Gap(10).PadSides(8, 10, 8, 10).Children(func() { + ui.Row(k.Part("pick")).Width(22).Shrink(0).Children(func() { + ui.Checkbox(k.Part("box"), &m.sshChosen[index], "").Label(host.Alias).Disabled(!choosable || m.applying) + }) + ui.Text(k, host.Alias).Mono().FontSize(small).Color(color).Width(widths[0]).Shrink(0).Ellipsis() + ui.Column(k).Grow(1).Basis(0).MinWidth(0).Gap(2).Children(func() { + switch { + case host.Status == core.RemoteImportPattern: + ui.Text(k, i18n.Shared(language, "desktop.remote.import.patternNote")).FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + case host.Resolved != nil: + resolved := host.Resolved + ui.Text(k, remoteAddress(core.SSHConnection{Host: resolved.HostName, User: resolved.User, Port: resolved.Port})). + Mono().FontSize(small).Color(color).Ellipsis().MinWidth(0) + } + if len(host.UsedAsJumpBy) > 0 { + ui.Text(k, i18n.SharedFormat(language, "desktop.remote.import.jumpFor", map[string]string{"hosts": strings.Join(host.UsedAsJumpBy, ", ")})). + Mono().FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + } + }) + status := remoteImportStatusName(language, host.Status) + if host.Status == core.RemoteImportExists && host.ExistingName != "" { + status = i18n.SharedFormat(language, "desktop.remote.import.status.existsAs", map[string]string{"name": host.ExistingName}) + } + ui.Row(k.Part("result")).Width(widths[2]).Shrink(0).Children(func() { + a.remoteImportTag(k.Part("status"), status, host.Status) + }) + }) ui.Row(k.Part("line")).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) } - ui.Row(k).FillWidth().Height(remoteRowHeight).Items(ui.Center).Gap(10).PadX(12).Children(func() { - ui.Checkbox(k.Part("pick"), host.chosen, "").Label(host.name).Shrink(0).Disabled(!host.choosable || m.applying) - mark := "" - if host.system != "" { - mark = remoteSystemMark(&remoteProbeOutcome{result: core.RemoteProbeResult{Host: &core.RemoteProbedHost{System: host.system}}}) - } - a.remoteTile(k.Part("tile"), mark, host.name, host.color, 26, 10) + }) + }) + }) +} + +// remoteMottyImportTable declares Motty's hosts: each with its color, system and address, its +// group, what the import does with it, and, opened, how each of its settings is imported. +func (a *App) remoteMottyImportTable(c ui.C, language i18n.Language, m *remoteImporter) { + small := a.theme.Metrics.FontSizeS + widths := []float32{0, 90, 210} + ui.Column(c).FillWidth().Grow(1).Basis(0).MinHeight(0).Children(func() { + a.remoteImportHeader(c.Part("header"), 22+10+10+10+26, 20, []string{ + i18n.Shared(language, "desktop.remote.import.column.host"), + i18n.Shared(language, "desktop.remote.import.column.group"), + i18n.Shared(language, "desktop.remote.import.column.result"), + }, widths) + ui.Scroll(c.Part("rows")).FillWidth().Grow(1).Basis(0).MinHeight(0).Children(func() { + ui.Column(c).FillWidth().Children(func() { + for index, candidate := range m.motty.Candidates { + k := c.KeyInt(index) + choosable := remoteMottyChoosable(candidate.Status) + open := m.opened == candidate.Key color := a.colors.Text - if !host.choosable { + if !choosable { color = a.colors.Subtle } - ui.Column(k).Grow(1).Basis(0).MinWidth(0).Gap(2).Children(func() { - ui.Text(k, host.name).Weight(gfx.WeightMedium).Color(color).Ellipsis().MinWidth(0) - if host.address != "" { - ui.Text(k, host.address).Mono().FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + ui.Row(k).FillWidth().MinHeight(44).Items(ui.Center).Gap(10).PadSides(6, 10, 6, 10).Children(func() { + ui.Row(k.Part("pick")).Width(22).Shrink(0).Children(func() { + ui.Checkbox(k.Part("box"), &m.mottyChosen[index], "").Label(candidate.Name).Disabled(!choosable || m.applying) + }) + ui.Row(k.Part("color")).Width(10).Shrink(0).Center().Children(func() { + if tint, marked := remoteColor(a.colors.Dark, candidate.Color); marked { + a.remoteDot(k.Part("dot"), tint, 8) + } + }) + mark := "" + if candidate.System != "" { + mark = remoteSystemMark(&remoteProbeOutcome{result: core.RemoteProbeResult{Host: &core.RemoteProbedHost{System: candidate.System}}}) + } + a.remoteTile(k.Part("tile"), mark, candidate.Name, candidate.Color, 26, 10) + ui.Column(k).Grow(1).Basis(0).MinWidth(0).Gap(2).Children(func() { + ui.Text(k, candidate.Name).Weight(gfx.WeightMedium).Color(color).Ellipsis().MinWidth(0) + if candidate.Address != "" { + ui.Text(k, candidate.Address).Mono().FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + } + }) + group := candidate.Group + if group == "" { + group = "—" + } + ui.Text(k, group).FontSize(small).Color(color).Width(widths[1]).Shrink(0).Ellipsis() + ui.Row(k.Part("result")).Width(widths[2]).Shrink(0).Items(ui.Center).Gap(6).Children(func() { + a.remoteImportTag(k.Part("status"), remoteImportStatusName(language, candidate.Status), candidate.Status) + if candidate.Status == core.RemoteImportExists && m.mottyChosen[index] { + ui.Text(k, i18n.Shared(language, "desktop.remote.import.fill")).FontSize(small).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) + } + }) + icon := icons.ChevronRight + if open { + icon = icons.ChevronDown + } + if len(candidate.Fields) > 0 { + if ui.Button(k.Part("more"), i18n.Shared(language, "desktop.remote.import.details")).Icon(icon).IconOnly().Ghost().Size(20, 20).Shrink(0).Clicked() { + key := candidate.Key + c.After(func() { + if m.opened == key { + m.opened = "" + } else { + m.opened = key + } + }) + } + } else { + ui.Row(k.Part("more")).Width(20).Shrink(0) } }) - statusColor := a.colors.Subtle - switch host.status { - case core.RemoteImportable: - statusColor = a.colors.Success - case core.RemoteImportPartial: - statusColor = a.colors.Warning + if open { + a.remoteMottyFields(k.Part("fields"), language, candidate.Fields) } - a.remotePill(k.Part("status"), remoteImportStatusName(language, host.status), statusColor) - }) - } + ui.Row(k.Part("line")).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) + } + }) }) }) } -// remoteImportFooter declares how many hosts are chosen and the buttons that import them or go -// back. +// remoteMottyFields declares how each of a Motty host's settings is imported: Motty's setting and +// value, the connection setting it becomes or why it is not imported. +func (a *App) remoteMottyFields(c ui.C, language i18n.Language, fields []core.RemoteMottyField) { + small := a.theme.Metrics.FontSizeS + ui.Column(c).FillWidth().PadSides(6, 10, 10, 52).Background(a.colors.Hover).Children(func() { + for index, field := range fields { + k := c.KeyInt(index) + if index > 0 { + ui.Row(k.Part("line")).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) + } + ui.Row(k).FillWidth().MinHeight(26).Items(ui.Center).Gap(10).PadY(3).Children(func() { + ui.Text(k, field.Motty).Mono().FontSize(small).Color(a.colors.Subtle).Grow(1).Basis(0).MinWidth(0).Ellipsis() + value := field.Value + if value == "" { + value = "—" + } + ui.Text(k, value).Mono().FontSize(small).Grow(1).Basis(0).MinWidth(0).Ellipsis() + ui.Text(k, "→").FontSize(small).Color(a.colors.Subtle).Shrink(0) + if field.Lithe != "" { + ui.Text(k, remoteMottyFieldName(language, field.Lithe)).FontSize(small).Grow(1.6).Basis(0).MinWidth(0).Ellipsis() + } else { + ui.Text(k, remoteMottySkipText(language, field.Skip)).FontSize(small).Color(a.colors.Subtle).Grow(1.6).Basis(0).MinWidth(0).Ellipsis() + } + ui.Row(k.Part("tag")).Width(110).Shrink(0).Children(func() { + ui.Spacer(k) + if field.Lithe != "" { + a.remoteTag(k.Part("imported"), i18n.Shared(language, "desktop.remote.import.field.imported"), a.colors.Success) + } else { + a.remoteTag(k.Part("skipped"), i18n.Shared(language, "desktop.remote.import.field.skipped"), a.theme.Danger) + } + }) + }) + } + }) +} + +// remoteMottyFieldName names the connection setting a Motty setting becomes, as the form names it. +func remoteMottyFieldName(language i18n.Language, field string) string { + switch field { + case "name": + return i18n.Shared(language, "desktop.remote.name") + case "host": + return i18n.Shared(language, "desktop.remote.host") + case "user": + return i18n.Shared(language, "desktop.remote.user") + case "port": + return i18n.Shared(language, "desktop.remote.port") + case "color": + return i18n.Shared(language, "desktop.remote.color") + case "group": + return i18n.Shared(language, "desktop.remote.group") + case "identityFile": + return i18n.Shared(language, "desktop.remote.identityFile") + case "keepAliveSeconds": + return i18n.Shared(language, "desktop.remote.keepAlive") + case "proxyJump": + return i18n.Shared(language, "desktop.remote.proxyJump") + case "authentication": + return i18n.Shared(language, "desktop.remote.import.field.authentication") + } + return field +} + +// remoteMottySkipText says why a Motty setting is not imported. +func remoteMottySkipText(language i18n.Language, skip core.RemoteMottySkip) string { + switch skip { + case core.RemoteMottySkipSecret: + return i18n.Shared(language, "desktop.remote.import.skip.secret") + case core.RemoteMottySkipProtocol: + return i18n.Shared(language, "desktop.remote.import.skip.protocol") + case core.RemoteMottySkipCommand: + return i18n.Shared(language, "desktop.remote.import.skip.command") + case core.RemoteMottySkipKerberos: + return i18n.Shared(language, "desktop.remote.import.skip.kerberos") + case core.RemoteMottySkipExtraKey: + return i18n.Shared(language, "desktop.remote.import.skip.extraKey") + case core.RemoteMottySkipInvalid: + return i18n.Shared(language, "desktop.remote.import.skip.invalid") + } + return i18n.Shared(language, "desktop.remote.import.skip.noSetting") +} + +// remoteImportNewGroups lists the groups the chosen Motty hosts bring that the list does not have, +// in Motty's order. +func (a *App) remoteImportNewGroups(m *remoteImporter) []string { + if m.source != remoteImportMotty || !m.keepGroups { + return nil + } + have := map[string]bool{} + for _, group := range a.remote.groups { + have[group] = true + } + var groups []string + for index, candidate := range m.motty.Candidates { + if index < len(m.mottyChosen) && m.mottyChosen[index] && candidate.Group != "" && !have[candidate.Group] { + have[candidate.Group] = true + groups = append(groups, candidate.Group) + } + } + return groups +} + +// remoteImportFooter declares what the import saves and the buttons that import or go back. func (a *App) remoteImportFooter(c ui.C, language i18n.Language, m *remoteImporter) { ui.Row(c).FillWidth().Items(ui.Center).Gap(8).Children(func() { count := m.chosen() - ui.Text(c, i18n.SharedFormat(language, "desktop.remote.import.footer", map[string]string{"count": strconv.Itoa(count)})). - FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Grow(1).MinWidth(0).Ellipsis() + text := i18n.SharedFormat(language, "desktop.remote.import.footer", map[string]string{"count": strconv.Itoa(count)}) + if groups := a.remoteImportNewGroups(m); len(groups) > 0 { + text = i18n.SharedFormat(language, "desktop.remote.import.footerGroups", map[string]string{ + "count": strconv.Itoa(count), "groupCount": strconv.Itoa(len(groups)), "groups": strings.Join(groups, ", "), + }) + } + ui.Text(c, text).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Grow(1).MinWidth(0).Ellipsis() if ui.Button(c.Part("cancel"), i18n.Shared(language, "desktop.remote.cancel")).Outline().Disabled(m.applying).Clicked() { c.After(a.leaveRemoteImport) } @@ -373,7 +620,7 @@ func (a *App) remoteImportFooter(c ui.C, language i18n.Language, m *remoteImport if m.applying { label = i18n.Shared(language, "desktop.remote.import.applying") } - if ui.Button(c.Part("apply"), label).Icon(icons.Download).Disabled(m.loading || m.applying || count == 0).Clicked() { + if ui.Button(c.Part("apply"), label).Disabled(m.loading || m.applying || count == 0).Clicked() { c.After(a.applyRemoteImport) } }) diff --git a/desktop/internal/workbench/remote_list.go b/desktop/internal/workbench/remote_list.go index 45863eda7..75a8bc724 100644 --- a/desktop/internal/workbench/remote_list.go +++ b/desktop/internal/workbench/remote_list.go @@ -130,6 +130,12 @@ func (a *App) clearRemoteSearch() { a.searchRemote() } +// remoteLive reports whether the connection id is connected now: a window has it open, or this +// window chooses a folder over its session. +func (a *App) remoteLive(id string) bool { + return a.remoteWindows(id) > 0 || (a.remote.browser != nil && a.remote.browser.entryID == id) +} + // remoteWindows is how many open windows work in a folder over the saved connection id. func (a *App) remoteWindows(id string) int { if a.sessions == nil { @@ -296,14 +302,15 @@ func (a *App) remoteAutoPlaceholder(language i18n.Language, value, fallback stri } // loadRemoteImportCounts counts the hosts Motty and ~/.ssh/config hold that can be imported, for -// the empty page's cards and the import menu. +// the empty page's cards and the import menu. Core compares them with the saved list, so a host +// already saved is not counted. func (a *App) loadRemoteImportCounts() { generation, kernel := a.remote.generation, a.kernel + document, failure := a.remote.source.Document() a.background(nil, remoteReadTimeout, func(ctx context.Context) func(*App) { counts := remoteImportCounts{loaded: true} - var failure error if dir, err := os.UserConfigDir(); err == nil { - hosts, err := kernel.RemoteMottyHosts(ctx, dir, nil) + hosts, err := kernel.RemoteMottyHosts(ctx, dir, document) if err != nil { failure = err } @@ -314,7 +321,7 @@ func (a *App) loadRemoteImportCounts() { } } if home, err := os.UserHomeDir(); err == nil { - hosts, err := kernel.RemoteSSHConfigHosts(ctx, home, nil) + hosts, err := kernel.RemoteSSHConfigHosts(ctx, home, document) if err != nil { failure = err } diff --git a/desktop/internal/workbench/remote_shell_view.go b/desktop/internal/workbench/remote_shell_view.go index 4b4c9c463..8b151ac9b 100644 --- a/desktop/internal/workbench/remote_shell_view.go +++ b/desktop/internal/workbench/remote_shell_view.go @@ -30,21 +30,23 @@ func (a *App) remoteView(c ui.C) { open := true ui.ModalWith(c, &open, a.remoteTitle(language), ui.ModalSpec{Width: remoteWindowWidth, Height: remoteWindowHeight}, func() { k := c.Part("remote") - switch { - case r.importer != nil: - a.remoteImportView(k, language, r.importer) - case r.trust != nil: - a.remoteTrustView(k, language, r.trust) - case r.browser != nil: - a.remoteBrowserView(k, r.browser) - default: - ui.Row(k).Fill().Children(func() { - a.remoteList(k, language) - ui.Column(k).Width(1).FillHeight().Shrink(0).Background(a.colors.Line) - page := k.Part("page") - ui.Column(page).Grow(1).Basis(0).MinWidth(0).FillHeight().Children(func() { a.remotePage(page, language) }) + ui.Row(k).Fill().Children(func() { + a.remoteList(k, language) + ui.Column(k).Width(1).FillHeight().Shrink(0).Background(a.colors.Line) + page := k.Part("page") + ui.Column(page).Grow(1).Basis(0).MinWidth(0).FillHeight().Children(func() { + switch { + case r.importer != nil: + a.remoteImportView(page, language, r.importer) + case r.trust != nil: + a.remoteTrustView(page, language, r.trust) + case r.browser != nil: + a.remoteBrowserView(page, r.browser) + default: + a.remotePage(page, language) + } }) - } + }) }, func() { k := c.Part("remote-footer") switch { @@ -72,13 +74,18 @@ func (a *App) remoteTitle(language i18n.Language) string { crumb := "" switch { case r.importer != nil: - crumb = i18n.Shared(language, "desktop.remote.import.title") + crumb = i18n.Shared(language, "desktop.remote.import.titleMotty") + if r.importer.source == remoteImportSSH { + crumb = i18n.Shared(language, "desktop.remote.import.titleSsh") + } case r.browser != nil: crumb = r.browser.name case r.steps != nil: crumb = r.steps.entry.Name case r.editing && r.entry(r.selected) == nil: crumb = i18n.Shared(language, "desktop.remote.newConnection") + case r.editing: + crumb = i18n.SharedFormat(language, "desktop.remote.editTitle", map[string]string{"name": r.entry(r.selected).Name}) case r.entry(r.selected) != nil: crumb = r.entry(r.selected).Name } @@ -162,10 +169,14 @@ func (a *App) remoteRows(k ui.C, language i18n.Language, title string, rows []re } }).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Label(title) if r.list.Changed() { - if at := r.list.Selected(); at >= 0 && at < len(rows) && rows[at].entry != nil && (rows[at].entry.ID != r.selected || r.editing || r.steps != nil) { + if at := r.list.Selected(); at >= 0 && at < len(rows) && rows[at].entry != nil && (rows[at].entry.ID != r.selected || r.editing || r.steps != nil || r.browser != nil || r.importer != nil) { id := rows[at].entry.ID c := k c.After(func() { + if !a.leaveRemoteFlows() { + r.syncListSelection() + return + } a.performed("remote.connection.select", surfaceButton) r.selectEntry(id) }) @@ -205,13 +216,22 @@ func (a *App) remoteEntryRow(row ui.ListRow, language i18n.Language, entry core. r := &a.remote rc := row.C small := a.theme.Metrics.FontSizeS - row.Element.Height(remoteRowHeight).Items(ui.Center).Gap(10).PadSides(0, 12, 0, 12) + row.Element.Height(remoteRowHeight).Items(ui.Center).Gap(9).PadSides(0, 12, 0, 0).Radius(6) + if entry.ID == r.selected { + row.Element.Background(a.colors.Selection) + } + // The stripe on the left is the connection's color; a connection without one keeps the + // stripe's room so the rows stay aligned. + stripe := ui.Row(rc.Part("stripe")).Width(3).Height(remoteRowHeight - 14).Shrink(0).Radius(1.5) + if tint, marked := remoteColor(a.colors.Dark, entry.Color); marked { + stripe.Background(tint) + } a.remoteTile(rc.Part("tile"), remoteSystemMark(r.probedOutcome(entry.Connection)), entry.Name, entry.Color, 26, 10) ui.Column(rc).Grow(1).Basis(0).MinWidth(0).Gap(2).Children(func() { ui.Text(rc, entry.Name).Weight(gfx.WeightMedium).Ellipsis().MinWidth(0) ui.Text(rc, remoteAddress(entry.Connection)).Mono().FontSize(small).Color(a.colors.Subtle).Ellipsis().MinWidth(0) }) - if a.remoteWindows(entry.ID) > 0 { + if a.remoteLive(entry.ID) { ui.Row(rc.Part("live")).Shrink(0).Items(ui.Center).Gap(5).Children(func() { a.remoteDot(rc.Part("dot"), a.colors.Success, 6) ui.Text(rc, i18n.Shared(language, "desktop.remote.connectedNow")).FontSize(small).Color(a.colors.Success) diff --git a/desktop/internal/workbench/remote_test.go b/desktop/internal/workbench/remote_test.go index a3ababa75..75822d6c0 100644 --- a/desktop/internal/workbench/remote_test.go +++ b/desktop/internal/workbench/remote_test.go @@ -522,7 +522,8 @@ func TestRemoteTestAsksInTheWindowAndReportsTheHost(t *testing.T) { key = "desktop.remote.probe.connected" } platform := map[string]string{"system": result.Host.System, "machine": result.Host.Machine} - if !h.showsWrapped(i18n.SharedFormat(lang, key, platform)) || !h.shows(i18n.Shared(lang, "desktop.remote.probe.cpu")) { + usable := result.Status != core.RemoteProbeConnected || h.shows(i18n.Shared(lang, "desktop.remote.probe.usable")) + if !h.showsWrapped(i18n.SharedFormat(lang, key, platform)) || !usable { t.Fatalf("the window does not show the platform the host reported (%s)", result.Status) } @@ -575,3 +576,69 @@ func TestRemoteTestStopsWithTheWindow(t *testing.T) { t.Fatalf("open = %v, probe = %v, result = %+v after closing", r.open, r.probe, r.result) } } + +// importCountKernel answers the import lists the way Core does for hosts already saved: a host is +// "exists" once the saved list it is handed holds it. Nothing runs ssh or reads the account's files. +type importCountKernel struct { + *testKernel + documents []*string +} + +func (k *importCountKernel) RemoteSSHConfigHosts(_ context.Context, _ string, document *string) (core.RemoteSSHConfigHosts, error) { + k.documents = append(k.documents, document) + var hosts core.RemoteSSHConfigHosts + for _, alias := range []string{"alpha", "beta"} { + status := core.RemoteImportable + if document != nil && strings.Contains(*document, `"`+alias+`"`) { + status = core.RemoteImportExists + } + hosts.Hosts = append(hosts.Hosts, core.RemoteSSHConfigHost{Alias: alias, Status: status}) + } + return hosts, nil +} + +func (k *importCountKernel) RemoteMottyHosts(context.Context, string, *string) (core.RemoteMottyHosts, error) { + return core.RemoteMottyHosts{Unavailable: core.RemoteMottyMissing}, nil +} + +// The empty page's import counts leave out the hosts already saved, and follow the list each time +// a save changes it. +func TestRemoteImportCountsLeaveOutSavedHosts(t *testing.T) { + kernel := &importCountKernel{testKernel: &testKernel{Client: core.NewClient()}} + h, _ := remoteHarnessWith(t, kernel) + r := &h.app.remote + h.settle() + if !r.imports.loaded || r.imports.sshConfig != 2 { + t.Fatalf("counts = %+v, want both hosts", r.imports) + } + h.clickLabeled(i18n.Shared(h.app.language(), "desktop.remote.new")) + r.form.host.SetText("alpha") + r.form.user.SetText("dev") + h.redraw() + h.clickLabeled(i18n.Shared(h.app.language(), "desktop.remote.save")) + h.settle() + h.settle() + if r.err != "" || len(r.source.Connections) != 1 { + t.Fatalf("saving: %q, %d saved", r.err, len(r.source.Connections)) + } + if r.imports.sshConfig != 1 { + t.Fatalf("counts = %+v after saving alpha, want only beta", r.imports) + } +} + +// The import's footer names only the groups the chosen Motty hosts bring that the list lacks, once +// each in Motty's order, and none when the import does not keep groups. +func TestRemoteImportNewGroupsAreTheChosenOnesTheListLacks(t *testing.T) { + app := &App{} + app.remote.groups = []string{"Production"} + m := &remoteImporter{source: remoteImportMotty, keepGroups: true, motty: core.RemoteMottyHosts{Candidates: []core.RemoteMottyCandidate{ + {Key: "1", Group: "Production"}, {Key: "2", Group: "Staging"}, {Key: "3", Group: "Lab"}, {Key: "4", Group: "Staging"}, {Key: "5"}, + }}, mottyChosen: []bool{true, true, false, true, true}} + if got, want := app.remoteImportNewGroups(m), []string{"Staging"}; !slices.Equal(got, want) { + t.Fatalf("new groups = %q, want %q", got, want) + } + m.keepGroups = false + if got := app.remoteImportNewGroups(m); got != nil { + t.Fatalf("new groups without keeping groups = %q", got) + } +} diff --git a/desktop/internal/workbench/remote_trust.go b/desktop/internal/workbench/remote_trust.go index cb0a11a9e..48b2bca97 100644 --- a/desktop/internal/workbench/remote_trust.go +++ b/desktop/internal/workbench/remote_trust.go @@ -113,55 +113,63 @@ func (a *App) decideRemoteTrust(trusted bool) { }) } -// remoteTrustView declares the question. +// remoteTrustView declares the question: the folder on its host, what trusting it lets run, what +// each answer opens it with, and whether to trust the folders beside it too. func (a *App) remoteTrustView(c ui.C, language i18n.Language, t *remoteTrustPrompt) { small := a.theme.Metrics.FontSizeS of := t.trust.State.WorkspaceTrust - notice, border := gfx.RGB24(0xFFF6E9), gfx.RGB24(0xF4CD9A) - if a.colors.Dark { - notice, border = gfx.RGB24(0x44321D), gfx.RGB24(0x694820) - } ui.Scroll(c.Part("trust")).Fill().Children(func() { - ui.Column(c).FillWidth().Items(ui.Center).PadSides(48, 32, 32, 32).Children(func() { - ui.Column(c.Part("card")).Width(520).Gap(16).Children(func() { - ui.Row(c).Size(40, 40).Center().Radius(10).Background(a.colors.Accent.WithAlpha(0.14)).Children(func() { - ui.Icon(c, icons.ShieldCheck).Size(20, 20).Color(a.colors.Accent) - }) - ui.Column(c).FillWidth().Gap(6).Children(func() { - ui.Text(c, i18n.Shared(language, "desktop.remote.trust.title")).FontSize(16).Weight(gfx.WeightSemibold) - ui.Paragraph(c, i18n.SharedFormat(language, "desktop.remote.trust.body", map[string]string{"folder": t.dir, "name": t.browser.name}), 4).Color(a.colors.Subtle) - }) - ui.Row(c.Part("folder")).FillWidth().Items(ui.Center).Gap(8).Pad(10).Radius(6).Stroke(1, a.colors.Line).Children(func() { - ui.Icon(c, icons.Folder).Size(14, 14).Shrink(0).Color(a.colors.Subtle) - ui.Text(c, t.dir).Mono().FontSize(small).Ellipsis().Grow(1).MinWidth(0) + ui.Column(c).FillWidth().Items(ui.Center).PadSides(28, 32, 32, 32).Children(func() { + ui.Row(c.Part("card")).Width(560).Gap(14).Children(func() { + ui.Row(c.Part("mark")).Size(40, 40).Shrink(0).Center().Radius(8).Background(a.colors.Warning).Children(func() { + ui.Text(c, "!").FontSize(16).Weight(gfx.WeightBold).Color(gfx.RGB24(0xFFFFFF)) }) - ui.Row(c.Part("safe")).FillWidth().Gap(8).Pad(10).Radius(6).Background(notice).Stroke(1, border).Children(func() { - ui.Icon(c, icons.Info).Size(14, 14).Shrink(0).Color(a.colors.Warning) - ui.Paragraph(c, i18n.Shared(language, "desktop.remote.trust.safe"), 4).FontSize(small).Grow(1).MinWidth(0) + ui.Column(c).Grow(1).Basis(0).MinWidth(0).Gap(12).Children(func() { + ui.Column(c).FillWidth().Gap(6).Children(func() { + ui.Text(c, i18n.Shared(language, "desktop.remote.trust.title")).FontSize(16).Weight(gfx.WeightSemibold) + ui.Text(c, remoteAddress(t.browser.connection)+" : "+t.dir).Mono().FontSize(small).Ellipsis().Shrink(1).MinWidth(0) + }) + ui.Paragraph(c.Part("body"), i18n.Shared(language, "desktop.remote.trust.body"), 6).FontSize(small).Color(a.colors.Subtle) + ui.Column(c.Part("choices")).FillWidth().Gap(4).Pad(12).Radius(8).Stroke(1, a.colors.Line).Children(func() { + a.remoteTrustChoice(c.Part("full"), language, i18n.Shared(language, "desktop.remote.trust.trustOpen"), i18n.Shared(language, "desktop.remote.trust.full")) + a.remoteTrustChoice(c.Part("safe"), language, i18n.Shared(language, "desktop.remote.trust.safeOpen"), i18n.Shared(language, "desktop.remote.trust.safe")) + }) + if of != nil && of.OfferedLocation != nil { + ui.Checkbox(c.Part("parent"), &t.parent, i18n.SharedFormat(language, "desktop.remote.trust.parent", map[string]string{"parent": *of.OfferedLocation})). + Disabled(t.deciding) + } + if t.err != "" { + a.remoteNotice(c.Part("error"), icons.CircleX, a.theme.Danger, t.err) + } }) - if of != nil && of.OfferedLocation != nil { - ui.Checkbox(c.Part("parent"), &t.parent, i18n.SharedFormat(language, "desktop.remote.trust.parent", map[string]string{"parent": *of.OfferedLocation})). - Disabled(t.deciding) - } - if t.err != "" { - a.remoteNotice(c.Part("error"), icons.CircleX, a.theme.Danger, t.err) - } }) }) }) } -// remoteTrustFooter declares the question's answers. +// remoteTrustChoice declares an answer's name in bold, then effect, what the folder opens with. +func (a *App) remoteTrustChoice(c ui.C, language i18n.Language, choice, effect string) { + small := a.theme.Metrics.FontSizeS + ui.Row(c).FillWidth().Items(ui.Start).Gap(0).Children(func() { + ui.Text(c, i18n.SharedFormat(language, "desktop.remote.trust.choice", map[string]string{"choice": choice})). + FontSize(small).Weight(gfx.WeightSemibold).Shrink(0) + ui.Paragraph(c, effect, 3).FontSize(small).Grow(1).Basis(0).MinWidth(0) + }) +} + +// remoteTrustFooter declares where the answer is kept and the question's answers. func (a *App) remoteTrustFooter(c ui.C, language i18n.Language, t *remoteTrustPrompt) { ui.Row(c).FillWidth().Items(ui.Center).Gap(8).Children(func() { + ui.Icon(c, icons.Info).Size(14, 14).Shrink(0).Color(a.colors.Subtle) + ui.Text(c, i18n.Shared(language, "desktop.remote.trust.local")).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Ellipsis().Shrink(1).MinWidth(0) + ui.Spacer(c) if ui.Button(c.Part("back"), i18n.Shared(language, "desktop.remote.trust.back")).Outline().Disabled(t.deciding).Clicked() { c.After(a.leaveRemoteTrust) } - ui.Spacer(c) if ui.Button(c.Part("safe"), i18n.Shared(language, "desktop.remote.trust.safeOpen")).Outline().Disabled(t.deciding).Clicked() { c.After(func() { a.decideRemoteTrust(false) }) } - if ui.Button(c.Part("trust"), i18n.Shared(language, "desktop.remote.trust.trustOpen")).Icon(icons.ShieldCheck).Disabled(t.deciding).Clicked() { + if ui.Button(c.Part("trust"), i18n.Shared(language, "desktop.remote.trust.trustOpen")).Disabled(t.deciding).Clicked() { c.After(func() { a.decideRemoteTrust(true) }) } }) diff --git a/desktop/internal/workbench/remote_view.go b/desktop/internal/workbench/remote_view.go index 2657b71fd..9faa3c075 100644 --- a/desktop/internal/workbench/remote_view.go +++ b/desktop/internal/workbench/remote_view.go @@ -168,24 +168,53 @@ func (a *App) remoteFields(c ui.C) { a.remoteHops(k, language, disabled) }) }) - ui.Collapsible(c.Part("advanced"), &f.advanced, i18n.Shared(language, "desktop.remote.advanced"), func() { + // The advanced options fold under a line; folded, the header says what they are now, so + // the form need not open to show them. + timeout := a.remoteAutoPlaceholder(language, effective.timeout, i18n.Shared(language, "desktop.remote.timeoutPlaceholder")) + keepAlive := a.remoteAutoPlaceholder(language, effective.keepAlive, i18n.Shared(language, "desktop.remote.keepAlivePlaceholder")) + ui.Row(c.Part("advanced-line")).FillWidth().Height(1).Shrink(0).Background(a.colors.Line) + head := c.Part("advanced") + ui.Row(head).FillWidth().Items(ui.Center).Gap(6).Children(func() { + icon := icons.ChevronRight + if f.advanced.Open { + icon = icons.ChevronDown + } + if ui.Button(head.Part("fold"), i18n.Shared(language, "desktop.remote.advanced")).Icon(icon).Ghost().Shrink(0).Clicked() { + c.After(func() { f.advanced.Open = !f.advanced.Open }) + } + if !f.advanced.Open { + ui.Text(head, i18n.SharedFormat(language, "desktop.remote.advancedSummary", map[string]string{ + "timeout": remoteSecondsOr(language, f.timeout.Text(), timeout), + "keepAlive": remoteSecondsOr(language, f.keepAlive.Text(), keepAlive), + })).FontSize(a.theme.Metrics.FontSizeS).Color(a.colors.Subtle).Ellipsis().MinWidth(0) + } + }) + if f.advanced.Open { k := c.Part("advanced-fields") ui.Column(k).FillWidth().Gap(14).PadTop(4).Children(func() { ui.Row(k.Part("line-timing")).FillWidth().Gap(14).Items(ui.Start).Children(func() { label := i18n.Shared(language, "desktop.remote.timeout") a.remoteCell(k.Part("connectTimeoutSeconds"), "connectTimeoutSeconds", label, "", 0, func(k ui.C) { - text(k, label, a.remoteAutoPlaceholder(language, effective.timeout, i18n.Shared(language, "desktop.remote.timeoutPlaceholder")), &f.timeout) + text(k, label, timeout, &f.timeout) }) label = i18n.Shared(language, "desktop.remote.keepAlive") a.remoteCell(k.Part("keepAliveSeconds"), "keepAliveSeconds", label, i18n.Shared(language, "desktop.remote.keepAliveHelp"), 0, func(k ui.C) { - text(k, label, a.remoteAutoPlaceholder(language, effective.keepAlive, i18n.Shared(language, "desktop.remote.keepAlivePlaceholder")), &f.keepAlive) + text(k, label, keepAlive, &f.keepAlive) }) }) }) - }) + } }) } +// remoteSecondsOr is a typed number of seconds as "N seconds", or fallback when the field is empty. +func remoteSecondsOr(language i18n.Language, typed, fallback string) string { + if typed = strings.TrimSpace(typed); typed != "" { + return i18n.SharedFormat(language, "desktop.remote.seconds", map[string]string{"count": typed}) + } + return fallback +} + // remoteSwatches declares the color choices: none, then Core's colors, as one stop of Tab that // the arrows move through. func (a *App) remoteSwatches(c ui.C, language i18n.Language, disabled bool) { diff --git a/desktop/internal/workbench/remote_workspace_test.go b/desktop/internal/workbench/remote_workspace_test.go index 5af189b2b..ae8f07aa2 100644 --- a/desktop/internal/workbench/remote_workspace_test.go +++ b/desktop/internal/workbench/remote_workspace_test.go @@ -309,10 +309,11 @@ func (h *harness) openBrowsedProject(t *testing.T, b *remoteBrowser) *project { if got := b.target(); got != remoteTestHome+"/project" { t.Fatalf("Open would open %q, want the selected folder", got) } - if !h.shows(i18n.SharedFormat(h.app.language(), "desktop.remote.browse.target", map[string]string{"path": remoteTestHome + "/project"})) { - t.Fatal("the footer does not show the folder Open opens") + open := i18n.SharedFormat(h.app.language(), "desktop.remote.browse.open", map[string]string{"name": "project"}) + if !h.shows(open) { + t.Fatal("Open does not name the folder it opens") } - h.clickFront(i18n.Shared(h.app.language(), "desktop.remote.browse.open")) + h.clickFront(open) h.await("the workspace's tree and first heartbeat", func() bool { p := h.app.project return p != nil && p.remote != nil && !p.remote.beating && p.tree.root != nil && p.tree.root.listed && !p.tree.reading @@ -332,9 +333,12 @@ func TestRemoteWorkspaceOpensTheChosenFolder(t *testing.T) { if got, want := b.folders, []string{"linked", "project", ".cache"}; !slices.Equal(got, want) { t.Fatalf("listed %q, want %q", got, want) } - if !h.shows(i18n.SharedFormat(lang, "desktop.remote.browse.connected", map[string]string{"name": remoteTestHost})) || - !h.showsWrapped(remoteSkippedText(lang, 1)) || h.shows("notes.txt") { - t.Fatal("the browser does not show the connection with the home folder's subfolders") + if got, want := b.files, []string{"notes.txt"}; !slices.Equal(got, want) { + t.Fatalf("listed files %q, want %q", got, want) + } + if !h.shows(i18n.SharedFormat(lang, "desktop.remote.browse.title", map[string]string{"name": remoteTestHost})) || + !h.showsWrapped(remoteSkippedText(lang, 1)) || !h.shows("notes.txt") { + t.Fatal("the browser does not show the connection with the home folder's entries") } if servers := k.servers[0]; len(servers) != 1 || servers[0].Path != "/bundle/lithe-server" { t.Fatalf("connected with %+v, want the client's server builds", servers) @@ -556,3 +560,24 @@ func TestRemoteBrowserBackEndsTheSession(t *testing.T) { t.Fatalf("logged a host path: %s", event) } } + +// After a listing the folder page tags the subfolders holding a .git entry, a folder or a +// worktree's file, and leaves the others untagged. +func TestRemoteBrowserTagsGitRepositories(t *testing.T) { + h, k, _, _ := remoteWorkspaceHarness(t) + k.set(func(k *remoteHostKernel) { + k.kinds = map[string]core.RemoteFileKind{ + remoteTestHome + "/project/.git": core.RemoteFileKindDirectory, + remoteTestHome + "/linked/.git": core.RemoteFileKindFile, + } + }) + b := h.connectAndBrowse(t) + h.await("the Git tags", func() bool { return b.repositories != nil }) + h.settle() + if !b.repositories["project"] || !b.repositories["linked"] || b.repositories[".cache"] { + t.Fatalf("repositories = %v, want project and linked", b.repositories) + } + if !h.shows(i18n.Shared(h.app.language(), "desktop.remote.browse.git")) { + t.Fatal("the folder list does not tag the repositories") + } +} diff --git a/desktop/internal/workbench/remote_workspace_visual_test.go b/desktop/internal/workbench/remote_workspace_visual_test.go index a8298d6a1..0eadc766d 100644 --- a/desktop/internal/workbench/remote_workspace_visual_test.go +++ b/desktop/internal/workbench/remote_workspace_visual_test.go @@ -88,7 +88,7 @@ func TestVisualRemoteWorkspace(t *testing.T) { } shot("browse") - h.clickFront(i18n.Shared(h.app.language(), "desktop.remote.browse.open")) + h.clickFront(i18n.SharedFormat(h.app.language(), "desktop.remote.browse.open", map[string]string{"name": "project"})) h.await("the remote workspace's tree", func() bool { p := h.app.project return p != nil && p.remote != nil && !p.remote.beating && p.tree.root != nil && p.tree.root.listed && !p.tree.reading diff --git a/docs/assets/remote-connections/README.md b/docs/assets/remote-connections/README.md index d1decbea6..da35e7517 100644 --- a/docs/assets/remote-connections/README.md +++ b/docs/assets/remote-connections/README.md @@ -5,7 +5,8 @@ - “测试连接”的结果:由测试替换的内核返回固定的主机信息; - `ssh -G` 解析出的生效设置; - 空页面上 Motty 和 `~/.ssh/config` 的可导入数量; -- 导入页的 Motty 主机; +- 导入页的 Motty 主机、逐项字段映射和 `~/.ssh/config` 的主机; +- 选文件夹页的远程目录; - OpenSSH 的主机密钥和密码询问。 截图里的主机、用户、指纹和路径都是虚构的。截图覆盖深色与浅色主题、中文与英文界面,用于确认: @@ -15,20 +16,38 @@ - “从 Motty 导入”和“从 ~/.ssh/config 导入”两张卡片,各显示可导入的主机数; - “手动填写”。 - **列表与概览:** 连接按 Core 给出的分组列出,分组可以折叠。每行显示: + - 左侧一条连接颜色的竖条,选中的行带选中底色; - 图标:测过的主机显示系统名的前两个字母(Ubuntu 显示“Ub”),没测过的显示名称首字母,都用连接的颜色; - - 名称、地址和上次连接时间。 + - 名称、地址,右侧是上次连接时间;已有窗口打开它、或正在为它选文件夹时,显示绿点和“已连接”。 - **概览页:** 选中连接后右侧显示: - 顶部:图标、颜色点、名称、分组标签,地址后跟跳板机; - 按钮:“编辑”、“⋯”和“打开文件夹…”; - 各区块:“最近打开的文件夹”、“主机信息”(主机名、系统、CPU、内存、磁盘,以及测试时间和“重新测试”)、“生效的 SSH 设置”。生效设置逐项列出 `ssh -G` 解析出的值和来源(本连接 / SSH 配置 / 默认值)。 -- **编辑与新建:** 在表单中编辑连接,高级选项可以展开。主机字段填了 `user@host` 时,Core 拒绝的原因显示在主机字段下方,连接不会写入列表。测试失败时,结果显示在表单顶部,OpenSSH 的原始诊断默认展开。 +- **编辑与新建:** 面包屑显示“编辑 <名称>”或“新建连接”。高级选项折叠在分隔线下,折叠时标题旁显示当前的连接超时和保活间隔,可以展开编辑。主机字段填了 `user@host` 时,Core 拒绝的原因显示在主机字段下方,连接不会写入列表。 +- **测试结果:** 显示在表单最下方、高级选项之后: + - 成功:绿色框,“已连接:<系统> <架构>,这台主机可以用于远程开发。”,下面一行小标签列出系统、主机名、核数、内存和磁盘;右侧“OpenSSH 输出”展开原始输出; + - 失败:红色框,失败原因和该检查什么(例如身份验证失败时提示检查用户名、或改用“私钥文件”);OpenSSH 的原始输出默认展开在框下方,右侧“收起”。 - **连接步骤:** 依次为读取配置、连接主机、身份验证、检查平台、安装服务端、启动会话: - OpenSSH 的主机密钥询问显示在“连接主机”下方,带密钥类型和指纹,按钮为“拒绝”和“信任并继续”; - 密码询问显示在“身份验证”下方; - 失败时标出失败的步骤并展开诊断。 - **SSH 密码询问(弹窗):** 窗口上方弹出“SSH 身份验证”,提示原样显示。 -- **信任文件夹:** 第一次打开远程文件夹时询问是否信任,可以选择只信任这个文件夹或信任它的上级目录。 -- **导入:** 页面右上角在 Motty 和 `~/.ssh/config` 之间切换,并显示数据来源路径。可以选择保留分组和保留颜色。每台主机标出状态(可导入 / 部分导入 / 已存在 / 非 SSH),不能导入的主机不能勾选。底部显示已选择的数量。 +- **选文件夹:** 左侧连接列表保留,面包屑显示连接名称。右侧: + - 顶部:系统图标、“选择 … 上的文件夹”、连接状态、地址和系统,右侧“断开”; + - 路径输入框和“前往”,下方是“常用”位置和可点击的路径面包屑; + - 目录列表:“上一级”,文件夹双击进入,文件灰显、不能选;含 `.git`(目录或工作树的文件)的子文件夹标“Git”。列表显示后,桌面端用 Core 已有的 `remote.stat` 查看前 64 个子文件夹,最多 8 个并行; + - 底部按钮为“稍后再选”和“打开 <文件夹名>”。 +- **信任文件夹:** 第一次打开远程文件夹时询问是否信任: + - 标题下方用等宽字体显示 `主机 : 路径`,正文说明信任后会在远端运行哪些程序; + - 两种打开方式的说明框:“信任并打开”是完整功能,“以安全模式打开”只浏览和编辑文件; + - 可以勾选信任上级目录;底部注明信任记录只保存在本机。 +- **从 Motty 导入:** 左侧连接列表保留,面包屑显示“从 Motty 导入”。 + - 顶部在 Motty 和 SSH 配置之间切换,旁边注明只读,ⓘ 说明读取的数据库、不打开密钥库;右侧“重新读取”; + - 汇总行显示找到的主机数、分组数和数据格式,以及“保留分组”“保留颜色”; + - 表格列出主机(颜色点、系统图标、名称和地址)、分组和结果(可导入 / 部分导入 / 已存在 / 非 SSH)。已保存的主机勾选后只补颜色和分组; + - 展开一台主机后逐项列出 Motty 的设置、值、对应的 Lithe 设置,或不导入的原因; + - 底部显示将导入的连接数和将新建的分组。 +- **从 SSH 配置导入:** 表格列出 Host 别名、`ssh -G` 解析出的生效值和结果。被其他主机用作跳板的主机注明“作为 … 的 ProxyJump”;通配符 Host 跳过并说明原因。 截图不能代替 macOS/Windows 原生窗口验收。 @@ -40,11 +59,14 @@ | 新建连接:新分组,主机字段被拒绝 | [浅色英文](remote-connections-refused-light-en-US.png) | [深色中文](remote-connections-refused-dark-zh-CN.png) | | SSH 密码询问(弹窗) | [浅色英文](remote-connections-password-light-en-US.png) | [深色中文](remote-connections-password-dark-zh-CN.png) | | 测试失败,诊断展开 | [浅色英文](remote-connections-test-failed-light-en-US.png) | [深色中文](remote-connections-test-failed-dark-zh-CN.png) | +| 测试成功,主机信息标签 | [浅色英文](remote-connections-test-ok-light-en-US.png) | [深色中文](remote-connections-test-ok-dark-zh-CN.png) | | 连接步骤:主机密钥询问 | [浅色英文](remote-connections-steps-host-key-light-en-US.png) | [深色中文](remote-connections-steps-host-key-dark-zh-CN.png) | | 连接步骤:密码询问 | [浅色英文](remote-connections-steps-password-light-en-US.png) | [深色中文](remote-connections-steps-password-dark-zh-CN.png) | | 连接步骤:失败 | [浅色英文](remote-connections-steps-failed-light-en-US.png) | [深色中文](remote-connections-steps-failed-dark-zh-CN.png) | | 是否信任远程文件夹 | [浅色英文](remote-connections-trust-light-en-US.png) | [深色中文](remote-connections-trust-dark-zh-CN.png) | -| 从 Motty 导入 | [浅色英文](remote-connections-import-light-en-US.png) | [深色中文](remote-connections-import-dark-zh-CN.png) | +| 从 Motty 导入(展开字段映射) | [浅色英文](remote-connections-import-light-en-US.png) | [深色中文](remote-connections-import-dark-zh-CN.png) | +| 从 SSH 配置导入 | [浅色英文](remote-connections-import-ssh-light-en-US.png) | [深色中文](remote-connections-import-ssh-dark-zh-CN.png) | +| 选择远程文件夹 | [浅色英文](remote-connections-folder-light-en-US.png) | [深色中文](remote-connections-folder-dark-zh-CN.png) | 复验方法:在仓库根目录把 `LITHE_VISUAL_OUTPUT_DIR` 设为绝对路径 `"$(pwd)/docs/assets/remote-connections"`,然后在 `desktop/` 下运行 `../scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench -run '^TestVisualRemoteConnections$' -count=1 -timeout 300s`。 diff --git a/docs/assets/remote-connections/remote-connections-edit-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-edit-dark-zh-CN.png index 19125778e..d30443032 100644 Binary files a/docs/assets/remote-connections/remote-connections-edit-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-edit-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-edit-light-en-US.png b/docs/assets/remote-connections/remote-connections-edit-light-en-US.png index cfd20b232..a85bbe7c8 100644 Binary files a/docs/assets/remote-connections/remote-connections-edit-light-en-US.png and b/docs/assets/remote-connections/remote-connections-edit-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-folder-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-folder-dark-zh-CN.png new file mode 100644 index 000000000..d34aab8c7 Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-folder-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-folder-light-en-US.png b/docs/assets/remote-connections/remote-connections-folder-light-en-US.png new file mode 100644 index 000000000..065614900 Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-folder-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-import-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-import-dark-zh-CN.png index 8a8bca300..cdcc40ff3 100644 Binary files a/docs/assets/remote-connections/remote-connections-import-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-import-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-import-light-en-US.png b/docs/assets/remote-connections/remote-connections-import-light-en-US.png index d05854da1..254b38a1c 100644 Binary files a/docs/assets/remote-connections/remote-connections-import-light-en-US.png and b/docs/assets/remote-connections/remote-connections-import-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-import-ssh-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-import-ssh-dark-zh-CN.png new file mode 100644 index 000000000..0bf5a50c2 Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-import-ssh-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-import-ssh-light-en-US.png b/docs/assets/remote-connections/remote-connections-import-ssh-light-en-US.png new file mode 100644 index 000000000..7139506d9 Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-import-ssh-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-overview-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-overview-dark-zh-CN.png index 7781b3fac..34d59ac32 100644 Binary files a/docs/assets/remote-connections/remote-connections-overview-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-overview-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-overview-light-en-US.png b/docs/assets/remote-connections/remote-connections-overview-light-en-US.png index 3b8c287d5..4a2cc9e1e 100644 Binary files a/docs/assets/remote-connections/remote-connections-overview-light-en-US.png and b/docs/assets/remote-connections/remote-connections-overview-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-password-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-password-dark-zh-CN.png index 8cad61045..080863c9f 100644 Binary files a/docs/assets/remote-connections/remote-connections-password-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-password-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-password-light-en-US.png b/docs/assets/remote-connections/remote-connections-password-light-en-US.png index 78d873884..ceb5ed81e 100644 Binary files a/docs/assets/remote-connections/remote-connections-password-light-en-US.png and b/docs/assets/remote-connections/remote-connections-password-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-refused-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-refused-dark-zh-CN.png index 6115811f1..7698ab67b 100644 Binary files a/docs/assets/remote-connections/remote-connections-refused-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-refused-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-refused-light-en-US.png b/docs/assets/remote-connections/remote-connections-refused-light-en-US.png index 176fdb33f..5c868f61c 100644 Binary files a/docs/assets/remote-connections/remote-connections-refused-light-en-US.png and b/docs/assets/remote-connections/remote-connections-refused-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-failed-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-steps-failed-dark-zh-CN.png index b25da7e31..3cd853215 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-failed-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-steps-failed-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-failed-light-en-US.png b/docs/assets/remote-connections/remote-connections-steps-failed-light-en-US.png index 314c7094f..07a6fce38 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-failed-light-en-US.png and b/docs/assets/remote-connections/remote-connections-steps-failed-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-host-key-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-steps-host-key-dark-zh-CN.png index c8b2f9fd4..16f330ca2 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-host-key-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-steps-host-key-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-host-key-light-en-US.png b/docs/assets/remote-connections/remote-connections-steps-host-key-light-en-US.png index be69a1e53..68e3b6697 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-host-key-light-en-US.png and b/docs/assets/remote-connections/remote-connections-steps-host-key-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-password-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-steps-password-dark-zh-CN.png index 65a6f91fc..5aa4b7b1b 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-password-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-steps-password-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-steps-password-light-en-US.png b/docs/assets/remote-connections/remote-connections-steps-password-light-en-US.png index 73bc3a22d..a1e9f6b86 100644 Binary files a/docs/assets/remote-connections/remote-connections-steps-password-light-en-US.png and b/docs/assets/remote-connections/remote-connections-steps-password-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-test-failed-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-test-failed-dark-zh-CN.png index aa2b2e061..e1fc5b212 100644 Binary files a/docs/assets/remote-connections/remote-connections-test-failed-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-test-failed-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-test-failed-light-en-US.png b/docs/assets/remote-connections/remote-connections-test-failed-light-en-US.png index be8a2bb57..79d3e3088 100644 Binary files a/docs/assets/remote-connections/remote-connections-test-failed-light-en-US.png and b/docs/assets/remote-connections/remote-connections-test-failed-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-test-ok-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-test-ok-dark-zh-CN.png new file mode 100644 index 000000000..2bd1ee336 Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-test-ok-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-test-ok-light-en-US.png b/docs/assets/remote-connections/remote-connections-test-ok-light-en-US.png new file mode 100644 index 000000000..eb59a29fa Binary files /dev/null and b/docs/assets/remote-connections/remote-connections-test-ok-light-en-US.png differ diff --git a/docs/assets/remote-connections/remote-connections-trust-dark-zh-CN.png b/docs/assets/remote-connections/remote-connections-trust-dark-zh-CN.png index 1b7ae231c..9867abc3f 100644 Binary files a/docs/assets/remote-connections/remote-connections-trust-dark-zh-CN.png and b/docs/assets/remote-connections/remote-connections-trust-dark-zh-CN.png differ diff --git a/docs/assets/remote-connections/remote-connections-trust-light-en-US.png b/docs/assets/remote-connections/remote-connections-trust-light-en-US.png index 2606c7f97..5fe8ab86f 100644 Binary files a/docs/assets/remote-connections/remote-connections-trust-light-en-US.png and b/docs/assets/remote-connections/remote-connections-trust-light-en-US.png differ diff --git a/shared/i18n/features/remote-connections.json b/shared/i18n/features/remote-connections.json index 223e4d752..80b24568a 100644 --- a/shared/i18n/features/remote-connections.json +++ b/shared/i18n/features/remote-connections.json @@ -421,6 +421,40 @@ "total": "string" } }, + { + "id": "desktop.remote.probe.usable", + "description": "Remote Development window, test outcome: follows the bold 'Connected: Linux x86_64' on the same line, so it starts with the punctuation that joins the two", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.probe.hostNameTag", + "description": "Remote Development window, test outcome: tag with the name of the machine that answered", + "platforms": [ + "desktop" + ], + "parameters": { + "name": "string" + } + }, + { + "id": "desktop.remote.probe.memoryTag", + "description": "Remote Development window, test outcome: tag with the host's memory", + "platforms": [ + "desktop" + ], + "parameters": { + "size": "string" + } + }, + { + "id": "desktop.remote.probe.hideOutput", + "description": "Remote Development window, test outcome: link that hides OpenSSH's output under the outcome", + "platforms": [ + "desktop" + ] + }, { "id": "desktop.remote.diagnostics", "description": "Remote Development window: heading over the OpenSSH output of a failed test", @@ -658,13 +692,10 @@ }, { "id": "desktop.remote.browse.connected", - "description": "Remote Development window, folder browser after connecting: heading with the connection's name", + "description": "Remote Development window, folder page after connecting: green tag saying the host is connected", "platforms": [ "desktop" - ], - "parameters": { - "name": "string" - } + ] }, { "id": "desktop.remote.browse.path", @@ -682,21 +713,7 @@ }, { "id": "desktop.remote.browse.up", - "description": "Remote Development window, folder browser after connecting: accessible label and tooltip of the button that lists the parent folder", - "platforms": [ - "desktop" - ] - }, - { - "id": "desktop.remote.browse.refresh", - "description": "Remote Development window, folder browser after connecting: accessible label and tooltip of the button that lists the folder again", - "platforms": [ - "desktop" - ] - }, - { - "id": "desktop.remote.browse.recent", - "description": "Remote Development window, folder browser after connecting: heading of the folders opened over this connection before", + "description": "Remote Development window, folder page after connecting: first row of the folder list, which lists the parent folder", "platforms": [ "desktop" ] @@ -710,34 +727,27 @@ }, { "id": "desktop.remote.browse.empty", - "description": "Remote Development window, folder browser after connecting: shown in place of the list when the folder has no subfolders", + "description": "Remote Development window, folder page after connecting: text in place of the list when the folder holds nothing", "platforms": [ "desktop" ] }, - { - "id": "desktop.remote.browse.target", - "description": "Remote Development window, folder browser after connecting: footer text naming the host folder Open opens", - "platforms": [ - "desktop" - ], - "parameters": { - "path": "string" - } - }, { "id": "desktop.remote.browse.back", - "description": "Remote Development window, folder browser after connecting: button that returns to the connection's form and ends the session", + "description": "Remote Development window, folder page after connecting: footer button that ends the session without opening a folder and shows the connection again", "platforms": [ "desktop" ] }, { "id": "desktop.remote.browse.open", - "description": "Remote Development window, folder browser after connecting: button that opens the chosen folder as a remote workspace", + "description": "Remote Development window, folder page after connecting: footer button that opens the chosen folder, naming its last path segment", "platforms": [ "desktop" - ] + ], + "parameters": { + "name": "string" + } }, { "id": "desktop.remote.browse.opening", @@ -814,6 +824,58 @@ "count": "integer" } }, + { + "id": "desktop.remote.browse.title", + "description": "Remote Development window, folder page after connecting: page title naming the saved connection the folder is chosen on", + "platforms": [ + "desktop" + ], + "parameters": { + "name": "string" + } + }, + { + "id": "desktop.remote.browse.disconnect", + "description": "Remote Development window, folder page after connecting: button that ends the session and shows the connection again", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.browse.go", + "description": "Remote Development window, folder page after connecting: button beside the path field that lists the folder typed", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.browse.shortcuts", + "description": "Remote Development window, folder page after connecting: label before the folders used often (home folder and folders opened before)", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.browse.home", + "description": "Remote Development window, folder page after connecting: button that lists the host account's home folder; ~ is the home folder", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.browse.enterHint", + "description": "Remote Development window, folder page after connecting: hint at the end of a folder's row saying a double click lists it", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.browse.git", + "description": "Remote Development window, folder page: tag of a subfolder that is a Git repository", + "platforms": [ + "desktop" + ] + }, { "id": "desktop.remote.status.label", "description": "Status bar item of a remote workspace: accessible label of the button that opens the connection's menu", @@ -1747,25 +1809,21 @@ }, { "id": "desktop.remote.trust.title", - "description": "Remote Development window: before a remote folder first opens: heading", + "description": "Remote Development window, before opening a host folder: title of the question whether to trust the folder", "platforms": [ "desktop" ] }, { "id": "desktop.remote.trust.body", - "description": "Remote Development window: before a remote folder first opens: what trusting means", + "description": "Remote Development window, before opening a host folder: what trusting the folder lets run on the host, and that trust is kept per host folder", "platforms": [ "desktop" - ], - "parameters": { - "folder": "string", - "name": "string" - } + ] }, { "id": "desktop.remote.trust.safe", - "description": "Remote Development window: before a remote folder first opens: what safe mode does", + "description": "Remote Development window, before opening a host folder: what Open in Safe Mode opens the folder with", "platforms": [ "desktop" ] @@ -1812,35 +1870,42 @@ } }, { - "id": "desktop.remote.import.title", - "description": "Remote Development window: import page: heading", + "id": "desktop.remote.trust.choice", + "description": "Remote Development window, before opening a host folder: an answer's name in bold, before what the folder opens with", + "platforms": [ + "desktop" + ], + "parameters": { + "choice": "string" + } + }, + { + "id": "desktop.remote.trust.full", + "description": "Remote Development window, before opening a host folder: what Trust and Open opens the folder with", "platforms": [ "desktop" ] }, { - "id": "desktop.remote.import.source.motty", - "description": "Remote Development window: import page: choice of Motty's hosts", + "id": "desktop.remote.trust.local", + "description": "Remote Development window, before opening a host folder: footer note that trust decisions are kept on this computer", "platforms": [ "desktop" ] }, { - "id": "desktop.remote.import.source.ssh", - "description": "Remote Development window: import page: choice of the hosts of ~/.ssh/config", + "id": "desktop.remote.import.source.motty", + "description": "Remote Development window: import page: choice of Motty's hosts", "platforms": [ "desktop" ] }, { - "id": "desktop.remote.import.from", - "description": "Remote Development window: import page: the file the hosts are read from", + "id": "desktop.remote.import.source.ssh", + "description": "Remote Development window, import page: segment that shows the hosts of ~/.ssh/config", "platforms": [ "desktop" - ], - "parameters": { - "path": "string" - } + ] }, { "id": "desktop.remote.import.keepGroups", @@ -1879,7 +1944,7 @@ }, { "id": "desktop.remote.import.status.pattern", - "description": "Remote Development window: import row tag: a Host pattern, not a host", + "description": "Remote Development window, import table: a Host line with wildcards, which is skipped", "platforms": [ "desktop" ] @@ -1905,9 +1970,19 @@ "desktop" ] }, + { + "id": "desktop.remote.import.status.existsAs", + "description": "Remote Development window, import table: the host is already saved, under the name given", + "platforms": [ + "desktop" + ], + "parameters": { + "name": "string" + } + }, { "id": "desktop.remote.import.footer", - "description": "Remote Development window: import page footer: how many hosts are chosen", + "description": "Remote Development window, import page footer: how many chosen hosts the import saves", "platforms": [ "desktop" ], @@ -1983,6 +2058,256 @@ "parameters": { "reason": "string" } + }, + { + "id": "desktop.remote.import.titleMotty", + "description": "Remote Development window: breadcrumb after the window's name while importing Motty's hosts", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.titleSsh", + "description": "Remote Development window: breadcrumb after the window's name while importing the hosts of the SSH configuration", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.mottyNote", + "description": "Remote Development window, import page: beside the source switch, that Motty is only read", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.mottyHelp", + "description": "Remote Development window, import page: tip of the info button beside the Motty note: the database read, and that no secret is read", + "platforms": [ + "desktop" + ], + "parameters": { + "path": "string" + } + }, + { + "id": "desktop.remote.import.sshNote", + "description": "Remote Development window, import page: beside the source switch, that ~/.ssh/config and the files it includes are only read", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.sshHelp", + "description": "Remote Development window, import page: tip of the info button beside the SSH config note: the files read and where the effective values come from", + "platforms": [ + "desktop" + ], + "parameters": { + "files": "string" + } + }, + { + "id": "desktop.remote.import.reload", + "description": "Remote Development window, import page: link that reads the source again", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.mottyFound", + "description": "Remote Development window, import page: summary of Motty's database: hosts and groups found, and the database's format version", + "platforms": [ + "desktop" + ], + "parameters": { + "hosts": "string", + "groups": "string", + "format": "string" + } + }, + { + "id": "desktop.remote.import.column.host", + "description": "Remote Development window, Motty import table: header of the host column", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.column.group", + "description": "Remote Development window, Motty import table: header of the group column", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.column.result", + "description": "Remote Development window, import table: header of the column saying what the import does with a host", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.column.alias", + "description": "Remote Development window, SSH config import table: header of the Host alias column", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.column.resolved", + "description": "Remote Development window, SSH config import table: header of the column of what ssh -G resolves the alias to", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.patternNote", + "description": "Remote Development window, SSH config import table: in place of the effective value of a wildcard Host line", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.jumpFor", + "description": "Remote Development window, SSH config import table: second line of a host other hosts jump through", + "platforms": [ + "desktop" + ], + "parameters": { + "hosts": "string" + } + }, + { + "id": "desktop.remote.import.fill", + "description": "Remote Development window, Motty import table: beside an already saved host that is chosen: the import only gives the saved one Motty's color and group", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.details", + "description": "Remote Development window, Motty import table: button that shows or hides how each of the host's Motty settings is imported", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.field.imported", + "description": "Remote Development window, Motty import table: tag of a Motty setting that is imported", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.field.skipped", + "description": "Remote Development window, Motty import table: tag of a Motty setting that is not imported", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.field.authentication", + "description": "Remote Development window, Motty import table: the connection setting Motty's sign-in method becomes", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.secret", + "description": "Remote Development window, Motty import table: why a setting is not imported: it is in Motty's vault, which is never read", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.noSetting", + "description": "Remote Development window, Motty import table: why a setting is not imported: Lithe has no such connection setting", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.protocol", + "description": "Remote Development window, Motty import table: why a setting is not imported: it belongs to a protocol other than SSH", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.command", + "description": "Remote Development window, Motty import table: why a setting is not imported: the jump route runs a command", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.kerberos", + "description": "Remote Development window, Motty import table: why a setting is not imported: Kerberos is left to the SSH configuration", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.extraKey", + "description": "Remote Development window, Motty import table: why a setting is not imported: only the first key file is imported", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.skip.invalid", + "description": "Remote Development window, Motty import table: why a setting is not imported: Lithe refuses the value", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.import.footerGroups", + "description": "Remote Development window, import page footer: how many chosen hosts the import saves, and the groups it creates", + "platforms": [ + "desktop" + ], + "parameters": { + "count": "string", + "groupCount": "string", + "groups": "string" + } + }, + { + "id": "desktop.remote.probe.hint.authentication", + "description": "Remote Development window, test outcome: what to check after the host refused the keys or password; method is the name of the private key file authentication", + "platforms": [ + "desktop" + ], + "parameters": { + "method": "string" + } + }, + { + "id": "desktop.remote.probe.hint.hostKey", + "description": "Remote Development window, test outcome: what to check after the host key was declined or differs from known_hosts", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.probe.hint.unreachable", + "description": "Remote Development window, test outcome: what to check after the host could not be reached", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.remote.advancedSummary", + "description": "Remote Development window, connection form: beside the folded Advanced header, the connect timeout and keep-alive interval now in effect", + "platforms": [ + "desktop" + ], + "parameters": { + "timeout": "string", + "keepAlive": "string" + } } ], "locales": { @@ -2044,6 +2369,10 @@ "desktop.remote.probe.memory": "Memory", "desktop.remote.probe.disk": "Disk (home)", "desktop.remote.probe.diskSpace": "{available} free of {total}", + "desktop.remote.probe.usable": ". This host can be used for remote development.", + "desktop.remote.probe.hostNameTag": "Host {name}", + "desktop.remote.probe.memoryTag": "Memory {size}", + "desktop.remote.probe.hideOutput": "Hide", "desktop.remote.diagnostics": "OpenSSH Output", "desktop.remote.error.required": "Required.", "desktop.remote.error.invalid": "This value is not accepted.", @@ -2097,17 +2426,14 @@ "desktop.remote.connecting": "Connecting… OpenSSH may ask for a password or to confirm the host key.", "desktop.remote.connect.notBundled": "This build of Lithe has no remote server for the host, so it cannot open a folder there.", "desktop.remote.connect.serverInvalid": "The remote server failed its integrity check and was not started. Reinstall Lithe and try again.", - "desktop.remote.browse.connected": "Connected to {name}", + "desktop.remote.browse.connected": "Connected", "desktop.remote.browse.path": "Folder path", "desktop.remote.browse.pathPlaceholder": "/home/user/project or ~/project", - "desktop.remote.browse.up": "Parent Folder", - "desktop.remote.browse.refresh": "Refresh", - "desktop.remote.browse.recent": "Recent Folders", + "desktop.remote.browse.up": "Parent folder", "desktop.remote.browse.folders": "Folders", - "desktop.remote.browse.empty": "This folder has no subfolders.", - "desktop.remote.browse.target": "Opens {path}", - "desktop.remote.browse.back": "Back", - "desktop.remote.browse.open": "Open", + "desktop.remote.browse.empty": "This folder is empty.", + "desktop.remote.browse.back": "Choose Later", + "desktop.remote.browse.open": "Open {name}", "desktop.remote.browse.opening": "Opening…", "desktop.remote.browse.lost": "The connection to the host closed. Connect again to choose a folder.", "desktop.remote.browse.notFound": "The folder does not exist on the host.", @@ -2117,6 +2443,13 @@ "desktop.remote.browse.anchorUnusable": "Cannot prepare the local folder that stands for remote workspaces: {path}", "desktop.remote.browse.openFailed": "Cannot open the folder: {reason}", "desktop.remote.browse.skipped": "Entries not listed because they could not be read: {count}", + "desktop.remote.browse.title": "Choose a Folder on {name}", + "desktop.remote.browse.disconnect": "Disconnect", + "desktop.remote.browse.go": "Go", + "desktop.remote.browse.shortcuts": "Frequent", + "desktop.remote.browse.home": "~ Home", + "desktop.remote.browse.enterHint": "Double-click to open", + "desktop.remote.browse.git": "Git", "desktop.remote.status.label": "Remote Connection", "desktop.remote.status.connected": "SSH: {name}", "desktop.remote.status.latency": "SSH: {name} · {ms} ms", @@ -2204,28 +2537,30 @@ "desktop.remote.question.asks": "OpenSSH asks:", "desktop.remote.question.answer": "Answer", "desktop.remote.question.continue": "Continue", - "desktop.remote.trust.title": "Trust this folder?", - "desktop.remote.trust.body": "Do you trust the authors of {folder} on {name}? A trusted folder can run its own code, such as tasks and build tool wrappers.", - "desktop.remote.trust.safe": "In safe mode the folder is only read: nothing in it runs until you trust it.", + "desktop.remote.trust.title": "Trust This Remote Folder?", + "desktop.remote.trust.body": "Once trusted, Lithe runs the folder's build scripts, language servers, Git hooks and debug adapters on the host. Trust it only if you trust that code. Trusting a local folder does not carry over to the host, and other folders on the same host are trusted separately.", + "desktop.remote.trust.safe": "browse and edit files; builds, language servers, Git and debugging do not start.", "desktop.remote.trust.parent": "Trust all folders in {parent}", "desktop.remote.trust.back": "Back", "desktop.remote.trust.safeOpen": "Open in Safe Mode", "desktop.remote.trust.trustOpen": "Trust and Open", "desktop.remote.trust.failed": "Could not save the decision: {reason}", - "desktop.remote.import.title": "Import Hosts", + "desktop.remote.trust.choice": "{choice}: ", + "desktop.remote.trust.full": "everything works.", + "desktop.remote.trust.local": "Trust decisions are kept on this computer only", "desktop.remote.import.source.motty": "Motty", - "desktop.remote.import.source.ssh": "~/.ssh/config", - "desktop.remote.import.from": "From {path}", + "desktop.remote.import.source.ssh": "SSH Config", "desktop.remote.import.keepGroups": "Keep groups", "desktop.remote.import.keepColors": "Keep colors", "desktop.remote.import.status.importable": "Ready", "desktop.remote.import.status.partial": "Partial", "desktop.remote.import.status.exists": "Already saved", - "desktop.remote.import.status.pattern": "Pattern", + "desktop.remote.import.status.pattern": "Skipped · Pattern", "desktop.remote.import.status.invalid": "Invalid", "desktop.remote.import.status.unreadable": "Unreadable", "desktop.remote.import.status.unsupported": "Not SSH", - "desktop.remote.import.footer": "{count} chosen", + "desktop.remote.import.status.existsAs": "Already saved ({name})", + "desktop.remote.import.footer": "Imports {count} host(s)", "desktop.remote.import.apply": "Import", "desktop.remote.import.applying": "Importing…", "desktop.remote.import.done": "Imported {count} host(s)", @@ -2235,6 +2570,14 @@ "desktop.remote.import.mottyTooLarge": "Motty's configuration is too large to read.", "desktop.remote.import.mottyUnsupported": "This version of Motty's configuration is not supported.", "desktop.remote.import.failed": "Could not import: {reason}", + "desktop.remote.import.titleMotty": "Import from Motty", + "desktop.remote.import.titleSsh": "Import from SSH Config", + "desktop.remote.import.mottyNote": "Read only; Motty's data is not changed", + "desktop.remote.import.mottyHelp": "Reads {path}. Motty's vault is never opened, so no password or key is read; nothing is written to Motty's files.", + "desktop.remote.import.sshNote": "Reads ~/.ssh/config (with Include), read only", + "desktop.remote.import.sshHelp": "Reads {files}. The effective value is what `ssh -G` resolves each alias to; the import saves the alias, so OpenSSH keeps resolving it.", + "desktop.remote.import.reload": "Read Again", + "desktop.remote.import.mottyFound": "Found {hosts} host(s), {groups} group(s) · data format {format}", "desktop.remote.workspace.banner": "This is a remote workspace. Its files open, edit, save and are searched on the host, and terminals run on the host; Git and running do not work here yet.", "desktop.remote.workspace.localOnly": "This feature does not work in a remote workspace yet. You can browse, edit, save and search the host's files and run terminals on the host.", "desktop.remote.document.disconnected": "the remote workspace is not connected; try again once it reconnects", @@ -2245,7 +2588,31 @@ "desktop.remote.document.tooLargeToSave": "This file exceeds the {limit} the host takes in one save. Your edits remain open.", "desktop.remote.terminal.notConnected": "the workspace is not connected to the host. Wait for it to connect again, or click Reconnect in the status bar.", "desktop.remote.terminal.tabNumber": "{name} ({number})", - "desktop.remote.terminal.dropOutside": "Only files of this remote workspace can be dropped on its terminal. Files of this computer are not on the host." + "desktop.remote.terminal.dropOutside": "Only files of this remote workspace can be dropped on its terminal. Files of this computer are not on the host.", + "desktop.remote.import.column.host": "Host", + "desktop.remote.import.column.group": "Group", + "desktop.remote.import.column.result": "Result", + "desktop.remote.import.column.alias": "Host Alias", + "desktop.remote.import.column.resolved": "Effective Value (ssh -G)", + "desktop.remote.import.patternNote": "Wildcard, not a single host", + "desktop.remote.import.jumpFor": "ProxyJump of {hosts}", + "desktop.remote.import.fill": "Color, group only", + "desktop.remote.import.details": "Show Settings", + "desktop.remote.import.field.imported": "✓ Imported", + "desktop.remote.import.field.skipped": "Not imported", + "desktop.remote.import.field.authentication": "Sign-in method", + "desktop.remote.import.skip.secret": "In Motty's vault, which is never read", + "desktop.remote.import.skip.noSetting": "Lithe has no such setting", + "desktop.remote.import.skip.protocol": "Not an SSH setting", + "desktop.remote.import.skip.command": "The jump route runs a command", + "desktop.remote.import.skip.kerberos": "Left to the SSH configuration", + "desktop.remote.import.skip.extraKey": "Only the first key file is imported", + "desktop.remote.import.skip.invalid": "Lithe does not accept this value", + "desktop.remote.import.footerGroups": "Imports {count} host(s) and creates {groupCount} group(s) ({groups})", + "desktop.remote.probe.hint.authentication": "Check the user name; the password method asks when connecting. If the server only allows keys, set Authentication to “{method}”.", + "desktop.remote.probe.hint.hostKey": "Connecting shows the host’s fingerprint for you to confirm. If it changed, check with the host’s administrator before updating known_hosts.", + "desktop.remote.probe.hint.unreachable": "Check the host and the port. If the host can only be reached through another one, add that one as a jump host.", + "desktop.remote.advancedSummary": "Connect timeout {timeout} · Keep-alive {keepAlive}" }, "zh-CN": { "desktop.remote.title": "远程开发", @@ -2305,6 +2672,10 @@ "desktop.remote.probe.memory": "内存", "desktop.remote.probe.disk": "磁盘(主目录)", "desktop.remote.probe.diskSpace": "可用 {available},共 {total}", + "desktop.remote.probe.usable": ",这台主机可以用于远程开发。", + "desktop.remote.probe.hostNameTag": "主机名 {name}", + "desktop.remote.probe.memoryTag": "内存 {size}", + "desktop.remote.probe.hideOutput": "收起", "desktop.remote.diagnostics": "OpenSSH 输出", "desktop.remote.error.required": "必填。", "desktop.remote.error.invalid": "这个值不被接受。", @@ -2358,17 +2729,14 @@ "desktop.remote.connecting": "正在连接…OpenSSH 可能会询问密码或请你确认主机密钥。", "desktop.remote.connect.notBundled": "此版本的 Lithe 未包含适用于该主机的远端服务,无法打开主机上的文件夹。", "desktop.remote.connect.serverInvalid": "远端服务未通过完整性校验,没有启动。请重新安装 Lithe 后再试。", - "desktop.remote.browse.connected": "已连接到 {name}", + "desktop.remote.browse.connected": "已连接", "desktop.remote.browse.path": "文件夹路径", "desktop.remote.browse.pathPlaceholder": "/home/user/project 或 ~/project", - "desktop.remote.browse.up": "上级文件夹", - "desktop.remote.browse.refresh": "刷新", - "desktop.remote.browse.recent": "最近的文件夹", + "desktop.remote.browse.up": "上一级", "desktop.remote.browse.folders": "文件夹", - "desktop.remote.browse.empty": "此文件夹没有子文件夹。", - "desktop.remote.browse.target": "将打开 {path}", - "desktop.remote.browse.back": "返回", - "desktop.remote.browse.open": "打开", + "desktop.remote.browse.empty": "此文件夹是空的。", + "desktop.remote.browse.back": "稍后再选", + "desktop.remote.browse.open": "打开 {name}", "desktop.remote.browse.opening": "正在打开…", "desktop.remote.browse.lost": "与主机的连接已断开。请重新连接后再选择文件夹。", "desktop.remote.browse.notFound": "主机上不存在此文件夹。", @@ -2378,6 +2746,13 @@ "desktop.remote.browse.anchorUnusable": "无法准备代表远程工作区的本地文件夹:{path}", "desktop.remote.browse.openFailed": "无法打开文件夹:{reason}", "desktop.remote.browse.skipped": "有 {count} 个条目无法读取,未列出。", + "desktop.remote.browse.title": "选择 {name} 上的文件夹", + "desktop.remote.browse.disconnect": "断开", + "desktop.remote.browse.go": "前往", + "desktop.remote.browse.shortcuts": "常用", + "desktop.remote.browse.home": "~ 主目录", + "desktop.remote.browse.enterHint": "双击进入", + "desktop.remote.browse.git": "Git", "desktop.remote.status.label": "远程连接", "desktop.remote.status.connected": "SSH: {name}", "desktop.remote.status.latency": "SSH: {name} · {ms} 毫秒", @@ -2465,28 +2840,30 @@ "desktop.remote.question.asks": "OpenSSH 询问:", "desktop.remote.question.answer": "回答", "desktop.remote.question.continue": "继续", - "desktop.remote.trust.title": "信任此文件夹吗?", - "desktop.remote.trust.body": "你信任 {name} 上 {folder} 的作者吗?受信任的文件夹可以运行其中的代码,例如任务和构建工具包装脚本。", - "desktop.remote.trust.safe": "在安全模式下只读取文件夹,信任之前不会运行其中的任何代码。", + "desktop.remote.trust.title": "信任这个远程文件夹吗?", + "desktop.remote.trust.body": "信任后,Lithe 会在远端运行这个文件夹里的构建脚本、语言服务器、Git 钩子和调试适配器。只在你相信这些代码时才信任。本机文件夹的信任不会带到远端;同一主机的其他文件夹需要单独信任。", + "desktop.remote.trust.safe": "可以浏览和编辑文件;不启动构建、语言服务器、Git 和调试。", "desktop.remote.trust.parent": "信任 {parent} 下的所有文件夹", "desktop.remote.trust.back": "返回", "desktop.remote.trust.safeOpen": "以安全模式打开", "desktop.remote.trust.trustOpen": "信任并打开", "desktop.remote.trust.failed": "无法保存决定:{reason}", - "desktop.remote.import.title": "导入主机", + "desktop.remote.trust.choice": "{choice}:", + "desktop.remote.trust.full": "完整功能。", + "desktop.remote.trust.local": "信任记录只保存在本机", "desktop.remote.import.source.motty": "Motty", - "desktop.remote.import.source.ssh": "~/.ssh/config", - "desktop.remote.import.from": "来自 {path}", + "desktop.remote.import.source.ssh": "SSH 配置", "desktop.remote.import.keepGroups": "保留分组", "desktop.remote.import.keepColors": "保留颜色", "desktop.remote.import.status.importable": "可导入", "desktop.remote.import.status.partial": "部分导入", "desktop.remote.import.status.exists": "已存在", - "desktop.remote.import.status.pattern": "通配规则", + "desktop.remote.import.status.pattern": "跳过 · 通配符", "desktop.remote.import.status.invalid": "无效", "desktop.remote.import.status.unreadable": "无法读取", "desktop.remote.import.status.unsupported": "非 SSH", - "desktop.remote.import.footer": "已选择 {count} 台", + "desktop.remote.import.status.existsAs": "已存在({name})", + "desktop.remote.import.footer": "将导入 {count} 个连接", "desktop.remote.import.apply": "导入", "desktop.remote.import.applying": "正在导入…", "desktop.remote.import.done": "已导入 {count} 台主机", @@ -2496,6 +2873,14 @@ "desktop.remote.import.mottyTooLarge": "Motty 的配置过大,无法读取。", "desktop.remote.import.mottyUnsupported": "不支持这个版本的 Motty 配置。", "desktop.remote.import.failed": "无法导入:{reason}", + "desktop.remote.import.titleMotty": "从 Motty 导入", + "desktop.remote.import.titleSsh": "从 SSH 配置导入", + "desktop.remote.import.mottyNote": "只读读取,不修改 Motty 的数据", + "desktop.remote.import.mottyHelp": "读取 {path}。不会打开 Motty 的密钥库,因此不读取任何密码或密钥;也不会写入 Motty 的文件。", + "desktop.remote.import.sshNote": "读取 ~/.ssh/config(含 Include),只读", + "desktop.remote.import.sshHelp": "读取 {files}。生效值是 `ssh -G` 对每个别名解析出的结果;导入保存的是别名,之后仍由 OpenSSH 解析。", + "desktop.remote.import.reload": "重新读取", + "desktop.remote.import.mottyFound": "找到 {hosts} 台主机、{groups} 个分组 · 数据格式 {format}", "desktop.remote.workspace.banner": "这是远程工作区。主机上的文件可以打开、编辑、保存和搜索,终端在主机上运行;Git 和运行暂不可用。", "desktop.remote.workspace.localOnly": "远程工作区暂不支持此功能,可以浏览、编辑、保存和搜索主机上的文件,也可以在主机上运行终端。", "desktop.remote.document.disconnected": "远程工作区未连接,请在重新连接后再试", @@ -2506,7 +2891,31 @@ "desktop.remote.document.tooLargeToSave": "文件超过主机单次保存上限 {limit},编辑内容仍保留。", "desktop.remote.terminal.notConnected": "工作区未连接到主机。请等待重新连接,或点击状态栏中的“重新连接”。", "desktop.remote.terminal.tabNumber": "{name} ({number})", - "desktop.remote.terminal.dropOutside": "只能把这个远程工作区里的文件拖到它的终端,本机的文件不在主机上。" + "desktop.remote.terminal.dropOutside": "只能把这个远程工作区里的文件拖到它的终端,本机的文件不在主机上。", + "desktop.remote.import.column.host": "主机", + "desktop.remote.import.column.group": "分组", + "desktop.remote.import.column.result": "结果", + "desktop.remote.import.column.alias": "Host 别名", + "desktop.remote.import.column.resolved": "生效值(ssh -G)", + "desktop.remote.import.patternNote": "通配符,不是具体主机", + "desktop.remote.import.jumpFor": "作为 {hosts} 的 ProxyJump", + "desktop.remote.import.fill": "只补颜色和分组", + "desktop.remote.import.details": "显示设置项", + "desktop.remote.import.field.imported": "✓ 导入", + "desktop.remote.import.field.skipped": "不导入", + "desktop.remote.import.field.authentication": "身份验证方式", + "desktop.remote.import.skip.secret": "在 Motty 的密钥库里,不会读取", + "desktop.remote.import.skip.noSetting": "Lithe 没有对应设置", + "desktop.remote.import.skip.protocol": "不是 SSH 的设置", + "desktop.remote.import.skip.command": "跳板路由会运行命令", + "desktop.remote.import.skip.kerberos": "交给 SSH 配置处理", + "desktop.remote.import.skip.extraKey": "只导入第一个密钥文件", + "desktop.remote.import.skip.invalid": "Lithe 不接受这个值", + "desktop.remote.import.footerGroups": "将导入 {count} 个连接、新建 {groupCount} 个分组({groups})", + "desktop.remote.probe.hint.authentication": "检查用户名是否正确;密码方式会在连接时询问。若服务器只允许密钥,把身份验证改成“{method}”。", + "desktop.remote.probe.hint.hostKey": "连接时会显示主机指纹请你确认;如果指纹变了,先向主机管理员核实,再更新 known_hosts。", + "desktop.remote.probe.hint.unreachable": "检查主机和端口;如果只能经另一台主机访问,把它加为跳板机。", + "desktop.remote.advancedSummary": "连接超时 {timeout} · 保活间隔 {keepAlive}" } } } diff --git a/shared/platform-feature-matrix/features/remote-connections.json b/shared/platform-feature-matrix/features/remote-connections.json index 8bf39d66e..a867d921e 100644 --- a/shared/platform-feature-matrix/features/remote-connections.json +++ b/shared/platform-feature-matrix/features/remote-connections.json @@ -2,7 +2,7 @@ "id": "remote-connections", "area": "工作区", "group": "远程开发", - "capability": "保存 SSH 连接(含颜色和分组)、按分组列出并查看概览,测试连接,在窗口中回答 SSH 的密码和口令询问", + "capability": "保存 SSH 连接(含颜色和分组)、按分组列出、搜索并查看概览(含 ssh -G 生效设置),测试连接并显示结果,从 Motty 或 ~/.ssh/config 导入,在窗口中回答 SSH 的询问", "macos": { "implementationStatus": "implemented", "verificationStatus": "pending", @@ -15,7 +15,15 @@ "desktop/internal/workbench/remote_view.go", "desktop/internal/workbench/remote_test.go", "desktop/internal/workbench/remote_connections_visual_test.go", - "desktop/internal/workbench/git_auth.go" + "desktop/internal/workbench/git_auth.go", + "desktop/internal/workbench/remote_detail_view.go", + "desktop/internal/workbench/remote_shell_view.go", + "desktop/internal/workbench/remote_list.go", + "desktop/internal/workbench/remote_steps.go", + "desktop/internal/workbench/remote_import.go", + "desktop/internal/workbench/remote_trust.go", + "desktop/internal/workbench/remote_browse.go", + "desktop/internal/workbench/remote_browse_view.go" ] }, "windows": { @@ -26,10 +34,18 @@ "desktop/internal/remoteconn/remoteconn.go", "desktop/internal/workbench/remote.go", "desktop/internal/workbench/remote_view.go", - "desktop/internal/workbench/git_auth.go" + "desktop/internal/workbench/git_auth.go", + "desktop/internal/workbench/remote_detail_view.go", + "desktop/internal/workbench/remote_shell_view.go", + "desktop/internal/workbench/remote_list.go", + "desktop/internal/workbench/remote_steps.go", + "desktop/internal/workbench/remote_import.go", + "desktop/internal/workbench/remote_trust.go", + "desktop/internal/workbench/remote_browse.go", + "desktop/internal/workbench/remote_browse_view.go" ] }, "owner": "Remote", - "verification": "从欢迎页的“远程开发”按钮和标题栏项目菜单打开“远程开发”:新建连接只填主机,保存后列表以主机名命名并选中这一行,右侧显示概览;点“编辑”进入表单,改名称和端口后保存,回到概览且列表与偏好目录 remote/connections.json 同步;编辑中点“取消”回到原连接、不写文件;删除先在底部确认。选颜色并选“新建分组…”输入分组名后保存,左侧出现带数量的分组标题和颜色条,未分组的连接排在最后的“未分组”下,第二个连接可从下拉框选同一分组(大小写不同视为同一分组)。概览的“连接设置”逐项列出设置,未填的项显示回退规则(例如“自动(SSH 配置,否则 22)”);测试成功后概览的“主机信息”显示本次运行最近一次测试的结果,关闭再打开窗口仍在,未测试的连接显示提示。主机填 user@host、端口填非数字、分组超过 64 个字符时,错误显示在对应字段下且不写文件。对一台 Linux SSH 主机分别用 SSH Agent、私钥文件和密码测试连接:密码和带口令私钥的询问出现在窗口中,输入以圆点显示,取消或关闭窗口立即停止测试且不再追问;成功后显示系统、架构、CPU、内存和主目录磁盘。首次连接时 OpenSSH 确认主机指纹的询问同样出现在窗口中,由用户回答,Lithe 不替用户接受;拒绝指纹或指纹已改变时测试失败并说明原因。日志只有 remote.connections.open、remote.connection.new/select/edit/edit.cancel/save/remove/test/test.stop 和 remote.authentication.answer/cancel 等动作,不含主机、用户名、私钥路径、分组名、询问原文或答案。", - "notes": "Viva:连接列表的格式和字段规则在 Core(remote.connections、remote.editConnections),桌面端只读写偏好目录里的 remote/connections.json,按读取时的字节原子写回 Core 返回的文档,文件被改过时不覆盖;测试连接由 Core 运行 PATH 中的 OpenSSH,SSH 询问经 SSH_ASKPASS 指向 lithe 可执行文件的助手模式回到窗口,和 Git 认证共用同一个提问队列。Lithe 只把私钥路径交给 OpenSSH,不读取私钥内容,也不接受粘贴的私钥。macOS 用无头截图和真实 Core 的单元测试覆盖;Windows 上 OpenSSH 调用 GUI 子系统助手读取答案仍待实机验证。连接后选择主机文件夹并打开远程工作区见 remote-workspace。 2026-11-21(#2231 窗口重设计):颜色(六种固定色或无)和分组随连接保存在 Core 的 connections.json(Lithe-IDEA/Lithe-core-rust#152),分组顺序由 Core 的 sections 给出(按首次使用的顺序,未分组在最后),桌面端只展示;概览的“主机信息”只保存在本次运行的内存里,不写文件。搜索、从 Motty 或 SSH 配置导入、ssh -G 实际生效值和最近一次测试时间尚未实现。自动化:TestRemoteConnectionsColorAndGroup、TestRemoteCancelGoesBackToTheSavedConnection、TestRemoteOverviewShowsTheTestedHost 与 TestVisualRemoteConnections。" + "verification": "从欢迎页的“远程开发”按钮和标题栏项目菜单打开“远程开发”:新建连接只填主机,保存后列表以主机名命名并选中这一行,右侧显示概览;点“编辑”进入表单,改名称和端口后保存,回到概览且列表与偏好目录 remote/connections.json 同步;编辑中点“取消”回到原连接、不写文件;删除先在底部确认。选颜色并选“新建分组…”输入分组名后保存,左侧出现带数量的分组标题和颜色条,未分组的连接排在最后的“未分组”下,第二个连接可从下拉框选同一分组(大小写不同视为同一分组)。概览的“连接设置”逐项列出设置,未填的项显示回退规则(例如“自动(SSH 配置,否则 22)”);测试成功后概览的“主机信息”显示本次运行最近一次测试的结果,关闭再打开窗口仍在,未测试的连接显示提示。主机填 user@host、端口填非数字、分组超过 64 个字符时,错误显示在对应字段下且不写文件。对一台 Linux SSH 主机分别用 SSH Agent、私钥文件和密码测试连接:密码和带口令私钥的询问出现在窗口中,输入以圆点显示,取消或关闭窗口立即停止测试且不再追问;成功后显示系统、架构、CPU、内存和主目录磁盘。首次连接时 OpenSSH 确认主机指纹的询问同样出现在窗口中,由用户回答,Lithe 不替用户接受;拒绝指纹或指纹已改变时测试失败并说明原因。日志只有 remote.connections.open、remote.connection.new/select/edit/edit.cancel/save/remove/test/test.stop 和 remote.authentication.answer/cancel 等动作,不含主机、用户名、私钥路径、分组名、询问原文或答案。 窗口按原型(#2276)验收:左侧连接行有连接颜色的竖条和选中底色,已连接的显示绿点;面包屑显示“编辑 <名称>”或“新建连接”;高级选项折叠时标题旁显示当前连接超时和保活间隔;测试结果显示在表单最下方,成功是绿框和系统、主机名、核数、内存、磁盘标签,失败是红框、检查提示和默认展开的 OpenSSH 输出。从 Motty 导入只读 config.db、不读 vault.json,表格列出每台主机的结果,展开后逐项列出设置映射或不导入的原因;从 SSH 配置导入列出 Host 别名、ssh -G 生效值和 ProxyJump,通配符 Host 跳过;已保存的主机不计入可导入数量。选文件夹页保留左侧列表,含 .git 的子文件夹标“Git”;信任页列出主机与文件夹和两种打开方式的说明。", + "notes": "Viva:连接列表的格式和字段规则在 Core(remote.connections、remote.editConnections),桌面端只读写偏好目录里的 remote/connections.json,按读取时的字节原子写回 Core 返回的文档,文件被改过时不覆盖;测试连接由 Core 运行 PATH 中的 OpenSSH,SSH 询问经 SSH_ASKPASS 指向 lithe 可执行文件的助手模式回到窗口,和 Git 认证共用同一个提问队列。Lithe 只把私钥路径交给 OpenSSH,不读取私钥内容,也不接受粘贴的私钥。macOS 用无头截图和真实 Core 的单元测试覆盖;Windows 上 OpenSSH 调用 GUI 子系统助手读取答案仍待实机验证。连接后选择主机文件夹并打开远程工作区见 remote-workspace。 2026-11-21(#2231 窗口重设计):颜色(六种固定色或无)和分组随连接保存在 Core 的 connections.json(Lithe-IDEA/Lithe-core-rust#152),分组顺序由 Core 的 sections 给出(按首次使用的顺序,未分组在最后),桌面端只展示;概览的“主机信息”只保存在本次运行的内存里,不写文件。搜索、从 Motty 或 SSH 配置导入、ssh -G 实际生效值、连接阶段和远程信任由 Core #154(crates/remote)给出,桌面端只展示(#2275 与本次补齐);选文件夹页的 Git 标记由桌面端组合 Core 已有的 remote.stat(前 64 个子文件夹、最多 8 个并行)。概览“⋯”菜单的“在新窗口打开”未实现:远程会话属于当前进程的 Core,新窗口要重新连接或交接会话。自动化:TestRemoteConnectionsColorAndGroup、TestRemoteCancelGoesBackToTheSavedConnection、TestRemoteOverviewShowsTheTestedHost、TestRemoteImportCountsLeaveOutSavedHosts、TestRemoteImportNewGroupsAreTheChosenOnesTheListLacks、TestRemoteBrowserTagsGitRepositories 与 TestVisualRemoteConnections。" }