fix(ssh): retain the source host in copied jump choices
This commit is contained in:
1 parent
66c876e632
commit
8c56181a76
2 files changed
+12
-6
No files matched your search
@@ -129,14 +129,16 @@ impl SettingsPane {
|
||||
.label
|
||||
.filter(|label| !label.trim().is_empty())
|
||||
.unwrap_or_else(|| host.clone());
|
||||
let label = self.ssh_hosts.profiles.next_default_label(label.trim());
|
||||
let copy_label = self.ssh_hosts.profiles.next_default_label(label.trim());
|
||||
|
||||
self.open_ssh_editor(Some(host), window, cx);
|
||||
self.open_ssh_editor(Some(host.clone()), window, cx);
|
||||
if let Some(editor) = self.ssh_editor.as_mut() {
|
||||
editor.original_destination = None;
|
||||
// 复制不会重命名原主机,编辑路径排除的原地址仍应可用作新主机的跳板。
|
||||
editor.jump_choices.push((host, label));
|
||||
}
|
||||
self.ssh_destination_input.update(cx, |input, cx| input.set_value("", window, cx));
|
||||
self.ssh_label_input.update(cx, |input, cx| input.set_value(label, window, cx));
|
||||
self.ssh_label_input.update(cx, |input, cx| input.set_value(copy_label, window, cx));
|
||||
self.ssh_password_input.update(cx, |input, cx| {
|
||||
input.set_placeholder(
|
||||
crate::gpui_shell::config::ui_language(cx)
|
||||
|
||||
@@ -66,10 +66,14 @@ fn pairing_design_ssh_cards_keep_icon_anchors_and_compact_filter(cx: &mut gpui::
|
||||
cx.update(|window, cx| {
|
||||
pane.update(cx, |pane, cx| {
|
||||
pane.duplicate_ssh_host("nebula-test".into(), window, cx);
|
||||
let editor = pane.ssh_editor.as_ref().expect("copied host draft");
|
||||
assert!(editor.original_destination.is_none());
|
||||
assert!(
|
||||
pane.ssh_editor
|
||||
.as_ref()
|
||||
.is_some_and(|editor| editor.original_destination.is_none())
|
||||
editor
|
||||
.jump_choices
|
||||
.iter()
|
||||
.any(|(host, label)| host == "nebula-test" && label == "Alpha"),
|
||||
"the copied-from host remains available as a jump host"
|
||||
);
|
||||
assert_eq!(pane.ssh_destination_input.read(cx).value(), "");
|
||||
assert_eq!(pane.ssh_label_input.read(cx).value(), "Alpha 1");
|
||||
|
||||
Reference in new issue
Block a user