Fix rustfmt
issues in dev_servers.rs
(#12205)
This PR fixes some issues preventing `rustfmt` from running properly in `dev_servers.rs`. The culprit was some long strings being inlined. Release Notes: - N/A
This commit is contained in:
parent
e903742d52
commit
951fbc57ba
1 changed files with 108 additions and 61 deletions
|
@ -724,6 +724,9 @@ impl DevServerProjects {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const MANUAL_SETUP_MESSAGE: &str = "Click create to generate a token for this server. The next step will provide instructions for setting zed up on that machine.";
|
||||||
|
const SSH_SETUP_MESSAGE: &str = "Enter the command you use to ssh into this server.\nFor example: `ssh me@my.server` or `gh cs ssh -c example`.";
|
||||||
|
|
||||||
Modal::new("create-dev-server", Some(self.scroll_handle.clone()))
|
Modal::new("create-dev-server", Some(self.scroll_handle.clone()))
|
||||||
.header(
|
.header(
|
||||||
ModalHeader::new()
|
ModalHeader::new()
|
||||||
|
@ -732,11 +735,15 @@ impl DevServerProjects {
|
||||||
)
|
)
|
||||||
.section(
|
.section(
|
||||||
Section::new()
|
Section::new()
|
||||||
.header(if manual_setup { "Server Name".into()} else { "SSH arguments".into()})
|
.header(if manual_setup {
|
||||||
|
"Server Name".into()
|
||||||
|
} else {
|
||||||
|
"SSH arguments".into()
|
||||||
|
})
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.max_w(rems(16.))
|
.max_w(rems(16.))
|
||||||
.child(self.dev_server_name_input.clone())
|
.child(self.dev_server_name_input.clone()),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.section(
|
.section(
|
||||||
|
@ -746,13 +753,19 @@ impl DevServerProjects {
|
||||||
v_flex()
|
v_flex()
|
||||||
.w_full()
|
.w_full()
|
||||||
.gap_y(Spacing::Large.rems(cx))
|
.gap_y(Spacing::Large.rems(cx))
|
||||||
.child(v_flex().child(RadioWithLabel::new(
|
.child(
|
||||||
|
v_flex()
|
||||||
|
.child(RadioWithLabel::new(
|
||||||
"use-server-name-in-ssh",
|
"use-server-name-in-ssh",
|
||||||
Label::new("Connect via SSH (default)"),
|
Label::new("Connect via SSH (default)"),
|
||||||
!manual_setup,
|
!manual_setup,
|
||||||
cx.listener({
|
cx.listener({
|
||||||
move |this, _, cx| {
|
move |this, _, cx| {
|
||||||
if let Mode::CreateDevServer(CreateDevServer{ manual_setup, .. }) = &mut this.mode {
|
if let Mode::CreateDevServer(CreateDevServer {
|
||||||
|
manual_setup,
|
||||||
|
..
|
||||||
|
}) = &mut this.mode
|
||||||
|
{
|
||||||
*manual_setup = false;
|
*manual_setup = false;
|
||||||
}
|
}
|
||||||
cx.notify()
|
cx.notify()
|
||||||
|
@ -765,48 +778,61 @@ impl DevServerProjects {
|
||||||
manual_setup,
|
manual_setup,
|
||||||
cx.listener({
|
cx.listener({
|
||||||
move |this, _, cx| {
|
move |this, _, cx| {
|
||||||
if let Mode::CreateDevServer(CreateDevServer{ manual_setup, .. }) = &mut this.mode {
|
if let Mode::CreateDevServer(CreateDevServer {
|
||||||
|
manual_setup,
|
||||||
|
..
|
||||||
|
}) = &mut this.mode
|
||||||
|
{
|
||||||
*manual_setup = true;
|
*manual_setup = true;
|
||||||
}
|
}
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}}),
|
}
|
||||||
)))
|
}),
|
||||||
|
)),
|
||||||
|
)
|
||||||
.when(dev_server_id.is_none(), |el| {
|
.when(dev_server_id.is_none(), |el| {
|
||||||
el.child(
|
el.child(
|
||||||
if manual_setup {
|
if manual_setup {
|
||||||
Label::new(
|
Label::new(MANUAL_SETUP_MESSAGE)
|
||||||
"Click create to generate a token for this server. The next step will provide instructions for setting zed up on that machine."
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
Label::new(
|
Label::new(SSH_SETUP_MESSAGE)
|
||||||
"Enter the command you use to ssh into this server.\n\
|
}
|
||||||
For example: `ssh me@my.server` or `gh cs ssh -c example`."
|
.size(LabelSize::Small)
|
||||||
|
.color(Color::Muted),
|
||||||
)
|
)
|
||||||
}.size(LabelSize::Small).color(Color::Muted))
|
|
||||||
})
|
})
|
||||||
.when(dev_server_id.is_some() && access_token.is_none(), |el| {
|
.when(dev_server_id.is_some() && access_token.is_none(), |el| {
|
||||||
el.child(
|
el.child(
|
||||||
if manual_setup {
|
if manual_setup {
|
||||||
Label::new(
|
Label::new(
|
||||||
"Note: updating the dev server generate a new token"
|
"Note: updating the dev server generate a new token",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Label::new(
|
Label::new(
|
||||||
"Enter the command you use to ssh into this server.\n\
|
"Enter the command you use to ssh into this server.\n\
|
||||||
For example: `ssh me@my.server` or `gh cs ssh -c example`."
|
For example: `ssh me@my.server` or `gh cs ssh -c example`.",
|
||||||
)
|
)
|
||||||
}.size(LabelSize::Small).color(Color::Muted)
|
}
|
||||||
|
.size(LabelSize::Small)
|
||||||
|
.color(Color::Muted),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.when_some(access_token.clone(), {
|
.when_some(access_token.clone(), {
|
||||||
|el, access_token| {
|
|el, access_token| {
|
||||||
el.child(
|
el.child(self.render_dev_server_token_creating(
|
||||||
self.render_dev_server_token_creating(access_token, name, manual_setup, status, creating, cx)
|
access_token,
|
||||||
|
name,
|
||||||
|
manual_setup,
|
||||||
|
status,
|
||||||
|
creating,
|
||||||
|
cx,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}}))
|
.footer(
|
||||||
)
|
ModalFooter::new().end_slot(if status == DevServerStatus::Online {
|
||||||
.footer(ModalFooter::new().end_slot(
|
|
||||||
if status == DevServerStatus::Online {
|
|
||||||
Button::new("create-dev-server", "Done")
|
Button::new("create-dev-server", "Done")
|
||||||
.style(ButtonStyle::Filled)
|
.style(ButtonStyle::Filled)
|
||||||
.layer(ElevationIndex::ModalSurface)
|
.layer(ElevationIndex::ModalSurface)
|
||||||
|
@ -816,17 +842,38 @@ impl DevServerProjects {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
Button::new("create-dev-server", if manual_setup { if dev_server_id.is_some() { "Update" } else { "Create"} } else { if dev_server_id.is_some() { "Reconnect" } else { "Connect"} })
|
Button::new(
|
||||||
|
"create-dev-server",
|
||||||
|
if manual_setup {
|
||||||
|
if dev_server_id.is_some() {
|
||||||
|
"Update"
|
||||||
|
} else {
|
||||||
|
"Create"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if dev_server_id.is_some() {
|
||||||
|
"Reconnect"
|
||||||
|
} else {
|
||||||
|
"Connect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
.style(ButtonStyle::Filled)
|
.style(ButtonStyle::Filled)
|
||||||
.layer(ElevationIndex::ModalSurface)
|
.layer(ElevationIndex::ModalSurface)
|
||||||
.disabled(creating && dev_server_id.is_none())
|
.disabled(creating && dev_server_id.is_none())
|
||||||
.on_click(cx.listener({
|
.on_click(cx.listener({
|
||||||
let access_token = access_token.clone();
|
let access_token = access_token.clone();
|
||||||
move |this, _, cx| {
|
move |this, _, cx| {
|
||||||
this.create_or_update_dev_server(manual_setup, dev_server_id, access_token.clone(), cx);
|
this.create_or_update_dev_server(
|
||||||
}}))
|
manual_setup,
|
||||||
|
dev_server_id,
|
||||||
|
access_token.clone(),
|
||||||
|
cx,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
))
|
}))
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_dev_server_token_creating(
|
fn render_dev_server_token_creating(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue