Add paths to connection headers (#19579)
Closes #ISSUE <img width="562" alt="Screenshot 2024-10-22 at 3 21 22 PM" src="https://github.com/user-attachments/assets/51afd8e8-b635-4d69-9463-2ccdaabeb955"> <img width="844" alt="Screenshot 2024-10-22 at 3 22 35 PM" src="https://github.com/user-attachments/assets/ae57c0f8-396c-485d-b5e2-14558da98a18"> Release Notes: - N/A --------- Co-authored-by: Trace <violet.white.batt@gmail.com>
This commit is contained in:
parent
fc7874e64e
commit
48674ec54c
2 changed files with 22 additions and 3 deletions
|
@ -312,6 +312,7 @@ impl gpui::Render for ProjectPicker {
|
||||||
.child(
|
.child(
|
||||||
SshConnectionHeader {
|
SshConnectionHeader {
|
||||||
connection_string: self.connection_string.clone(),
|
connection_string: self.connection_string.clone(),
|
||||||
|
paths: Default::default(),
|
||||||
nickname: self.nickname.clone(),
|
nickname: self.nickname.clone(),
|
||||||
}
|
}
|
||||||
.render(cx),
|
.render(cx),
|
||||||
|
@ -519,7 +520,7 @@ impl RemoteServerProjects {
|
||||||
workspace.update(cx, |_, cx| {
|
workspace.update(cx, |_, cx| {
|
||||||
cx.defer(move |workspace, cx| {
|
cx.defer(move |workspace, cx| {
|
||||||
workspace.toggle_modal(cx, |cx| {
|
workspace.toggle_modal(cx, |cx| {
|
||||||
SshConnectionModal::new(&connection_options, nickname, cx)
|
SshConnectionModal::new(&connection_options, Vec::new(), nickname, cx)
|
||||||
});
|
});
|
||||||
let prompt = workspace
|
let prompt = workspace
|
||||||
.active_modal::<SshConnectionModal>(cx)
|
.active_modal::<SshConnectionModal>(cx)
|
||||||
|
@ -965,6 +966,7 @@ impl RemoteServerProjects {
|
||||||
.child(
|
.child(
|
||||||
SshConnectionHeader {
|
SshConnectionHeader {
|
||||||
connection_string: connection_string.clone(),
|
connection_string: connection_string.clone(),
|
||||||
|
paths: Default::default(),
|
||||||
nickname: connection.nickname.clone(),
|
nickname: connection.nickname.clone(),
|
||||||
}
|
}
|
||||||
.render(cx),
|
.render(cx),
|
||||||
|
@ -1152,6 +1154,7 @@ impl RemoteServerProjects {
|
||||||
.child(
|
.child(
|
||||||
SshConnectionHeader {
|
SshConnectionHeader {
|
||||||
connection_string,
|
connection_string,
|
||||||
|
paths: Default::default(),
|
||||||
nickname: connection.nickname.clone(),
|
nickname: connection.nickname.clone(),
|
||||||
}
|
}
|
||||||
.render(cx),
|
.render(cx),
|
||||||
|
|
|
@ -130,6 +130,7 @@ pub struct SshPrompt {
|
||||||
|
|
||||||
pub struct SshConnectionModal {
|
pub struct SshConnectionModal {
|
||||||
pub(crate) prompt: View<SshPrompt>,
|
pub(crate) prompt: View<SshPrompt>,
|
||||||
|
paths: Vec<PathBuf>,
|
||||||
finished: bool,
|
finished: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +141,7 @@ impl SshPrompt {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let connection_string = connection_options.connection_string().into();
|
let connection_string = connection_options.connection_string().into();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
connection_string,
|
connection_string,
|
||||||
nickname,
|
nickname,
|
||||||
|
@ -257,12 +259,14 @@ impl Render for SshPrompt {
|
||||||
impl SshConnectionModal {
|
impl SshConnectionModal {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
connection_options: &SshConnectionOptions,
|
connection_options: &SshConnectionOptions,
|
||||||
|
paths: Vec<PathBuf>,
|
||||||
nickname: Option<SharedString>,
|
nickname: Option<SharedString>,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
prompt: cx.new_view(|cx| SshPrompt::new(connection_options, nickname, cx)),
|
prompt: cx.new_view(|cx| SshPrompt::new(connection_options, nickname, cx)),
|
||||||
finished: false,
|
finished: false,
|
||||||
|
paths,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +292,7 @@ impl SshConnectionModal {
|
||||||
|
|
||||||
pub(crate) struct SshConnectionHeader {
|
pub(crate) struct SshConnectionHeader {
|
||||||
pub(crate) connection_string: SharedString,
|
pub(crate) connection_string: SharedString,
|
||||||
|
pub(crate) paths: Vec<PathBuf>,
|
||||||
pub(crate) nickname: Option<SharedString>,
|
pub(crate) nickname: Option<SharedString>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +321,16 @@ impl RenderOnce for SshConnectionHeader {
|
||||||
h_flex()
|
h_flex()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child(Headline::new(main_label).size(HeadlineSize::XSmall))
|
.child(Headline::new(main_label).size(HeadlineSize::XSmall))
|
||||||
.children(meta_label.map(|label| Label::new(label).color(Color::Muted))),
|
.children(
|
||||||
|
meta_label.map(|label| {
|
||||||
|
Label::new(label).color(Color::Muted).size(LabelSize::Small)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.children(self.paths.into_iter().map(|path| {
|
||||||
|
Label::new(path.to_string_lossy().to_string())
|
||||||
|
.size(LabelSize::Small)
|
||||||
|
.color(Color::Muted)
|
||||||
|
})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,6 +354,7 @@ impl Render for SshConnectionModal {
|
||||||
.on_action(cx.listener(Self::confirm))
|
.on_action(cx.listener(Self::confirm))
|
||||||
.child(
|
.child(
|
||||||
SshConnectionHeader {
|
SshConnectionHeader {
|
||||||
|
paths: self.paths.clone(),
|
||||||
connection_string,
|
connection_string,
|
||||||
nickname,
|
nickname,
|
||||||
}
|
}
|
||||||
|
@ -652,10 +667,11 @@ pub async fn open_ssh_project(
|
||||||
let delegate = window.update(cx, {
|
let delegate = window.update(cx, {
|
||||||
let connection_options = connection_options.clone();
|
let connection_options = connection_options.clone();
|
||||||
let nickname = nickname.clone();
|
let nickname = nickname.clone();
|
||||||
|
let paths = paths.clone();
|
||||||
move |workspace, cx| {
|
move |workspace, cx| {
|
||||||
cx.activate_window();
|
cx.activate_window();
|
||||||
workspace.toggle_modal(cx, |cx| {
|
workspace.toggle_modal(cx, |cx| {
|
||||||
SshConnectionModal::new(&connection_options, nickname.clone(), cx)
|
SshConnectionModal::new(&connection_options, paths, nickname.clone(), cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
let ui = workspace
|
let ui = workspace
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue